Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Activate Switch with a button
#4
oh whoops! (this is why you don't try to script after working for 8 hours) Try this:

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?
Reply }


Messages In This Thread
Activate Switch with a button - by Iqus - 06-18-2013, 07:16 PM
RE: Activate Switch with a button - by Iqus - 06-19-2013, 12:13 PM
RE: Activate Switch with a button - by MechanicalPen - 06-19-2013, 04:00 PM
RE: Activate Switch with a button - by Iqus - 06-19-2013, 08:30 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
   How can i activate switches with rgss computerwizoo7 2 6,923 07-04-2009, 03:01 AM
Last Post: computerwizoo7



Users browsing this thread: