Advertisement
LiTTleDRAgo

[RGSS/2/3] Swap Switch and Variables

May 18th, 2012
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.80 KB | None | 0 0
  1. ['variables','switches','self_switches'].each_with_index {|d,i| eval "
  2. class #{defined?(Window_ActorCommand) ? 'Game_' : ''}Interpreter
  3.  #--------------------------------------------------------------------------
  4.  # * swap_variables(VAR_1,VAR_2)
  5.  # * swap_switches(SWITCH_1,SWITCH_2)
  6.  # * swap_self_switches(X,X) => X = 'A','B','C', or 'D'
  7.  # * swap_self_switches(X,X) => X = [@map_id,@event_id,'A'/'B'/'C'/'D']
  8.  #--------------------------------------------------------------------------
  9.  def swap_#{d}(from, to)
  10.    from = [@map_id,@event_id,from.to_s] if !from.is_a?(Array) && #{i} == 2
  11.    to   = [@map_id,@event_id,  to.to_s] if   !to.is_a?(Array) && #{i} == 2
  12.    temp = [$game_#{d}[from], $game_#{d}[to]]
  13.    $game_#{d}[to], $game_#{d}[from] = temp
  14.    $game_map.need_refresh = true
  15.  end
  16. end#"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement