Expanding the range of QL Adventures

Anything QL Software or Programming Related.
User avatar
tofro
QL Wafer Drive
Posts: 1436
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Expanding the range of QL Adventures

Postby tofro » Thu Jan 25, 2018 9:59 am

Cristian wrote:100 DEFine PROCedure doSomething(dng)
110 some calculations
120 IF done THEN EXIT doSomething
130 do some more
140 END DEFine doSomething

You should utilize EXIT and place the END DEFine at the very end of the procedure.
And thanks for your nice game!


No you shouldn't. EXIT (at least on SBASIC) will only work to exit from loops (REPeat, FOR). Your way of doing things produces an "undefined loop variable" error in SBASIC. The Turbo compiler will also choke on this line. SuperBASIC with its sloppy syntax check might probably accept this, I can't test at the moment.

Tobias


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
georgeo
Bent Pin Expansion Port
Posts: 94
Joined: Wed Aug 03, 2016 8:49 am

Re: Expanding the range of QL Adventures

Postby georgeo » Thu Jan 25, 2018 2:03 pm

Hi everyone,

A quick look at Jan Jones' book suggests that I should use RETURN if I want to exit a procedure before the end, which is what I have mostly done--except for the typo, which is probably what Martyn was referring to.

Thanks for your help,
George.


User avatar
Cristian
Gold Card
Posts: 493
Joined: Mon Feb 16, 2015 1:40 pm
Location: Veneto

Re: Expanding the range of QL Adventures

Postby Cristian » Thu Jan 25, 2018 7:43 pm

tofro wrote:
No you shouldn't. EXIT (at least on SBASIC) will only work to exit from loops (REPeat, FOR). Your way of doing things produces an "undefined loop variable" error in SBASIC. The Turbo compiler will also choke on this line. SuperBASIC with its sloppy syntax check might probably accept this, I can't test at the moment.

Tobias



Yes you're absolutely right Tobias, and thank you very much for your correction! Sorry! Never try to write code with a headache... I should take a pill and keep my hands far from the keyboard!


georgeo
Bent Pin Expansion Port
Posts: 94
Joined: Wed Aug 03, 2016 8:49 am

Re: Expanding the range of QL Adventures

Postby georgeo » Sun Aug 12, 2018 9:24 pm

Modest updates to Akalabeth: World of Doom. Player now receives reward (hit points) when leaving dungeon and the special attacks for thief and gremlin are implemented--thief special attack is particularly annoying as they keep stealing your weapons! Try it out from:

https://github.com/SinclairQL/akalabeth

Hopefully find time to do more over coming weeks,
Georgeo.



Return to “Software & Programming”

Who is online

Users browsing this forum: Google [Bot] and 1 guest