Nested loops

From Dark Signs Online

Jump to: navigation, search

Contents

The nested loops trick

Intro

Nested loops in Dark Signs Online is currently impossible as just a FOR loop, if you put a FOR inside one other FOR, it wont work, it will ignore the outer FOR condition

There is only one discovered way to get around this.


Code

 @loop
   Action
   @nested-loop
     Nested-Action
     IF Nested-Action is not complete
       GOTO nested-loop
   ENDIF
   IF Action is not complete
     GOTO loop
 ENDIF


Explanation

This basically replaces FOR and NEXT with an IF and GOTO loop, this way it can be nested, witch is not possible in FOR loops as of yet.

Personal tools