This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
robrecht's profile picture

[lua] script problem

Started by robrecht, 15 January 2013 - 04:04 AM
robrecht #1
Posted 15 January 2013 - 05:04 AM
This is a par of the broken script, which i put seperate in a program.

if (a=0) and (b=0) and (c=0) then
break
elseif  (a~=0) and (b=0) and (c=0) then
c=60
b=60
a=(a-1)
elseif (c=0) and (b~=0) and (c~=0) then
c=60
b=(b-1)
else
c=(c-1)
end
When i run this it says: :1: ')' expected.
Please don't think im dumb and i did it correct here and i forgot a ')' in the script because i didn't. I've looked over it 1000 times i can't get whats wrong please help me. thanks
crazyguymgd #2
Posted 15 January 2013 - 05:06 AM
Use == in your ifs. A single = is for assignments, double == is for comparisons.
sjele #3
Posted 15 January 2013 - 05:07 AM
In if loops you are comparing to values with == not =. Therefor the fixed code would be this. = assigns them


if (a==0) and (b==0) and (c==0) then
break
elseif  (a~=0) and (b==0) and (c==0) then
c=60
b=60
a=(a-1)
elseif (c==0) and (b~=0) and (c~=0) then
c=60
b=(b-1)
else
c=(c-1)
end

EDit: Ninjaed
robrecht #4
Posted 15 January 2013 - 05:12 AM
ooooow i'm not used to work with numbers instead of strings in variables!!! thanks so much! pretty stupid of me :/