Nested Loop Doesn't Execute

BlueSin

New Member
Reaction score
37
I have a nested loop here:

Code:
function Trig_New_Puzzle_Actions takes nothing returns nothing
    local integer puzzle = GetRandomInt(1,3)
    local integer board=0
    local integer row=0
    loop
        set board=board+1
        exitwhen board>12
        loop
            set row=row+1
            exitwhen row>9
            call SetAnswers(udg_Puzzle[row+18*(puzzle-1)],board,row)
            call SetHints(udg_Puzzle[row+9*(puzzle-1)],board,row)
        endloop
    endloop
endfunction

//===========================================================================
function InitTrig_New_Puzzle takes nothing returns nothing
    set gg_trg_New_Puzzle = CreateTrigger(  )
    call TriggerAddAction( gg_trg_New_Puzzle, function Trig_New_Puzzle_Actions )
endfunction

...that is called at map initialization. Though I think board is never incremented, because only the actions of the first are performed. I probably just made a stupid mistake since I'm not used to doing these things without a for-loop.

Can anyone help?
 

BlueSin

New Member
Reaction score
37
Ah of course, thank you. :)

+rep Edit: Eh, hang on, I need to spread some rep first.

Im used to like

for(int i=0;....)
{
for(int j=0...)
{
}
}

where each variable is initialized at the start of the loop.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top