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

#1 2009-12-15 21:13:41

Cookies100
Scratcher
Registered: 2008-10-18
Posts: 74

Variables and Time

I don't want to use the timer, so I'm using variables. When I try something like this:

<set{ Time }to( 8.00
<change{ Time }by( 0.01

It show the variable as 8.0 and every 10 clicks of testing, it shows up as 8.1.

Can anybody show me how to fix this or show me a new method besides using a timer block?

Plus, when there is 2 numbers after the decimals, the number goes past the white circle.


http://t2.gstatic.com/images?q=tbn:cSea35x5Aa93LM:http://scratch.mit.edu/static/icons/buddy/172660_sm.png%3Ft%3D2009-11-18%2B20%253A59%253A44
Fear the Cookie.  hmm

Offline

 

#2 2009-12-15 21:37:37

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Variables and Time

Hmmmmm... if that's exactly what you're doing, I don't see how it messes up.

This sounds more like a bug with Scratch.

For a different method, you can try getting rid of the decimal point, so 8.00 becomes 800 and 0.01 becomes 1.


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#3 2009-12-15 21:53:59

Cookies100
Scratcher
Registered: 2008-10-18
Posts: 74

Re: Variables and Time

Jonathanpb wrote:

Hmmmmm... if that's exactly what you're doing, I don't see how it messes up.

This sounds more like a bug with Scratch.

For a different method, you can try getting rid of the decimal point, so 8.00 becomes 800 and 0.01 becomes 1.

I might try that, but it won't look as good I thought it will be. Thanks!


http://t2.gstatic.com/images?q=tbn:cSea35x5Aa93LM:http://scratch.mit.edu/static/icons/buddy/172660_sm.png%3Ft%3D2009-11-18%2B20%253A59%253A44
Fear the Cookie.  hmm

Offline

 

#4 2009-12-16 02:14:44

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

Re: Variables and Time

Scratch's variables aren't that great at showing longer numbers... but I didn't know it was as simple as that.  hmm

That's why I use a list to compute numbers.


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 2009-12-16 10:11:07

nightangel
Scratcher
Registered: 2009-12-09
Posts: 9

Re: Variables and Time

I still don't get the variables. This is confuzzling. Help. =}


Chaos, panic, pandemonium - my work here is done.
Some people are like slinkies...they're really good for nothing...but they still bring a smile to your face when you push them down a flight of stairs.

Offline

 

#6 2009-12-17 23:12:55

RyanBenLee
Scratcher
Registered: 2009-03-08
Posts: 47

Re: Variables and Time

8.00 maybe looked at as a decimal.8.00 can also be 8.0 or 8. Since you put 8.00, the computer must have thought that you wanted a decimal so it didn't put 8, but because 8.0 is a also 8.00 and the extra 0 wasn't really needed (to computer) it must have made it 8.0. I doubt there's a way to make a time variable (for now). I suggest adding this to 'Suggestions'.

Offline

 

#7 2009-12-17 23:33:35

Jonathanpb
Scratcher
Registered: 2008-07-25
Posts: 1000+

Re: Variables and Time

nightangel wrote:

I still don't get the variables. This is confuzzling. Help. =}

Even though variables sound fancy, they're just values. They're normally numbers, but you can set them to letters and words also.  smile

Last edited by Jonathanpb (2009-12-17 23:34:17)


"Human beings... must have action; and they will make it if they cannot find it.
-Charlotte Brontë

Offline

 

#8 2009-12-30 13:11:23

nightangel
Scratcher
Registered: 2009-12-09
Posts: 9

Re: Variables and Time

Jonathanpb wrote:

nightangel wrote:

I still don't get the variables. This is confuzzling. Help. =}

Even though variables sound fancy, they're just values. They're normally numbers, but you can set them to letters and words also.  smile

I know that they're numbers and values, it's just what is the purpose of them. Do they help or make your game harder and even more confusing for people? If that's the case then I don't want to use them.


Chaos, panic, pandemonium - my work here is done.
Some people are like slinkies...they're really good for nothing...but they still bring a smile to your face when you push them down a flight of stairs.

Offline

 

#9 2009-12-30 14:47:21

greenflash
Scratcher
Registered: 2009-05-27
Posts: 1000+

Re: Variables and Time

nightangel wrote:

Jonathanpb wrote:

nightangel wrote:

I still don't get the variables. This is confuzzling. Help. =}

Even though variables sound fancy, they're just values. They're normally numbers, but you can set them to letters and words also.  smile

I know that they're numbers and values, it's just what is the purpose of them. Do they help or make your game harder and even more confusing for people? If that's the case then I don't want to use them.

All variables do are store values. What you do with them is up to you.

You can use variables to:
-Make games with levels
-Make string art
-Make complex simulations
And lots of other things!

To make levels, all you need to do it set a condition. If you need to touch a certain sprite to go to the next level, you could use variables.

For example:

[blocks]
<when green flag clicked>
<forever>
<if><touching[ level end
<change{ level }by( 1
[/blocks]

You can change the value of the variables too. You can use them as references. For example, lets say you have a game with a boss and you have a variable for what level you're on.

You can use the value of the variable to tell the boss when to appear. If you only wanted the boss to appear on level ten, you would use

[blocks]
<when green flag clicked>
<forever>
<if><( <{ level }> <=> 10 )>
<show>
[/blocks]

Just a couple of simple things that demonstrate the power of variables!


http://i48.tinypic.com/2wrkirk.pnghttp://i46.tinypic.com/6r5zk7.pnghttp://i45.tinypic.com/2vtxr1t.png

Offline

 

#10 2009-12-31 10:34:24

nightangel
Scratcher
Registered: 2009-12-09
Posts: 9

Re: Variables and Time

greenflash wrote:

nightangel wrote:

Jonathanpb wrote:


Even though variables sound fancy, they're just values. They're normally numbers, but you can set them to letters and words also.  smile

I know that they're numbers and values, it's just what is the purpose of them. Do they help or make your game harder and even more confusing for people? If that's the case then I don't want to use them.

All variables do are store values. What you do with them is up to you.

You can use variables to:
-Make games with levels
-Make string art
-Make complex simulations
And lots of other things!

To make levels, all you need to do it set a condition. If you need to touch a certain sprite to go to the next level, you could use variables.

For example:

[blocks]
<when green flag clicked>
<forever>
<if><touching[ level end
<change{ level }by( 1
[/blocks]

You can change the value of the variables too. You can use them as references. For example, lets say you have a game with a boss and you have a variable for what level you're on.

You can use the value of the variable to tell the boss when to appear. If you only wanted the boss to appear on level ten, you would use

[blocks]
<when green flag clicked>
<forever>
<if><( <{ level }> <=> 10 )>
<show>
[/blocks]

Just a couple of simple things that demonstrate the power of variables!

Ok, Thank you that helps a lot.
I'm sorry I'm so stupid.


Chaos, panic, pandemonium - my work here is done.
Some people are like slinkies...they're really good for nothing...but they still bring a smile to your face when you push them down a flight of stairs.

Offline

 

Board footer