This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2007-08-21 19:06:17

blueblue
Scratcher
Registered: 2007-08-12
Posts: 38

Hide Variable

There Should Be A Way To Hide Variables During The Project. You Can Already Hide Variables, But For The Whole Project.
<when green flag clicked><if><touching[sprite 1] hide variable

Offline

 

#2 2007-08-21 21:03:49

Sawman3
Scratcher
Registered: 2007-07-19
Posts: 97

Re: Hide Variable

YES


"These are the old days, the glory days...they're back."

Offline

 

#3 2007-08-21 21:25:06

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Hide Variable

Currently, the only way to "hide" a variable temporarily is to put a sprite in front of it.  If the sprite looks the same as the background behind the variable display, then the variable is effectively hidden.

Offline

 

#4 2007-08-21 21:31:19

archmage
Scratcher
Registered: 2007-05-18
Posts: 1000+

Re: Hide Variable

Hopefully they will put this feature in the next version of scratch.


Hi, I am Archmage coder extraordinaire. I do Scratch,pascal,java,php,html, AS2 and AS3. Leave me a message if you want coding advice. Also check out my personal website, lots of good stuff about web development, Flash, and Scratch (v1 and v2) !

Offline

 

#5 2007-08-22 08:10:33

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Hide Variable

Variable windows should IMO be treated exactly like sprites.

You create a variable, and a new sprite appears in the sprites list.  That sprite will display the variable, comes with 3 costumes (ordinary, large and slider) and can be manipulated exactly the same way as any other sprite, including moving, hiding, and colour effects.

Even cooler would be the ability to take the "large" costume and edit it, adding frames or whatnots of your own around the outside (the central display bit would not be editable).


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#6 2007-08-22 09:18:06

relyt12101
Scratcher
Registered: 2007-05-19
Posts: 500+

Re: Hide Variable

Yes. That would be helpful: variables as a sprite


http://img392.imageshack.us/img392/2860/pspbanneregg089deiy0.png

Offline

 

#7 2007-08-22 09:46:13

Jens
Scratcher
Registered: 2007-06-04
Posts: 1000+

Re: Hide Variable

Well, you could - in principle - design your own "variable sprite" in Scratch, couldn't you? it would just involve lots of costumes (for every number in your scope), which in turn would be chosen according to the value of the actual (hidden) variable you would want to monitor. Alternatively you could just make one 10-digit sprite, clone it a couple of times and use a decimal algorithm to display large numers / fractions.

There's a pretty cool project by MSP1 demonstrating some of this:
http://scratch.mit.edu/projects/MSP1/3505

When you look a the code of that project you'll notice that the scripts can be simplified significantly by using Scratch's 'secret' ability to address a costume by its position-number rather than by its name.

If you're after sliders/scrollbars, there are also lots of projects that you could remix to build your own generic slider, with which to control the value of your variables.

Since Scratch now has the fantastic capability to export / import 'generic' sprites you wouldn't even have to assemble these variable monitors every time 'from scratch'.


Jens Mönig

Offline

 

#8 2007-08-22 12:58:05

Mayhem
Scratcher
Registered: 2007-05-26
Posts: 1000+

Re: Hide Variable

You could - but it would be a lot of work.  The ability to show/hide variables during a run is pretty basic, though, really, and shouldn't be something that needs the amount of work that displaying a variable with a range greater than a single digit as a sprite.


Web-spinning Spider:  http://scratch.mit.edu/projects/Mayhem/18456
3D Dungeon Adventure:  http://scratch.mit.edu/projects/Mayhem/23570
Starfighter X: http://scratch.mit.edu/projects/Mayhem/21825
Wandering Knight: http://scratch.mit.edu/projects/Mayhem/28484

Offline

 

#9 2007-08-22 14:12:51

kevin_karplus
Scratcher
Registered: 2007-04-27
Posts: 1000+

Re: Hide Variable

I have done multi-digit display as stamps:
http://scratch.mit.edu/projects/kevin_karplus/2951
but not as multiple sprites---that struck me as too painful to manipulate and re-use.

