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
Hopefully they will put this feature in the next version of scratch.
Offline
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).
Offline
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'.
Offline
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.
Offline
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
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
Please help can't hide a veriable!<when[ ]key pressed>
;D
Offline
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.
Offline
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.
Offline
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.
Offline
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!
Offline