supplierdeeply

Setting constants in script / Error Message / uBasic:52 Bad Return

  • 2 Replies
  • 779 Views
Advertisements
Hi,

I'm hoping someone can help me? I'm revisiting an old 'time lapse with HDR' script that I was working on a while ago to use with my Canon A560. I was getting an error message so I've stripped the script right back to basics in order to build it up again (and understand where the error is coming from).

The script is below, when I run it I get a message on the screen saying 'uBasic:52 Bad Return' and I have no idea why? It's possible that I'm overlooking something obvious but searching for the error online returns no results, is anyone able to assist?

Thanks,

Adam

Code: [Select]
rem Author: e3SpaceProgram
rem Revised: 06 March 2015
rem License: GPL
rem Twitter: @e3SpaceProgram
rem Web: [url=http://www.adamdynamic.com/e3spaceprogram]www.adamdynamic.com/e3spaceprogram[/url]
rem Version: 0.01

rem Description: Takes timelapse bracketed photographs for a set period of time

@title e3SpaceProgram_TimelapseHDR

@param i Target photo interval (sec)
@default i 15

@param f Focus (mm)
@default f 65535

@param z Zoom (value)
@default z 0

@param s Shutter speed (APEX)
@default s 640

@param x Minimum Sv96
@default x 371

@param X Maximum Sv96
@default X 795

rem Main Script   
    print "Starting script..."

    click "shoot_half"

    gosub "setconstants"

    print "Finished"

:setconstants
    print "Setting constants..."
    C=1
    T = get_tick_count

    if i<0 then i=0

    if z<0 then z=0
    if z>8 then z=8
    if f<0 then f=0
    if f>65535 then f=65535
    print "Constants set."
    return


*

Offline zeno

  • *****
  • 881
Re: Setting constants in script / Error Message / uBasic:52 Bad Return
« Reply #1 on: 11 / March / 2015, 05:40:44 »
You need to add an end statement line after
print "Finished"
Without it control runs into the setConstants subroutine again (and since control didn't get there the second time via a gosub, the return is an error).

Dave
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

Re: Setting constants in script / Error Message / uBasic:52 Bad Return
« Reply #2 on: 11 / March / 2015, 13:10:34 »
You need to add an end statement line after
print "Finished"
Without it control runs into the setConstants subroutine again (and since control didn't get there the second time via a gosub, the return is an error).

Dave

Ah, schoolboy, I'll give that a try - many thanks!

 

Related Topics