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

#1 2008-05-09 18:40:09

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Variable Display

Help! I've been working on a project for a while but I didn't want to use the variables that scratch has. So I calculated the percentage (for the project) and made four sets of three digits (sprites) so I could display the numbers from the variables. So far sometimes the sprites are accurate, other times they're off by 10% or 1% sometimes others. Any ideas on how to fix this would definitely be appreciated. Heres an example of what I tried: (the variable "one" is the number I want to display)

Tens place: (usually the one that messes up)

<switch to costume[(( (( <{ 1 }> <mod>100  )) / 10  ))

Hundreds place:(normally accurate)
(if)
<if><( (( <{ 1 }> </> 1 )) <=> 100 )>
<switch to costume[ 9          (the digit one)
<else>
<switch to costume[ 10        (the digit zero)

Ones place: (another normal mess up)

<switch to costume[ (( <{ 1 }> <mod> 10 ))

Note: I'm also placing this on advanced topics.

Offline

 

#2 2008-05-09 19:53:51

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

Re: Variable Display

I addressed this in the duplicate posting in Advanced Topics.


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

Offline

 

#3 2008-05-09 20:08:46

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

Re: Variable Display

I did this for mine kinda:


[blocks]<when green flag clicked>[/blocks]
[blocks]<forever>[/blocks]
<switch to costume[ <{ score }>[/blocks]

And for tens, you use it also for hundreds, just didvde by that much and add when it shows:


[blocks]<when green flag clicked>[/blocks]
[blocks]<forever>[blocks]
[blocks]<switch to costume[ (((( <{score  }> </>10  )) <-> .5 ))[/blocks]


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

 

#4 2008-05-09 20:19:36

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

Re: Variable Display

AURGH! I didn't know you could do (switch to costume) then a variable! THANKS! THAT MAKES MY LIFE SO MUCH EASIER! WOW!!!

OMG YOUR THE BEST SCRATCHER EVER!

Offline

 

#5 2008-05-09 20:24:49

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

Re: Variable Display

coolstuff wrote:

AURGH! I didn't know you could do (switch to costume) then a variable! THANKS! THAT MAKES MY LIFE SO MUCH EASIER! WOW!!!

OMG YOUR THE BEST SCRATCHER EVER!

ME? Your welcome??? Shadow? He's welcome


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

 

Board footer