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

#26 2008-04-07 16:34:08

likegames
Scratcher
Registered: 2008-03-24
Posts: 100+

Re: How can I learn about Variables?

i know varibles and im a begginner


There are 10 types of people in this world: Those who understand trinary, those who don't, and those who think this is the same old signature.
Three lines! (and base three!)

Offline

 

#27 2008-04-09 08:30:38

ihaveamac
Scratcher
Registered: 2007-09-22
Posts: 1000+

Re: How can I learn about Variables?

Sawman3 wrote:

You can't really reverse a forever loop, Larry828, but you can use the following options instead:<repeat(
or
<forever if>
or
<repeat until>

Used along with broadcasts and sets of 'true' and 'untrue' (0 and 1) variable configurations, these can be even more effective than the forever loop.  Hope that helps!  If you want more extensive advice, you can email me at [ADDRESS DELETED].  Good Luck!

...Off Topic, but There's an e-mail address in here.

{DELETED here and in the original post-kjk]

Last edited by kevin_karplus (2008-04-09 09:36:15)


~ihaveamac - visit ihaveamac.net

Offline

 

#28 2008-04-23 14:51:52

Jacobo
Scratcher
Registered: 2007-06-15
Posts: 100+

Re: How can I learn about Variables?

They also can be used to do something randomly



