supplierdeeply

attempt to perform arithmetoic on a global (now a nil value) - TERMINATED

  • 2 Replies
  • 819 Views
Advertisements
a Part of my script should shutdown the camera if done taking pictures, and if idle for 60 sec.
I get the error in subject after a few pictures.

    repeat
   sleep(60)
   x=get_usb_power(0)
   if (autoshdn > 0 and picturecount > 5 and get_day_seconds-lastpicturesec > autoshdnsec) then shutdown() end
    until x>0

Why fdoes this happen ?

I would be easier to answer that question if you posted the whole script.   The actaul error message with line number would be good to know as well.

At a guess,  this line is probably the problem :
Code: [Select]
if (autoshdn > 0 and picturecount > 5 and get_day_seconds-lastpicturesec > autoshdnsec) then shutdown() endas it's the only thing in your code doing arithmetic.   

I'd suggest changing it to :
Code: [Select]
if (autoshdn > 0 and picturecount > 5 and get_day_seconds()-lastpicturesec > autoshdnsec) then shutdown() endas the get_day_seconds()-lastpicturesec > autoshdnsec part is not evaluated until after the sixth picture is taken.
« Last Edit: 14 / January / 2015, 08:10:20 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

thanks - I also had another nil problem.

 

Related Topics