Jump

From EDukeWiki
Revision as of 10:13, 9 December 2007 by Hunter byte (talk | contribs) (New page: 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 b...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 en 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.