mcgluszak

[Author: Aleworks] AIM Compatibility Patch v1.00

Jul 31st, 2011
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 5.99 KB | None | 0 0
  1. #=============================================================================
  2. # *** Aleworks Input Module Compability Patch 1(AIM CP1)
  3. #=============================================================================
  4. # Created by Aleworks
  5. # Version: 1.00
  6. # Last Update: 29/03/2007 (day/month/year)
  7. #=============================================================================
  8. #==== Description ====
  9. # This patch, is for making AIM, compatible with the default interpreter script
  10. # of RPG Maker XP, when using the Conditional Branch and Button Input Processing
  11. # commands.
  12. #=============================================================================
  13. #==== Requeriments ====
  14. # * Aleworks Input Module
  15. #   - Version: 1.00
  16. #=============================================================================
  17. #==== Classes & Methods ====
  18. # ** Class Interpreter
  19. #   * Overwrite Methods: input_button; command_111
  20. #=============================================================================
  21.  
  22. #=============================================================================
  23. # ** Interpreter
  24. #=============================================================================
  25. class Interpreter
  26.   #---------------------------------------------------------------------------
  27.   # * Input Button
  28.   #---------------------------------------------------------------------------
  29.   SDK.log_overwrite(:Interpreter, :input_button)
  30.   def input_button
  31.     n = 1 if Input.trigger?(Input::LOWER_LEFT)
  32.     n = 3 if Input.trigger?(Input::LOWER_RIGHT)
  33.     n = 7 if Input.trigger?(Input::UPPER_LEFT)
  34.     n = 9 if Input.trigger?(Input::UPPER_RIGHT)
  35.     n = 2 if Input.trigger?(Input::DOWN)
  36.     n = 4 if Input.trigger?(Input::LEFT)
  37.     n = 6 if Input.trigger?(Input::RIGHT)
  38.     n = 8 if Input.trigger?(Input::UP)
  39.     n = 11 if Input.trigger?(Input::A)
  40.     n = 12 if Input.trigger?(Input::B)
  41.     n = 13 if Input.trigger?(Input::C)
  42.     n = 14 if Input.trigger?(Input::X)
  43.     n = 15 if Input.trigger?(Input::Y)
  44.     n = 16 if Input.trigger?(Input::Z)
  45.     n = 17 if Input.trigger?(Input::L)
  46.     n = 18 if Input.trigger?(Input::R)
  47.     if !n.nil?
  48.       $game_variables[@button_input_variable_id] = n
  49.       $game_map.need_refresh = true
  50.       @button_input_variable_id = 0
  51.     end
  52.   end
  53.   #---------------------------------------------------------------------------
  54.   # * Conditional Branch
  55.   #---------------------------------------------------------------------------
  56.   SDK.log_overwrite(:Interpreter, :command_111)
  57.   def command_111
  58.     result = false
  59.     case @parameters[0]
  60.     when 0
  61.       result = ($game_switches[@parameters[1]] == (@parameters[2] == 0))
  62.     when 1
  63.       value1 = $game_variables[@parameters[1]]
  64.       if @parameters[2] == 0
  65.         value2 = @parameters[3]
  66.       else
  67.         value2 = $game_variables[@parameters[3]]
  68.       end
  69.       case @parameters[4]
  70.       when 0
  71.         result = (value1 == value2)
  72.       when 1
  73.         result = (value1 >= value2)
  74.       when 2
  75.         result = (value1 <= value2)
  76.       when 3
  77.         result = (value1 > value2)
  78.       when 4
  79.         result = (value1 < value2)
  80.       when 5
  81.         result = (value1 != value2)
  82.       end
  83.     when 2
  84.       if @event_id > 0
  85.         key = [$game_map.map_id, @event_id, @parameters[1]]
  86.         if @parameters[2] == 0
  87.           result = ($game_self_switches[key] == true)
  88.         else
  89.           result = ($game_self_switches[key] != true)
  90.         end
  91.       end
  92.     when 3
  93.       if $game_system.timer_working
  94.         sec = $game_system.timer / Graphics.frame_rate
  95.         if @parameters[2] == 0
  96.           result = (sec >= @parameters[1])
  97.         else
  98.           result = (sec <= @parameters[1])
  99.         end
  100.       end
  101.     when 4
  102.       actor = $game_actors[@parameters[1]]
  103.       if actor != nil
  104.         case @parameters[2]
  105.         when 0
  106.           result = ($game_party.actors.include?(actor))
  107.         when 1
  108.           result = (actor.name == @parameters[3])
  109.         when 2
  110.           result = (actor.skill_learn?(@parameters[3]))
  111.         when 3
  112.           result = (actor.weapon_id == @parameters[3])
  113.         when 4
  114.           result = (actor.armor1_id == @parameters[3] or
  115.                     actor.armor2_id == @parameters[3] or
  116.                     actor.armor3_id == @parameters[3] or
  117.                     actor.armor4_id == @parameters[3])
  118.         when 5
  119.           result = (actor.state?(@parameters[3]))
  120.         end
  121.       end
  122.     when 5
  123.       enemy = $game_troop.enemies[@parameters[1]]
  124.       if enemy != nil
  125.         case @parameters[2]
  126.         when 0
  127.           result = (enemy.exist?)
  128.         when 1
  129.           result = (enemy.state?(@parameters[3]))
  130.         end
  131.       end
  132.     when 6
  133.       character = get_character(@parameters[1])
  134.       if character != nil
  135.         result = (character.direction == @parameters[2])
  136.       end
  137.     when 7
  138.       if @parameters[2] == 0
  139.         result = ($game_party.gold >= @parameters[1])
  140.       else
  141.         result = ($game_party.gold <= @parameters[1])
  142.       end
  143.     when 8
  144.       result = ($game_party.item_number(@parameters[1]) > 0)
  145.     when 9
  146.       result = ($game_party.weapon_number(@parameters[1]) > 0)
  147.     when 10
  148.       result = ($game_party.armor_number(@parameters[1]) > 0)
  149.     when 11
  150.       n = Input::DOWN if @parameters[1] == 2
  151.       n = Input::LEFT if @parameters[1] == 4
  152.       n = Input::RIGHT if @parameters[1] == 6
  153.       n = Input::UP if @parameters[1] == 8
  154.       n = Input::A if @parameters[1] == 11
  155.       n = Input::B if @parameters[1] == 12
  156.       n = Input::C if @parameters[1] == 13
  157.       n = Input::X if @parameters[1] == 14
  158.       n = Input::Y if @parameters[1] == 15
  159.       n = Input::Z if @parameters[1] == 16
  160.       n = Input::L if @parameters[1] == 17
  161.       n = Input::R if @parameters[1] == 18
  162.       result = (Input.press?(n))
  163.     when 12
  164.       result = eval(@parameters[1])
  165.     end
  166.     @branch[@list[@index].indent] = result
  167.     if @branch[@list[@index].indent] == true
  168.       @branch.delete(@list[@index].indent)
  169.       return true
  170.     end
  171.     return command_skip
  172.   end
  173. end
Advertisement
Add Comment
Please, Sign In to add comment