0

HD810 Gosub command does not work in script



I am trying to add a gosub command to a script in an HD810

I have tried exact syntax as suggested in "BrightsignBrightScriptReference/PDF"

Example:
GOSUB ["king"]
a$="queen"
GOTO [a$]
PRINT "ERROR!":STOP
king:
PRINT "king!"
14
RETURN
PRINT "ERROR!":STOP
queen:
PRINT "queen!"

I have tried it with and without Parenthesis and quotes all combinations.
No luck.

My actual code. The part which does not work is;

if button = 6 then
Gosub PSet25
If debug print "7"
endif

Followed by;

Pset25:
serial.SendByte(&H1C) 'Dynalite Preset 1 Area 1 at 2sec
serial.SendByte(&H01)
serial.SendByte(&H64)
serial.SendByte(&H0A)
serial.SendByte(&H00)
serial.SendByte(&H00)
serial.SendByte(&HFF)
serial.SendByte(&H76)
RETURN

The only way I can make the code work is to replace the gosub with a goto and the return at the end of the sub with a goto the start of the lookup. (Kludgy way to do it but it works) Why does the gosub not work 1

1 comment

  • 0
    Avatar
    RokuLyndon


    IF you look at the brightscript reference document for the compacts, you'll see that gosub is no longer supported. The new object reference for the compacts details how you can use functions when scripting. Examples are also included in the object reference including some fully functional code samples.
Please sign in to leave a comment.