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

#1 2010-01-12 21:22:50

warioandbob
Scratcher
Registered: 2010-01-11
Posts: 95

If a variable= this, do this, HELP!

So I'm making a King of Buttons style game, but I can't seem to make an easy way to post comments.

What I want to do is have a variable, and every time you press the button, the variable goes up by one.

And if the variable reaches a certain number, the game will say a comment

ex.

If you press the button 25 times
the button says "Stop pressing enter!!"

PLEASE HELP, I FEEL STUPID!


http://www.smileydesign.net/smileys/zombie01.gif[url=http://scratch.mit.edu/forums/viewtopic.php?id=30739]Please read my Zombie story- Chaos Theory: The Zombie Effect.
NEW: Chapter 3 is UP[/url]
http://www.smileydesign.net/smileys/zombie04.gif

Offline

 

#2 2010-01-12 23:49:00

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: If a variable= this, do this, HELP!

To make the variable change:

When Button Clicked
change variable by 1

And then...

When Green Flag Clicked
wait until variable = 25
say "Stop pressing enter!!"

Does that work?


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#3 2010-01-13 00:18:25

carnack
Scratcher
Registered: 2009-06-30
Posts: 100+

Re: If a variable= this, do this, HELP!

Lol, just put when flag clicked (If key enter pressed) and (Variable) smaller than 25, change (variable) by 1.  And when flag clicked, if (variable) equals 25, say (insert quote here) hope this helped!


http://i853.photobucket.com/albums/ab95/7x9/Carnack.png
Carnack The Bug

Offline

 

#4 2010-01-13 01:29:02

Chrischb
Scratcher
Registered: 2008-07-24
Posts: 1000+

Re: If a variable= this, do this, HELP!

carnack wrote:

Lol, just put when flag clicked (If key enter pressed) and (Variable) smaller than 25, change (variable) by 1.  And when flag clicked, if (variable) equals 25, say (insert quote here) hope this helped!

Nice one. xP


I fall: It's a tragedy. You fall: It's comedy.
Hmph enjoy your fall - I get a lovely spring... without pans of new leaves.

Offline

 

#5 2010-01-13 17:33:31

warioandbob
Scratcher
Registered: 2010-01-11
Posts: 95

Re: If a variable= this, do this, HELP!

THANK YOU SO MUCH!

I got it, yay, now I can make my game! Sorry, I'm new to this whole Scratch thing :p


http://www.smileydesign.net/smileys/zombie01.gif[url=http://scratch.mit.edu/forums/viewtopic.php?id=30739]Please read my Zombie story- Chaos Theory: The Zombie Effect.
NEW: Chapter 3 is UP[/url]
http://www.smileydesign.net/smileys/zombie04.gif

Offline

 

#6 2010-01-14 19:58:20

samurai768
Scratcher
Registered: 2009-07-21
Posts: 1000+

Re: If a variable= this, do this, HELP!

There's no enter button thingy  tongue

Offline

 

#7 2010-01-14 20:34:36

cds56
Scratcher
Registered: 2008-05-02
Posts: 500+

Re: If a variable= this, do this, HELP!

or :

Code:

if(button clicked) 
change variable by 1
wait until (button not pressed)
end if
if (variable = 25)
say "STOP PRESSING ENTER " for two seconds
end if

or that, which is better if you want fewer scripts


http://img192.imageshack.us/img192/909/meowdevlogo.pnghttp://i32.tinypic.com/pucti.png

Offline

 

Board footer