#==============================================================================
# ** TDS Self Switch Control
#    Ver: 1.5
#------------------------------------------------------------------------------
#  * Description:
#  Just a simple script that allows you to control self switches of events even
#  if they are on other maps.
#------------------------------------------------------------------------------
#  * Features: 
#  Changing the state of event self switches
#------------------------------------------------------------------------------
#  * Instructions:
#  To change the state of a self switch use this in a script call from an event:
#
#  control_self_switch(map_id, event_id, self_switch, state)
#
#  map_id = ID of the map where the event is
#  event_id = ID of the event you wish to use
#  self_switch = Self switch to change value('A', 'B', 'C', 'D')
#  state = true or false
#
#  Example:
#
#  control_self_switch(1,  2,  'A',  true)
#------------------------------------------------------------------------------
#  * New Methods:
#  New Methods here
#  Game_Interpreter:
#  - control_self_switch(map_id, event_id, self_switch, state) 
#    ^ Used to set the state of self switches.
#------------------------------------------------------------------------------
# WARNING:
#
# Do not release, distribute or change my work without my expressed written 
# consent, doing so violates the terms of use of this work.
#
# If you really want to share my work please just post a link to the original
# site.
#
# * Not Knowing English or understanding these terms will not excuse you in any
#   way from the consequenses.
#==============================================================================

#==============================================================================
# ** Game_Interpreter
#------------------------------------------------------------------------------
#  An interpreter for executing event commands. This class is used within the
# Game_Map, Game_Troop, and Game_Event classes.
#==============================================================================

class Game_Interpreter
  #--------------------------------------------------------------------------
  # * Control Self Switch
  #  map_id       : ID of map
  #  event_id     : ID of event 
  #  self_switch  : Self switch ( 'A', 'B', 'C', 'D')
  #  state        : Set state of activation (True or False)
  #--------------------------------------------------------------------------
  def control_self_switch(map_id, event_id, self_switch, state) 
    # Make Hash Key
    key = [map_id, event_id, self_switch]
    # Set Self Switch State
    $game_self_switches[key] = state
    # Refresh Game Map
    $game_map.refresh
  end
end