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

#1 2012-07-28 04:27:32

JH1010
Scratcher
Registered: 2012-05-31
Posts: 1000+

Script Highlighted In Red

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]]]
end
This 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?

Last edited by JH1010 (2012-07-28 04:31:02)

Offline

 

#2 2012-07-28 04:36:28

Servine
Scratcher
Registered: 2011-03-19
Posts: 1000+

Re: Script Highlighted In Red

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]]]
end
This 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]


http://bluetetrarpg.x10.mx/usercard/?name=Servine

Offline

 

#3 2012-07-28 04:37:18

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: Script Highlighted In Red

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)))
end
This 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.


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#4 2012-07-28 04:44:09

JH1010
Scratcher
Registered: 2012-05-31
Posts: 1000+

Re: Script Highlighted In Red

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)))
end
This 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

 

#5 2012-07-28 06:38:19

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: Script Highlighted In Red

You saw the dividing block turned red too, right? This means that there was an error; try checking out the specific block.

Useful for if this ever happens again.  smile


http://i50.tinypic.com/312u714.jpg

Offline

 

#6 2012-07-28 13:43:25

infinite_minus_zero
Scratcher
Registered: 2010-02-18
Posts: 100+

Re: Script Highlighted In Red

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

 

#7 2012-08-04 19:33:09

CylonToast
Scratcher
Registered: 2011-10-06
Posts: 1000+

Re: Script Highlighted In Red

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.


https://lh3.googleusercontent.com/-Axvm8TlDHc4/Tocl0m1Z39I/AAAAAAAACAI/j32nzVU69DU/animated-peanut.gifhttp://gifsoup.com/webroot/animatedgifs/136991_o.gif

Offline

 

Board footer