A little help with syntax please (both .bas and .lua) - Script Writing - CHDK Forum

A little help with syntax please (both .bas and .lua)

  • 2 Replies
  • 3513 Views
A little help with syntax please (both .bas and .lua)
« on: 25 / January / 2014, 17:00:03 »
Advertisements
I am trying to use functions from: http://chdk.wikia.com/wiki/USB_Remote_V2#Scripting_Interface

First I tried .bas  - and uBASIC:6 parse error  (i thought that was about the do p=..)
Code: [Select]
rem
rem
@title Remote button

while 1
do p = get_usb_power 2 until p>0
if p = 1 then
print "value is 1" 
endif

if p = 2 then
print "value is 2" 
endif

if p > 2 then
print "value is >2" 
endif


rem wait_click 1
rem if is_key "remote" then shoot
wend
end


So I tried lua: 
Code: [Select]
--[[
@title Remote2L
]]

repeat
do p = get_usb_power 2 until p>0
if p = 1 then
print "value is 1" 
end

if  p = 2 then
print "value is 2" 
end

if  p > 2 then
print "value is >2" 
end
until (false)


and failed miserably as well with the "unexpected symbol near "2" , line 6

Re: A little help with syntax please (both .bas and .lua)
« Reply #1 on: 25 / January / 2014, 17:06:36 »
Code: [Select]
@title Remote button
while 1=1
do
p = get_usb_power 2
until p>0
if p = 1 then
print "value is 1" 
endif
if p = 2 then
print "value is 2" 
endif
if p > 2 then
print "value is >2" 
endif
rem wait_click 1
rem if is_key "remote" then shoot
wend
end

Code: [Select]
--[[
@title Remote2L
]]

repeat
    repeat p = get_usb_power(2) until p>0
    if p == 1 then
        print "value is 1" 
    end

    if  (p == 2) then
        print "value is 2" 
    end

    if  (p > 2) then
        print "value is >2" 
    end
until (false)
« Last Edit: 25 / January / 2014, 17:14:48 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: A little help with syntax please (both .bas and .lua)
« Reply #2 on: 26 / January / 2014, 08:52:08 »
Thank you very much.

 

Related Topics