Pages: 1
I have a setup similar to this:
when gf clicked
set [var v] to [0.1]
go to x: (0) y: (3)
point in direction (90 v)
clear
set pen color to (0)
pen down
forever
move (dir) steps
turn cw (1) degrees
if <(direction) = [90]>
pen up
change y by (6)
pen down
change pen color by (10)
if <(var) = [2.1]>
play sound[Pop v]
stop script
else
change [var v] by (0.1)
end
end
end
but for some reason, the if block doesn't fire the code inside of it. Any ideas?Last edited by DigiTechs (2012-12-19 14:45:42)
Offline
Actually, the way you have the script, var is equal to 0.2.
Offline
Because your changing var by 0.1 forever. When it's changing forever, it goes on and on and on. Try this:
when gf clicked set [var v] to [0.2] forever if (var) = [2.1] say [var is more than 2.1!] end end
Offline
TheScratchCircle wrote:
Because your changing var by 0.1 forever. When it's changing forever, it goes on and on and on. Try this:
when gf clicked set [var v] to [0.2] forever if (var) = [2.1] say [var is more than 2.1!] end end
*facepalm* I should put my script PROPERLY.
Offline
technoboy10 wrote:
Actually, the way you have the script, var is equal to 0.2.
![]()
It repeats the loop until var is equal to 2.1, but for some reason the []=[] block seems to only work sith STRINGS.
EDIT: It doesn't even work when comparing to a variable that's set EXACTLY THE SAME!
Last edited by DigiTechs (2012-12-19 14:53:11)
Offline
Show the variable and see if it ever reaches 2.1
Offline
if nothing else works, just do (var)>2 instead
Offline
Firedrake969 wrote:
Show the variable and see if it ever reaches 2.1
I've already tried that. I've also tried the single stepping mode, and Scratch just skips the if block it's in.
Offline
Wes64 wrote:
if nothing else works, just do (var)>2 instead
Yes, it worked. Mabye it's because Scratch is changing the value BEFORE checking, even though I set it to not do that.
Offline
It only fires off if the direction = 90. Maybe it's because of that?
Offline
Firedrake969 wrote:
It only fires off if the direction = 90. Maybe it's because of that?
No, it's not. Go to my latest project and download it, That's the problem I had it with.
Offline
Pages: 1