supplierdeeply

CHDKPTP: Script works on camera itself but not with chdkptp

  • 7 Replies
  • 1686 Views
*

Offline toby

  • *
  • 46
CHDKPTP: Script works on camera itself but not with chdkptp
« on: 26 / October / 2014, 11:58:14 »
Advertisements
Hi there,

i got an errore trying to run a lua script on the camera with chdkptp. I am converting the working basic script to lua.

ERROR: A/CHDK/SCRIPTS/spektrum.lua:35: attempt to perform arithmetic on global 's' (a nil value)

Quote
--[[
@title Spektrum

@param w Schrittweite
@default w 20
@param s Schritte
@default s 15
--]]


while 1~=get_prop(6) do
   click("left")
   sleep(1000)
end

if 7~=get_zoom() then
   press("zoom_in")
   sleep(3000)
   release("zoom_in")
end


set_led(7,1)
sleep(3000)
play_sound(6)
sleep(2000)
set_led(7,0)

press("shoot_half")
sleep(2000)
f=get_focus()
release("shoot_half")


a=(f-(s*w/2))
e=(f+(s*w/2))
print("get_focus="..get_focus())

for f=a, e, w do
   set_focus(f)
   sleep(1000)
   click("shoot_full_only")
   sleep(1500)
end

I absolutely dont know why its not working with lua.
« Last Edit: 27 / October / 2014, 02:39:05 by toby »

Re: Assignment works with basic but not with lua?
« Reply #1 on: 26 / October / 2014, 12:16:44 »
I just cut & pasted it and ran on my A1200.  Runs without errors (although I had to comment out the 1~=get_prop(6) part on the assumption it's a different prop ( drive mode? focus mode?) on my camera).
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline toby

  • *
  • 46
Re: Assignment works with basic but not with lua?
« Reply #2 on: 26 / October / 2014, 12:52:01 »
I did start the script on the camera itself and it worked! It doesnt work with chdkptp and loadfile ;-(

prop6 is focusmode

Re: Assignment works with basic but not with lua?
« Reply #3 on: 26 / October / 2014, 13:01:46 »
I did start the script on the camera itself and it worked! It doesnt work with chdkptp and loadfile ;-(
Doh.   AFAIK chdkptp does not read/use/understand the @param stuff in the script header.   Put this at the start of the script :

Code: [Select]
w=20
s=15
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline toby

  • *
  • 46
Re: Assignment works with basic but not with lua?
« Reply #4 on: 26 / October / 2014, 13:03:51 »
I already just did. it somehow worked but now it doesnt WTF?

Re: Assignment works with basic but not with lua?
« Reply #5 on: 26 / October / 2014, 13:07:23 »
I already just did. it somehow worked but now it doesnt WTF?
Hard to comment without a more detailed description of what it now doesn't do.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline toby

  • *
  • 46
Re: Assignment works with basic but not with lua?
« Reply #6 on: 26 / October / 2014, 13:11:33 »
Jeeez, that was my mistake. Because i made an "onlineversion" of the script but accidently uploaded the wrong script.
 :-[

*

Offline toby

  • *
  • 46
Re: CHDKPTP: Script works on camera itself but not with chdkptp
« Reply #7 on: 27 / October / 2014, 02:41:02 »
Here is the clue:

If the script was written to be loaded from the CHDK script menu and expects
menu settings, you will need to manually set the corresponding variables, e.g.

con> .a=1; b=2; loadfile("A/CHDK/SCRIPTS/MY.LUA")()

Why couldnt i have found this earlier?


 

Related Topics