I like the idea of being able to manipulate a variable display exactly like a sprite (with movement, show/hide, color effects, multiple costumes, ...)  Of course, I'd *really* like the displays to work correctly with large and small numbers---whoever designed them forgot about the space taken up by exponents in scientific notation, and they get really messed up.

Offline

 

#10 2007-09-05 09:27:54

VincentValentine
Scratcher
Registered: 2007-06-03
Posts: 6

Re: Hide Variable

If you think creating your own variable as a sprite is too much work, you could copy mine. It's incorporated in my "last imagination" game, it can go up to 9999, which should be sufficient, you could add another digit relatively easily if necessary though. And you'd probably have to replace my variable "HP"  with whatever variable you wanted displayed. This is really only useful if there's only one or 2 variables you want to display this way, because it's 10 replacements per digit, so that's 40 digits for up to 9999, less if say 999 is enough. You might also want to make the wait command a little shorter, I set it to 1 sec because there's plenty of time in my game.
You could also set: forever set HP to <your variable>, but that would probably make the calculation last quite a bit longer, and would only work once per game (well twice if you do it for the MP one too). If you have no idea what I'm talking about, download my game and look for the sprites called (IIRC): 0-9 HP Counter, 10^1 HP counter, 10^2 HP, 10^3 HP, 0-9 MP counter, 10^1 MP counter, 10^2 MP, 10^3 MP. 

Link to my game with the "variable as sprites": http://scratch.mit.edu/projects/VincentValentine/33716

Last edited by VincentValentine (2007-09-05 09:33:35)

Offline

 

#11 2008-07-24 16:55:11

FLEABAGMONKEYFACE
Scratcher
Registered: 2008-05-15
Posts: 2

Re: Hide Variable

Please help can't hide a veriable!<when[  ]key pressed>

;D

Offline

 

#12 2008-07-25 19:10:20

Cyclone103
Scratcher
Registered: 2008-03-20
Posts: 500+

Re: Hide Variable

I really hope they add a way to do that, but for now we must resort to using colored panels to cover the variables up.


All your base are belong to us

Offline

 

#13 2008-07-27 09:28:22

Maker
Scratcher
Registered: 2008-07-07
Posts: 30

Re: Hide Variable

well I use the cover up variables alot, It even used 2ce in my nightly turret shooting game http://scratch.mit.edu/projects/Maker/213552 the game isn't that good but I was testing out what you were talking about.


http://img201.imageshack.us/img201/9176/mybanner488622f31da7bpx6.png

Offline

 

#14 2008-07-27 10:14:41

the_guardian
Scratcher
Registered: 2008-03-16
Posts: 98

Re: Hide Variable

When I need a number displayed on the screen, I use the stamp feature.  Here is a link to a Widget I created.  It has a very small and fast script to display a number on the screen.  http://scratch.mit.edu/projects/the_guardian/161167 .  You can see it in use on all 3 of my games.


Guardian 3D!  http://scratch.mit.edu/projects/the_guardian/169865

Offline

 

#15 2008-07-27 21:28:28

Shadow-Kun
Scratcher
Registered: 2008-01-21
Posts: 20

Re: Hide Variable

I just grab the screen region and create a sprite that blends in with the background.  By showing the sprite it covers up the variable but causes no additional effect.  Still, I agree that a simple hide block for each variable would be very helpful.


http://img39.imageshack.us/img39/61/mybanner4a3903a0d3a87.jpg

Offline

 

#16 2008-10-18 19:01:21

ClubMario
Scratcher
Registered: 2008-08-09
Posts: 22

Re: Hide Variable

To make a game with a "Life" or "HP" or "Health" Variable, <set{  }to( (Set it to what you want) and then, grab the < Number block, where the Variable Hide or Show thing is, take the Variable, put it in the LEFT of the<(  <<>  )> block, then type a 0 in the right of it, make a LOSE or WIN Backround, click and drag the <broadcast[  block,then type in the Backround name, go to the Backround, and  take out the   
<when I receive[  block, click the name of the Backround, (If it isn't there, type the Backround into the <when I receive[  block.) go to Looks and click on the Backround you want it to go to,<switch to costume[  and, that's how! Thanks for reading!


~ClubMario~ClubMario
~ClubMario~ClubMario

Offline

 

Board footer