When I run it, it seems to stall instead of run. Sometimes it works, other times stall.
Is there another way to accomplish this?
Spoiler
def create_code
complete = 0
code_pos = 61
while(complete < 27)
rand_value = rand(27) + 1
if $game_switches[rand_value] == false
$game_switches[rand_value] = true
$game_switches[26 + rand_value] = true
$game_variables[code_pos] = rand_value
code_pos += 1
complete += 1
end
end
end
complete = 0
code_pos = 61
while(complete < 27)
rand_value = rand(27) + 1
if $game_switches[rand_value] == false
$game_switches[rand_value] = true
$game_switches[26 + rand_value] = true
$game_variables[code_pos] = rand_value
code_pos += 1
complete += 1
end
end
end
Update: I removed the complete variable and changed the while condition and it is acting better.