<when[ space ]key pressed>
<set{ variable }to( <pick random( 1 )to( 2



<when green flag clicked>
<forever>
<if><( <{ variable }> <=> 1 )>
<say[ Yes ]for( 3 )secs>



<when green flag clicked>
<forever>
<if><( <{ variable }> <=> 2 )>
<say[ No ]for( 3 )secs>



See my projectSprite Mixer as an example

Hope this helped!

Last edited by Jacobo (2008-04-23 14:52:26)


"It's like deja vu all over again"
-Yogi Berra

Offline

 

#29 2008-04-29 21:54:48

ben2
Scratcher
Registered: 2008-03-28
Posts: 20

Re: How can I learn about Variables?

Larry828 wrote:

So it sounds as if variables help one deal with QUANTITIES.  If no ammo, you can't shoot.  If someone is walking, then it will take a long time to get somewhere.  If someone scores 5 or more points they win the game. 

Or, if there are no seconds left on the clock, then the game is over.

Or, with a variable "PeopleNumber" if there are 3 or more people, then you get CROWD behavior!  If PeopleNumber = 2, then nobody can keep a secret.

That just gave me an idea to tell you! I made a project about a secret and ilovescratch1 flagged it! Oh-no! I just started it again!  sad

Offline

 

#30 2008-04-29 21:56:10

ben2
Scratcher
Registered: 2008-03-28
Posts: 20

Re: How can I learn about Variables?

(/b)

Offline

 

#31 2008-05-11 18:05:21

dbal
Scratcher
Registered: 2007-07-19
Posts: 100+

Re: How can I learn about Variables?

Larry828 wrote:

Never having programmed, I'm puzzled by the use of variables.  "Score" as a variable is clear and I've used that several times in projects.    But when I look at the use of variables in other peoples' projects the variables are often puzzling.   The Wikipedia entry on variables in computer science was too brief and too general to be of help.  Is there a helpful book, or are there projects here at Scratch that would introduce variables to a real beginner?  I need a basic idea of how they function in scripting a project.   Thanks!!

Don't know if this will add anything to what has already been said, but at least it is a new resource that some might find useful.  See http://www.dickbaldwin.com/homeschool/Hs00102.htm

Dick Baldwin
Free Alice tutorials:  http://www.dickbaldwin.com/tocalice.htm
Free Scratch tutorials:  http://www.dickbaldwin.com/tocHomeSchool.htm
Free Java/C#, etc. tutorials:  http://www.dickbaldwin.com/toc.htm


Dick Baldwin - Don't get stuck scratching. When you master Scratch, move on up to more serious programming languages. Free online programming tutorials:
Scratch - Alice - Java - C# - C++ - JavaScript - XML - Python - DSP

Offline

 

#32 2008-05-13 17:06:33

Aussie
Scratcher
Registered: 2008-05-13
Posts: 1

Re: How can I learn about Variables?

Variables are also handy if you are making a game and need to keep score pr need health.
Please add to my gallery!!! The Ultimate Stick Figure Gallery!!  smile
blocks<change{ Score }by(5)/blocks

Offline

 

#33 2008-05-14 14:44:05

DigiFox
Scratcher
Registered: 2008-03-07
Posts: 100+

Re: How can I learn about Variables?

Well, if I remeber, a variable is something that stands for a number. Like 6 + a = 34 - 29 , in which the answer is a = -1


[url=http://www.mubos-md.com/licensemaker/levelup.php?5601]http://www.mubos-md.com/licensemaker/yeuzz7wj.png
Click here to level up my license![/url]

Offline

 

#34 2008-05-15 17:10:58

redsooty9
Scratcher
Registered: 2008-03-06
Posts: 69

Re: How can I learn about Variables?

testing testing... hmmm


Redsooty9

Offline

 

#35 2008-06-02 13:46:22

terminator68
Scratcher
Registered: 2008-02-26
Posts: 1000+

Re: How can I learn about Variables?

archmage wrote:

Really you don't need a book to learn variables. Variables are simply just numbers that you can control and use to control your program. Variables are most useful for if statements and you can check the variables values to determine what script to execute. for example

If score > 1000
say "you got over 1000 points"

if score > 100
say "you got over 100 points''

if score = 0
say "You are really bad at this game"

Variables are not really confusing, what can be confusing is the ways that they are put to use. And don't worry when I started programming variables and if statements confused the hell outta me too  smile  You will get better with practice.

Me too, archmage, now i'm clear with them, but it took a long time, because i thoguht you drag it on the screen and it'll do whatever i want the project to do. I'm not dumb like that anymore...but trust me, it takes practice  smile


--------------------Scratcher since '08--------------------
http://images1.wikia.nocookie.net/__cb20110314152018/mlpfanart/images/5/5d/Applejack_chewing.gif

Offline

 

#36 2008-06-02 18:03:35

dbal
Scratcher
Registered: 2007-07-19
Posts: 100+

Re: How can I learn about Variables?

The best way to learn about variables and everything else in programming is to start at the beginning and learn one step at a time.  If you do that, before you know it, you will be programming in a modern powerful object-oriented programming language such as C++, Java, or C#.


Dick Baldwin - Don't get stuck scratching. When you master Scratch, move on up to more serious programming languages. Free online programming tutorials:
Scratch - Alice - Java - C# - C++ - JavaScript - XML - Python - DSP

Offline

 

#37 2008-06-12 03:25:27

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: How can I learn about Variables?

In my new Pokemon™ Game, I used variables to remember which Pokemon you had chose, your health, etc. They come really useful for remembering things, whether it's Pokemon™ or time or simply if your touching a wall. Variables are Very useful


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#38 2008-06-12 06:13:28

redsooty9
Scratcher
Registered: 2008-03-06
Posts: 69

Re: How can I learn about Variables?

Bluestribute, please dont spam the forums with your signature.


Redsooty9

Offline

 

#39 2008-06-12 13:41:38

Bluestribute
Scratcher
Registered: 2008-01-24
Posts: 1000+

Re: How can I learn about Variables?

redsooty9 wrote:

Bluestribute, please dont spam the forums with your signature.

???? It's the smallest one of them all


http://img247.imageshack.us/img247/1204/bluestributett4.jpg
That's my PSN ID. I know tons of COD4 glitches. Add me as your friend. Oh, and get a headset

Offline

 

#40 2008-06-19 19:52:01

keroro645
Scratcher
Registered: 2008-06-07
Posts: 1000+

Re: How can I learn about Variables?

So how do you do the ammo variable to where it will stops shooting when it reaches zero?

Offline

 

#41 2008-06-19 20:10:31

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: How can I learn about Variables?

when I recieve [shoot]
if [ammo > -1]
do shooting blahdeblah scripty thing
change ammo by [-1]
=======

when I recieve [refill ammo]
set ammo to 10 (or whatever your number is)

Change it to suit your needs

Offline

 

#42 2008-07-01 07:47:47

sim
Scratcher
Registered: 2007-12-12
Posts: 14

Re: How can I learn about Variables?

SO if the thing is a true thing it will jump and false made it land right????? Like this....

<when green flag clicked><when green flag clicked>

<forever><if><set{ground}to(1<else><set{ ground}to(o


I am apart of VANN Production's  XD GO VAMPIRES AWSOME NINJA NOOFS!!!

Offline

 

#43 2008-07-01 09:07:55

SaltAndVinegar
Scratcher
Registered: 2008-01-24
Posts: 12

Re: How can I learn about Variables?

Lately I wrote a small tutorial "Learn to program with Scratch" (Okay it is German, but I will translate it into English ;-) )

There I took variables to draw spirales. Every step you change the length of the edge.

http://www.cs.uni-magdeburg.de/~krueger/script.png

Last edited by SaltAndVinegar (2008-07-01 09:10:30)


Franziska Krueger
University Magdeburg, Germany

Offline

 

#44 2008-07-20 16:17:35

the_bowser_bub
Scratcher
Registered: 2008-07-20
Posts: 3

Re: How can I learn about Variables?

ok variables are things that show up on your project

Offline

 

#45 2008-07-20 16:20:07

the_bowser_bub
Scratcher
Registered: 2008-07-20
Posts: 3

Re: How can I learn about Variables?

ben2 wrote:

Larry828 wrote:

So it sounds as if variables help one deal with QUANTITIES.  If no ammo, you can't shoot.  If someone is walking, then it will take a long time to get somewhere.  If someone scores 5 or more points they win the game. 

Or, if there are no seconds left on the clock, then the game is over.

Or, with a variable "PeopleNumber" if there are 3 or more people, then you get CROWD behavior!  If PeopleNumber = 2, then nobody can keep a secret.

That just gave me an idea to tell you! I made a project about a secret and ilovescratch1 flagged it! Oh-no! I just started it again!  sad

poor u

Offline

 

#46 2008-07-20 16:22:20

the_bowser_bub
Scratcher
Registered: 2008-07-20
Posts: 3

Re: How can I learn about Variables?

well on my other acount i did a project to say i hate noatwin and alanprojects flagged it.

Offline

 

#47 2008-09-30 15:10:37

jcv1235
Scratcher
Registered: 2008-03-10
Posts: 86

Re: How can I learn about Variables?

i don't understand a lot about variables, like velocity and stuff, but i'm sure archmage has a few tutorials


http://i368.photobucket.com/albums/oo122/jcv123_bucket/1.jpg

Offline

 

#48 2008-10-01 13:16:23

bionicben2
Scratcher
Registered: 2008-10-01
Posts: 1

Re: How can I learn about Variables?

is it possible to create a volume variable to make a really quiet soundtrack louder?

any help appreciated...

thanks

Offline

 

#49 2008-10-06 04:57:53

bart9032
Scratcher
Registered: 2008-06-16
Posts: 100+

Re: How can I learn about Variables?

andresmh wrote:

A variable can also be used to determine the state of a sprite. For example, if a sprite is walking could be equal to 1, if running equal to 2 and if it's standing equal to 3. Just an example.

Pretty much to monitor when a various monitor(variable) for example, health will monitor if health is zero you die and if health isn't 0 then you don't die! etc.


Hi, my name is Bartholomew JoJo 'Bart' Simpson. Nice to meet you,
Actually, no I am not Bart Simpson. I am bart9032  cool

Offline

 

#50 2008-10-31 06:22:06

oliiscool
Scratcher
Registered: 2008-07-08
Posts: 31

Re: How can I learn about Variables?

<when green flag clicked><say[  i need help making 3D sprites]for(  0.18)secs>
<say[who can help me?  ]for(  0.18)secs>

Offline

 

Board footer