Someone help me with a very simple script?

User avatar
Heiko
Site Admin
Posts: 1548
Joined: Wed Mar 11, 2009 6:26 pm

Re: Someone help me with a very simple script?

Post by Heiko »

Because you have an error in your script.

Code: Select all

rTot = rTot + 1 or 0
You are doing arithmetics with an undefined variable. This causes a runtime error.
Use this instead:

Code: Select all

rTot = rTot or 0
rTot = rTot + 1;
You can find out yourself about such errors when using the debug console where runtime errors etc. are reported. -> script editor bug button

User avatar
Vadi
Posts: 5042
Joined: Sat Mar 14, 2009 3:13 pm

Re: Someone help me with a very simple script?

Post by Vadi »

If a variable doesn't have a value yet, you can't use it.

ie,

c = a + b out of the blue won't work. you'd first need to do

a,b = 0,0
c = a+b

that'll be ok, because a and b now have values.

Brinson
Posts: 15
Joined: Wed Nov 25, 2009 5:19 am

Re: Someone help me with a very simple script?

Post by Brinson »

Ah, thanks, that makes sense.

Lots of thanks.

Post Reply