Jump: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Jblade (talk | contribs)
mNo edit summary
XTHX2 (talk | contribs)
No edit summary
Line 5: Line 5:
This command is also know as GOTO(http://en.wikipedia.org/wiki/Goto). Too bad this jump command isn't as good as it can be. It hardly can be used to jump forward because <addr> isn't known.
This command is also know as GOTO(http://en.wikipedia.org/wiki/Goto). Too bad this jump command isn't as good as it can be. It hardly can be used to jump forward because <addr> isn't known.


Here is en example. It countdowns the i variable from 10 to 0.
Here is an example. It countdowns the i variable from 10 to 0.
   // addr and i are gamevars.
   // addr and i are gamevars.
   setvar i 10
   setvar i 10

Revision as of 12:41, 31 July 2008

jump <addr>

<addr> - is a gamevar obtained by getcurraddress

This command is also know as GOTO(http://en.wikipedia.org/wiki/Goto). Too bad this jump command isn't as good as it can be. It hardly can be used to jump forward because <addr> isn't known.

Here is an example. It countdowns the i variable from 10 to 0.

 // addr and i are gamevars.
 setvar i 10
 getcurraddress addr
 // begin loop
 addlogvar i
 subvar i 1
 ifvarn i 0 jump addr // if i isn't 0, jump to addr

Yes, it could be done via whilevarn but it's just an example.