06-19-2013, 04:00 PM
oh whoops! (this is why you don't try to script after working for 8 hours) Try this:
remove the print statements once you know it's working. What is probably happening is the first 'if' is satisfied so the switch is set to true, and then since the switch is true the second if statement is run, setting the switch back to false.
That is, if you put your code somewhere where it can run every frame. You did that, right?
Code:
if Input.trigger?(Input::L) && $game_switches[2] = false
$game_switches[2] = true
p "switch on!"
elsif Input.trigger?(Input::L) && $game_switches[2] = true
$game_switches[2] = false
p "switch off!"
end
remove the print statements once you know it's working. What is probably happening is the first 'if' is satisfied so the switch is set to true, and then since the switch is true the second if statement is run, setting the switch back to false.
That is, if you put your code somewhere where it can run every frame. You did that, right?