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

#1 2008-07-31 02:19:27

stonefruited
Scratcher
Registered: 2008-07-31
Posts: 1

user input of values into variables (how to?)

How can the user input values into variables (while the program is running) such as an inputbox with prompt. The simple scenario is that if variable 'testresult' is >10 then sprite moves forward 50, else sprite moves backward 50 steps. Cheers, Kev

Offline

 

#2 2008-07-31 02:50:10

AlanProjects
Scratcher
Registered: 2008-06-23
Posts: 500+

Re: user input of values into variables (how to?)

are you talking about a slider?

Offline

 

#3 2008-07-31 05:35:50

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: user input of values into variables (how to?)

stonefruited wrote:

How can the user input values into variables (while the program is running) such as an inputbox with prompt. The simple scenario is that if variable 'testresult' is >10 then sprite moves forward 50, else sprite moves backward 50 steps. Cheers, Kev

For simple input, you can set the variable watcher (on the stage) to a slider which lets the user change the variable value by moving the slider with the mouse.  Right-click on the variable watcher and pick the slider option.

For larger numbers, if you want the user to be able to type them in, there is no built-in method.  You can, however, capture the number keys when they are pressed and build up an input value.  Here is a project that shows one approach:

http://scratch.mit.edu/projects/Paddle2SeeFixIt/145585


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#4 2008-07-31 10:03:21

thomastoxic
Scratcher
Registered: 2008-07-31
Posts: 3

Re: user input of values into variables (how to?)

what are variables

Offline

 

#5 2008-07-31 15:49:27

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: user input of values into variables (how to?)

thomastoxic wrote:

what are variables

Hey thomastoxic!  Here is a link I found that talks about what variables are and how they are used.  Hope you find it useful!

http://scratch.mit.edu/forums/viewtopic.php?id=1346


http://i39.tinypic.com/2nav6o7.gif

Offline

 

Board footer