I have this script for my new game:
when I receive [time attack v] forever if <[time left]is bigger than(0)> set [clicks per second v] to [[current button presses]/[(25)-[time left]]] endThis doesn't work and is highlighted in red instead of the usual white. If anybody could tell my why and/or the workaround it would be much appreciated.
Last edited by JH1010 (2012-07-28 04:31:02)
Offline
JH1010 wrote:
I have this script for my new game:
when I receive [time attack v] forever if <[time left]is bigger than(0)> set [clicks per second v] to [[current button presses]/[(25)-[time left]]] endThis doesn't work and is highlighted in red instead of the usual white. If anybody could tell my why and/or the workaround it would be much appreciated.
Also, could someone fix my forum scratchblocks?
The math is probably wrong. Try redoing the formula for the math!
(I think it should be:)
((current button presses)/(time left)-[25]) [This formula is probably wrong :P]
Offline
JH1010 wrote:
I have this script for my new game:
when I receive [time attack v] forever if <(time left) > [0]> set [clicks per second v] to ((current button presses)/((25)-(time left))) endThis doesn't work and is highlighted in red instead of the usual white. If anybody could tell my why and/or the workaround it would be much appreciated.
Also, could someone fix my forum scratchblocks?
Fixed. Because 25 - time left may result in zero, deciding by zero causes an error so it is red and not white.
Offline
jontmy00 wrote:
JH1010 wrote:
I have this script for my new game:
when I receive [time attack v] forever if <(time left) > [0]> set [clicks per second v] to ((current button presses)/((25)-(time left))) endThis doesn't work and is highlighted in red instead of the usual white. If anybody could tell my why and/or the workaround it would be much appreciated.
Also, could someone fix my forum scratchblocks?Fixed. Because 25 - time left may result in zero, deciding by zero causes an error so it is red and not white.
Thank you this was useful.
Offline
Yea, the red highlight happens when the Scratch blocks are incapable of doing what you "asked" them to do. For example, 0/0, or if you make a variable count up or down by x , it will eventually reach the limt and crash.
Offline
It means there's an error in the script, be it a mathematical error, or if you've, for example, put a block that can only work with a sprite into the script sequence of a stage.
Offline