I believe I have mistaken nested ifs inside of elseifs.
For example:
if i=0
blah
elseif i =1
if o=1
other blah
endif
elseif....
I believe I was wrong in thinking the nested if broke out of the entire if statement? I thought once an elseif was correct it exited the if statement... so if i=1 it would do those commands and quit the entire thing.
I am testing something, and the bad result is so rare I don't get to see it much. I have corrected the code using if/else/endif, then I am back inside the elseif statement. Which, at the very least, does the same thing if it doesn't fix the problem.
My code is below I am getting a result I thought I coded as impossible, but I guess I coded wrong.
I am storing random values in 3 variables. I am trying to set rules to which random number I can get, as it determines the direction of a corridor.
My previous_last was a 3, then I randomed a 4(last), and then a 3 again(current). But I should not be able to get that result. You can see that on the first elseif.
if Last_Corridor_Direction = 1 or Last_Corridor_Direction = 3
repeat
Current_Corridor_Direction = random2(1,4)
until Current_Corridor_Direction <> Last_Corridor_Direction and Current_Corridor_Direction <> 2 and and Current_Corridor_Direction <> 4
elseif Last_Corridor_Direction = 2 or Last_Corridor_Direction = 4
if Prvs_Last_Corridor_Direction = 1 or Prvs_Last_Corridor_Direction = 3
repeat
Current_Corridor_Direction = random2(1,4)
until Current_Corridor_Direction <> Last_Corridor_Direction-1 and Current_Corridor_Direction <> Prvs_Last_Corridor_Direction - 1 and Current_Corridor_Direction <> Prvs_Last_Corridor_Direction
else
repeat
Current_Corridor_Direction = random2(1,4)
until Current_Corridor_Direction <> Last_Corridor_Direction-1 and Current_Corridor_Direction <> Prvs_Last_Corridor_Direction-1
endif
else
Current_Corridor_Direction = random2(1,4)
endif