11.03.2018, 00:21
(11.03.2018, 00:04)02dag Wrote: Hi,
I have made a script with two conditions that need to be fulfilled before doing something. I have tried everything bt it is not working. There are no syntax errors now and I disable/enable every time I save scripts just to be sure.
The script reads a value from a illumination sensor and status from a light object. Then it compares the two and writes to the same light object. Here it is:
Code:illumivalue = grp.getvalue('32/1/3')
switchvalue = grp.getvalue('0/4/10')
if (illumivalue <= 5 and switchvalue == 0) then
grp.write('0/4/10',1)
elseif (illumivalue >= 5 and switchvalue == 1)
then grp.write('0/4/10',0)
end
Change this line:
Code:
if (illumivalue <= 5 and switchvalue == false) then
Done is better than perfect