Advertisement
ezmash

Extract Events to Text File (VX Ace)

Sep 14th, 2013
7,795
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 61.22 KB | None | 0 0
  1. #============================================================================
  2. # EXTRACT EVENTS
  3. # v1.03 by Shaz
  4. #----------------------------------------------------------------------------
  5. # This script extracts ALL event commands into a number of text files.
  6. # These can be opened in a spreadsheet, split into columns, searched and
  7. # sorted.
  8. #
  9. # Data/_EventContents.txt
  10. # Contains ALL event commands
  11. # - useful for perusing, searching for anything in any event
  12. # - this also includes everything in the following two files
  13. #
  14. # Data/_EventDialogue.txt
  15. # A subset of _EventContents.txt
  16. # Contains any event commands to do with text - Show Text, Show Choices,
  17. # actor names, etc
  18. # - useful for proofreading and translation (there is no facility to replace
  19. #   text with translations - this is JUST an extract)
  20. #
  21. # Data/_EventSwitchesVariables.txt
  22. # A subset of _EventContents.txt
  23. # Contains any event commands and conditions to do with switches and variables
  24. # - useful for finding where they've been used
  25. #----------------------------------------------------------------------------
  26. # To Install:
  27. # Copy and paste into a new slot in materials, below all other scripts
  28. #----------------------------------------------------------------------------
  29. # To Customize:
  30. # Change the values of the following constants and variables
  31. #
  32. #  EXPORT_COMMON_EVENTS = true
  33. #    true to export common events
  34. #    false to exclude common events
  35. #
  36. #  EXPORT_BATTLE_EVENTS = true
  37. #    true to export battle events
  38. #    false to export battle events
  39. #
  40. #  MAP_START = 1
  41. #  MAP_END = 999
  42. #    range of maps to include
  43. #    set to 1 and 999 for all maps
  44. #    change both to the same map number to export just a single map
  45. #
  46. #  EXPAND_MOVE_ROUTES = true
  47. #    true to export every line in a move route command
  48. #    false to export the move route "heading" only, but no individual move route commands
  49. #
  50. #  INDENT = true
  51. #  @ind = ". "
  52. #    true to indent text within blocks, as you see it in the editor
  53. #    false to align everything to the left
  54. #    if true, @ind is the string that will be repeated to show indenting
  55. #
  56. #  @cb = "^"
  57. #    column break character - this MUST be something that is not used
  58. #    in any text or Call Script commands
  59. #
  60. #  @lb = "\n"
  61. #    line break character - changing this is not recommended
  62. #
  63. #----------------------------------------------------------------------------
  64. # To Use:
  65. # You do not "call" this script.  
  66. # Paste it, hit Play Test.
  67. # When your title screen appears, the script has run and the files have been
  68. # created.
  69. #
  70. # The script will run every time you play unless you disable it.  
  71. # Once you've run it once, edit the script and disable the whole thing
  72. # (Ctrl A to select all, Ctrl Q to disable)
  73. # Enable it when you want to run it again (same key sequence)
  74. #
  75. # Once the files have been created, open them in a spreadsheet and use the
  76. # Text to Columns feature to separate based on your chosen delimiter
  77. #----------------------------------------------------------------------------
  78. # Terms:
  79. # This is a DEVELOPMENT ONLY script.  You may use it when creating free or
  80. # commercial games, but PLEASE remove the script before the game is released.
  81. # You do NOT need to credit me in the game.
  82. # If you share this script, PLEASE keep this header intact, and include a
  83. # link back to the original RPG Maker Web forum post.
  84. #----------------------------------------------------------------------------
  85. # Revisions:
  86. # 1.01  Jun 22 2014   Fix troop condition crash
  87. # 1.02  May 11 2020   Fix crash on Change Parallax
  88. # 1.03  Jul 22 2020   Fix name on Show Balloon Icon
  89. #                     Fix actor in Change Equipment
  90. #                     Fix actor in Change Nickname
  91. #============================================================================
  92.  
  93.  
  94. class Game_Event < Game_Character
  95.   attr_reader    :event
  96.   attr_reader    :name
  97.   attr_reader    :pages
  98.  
  99.   alias shaz_ee_game_event_initialize initialize
  100.   def initialize(map_id, event)
  101.     @name = event.name
  102.     @pages = event.pages
  103.     shaz_ee_game_event_initialize(map_id, event)
  104.   end
  105. end
  106.  
  107. module EVExport
  108.   EXPORT_COMMON_EVENTS = true
  109.   EXPORT_BATTLE_EVENTS = true
  110.   MAP_START = 1
  111.   MAP_END = 999
  112.   EXPAND_MOVE_ROUTES = true
  113.   INDENT = true
  114.  
  115.   @cb = "^"
  116.   @lb = "\n"
  117.   @ind = ". "
  118.  
  119.   @expline = 0
  120.  
  121.   def self.export
  122.     DataManager.load_normal_database
  123.     DataManager.create_game_objects
  124.     @file_all = File.open('Data/_EventContents.txt', 'w')
  125.     @file_text = File.open('Data/_EventDialogue.txt', 'w')
  126.     @file_swvar = File.open('Data/_EventSwitchesVariables.txt', 'w')
  127.    
  128.     text = sprintf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
  129.       'Seq', @cb, 'Type', @cb, 'Source', @cb, 'Event ID', @cb, 'Name', @cb,
  130.       'Page', @cb, 'Line', @cb, 'Code', @cb, 'Command', @cb, 'Arguments', @lb)
  131.      
  132.     @file_all.print(text)
  133.     @file_text.print(text)
  134.    
  135.     text = sprintf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s",
  136.       'Seq', @cb, 'Type', @cb, 'Source', @cb, 'Event ID', @cb, 'Name', @cb,
  137.       'Page', @cb, 'Line', @cb, 'Code', @cb, 'Command', @cb, 'Switch/Var', @cb,
  138.       'Arguments', @lb)
  139.    
  140.     @file_swvar.print(text)
  141.    
  142.     @mapnames = []
  143.     for m in 1...999
  144.       if File.exists?(sprintf('Data/Map%03d.rvdata2', m))
  145.         @mapnames[m] = load_data(sprintf("Data/Map%03d.rvdata2", m)).display_name
  146.       else
  147.         @mapnames[m] = 'undefined'
  148.       end
  149.     end
  150.    
  151.     @sv3 = nil
  152.     self.export_common_events if EXPORT_COMMON_EVENTS
  153.     self.export_battle_events if EXPORT_BATTLE_EVENTS
  154.     @event_seq = 3
  155.     for m in MAP_START .. MAP_END
  156.       self.export_map_events(m) if File.exists?(sprintf('Data/Map%03d.rvdata2', m))
  157.     end
  158.    
  159.     @file_all.close
  160.     @file_text.close
  161.   end
  162.  
  163.   def self.export_common_events
  164.     @event_seq = 1
  165.     @event_type = "Common Event"
  166.     @event_tab = ""
  167.     for @event in $data_common_events.compact
  168.       @event_source = sprintf("%d%s%s", @event.id, @cb, @event.name)
  169.       @list = @event.list
  170.       self.export_common_event_conditions
  171.       self.export_event_list
  172.     end
  173.   end
  174.  
  175.   def self.export_battle_events
  176.     @event_seq = 2
  177.     for troop in $data_troops
  178.       next if troop.nil?
  179.       @event_type = "Troop"
  180.       @event_source = sprintf("%d%s%s", troop.id, @cb, troop.name)
  181.       for index in 0..troop.pages.size - 1
  182.         @event_tab = index.to_s
  183.         page = troop.pages[index]
  184.         @cond = page.condition
  185.         @list = page.list
  186.         self.export_troop_event_conditions
  187.         self.export_event_list
  188.       end
  189.     end
  190.   end
  191.  
  192.   def self.export_map_events(m)
  193.     $game_map.setup(m)
  194.     @event_type = sprintf("Map %3d (%s - %s)", m, $game_map.display_name, @mapnames[m])
  195.    
  196.     for event_key in $game_map.events.keys
  197.       @event = $game_map.events[event_key]
  198.       next if @event.nil? || @event.pages.nil?
  199.       @event_source = sprintf("%d%sEV%03d (%d,%d) - %s", @event.id, @cb, @event.id,
  200.       @event.event.x, @event.event.y, @event.name)
  201.       for page in 0..@event.pages.size - 1
  202.         @event_tab = (page + 1).to_s
  203.         @cond = @event.pages[page].condition
  204.         @list = @event.pages[page].list
  205.         self.export_map_event_conditions
  206.         self.export_event_list
  207.       end
  208.     end
  209.   end
  210.  
  211.   def self.export_common_event_conditions
  212.     @line = 0
  213.     @sv2 = nil
  214.     if @event.trigger != 0
  215.       @swvar_export = true
  216.       @sv1 = get_switch(@event.switch_id)
  217.       @cmd = "Switch"
  218.       @arg = sprintf('%s is ON', @sv1)
  219.       self.export_condition
  220.     end
  221.   end
  222.  
  223.   def self.export_troop_event_conditions
  224.     @line = 0
  225.     @sv1 = nil
  226.     @sv2 = nil
  227.     if @cond.turn_ending
  228.       @cmd = 'Turn'
  229.       @arg = 'End of turn'
  230.       @swvar_export = false
  231.       self.export_condition
  232.     end
  233.     if @cond.turn_valid
  234.       @cmd = 'Turn'
  235.       @arg = sprintf('Turn no. %d + %d * X', @cond.turn_a, @cond.turn_b)
  236.       @swvar_export = false
  237.       self.export_condition
  238.     end
  239.     if @cond.enemy_valid
  240.       @cmd = 'Enemy'
  241.       @arg = sprintf('Enemy %d\'s HP is %d%% or below', @cond.enemy_index,
  242.         @cond.enemy_hp)
  243.       @swvar_export = false
  244.       self.export_condition
  245.     end
  246.     if @cond.actor_valid
  247.       @cmd = 'Actor'
  248.       @arg = sprintf('Actor %d\'s HP is %d%% or below', @cond.actor_id,
  249.         @cond.actor_hp)
  250.       @swvar_export = false
  251.       self.export_condition
  252.     end
  253.     if @cond.switch_valid
  254.       @sv1 = get_switch(@cond.switch_id)
  255.       @cmd = 'Switch'
  256.       @arg = sprintf('%s is ON', @sv1)
  257.       @swvar_export = true
  258.       self.export_condition
  259.     end
  260.   end
  261.  
  262.   def self.export_map_event_conditions
  263.     @line = 0
  264.     @sv2 = nil
  265.     @swvar_export = true
  266.     if @cond.switch1_valid
  267.       @sv1 = get_switch(@cond.switch1_id)
  268.       @cmd = 'Switch'
  269.       @arg = sprintf('%s is ON', @sv1)
  270.       self.export_condition
  271.     end
  272.     if @cond.switch2_valid
  273.       @sv1 = get_switch(@cond.switch2_id)
  274.       @cmd = 'Switch'
  275.       @arg = sprintf('%s is ON', @sv1)
  276.       self.export_condition
  277.     end
  278.     @sv1 = nil
  279.     if @cond.variable_valid
  280.       @sv1 = get_variable(@cond.variable_id)
  281.       @cmd = 'Variable'
  282.       @arg = sprintf('%s >= %d', @sv1, @cond.variable_value)
  283.       self.export_condition
  284.     end
  285.     @swvar_export = false
  286.     if @cond.self_switch_valid
  287.       @cmd = 'Self Switch'
  288.       @arg = sprintf('Self Switch %s is ON', @cond.self_switch_ch)
  289.       self.export_condition
  290.     end
  291.     if @cond.item_valid
  292.       @cmd = 'Item'
  293.       @arg = sprintf('Item %d (%s) is in Inventory', @cond.item_id,
  294.         self.item_name(@cond.item_id))
  295.       self.export_condition
  296.     end
  297.     if @cond.actor_valid
  298.       @cmd = 'Actor'
  299.       @arg = sprintf('Actor %d (%s) is in the Party', @cond.actor_id,
  300.         self.actor_name(@cond.actor_id))
  301.       self.export_condition
  302.     end
  303.   end
  304.  
  305.   def self.export_event_list
  306.     return if @list.nil?
  307.     @cmdline = 0
  308.    
  309.     while @cmdline < @list.size
  310.       @line = @cmdline + 1
  311.       @command = @list[@cmdline]
  312.       @params = @command.parameters.clone
  313.       @indent = @command.indent
  314.       @cmd = ""
  315.       @arg = ""
  316.       @sv1 = nil
  317.       @sv2 = nil
  318.       @sv3 = nil
  319.       @skip_export = false
  320.       @text_export = false
  321.       @swvar_export = false
  322.       method_name = "command_#{@command.code}"
  323.       send(method_name) if respond_to?(method_name)
  324.       self.export_command if !@skip_export
  325.       @cmdline += 1
  326.     end
  327.   end
  328.  
  329.   def self.get_switch(id)
  330.     sprintf('Switch %04d [%s]', id, $data_system.switches[id])
  331.   end
  332.  
  333.   def self.get_variable(id)
  334.     sprintf('Variable %04d [%s]', id, $data_system.variables[id])
  335.   end
  336.  
  337.   def self.actor_name(id)
  338.     $data_actors[id].nil? ? 'undefined' : $data_actors[id].name
  339.   end
  340.  
  341.   def self.class_name(id)
  342.     $data_classes[id].nil? ? 'undefined' : $data_classes[id].name
  343.   end
  344.  
  345.   def self.skill_name(id)
  346.     $data_skills[id].nil? ? 'undefined' : $data_skills[id].name
  347.   end
  348.  
  349.   def self.item_name(id)
  350.     $data_items[id].nil? ? 'undefined' : $data_items[id].name
  351.   end
  352.  
  353.   def self.weapon_name(id)
  354.     $data_weapons[id].nil? ? 'undefined' : $data_weapons[id].name
  355.   end
  356.  
  357.   def self.armor_name(id)
  358.     $data_armors[id].nil? ? 'undefined' : $data_armors[id].name
  359.   end
  360.  
  361.   def self.enemy_name(id)
  362.     $data_enemies[id].nil? ? 'undefined' : $data_enemies[id].name
  363.   end
  364.  
  365.   def self.troop_name(id)
  366.     $data_troops[id].nil? ? 'undefined' : $data_troops[id].name
  367.   end
  368.  
  369.   def self.state_name(id)
  370.     $data_states[id].nil? ? 'undefined' : $data_states[id].name
  371.   end
  372.  
  373.   def self.animation_name(id)
  374.     $data_animations[id].nil? ? 'undefined' : $data_animations[id].name
  375.   end
  376.  
  377.   def self.tileset_name(id)
  378.     $data_tilesets[id].nil? ? 'undefined' : $data_tilesets[id].name
  379.   end
  380.  
  381.   def self.common_event_name(id)
  382.     $data_common_events[id].nil? ? 'undefined' : $data_common_events[id].name
  383.   end
  384.    
  385.   def self.next_event_code
  386.     @list[@cmdline + 1].code
  387.   end
  388.  
  389.   def self.get_operator(operator)
  390.     return ['=', '+=', '-=', '*=', '/=', '%='][operator]
  391.   end
  392.    
  393.   def self.operate_value(sign, value, const = true)
  394.     @swvar_export = !const
  395.     @sv1 = get_variable(value) if @swvar_export
  396.     return sprintf("%s %s", (sign == 0 ? "+" : "-"),
  397.       (const ? value.to_s : sprintf("%s", @sv1)))
  398.   end
  399.  
  400.   def self.get_actor(type, id)
  401.     @swvar_export = type != 0
  402.     @sv1 = get_variable(id) if @swvar_export
  403.     return type == 0 ? (id == 0 ? "All actors" : sprintf('Actor %d (%s)', id,
  404.       self.actor_name(id))) : sprintf('Actor %s', @sv1)
  405.   end
  406.  
  407.   def self.get_enemy(id)
  408.     return id < 0 ? "All enemies" : ("Enemy " + id.to_s)
  409.   end
  410.    
  411.   def self.get_character(character)
  412.     return character < 0 ? "Player" : character > 0 ? ("Event " + character.to_s) :
  413.       "This event"
  414.   end
  415.    
  416.   def self.get_direction(dir)
  417.     return ['', '', 'down', '', 'left', '', 'right', '', 'up'][dir]
  418.   end
  419.  
  420.   def self.get_audio(audio)
  421.     return sprintf("%s;  Volume %d  Pitch %d", audio.name, audio.volume, audio.pitch)
  422.   end
  423.  
  424.   def self.get_vehicle(vehicle)
  425.     return ['boat', 'ship', 'airship'][vehicle]
  426.   end
  427.  
  428.   def self.get_map_loc(map, x, y, const = true)
  429.     @swvar_export = !const
  430.     if const
  431.       return sprintf("%d (%s - %s), (%d, %d)", map, @mapnames[map],
  432.         $data_mapinfos[map] ? $data_mapinfos[map].name : 'unknown', x, y)
  433.     else
  434.       @sv1 = get_variable(map)
  435.       @sv2 = get_variable(x)
  436.       @sv3 = get_variable(y)
  437.       return sprintf("%s, (%s, %s)", @sv1, @sv2, @sv3)
  438.     end
  439.   end
  440.  
  441.   def self.get_loc(x, y, const = true)
  442.     if const
  443.       return sprintf("(%d, %d)", x, y)
  444.     else
  445.       @swvar_export = true
  446.       @sv1 = get_variable(x)
  447.       @sv2 = get_variable(y)
  448.       return sprintf("(%s, %s)", @sv1, @sv2)
  449.     end
  450.   end
  451.  
  452.   def self.command_0
  453.     @skip_export = true
  454.   end
  455.   def self.command_505
  456.     @skip_export = true
  457.   end
  458.   def self.command_404
  459.     @cmd = "End Show Choices"
  460.     @arg = 'end choices'
  461.   end
  462.   def self.command_412
  463.     @cmd = "End Conditional Branch"
  464.     @arg = 'end condition'
  465.   end
  466.   def self.command_604
  467.     @cmd = "End Battle Result"
  468.     @arg = 'end battle result'
  469.   end
  470.  
  471.   #--------------------------------------------------------------------------
  472.   # * Show Text
  473.   #--------------------------------------------------------------------------
  474.   def self.command_101
  475.     @text_export = true
  476.     @cmd = "Show Text"
  477.     @arg = sprintf('Face: %s (index %d) on %s at %s',
  478.       (@params[0] == "" ? 'none' : @params[0]), @params[1],
  479.       ['normal window', 'dim background', 'transparent'][@params[2]],
  480.       ['top', 'middle', 'bottom'][@params[3]])
  481.   end
  482.   def self.command_401
  483.     @text_export = true
  484.     @cmd = "Show Text"
  485.     @arg = @params[0]
  486.   end
  487.   #--------------------------------------------------------------------------
  488.   # * Show Choices
  489.   #--------------------------------------------------------------------------
  490.   def self.command_102
  491.     @text_export = true
  492.     @cmd = "Show Choices"
  493.     for choice in @params[0]
  494.       @arg += choice + "; "
  495.     end
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # * When [**]
  499.   #--------------------------------------------------------------------------
  500.   def self.command_402
  501.     @text_export = true
  502.     @cmd = "When [**]"
  503.     @arg = "When " + @params[1]
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # * When Cancel
  507.   #--------------------------------------------------------------------------
  508.   def self.command_403
  509.     @text_export = true
  510.     @cmd = "When Cancel"
  511.     @arg = "When Cancel"
  512.   end
  513.   #--------------------------------------------------------------------------
  514.   # * Input Number
  515.   #--------------------------------------------------------------------------
  516.   def self.command_103
  517.     @cmd = "Input Number"
  518.     @sv1 = get_variable(@params[0])
  519.     @arg = sprintf("%s  Digits: %d", @sv1, @params[1])
  520.     @swvar_export = true
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # * Select Item
  524.   #--------------------------------------------------------------------------
  525.   def self.command_104
  526.     @cmd = "Select Item"
  527.     @sv1 = @params[0]
  528.     @args = sprintf("%s", @sv1)
  529.     @swvar_export = true
  530.   end
  531.   #--------------------------------------------------------------------------
  532.   # * Show Scrolling Text
  533.   #--------------------------------------------------------------------------
  534.   def self.command_105
  535.     @text_export = true
  536.     @cmd = "Show Scrolling Text"
  537.     while next_event_code == 405
  538.       @cmdline += 1
  539.       @arg += @list[@cmdline].parameters[0] + " "
  540.     end
  541.   end
  542.   #--------------------------------------------------------------------------
  543.   # * Comment
  544.   #--------------------------------------------------------------------------
  545.   def self.command_108
  546.     @cmd = "Comment"
  547.     @arg = @params[0]
  548.   end
  549.   def self.command_408
  550.     @cmd = "Comment"
  551.     @arg = @params[0]
  552.   end
  553.   #--------------------------------------------------------------------------
  554.   # * Conditional Branch
  555.   #--------------------------------------------------------------------------
  556.   def self.command_111
  557.     @cmd = "Conditional Branch"
  558.     @arg = "IF "
  559.     case @params[0]
  560.     when 0 # Switch
  561.       @swvar_export = true
  562.       @sv1 = get_switch(@params[1])
  563.       @arg += sprintf("%s is %s", @sv1, (@params[2] == 0 ? "ON" : "OFF"))
  564.     when 1 # Variable
  565.       @swvar_export = true
  566.       @sv1 = get_variable(@params[1])
  567.       @arg += sprintf("%s %s ", @sv1, ['==', '>=', '<=', '>', '<', '!='][@params[4]])
  568.       if @params[2] == 0 #constant
  569.         @arg += @params[3].to_s
  570.       else
  571.         @sv2 = get_variable(@params[3])
  572.         @arg += sprintf("%s", @sv2)
  573.       end
  574.     when 2 # Self Switch
  575.       @arg += sprintf("Self Switch %s is %s", @params[1],
  576.         (@params[2] == 0 ? "ON" : "OFF"))
  577.     when 3 # Timer
  578.       @arg += sprintf("Timer: %d minutes %d seconds or %s", @params[1]/60,
  579.         @params[1]%60, (@params2 == 0 ? "more" : "less"))
  580.     when 4 # Actor
  581.       @arg += sprintf("Actor %d (%s): ", @params[1], self.actor_name(@params[1]))
  582.       case @params[2]
  583.       when 0
  584.         @arg += "is in the party"
  585.       when 1
  586.         @text_export = true
  587.         @arg += sprintf("name is %s", @params[3])
  588.       when 2
  589.         @arg += sprintf("is class %d (%s)", @params[3], self.class_name(@params[3]))
  590.       when 3
  591.         @arg += sprintf("knows skill %d (%s)", @params[3], self.skill_name(@params[3]))
  592.       when 4
  593.         @arg += sprintf("has weapon %d (%s) equipped", @params[3], self.weapon_name(@params[3]))
  594.       when 5
  595.         @arg += sprintf("has armor %d (%s) equipped", @params[3], self.armor_name(@params[3]))
  596.       when 6
  597.         @arg += sprintf("has state %d (%s) applied", @params[3], self.state_name(@params[3]))
  598.       end
  599.     when 5 # Enemy
  600.       @arg += sprintf("Enemy %d ", @params[1])
  601.       case @params[2]
  602.       when 0 # appear
  603.         @arg += "is visible"
  604.       when 1 # state
  605.         @arg += sprintf("has state %d (%s) applied", @params[3], self.state_name(@params[3]))
  606.       end
  607.     when 6 # Character facing
  608.       @arg += sprintf("%s is facing %s", self.get_character(@params[1]),
  609.         self.get_direction(@params[2]))
  610.     when 7 # Gold
  611.       @arg += sprintf("Gold %s %d", (@params[2] == 0 ? ">=" : @params[2] == 1 ? "<=" : "<"),
  612.         @params[1])
  613.     when 8 # Item
  614.       @arg += sprintf("Party has item %d (%s)", @params[1], self.item_name(@params[1]))
  615.     when 9 # Weapon
  616.       @arg += sprintf("Party has weapon %d (%s)", @params[1],
  617.         self.weapon_name(@params[1]))
  618.       @arg += ' (including equipped)' if @params[2]
  619.     when 10 # Armor
  620.       @arg += sprintf("Party has armor %d (%s)", @params[1],
  621.         self.armor_name(@params[1]))
  622.       @arg += ' (including equipped)' if @params[2]
  623.     when 11 # Button
  624.       @arg += sprintf("Button %s is pressed", ['0', '1', 'down', '3', 'left', '5', 'right',
  625.         '7', 'up', '9', '10', 'A', 'B', 'C', 'X', 'Y', 'Z', 'L', 'R'][@params[1]])
  626.     when 12 # Script
  627.       @arg += sprintf("Script (%s)", @params[1])
  628.     when 13 # Vehicle
  629.       @arg += sprintf("Player is in %s", self.get_vehicle(@params[1]))
  630.     end
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # * Else
  634.   #--------------------------------------------------------------------------
  635.   def self.command_411
  636.     @cmd = "Else"
  637.     @arg = "Else"
  638.   end
  639.   #--------------------------------------------------------------------------
  640.   # * Loop
  641.   #--------------------------------------------------------------------------
  642.   def self.command_112
  643.     @cmd = "Loop"
  644.     @arg = "Loop"
  645.   end
  646.   #--------------------------------------------------------------------------
  647.   # * Repeat Above
  648.   #--------------------------------------------------------------------------
  649.   def self.command_413
  650.     @cmd = "Repeat Above"
  651.     @arg = "Repeat Above"
  652.   end
  653.   #--------------------------------------------------------------------------
  654.   # * Break Loop
  655.   #--------------------------------------------------------------------------
  656.   def self.command_113
  657.     @cmd = "Break Loop"
  658.     @arg = "Break Loop"
  659.   end
  660.   #--------------------------------------------------------------------------
  661.   # * Exit Event Processing
  662.   #--------------------------------------------------------------------------
  663.   def self.command_115
  664.     @cmd = "Exit Event Processing"
  665.     @arg = "Exit Event Processing"
  666.   end
  667.   #--------------------------------------------------------------------------
  668.   # * Common Event
  669.   #--------------------------------------------------------------------------
  670.   def self.command_117
  671.     @cmd = "Common Event"
  672.     @arg = sprintf("Common Event %03d (%s)", @params[0],
  673.       self.common_event_name(@params[0]))
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # * Label
  677.   #--------------------------------------------------------------------------
  678.   def self.command_118
  679.     @cmd = "Label"
  680.     @arg = @params[0]
  681.   end
  682.   #--------------------------------------------------------------------------
  683.   # * Jump to Label
  684.   #--------------------------------------------------------------------------
  685.   def self.command_119
  686.     @cmd = "Jump to Label"
  687.     @arg = @params[0]
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # * Control Switches
  691.   #--------------------------------------------------------------------------
  692.   def self.command_121
  693.     @cmd = "Control Switches"
  694.     @swvar_export = true
  695.     for s in @params[0]..@params[1]
  696.       @sv1 = get_switch(s)
  697.       @arg = sprintf("%s = %s", @sv1, (@params[2] == 0 ? "ON" : "OFF"))
  698.       self.export_command
  699.     end
  700.     @skip_export = true  
  701.   end
  702.   #--------------------------------------------------------------------------
  703.   # * Control Variables
  704.   #--------------------------------------------------------------------------
  705.   def self.command_122
  706.     @cmd = "Control Variables"
  707.     @swvar_export = true
  708.     case @params[3]
  709.     when 0 # Constant
  710.       value = @params[4].to_s
  711.     when 1 # Variable
  712.       @sv2 = get_variable(@params[4])
  713.       value = sprintf("%s", @sv2)
  714.     when 2 # Random
  715.       value = sprintf("Random %d - %d", @params[4], @params[5])
  716.     when 3 # Game Data
  717.       case @params[4]
  718.       when 0 # Items
  719.         value = sprintf("Item %d (%s) in inventory", @params[5], self.item_name(@params[5]))
  720.       when 1 # Weapons
  721.         value = sprintf("Weapon %d (%s) in inventory", @params[5], self.item_name(@params[5]))
  722.       when 2 # Armor
  723.         value = sprintf("Armor %d (%s) in inventory", @params[5], self.item_name(@params[5]))
  724.       when 3 # Actor
  725.         value = sprintf("Actor %d's (%s) %s", @params[5], self.actor_name(@params[5]),
  726.           ['level', 'EXP', 'HP', 'MP', 'MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF',
  727.           'AGI', 'LUK'][@params[6]])
  728.       when 4 # Enemy
  729.         value = sprintf("Enemy %d's %s", @params[5],
  730.           ['HP', 'MP', 'MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF',
  731.           'AGI', 'LUK'][@params[6]])
  732.       when 5 # Character
  733.         value = sprintf("%s's %s", self.get_character(@params[5]),
  734.           ['x coordinate', 'y coordinate', 'direction', 'screen x coordinate',
  735.           'screen y coordinate'][@params[6]])
  736.       when 6 # Party
  737.         value = sprintf("Party member %d's id", @params[5])
  738.       when 7 # Other
  739.         value = ['Map ID', 'Party Size', 'Gold', 'Steps', 'Play Time', 'Timer',
  740.           'Save Count', 'Battle Count'][@params[5]]
  741.       end
  742.     when 4 # Script
  743.       value = sprintf("Script: %s", @params[4])
  744.     end
  745.    
  746.     operator = get_operator(@params[2])
  747.  
  748.     (@params[0]..@params[1]).each do |i|
  749.       @sv1 = get_variable(i)
  750.       @arg = sprintf("%s %s %s", @sv1, operator, value)
  751.       self.export_command
  752.     end
  753.     @skip_export = true
  754.   end
  755.   #--------------------------------------------------------------------------
  756.   # * Control Self Switch
  757.   #--------------------------------------------------------------------------
  758.   def self.command_123
  759.     @cmd = "Control Self Switch"
  760.     @arg = sprintf("Self Switch %s = %s", @params[0], (@params[1] ? "true" : "false"))
  761.   end
  762.   #--------------------------------------------------------------------------
  763.   # * Control Timer
  764.   #--------------------------------------------------------------------------
  765.   def self.command_124
  766.     @cmd = "Control Timer"
  767.     if @params[0] == 0
  768.       @arg = sprintf("Start Timer at %d minutes, %d seconds", @params[1]/60, @params[1]%60)
  769.     else
  770.       @arg = "Stop Timer"
  771.     end
  772.   end
  773.   #--------------------------------------------------------------------------
  774.   # * Change Gold
  775.   #--------------------------------------------------------------------------
  776.   def self.command_125
  777.     @cmd = "Change Gold"
  778.     @arg = sprintf("%s", self.operate_value(@params[0], @params[2], @params[1] == 0))
  779.   end
  780.   #--------------------------------------------------------------------------
  781.   # * Change Items
  782.   #--------------------------------------------------------------------------
  783.   def self.command_126
  784.     @cmd = "Change Items"
  785.     @arg = sprintf("Item %d (%s) %s", @params[0], self.item_name(@params[0]),
  786.       self.operate_value(@params[1], @params[3], @params[2] == 0))
  787.   end
  788.   #--------------------------------------------------------------------------
  789.   # * Change Weapons
  790.   #--------------------------------------------------------------------------
  791.   def self.command_127
  792.     @cmd = "Change Weapons"
  793.     @arg = sprintf("Weapon %d (%s) %s", @params[0], self.weapon_name(@params[0]),
  794.       self.operate_value(@params[1], @params[3], @params[2] == 0))
  795.     @arg += " (include equipped)" if @params[1] == 0 && @params[4]
  796.   end
  797.   #--------------------------------------------------------------------------
  798.   # * Change Armor
  799.   #--------------------------------------------------------------------------
  800.   def self.command_128
  801.     @cmd = "Change Armor"
  802.     @arg = sprintf("Armor %d (%s) %s", @params[0], self.armor_name(@params[0]),
  803.       self.operate_value(@params[1], @params[3], @params[2] == 0))
  804.     @arg += " (include equipped)" if @params[1] == 0 && @params[4]
  805.   end
  806.   #--------------------------------------------------------------------------
  807.   # * Change Party Member
  808.   #--------------------------------------------------------------------------
  809.   def self.command_129
  810.     @cmd = "Change Party Member"
  811.     @arg = sprintf("%s %s %s", (@params[1] == 0 ? "+" : "-"), self.get_actor(0, @params[0]),
  812.       (@params[1] == 0 && @params[2] == 1 ? "(initialize)" : ""))
  813.   end
  814.   #--------------------------------------------------------------------------
  815.   # * Change Battle BGM
  816.   #--------------------------------------------------------------------------
  817.   def self.command_132
  818.     @cmd = "Change Battle BGM"
  819.     @arg = sprintf("BGM %s", self.get_audio(@params[0]))
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # * Change Battle End ME
  823.   #--------------------------------------------------------------------------
  824.   def self.command_133
  825.     @cmd = "Change Battle End ME"
  826.     @arg = sprintf("ME %s", self.get_audio(@params[0]))
  827.   end
  828.   #--------------------------------------------------------------------------
  829.   # * Change Save Access
  830.   #--------------------------------------------------------------------------
  831.   def self.command_134
  832.     @cmd = "Change Save Access"
  833.     @arg = @params[0] == 0 ? "disable" : "enable"
  834.   end
  835.   #--------------------------------------------------------------------------
  836.   # * Change Menu Access
  837.   #--------------------------------------------------------------------------
  838.   def self.command_135
  839.     @cmd = "Change Menu Access"
  840.     @arg = @params[0] == 0 ? "disable" : "enable"
  841.   end
  842.   #--------------------------------------------------------------------------
  843.   # * Change Encounter Disable
  844.   #--------------------------------------------------------------------------
  845.   def self.command_136
  846.     @cmd = "Change Encounter Disable"
  847.     @arg = @params[0] == 0 ? "disable" : "enable"
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # * Change Formation Access
  851.   #--------------------------------------------------------------------------
  852.   def self.command_137
  853.     @cmd = "Change Formation Access"
  854.     @arg = @params[0] == 0 ? "disable" : "enable"
  855.   end
  856.   #--------------------------------------------------------------------------
  857.   # * Change Window Color
  858.   #--------------------------------------------------------------------------
  859.   def self.command_138
  860.     @cmd = "Change Window Color"
  861.     @arg = @params[0].to_s
  862.   end
  863.   #--------------------------------------------------------------------------
  864.   # * Transfer Player
  865.   #--------------------------------------------------------------------------
  866.   def self.command_201
  867.     @cmd = "Transfer Player"
  868.     @arg = sprintf("Map %s", self.get_map_loc(@params[1], @params[2], @params[3],
  869.       @params[0] == 0))
  870.     @arg += ' Direction: ' + self.get_direction(@params[4])
  871.   end
  872.   #--------------------------------------------------------------------------
  873.   # * Set Vehicle Location
  874.   #--------------------------------------------------------------------------
  875.   def self.command_202
  876.     @cmd = "Set Vehicle Location"
  877.     @arg = sprintf("%s to Map %s", self.get_vehicle(@params[0]),
  878.       self.get_map_loc(@params[2], @params[3], @params[4], @params[1] == 0))
  879.   end
  880.   #--------------------------------------------------------------------------
  881.   # * Set Event Location
  882.   #--------------------------------------------------------------------------
  883.   def self.command_203
  884.     @cmd = "Set Event Location"
  885.     if [0,1].include?(@params[1])
  886.       @arg = sprintf("%s to %s", self.get_character(@params[0]), self.get_loc(@params[2],
  887.         @params[3], @params[1] == 0))
  888.     else
  889.       @arg = sprintf("swap %s and %s", self.get_character(@params[0]),
  890.         self.get_character(@params[2]))
  891.     end
  892.     @arg += ' direction ' + self.get_direction(@params[4]) if @params[4] > 0
  893.   end
  894.   #--------------------------------------------------------------------------
  895.   # * Scroll Map
  896.   #--------------------------------------------------------------------------
  897.   def self.command_204
  898.     @cmd = "Scroll Map"
  899.     @arg = sprintf('%s %d tiles, speed %d',
  900.       self.get_direction(@params[0]), @params[1],
  901.       @params[2])
  902.   end
  903.   #--------------------------------------------------------------------------
  904.   # * Set Move Route
  905.   #--------------------------------------------------------------------------
  906.   def self.command_205
  907.     @cmd = "Set Move Route"
  908.     @arg = self.get_character(@params[0])
  909.     mvr = @params[1]
  910.     extra = ''
  911.     extra = ' (repeat' if mvr.repeat
  912.     extra += (mvr.repeat ? ', ' : ' (') + 'skip if can\'t move' if mvr.skippable
  913.     extra += (mvr.repeat || mvr.skippable ? ', ' : ' (') + 'wait' if mvr.wait
  914.     extra += ')' if extra != ''
  915.     @arg += extra
  916.     self.export_command
  917.    
  918.     if EXPAND_MOVE_ROUTES
  919.       mvr.list.each do |cmd|
  920.         mp = cmd.parameters
  921.         @arg = '  '
  922.         @sv1 = nil
  923.         @swvar_export = false
  924.         case cmd.code
  925.         when 0
  926.           @arg += 'end'
  927.         when 1
  928.           @arg += 'move down'
  929.         when 2
  930.           @arg += 'move left'
  931.         when 3
  932.           @arg += 'move right'
  933.         when 4
  934.           @arg += 'move up'
  935.         when 5
  936.           @arg += 'move lower left'
  937.         when 6
  938.           @arg += 'move lower right'
  939.         when 7
  940.           @arg += 'move upper left'
  941.         when 8
  942.           @arg += 'move upper right'
  943.         when 9
  944.           @arg += 'move at random'
  945.         when 10
  946.           @arg += 'move toward player'
  947.         when 11
  948.           @arg += 'move away from player'
  949.         when 12
  950.           @arg += '1 step forward'
  951.         when 13
  952.           @arg += '1 step backward'
  953.         when 14
  954.           @arg += sprintf('jump %d, %d', mp[0], mp[1])
  955.         when 15
  956.           @arg += sprintf('wait %d frames', mp[0])
  957.         when 16
  958.           @arg += 'turn down'
  959.         when 17
  960.           @arg += 'turn left'
  961.         when 18
  962.           @arg += 'turn right'
  963.         when 19
  964.           @arg += 'turn up'
  965.         when 20
  966.           @arg += 'turn 90 degrees right'
  967.         when 21
  968.           @arg += 'turn 90 degrees left'
  969.         when 22
  970.           @arg += 'turn 180 degrees'
  971.         when 23
  972.           @arg += 'turn 90 degrees right or left'
  973.         when 24
  974.           @arg += 'turn at random'
  975.         when 25
  976.           @arg += 'turn toward player'
  977.         when 26
  978.           @arg += 'turn away from player'
  979.         when 27
  980.           @sv1 = get_switch(mp[0])
  981.           @arg += sprintf('%s ON', @sv1)
  982.           @swvar_export = true
  983.         when 28
  984.           @sv1 = get_switch(mp[0])
  985.           @arg += sprintf('%s OFF', @sv1)
  986.           @swvar_export = true
  987.         when 29
  988.           @arg += sprintf('change speed to %d', mp[0])
  989.         when 30
  990.           @arg += sprintf('change frequency to %d', mp[0])
  991.         when 31
  992.           @arg += 'walking animation on'
  993.         when 32
  994.           @arg += 'walking animation off'
  995.         when 33
  996.           @arg += 'stepping animation on'
  997.         when 34
  998.           @arg += 'stepping animation off'
  999.         when 35
  1000.           @arg += 'direction fix on'
  1001.         when 36
  1002.           @arg += 'direction fix off'
  1003.         when 37
  1004.           @arg += 'through on'
  1005.         when 38
  1006.           @arg += 'through off'
  1007.         when 39
  1008.           @arg += 'transparent on'
  1009.         when 40
  1010.           @arg += 'transparent off'
  1011.         when 41
  1012.           @arg += sprintf('change graphic to %s index %s', mp[0], mp[1].to_s)
  1013.         when 42
  1014.           @arg += sprintf('change opacity to %d', mp[0])
  1015.         when 43
  1016.           @arg += sprintf('change blending to %s', ['normal', 'add', 'sub'][mp[0]])
  1017.         when 44
  1018.           @arg += sprintf('play SE %s;  Volume %d  Pitch %d', mp[0].name, mp[0].volume, mp[0].pitch)
  1019.         when 45
  1020.           @arg += sprintf('script: %s', mp[0])
  1021.         end
  1022.         self.export_command
  1023.       end
  1024.     end
  1025.     @skip_export = true
  1026.   end
  1027.   #--------------------------------------------------------------------------
  1028.   # * Getting On and Off Vehicles
  1029.   #--------------------------------------------------------------------------
  1030.   def self.command_206
  1031.     @cmd = "Getting On and Off Vehicles"
  1032.     @arg = "Get on/off Vehicle"
  1033.   end
  1034.   #--------------------------------------------------------------------------
  1035.   # * Change Transparency
  1036.   #--------------------------------------------------------------------------
  1037.   def self.command_211
  1038.     @cmd = "Change Transparency"
  1039.     @arg = sprintf('Transparency %s', (@params[0] == 0 ? 'ON' : 'OFF'))
  1040.   end
  1041.   #--------------------------------------------------------------------------
  1042.   # * Show Animation
  1043.   #--------------------------------------------------------------------------
  1044.   def self.command_212
  1045.     @cmd = "Show Animation"
  1046.     @arg = sprintf('%d (%s) on %s', @params[1], self.animation_name(@params[1]),
  1047.       self.get_character(@params[0]))
  1048.     @arg += ' (wait)' if @params[2]
  1049.   end
  1050.   #--------------------------------------------------------------------------
  1051.   # * Show Balloon Icon
  1052.   #--------------------------------------------------------------------------
  1053.   def self.command_213
  1054.     @cmd = "Show Balloon Icon"
  1055.     @arg = sprintf('%d (%s) on %s', @params[1],
  1056.       ['Exclamation', 'Question', 'Music Note', 'Heart', 'Anger', 'Sweat',
  1057.       'Cobweb', 'Silence', 'Light Bulb', 'Zzz'][@params[1]-1],
  1058.       self.get_character(@params[0]))
  1059.     @arg += ' (wait)' if @params[2]
  1060.   end
  1061.   #--------------------------------------------------------------------------
  1062.   # * Temporarily Erase Event
  1063.   #--------------------------------------------------------------------------
  1064.   def self.command_214
  1065.     @cmd = "Temporarily Erase Event"
  1066.     @arg = 'Erase Event'
  1067.   end
  1068.   #--------------------------------------------------------------------------
  1069.   # * Change Player Followers
  1070.   #--------------------------------------------------------------------------
  1071.   def self.command_216
  1072.     @cmd = "Change Player Followers"
  1073.     @arg = @params[0] == 0 ? "make visible" : "make invisible"
  1074.   end
  1075.   #--------------------------------------------------------------------------
  1076.   # * Gather Followers
  1077.   #--------------------------------------------------------------------------
  1078.   def self.command_217
  1079.     @cmd = "Gather Followers"
  1080.     @arg = 'Gather Followers'
  1081.   end
  1082.   #--------------------------------------------------------------------------
  1083.   # * Fadeout Screen
  1084.   #--------------------------------------------------------------------------
  1085.   def self.command_221
  1086.     @cmd = "Fadeout Screen"
  1087.     @arg = '30 frames'
  1088.   end
  1089.   #--------------------------------------------------------------------------
  1090.   # * Fadein Screen
  1091.   #--------------------------------------------------------------------------
  1092.   def self.command_222
  1093.     @cmd = "Fadein Screen"
  1094.     @arg = '30 frames'
  1095.   end
  1096.   #--------------------------------------------------------------------------
  1097.   # * Tint Screen
  1098.   #--------------------------------------------------------------------------
  1099.   def self.command_223
  1100.     @cmd = "Tint Screen"
  1101.     @arg = sprintf('%s in %d frames', @params[0].to_s, @params[1])
  1102.     @arg += ' (wait)' if @params[2]
  1103.   end
  1104.   #--------------------------------------------------------------------------
  1105.   # * Screen Flash
  1106.   #--------------------------------------------------------------------------
  1107.   def self.command_224
  1108.     @cmd = "Screen Flash"
  1109.     @arg = sprintf('%s for %d frames', @params[0].to_s, @params[1])
  1110.     @arg += ' (wait)' if @params[2]
  1111.   end
  1112.   #--------------------------------------------------------------------------
  1113.   # * Screen Shake
  1114.   #--------------------------------------------------------------------------
  1115.   def self.command_225
  1116.     @cmd = "Screen Shake"
  1117.     @arg = sprintf('Power %d  Speed %d  for %d frames', @params[0], @params[1],
  1118.       @params[2])
  1119.     @arg += ' (wait)' if @params[3]
  1120.   end
  1121.   #--------------------------------------------------------------------------
  1122.   # * Wait
  1123.   #--------------------------------------------------------------------------
  1124.   def self.command_230
  1125.     @cmd = "Wait"
  1126.     @arg = sprintf("%d frames", @params[0])
  1127.   end
  1128.   #--------------------------------------------------------------------------
  1129.   # * Show Picture
  1130.   #--------------------------------------------------------------------------
  1131.   def self.command_231
  1132.     @cmd = "Show Picture"
  1133.     @arg = sprintf("%d (%s) origin %s at %s, opacity %d", @params[0], @params[1],
  1134.      (@params[2] == 0 ? "top left" : "center"), self.get_loc(@params[4], @params[5],
  1135.      @params[3] == 0), @params[8])
  1136.   end
  1137.   #--------------------------------------------------------------------------
  1138.   # * Move Picture
  1139.   #--------------------------------------------------------------------------
  1140.   def self.command_232
  1141.     @cmd = "Move Picture"
  1142.     @arg = sprintf("%d origin %s to %s, opacity %d, duration %d", @params[0],
  1143.       (@params[2] == 0 ? "top left" : "center"), self.get_loc(@params[4], @params[5],
  1144.       @params[3] == 0), @params[8], @params[10])
  1145.     @arg += ' (wait)' if @params[11]
  1146.   end
  1147.   #--------------------------------------------------------------------------
  1148.   # * Rotate Picture
  1149.   #--------------------------------------------------------------------------
  1150.   def self.command_233
  1151.     @cmd = "Rotate Picture"
  1152.     @arg = sprintf('%d at speed %d', @params[0], @params[1])
  1153.   end
  1154.   #--------------------------------------------------------------------------
  1155.   # * Tint Picture
  1156.   #--------------------------------------------------------------------------
  1157.   def self.command_234
  1158.     @cmd = "Tint Picture"
  1159.     @arg = sprintf('%d to tone %s in %d frames', @params[0], @params[1].to_s, @params[2])
  1160.     @arg += ' (wait)' if @params[3]
  1161.   end
  1162.   #--------------------------------------------------------------------------
  1163.   # * Erase Picture
  1164.   #--------------------------------------------------------------------------
  1165.   def self.command_235
  1166.     @cmd = "Erase Picture"
  1167.     @arg = @params[0].to_s
  1168.   end
  1169.   #--------------------------------------------------------------------------
  1170.   # * Set Weather
  1171.   #--------------------------------------------------------------------------
  1172.   def self.command_236
  1173.     @cmd = "Set Weather"
  1174.     @arg = sprintf('%s  Power %d  Time %d frames', @params[0],
  1175.       @params[1], @params[2])
  1176.     @arg += ' (wait)' if @params[3]
  1177.   end
  1178.   #--------------------------------------------------------------------------
  1179.   # * Play BGM
  1180.   #--------------------------------------------------------------------------
  1181.   def self.command_241
  1182.     @cmd = "Play BGM"
  1183.     @arg = self.get_audio(@params[0])
  1184.   end
  1185.   #--------------------------------------------------------------------------
  1186.   # * Fadeout BGM
  1187.   #--------------------------------------------------------------------------
  1188.   def self.command_242
  1189.     @cmd = "Fadeout BGM"
  1190.     @arg = sprintf('%d seconds', @params[0])
  1191.   end
  1192.   #--------------------------------------------------------------------------
  1193.   # * Save BGM
  1194.   #--------------------------------------------------------------------------
  1195.   def self.command_243
  1196.     @cmd = "Save BGM"
  1197.     @arg = 'Save BGM'
  1198.   end
  1199.   #--------------------------------------------------------------------------
  1200.   # * Resume BGM
  1201.   #--------------------------------------------------------------------------
  1202.   def self.command_244
  1203.     @cmd = "Resume BGM"
  1204.     @arg = 'Resume BGM'
  1205.   end
  1206.   #--------------------------------------------------------------------------
  1207.   # * Play BGS
  1208.   #--------------------------------------------------------------------------
  1209.   def self.command_245
  1210.     @cmd = "Play BGS"
  1211.     @arg = self.get_audio(@params[0])
  1212.   end
  1213.   #--------------------------------------------------------------------------
  1214.   # * Fadeout BGS
  1215.   #--------------------------------------------------------------------------
  1216.   def self.command_246
  1217.     @cmd = "Fadeout BGS"
  1218.     @arg = sprintf('%d seconds', @params[0])
  1219.   end
  1220.   #--------------------------------------------------------------------------
  1221.   # * Play ME
  1222.   #--------------------------------------------------------------------------
  1223.   def self.command_249
  1224.     @cmd = "Play ME"
  1225.     @arg = self.get_audio(@params[0])
  1226.   end
  1227.   #--------------------------------------------------------------------------
  1228.   # * Play SE
  1229.   #--------------------------------------------------------------------------
  1230.   def self.command_250
  1231.     @cmd = "Play SE"
  1232.     @arg = self.get_audio(@params[0])
  1233.   end
  1234.   #--------------------------------------------------------------------------
  1235.   # * Stop SE
  1236.   #--------------------------------------------------------------------------
  1237.   def self.command_251
  1238.     @cmd = "Stop SE"
  1239.     @arg = 'Stop SE'
  1240.   end
  1241.   #--------------------------------------------------------------------------
  1242.   # * Play Movie
  1243.   #--------------------------------------------------------------------------
  1244.   def self.command_261
  1245.     @cmd = "Play Movie"
  1246.     @arg = @params[0]
  1247.   end
  1248.   #--------------------------------------------------------------------------
  1249.   # * Change Map Name Display
  1250.   #--------------------------------------------------------------------------
  1251.   def self.command_281
  1252.     @cmd = "Change Map Name Display"
  1253.     @arg = @params[0] == 0 ? "visible" : "hidden"
  1254.   end
  1255.   #--------------------------------------------------------------------------
  1256.   # * Change Tileset
  1257.   #--------------------------------------------------------------------------
  1258.   def self.command_282
  1259.     @cmd = "Change Tileset"
  1260.     @arg = sprintf('%d (%s)', @params[0], self.tileset_name(@params[0]))
  1261.   end
  1262.   #--------------------------------------------------------------------------
  1263.   # * Change Battle Background
  1264.   #--------------------------------------------------------------------------
  1265.   def self.command_283
  1266.     @cmd = "Change Battle Background"
  1267.     @arg = sprintf('Ground: %s  Walls: %s', @params[0], @params[1])
  1268.   end
  1269.   #--------------------------------------------------------------------------
  1270.   # * Change Parallax Background
  1271.   #--------------------------------------------------------------------------
  1272.   def self.command_284
  1273.     @cmd = "Change Parallax Background"
  1274.     @arg = @params[0]
  1275.     @arg += sprintf(' (loop horizontal%s)',
  1276.       (@params[3] > 0 ? " [scroll " + @params[3].to_s + "]" : "")) if @params[1]
  1277.     @arg += sprintf(' (loop vertical%s)',
  1278.       (@params[4] > 0 ? " [scroll " + @params[4].to_s + "]" : "")) if @params[2]
  1279.   end
  1280.   #--------------------------------------------------------------------------
  1281.   # * Get Location Info
  1282.   #--------------------------------------------------------------------------
  1283.   def self.command_285
  1284.     @cmd = "Get Location Info"
  1285.     @sv1 = get_variable(@params[0])
  1286.     @arg = sprintf('Tile %s, %s into %s', self.get_loc(@params[3], @params[4], @params[2] == 0),
  1287.       ['Terrain Tag', 'Event ID', 'Tile ID (Layer 1)', 'Tile ID (Layer 2)',
  1288.       'Tile ID (Layer 3)', 'Region ID'][@params[1]], @sv1)
  1289.     @swvar_export = true
  1290.   end
  1291.   #--------------------------------------------------------------------------
  1292.   # * Battle Processing
  1293.   #--------------------------------------------------------------------------
  1294.   def self.command_301
  1295.     @cmd = "Battle Processing"
  1296.     @sv1 = get_variable(@params[1]) if @params[0] == 1
  1297.     @arg = @params[0] == 0 ? sprintf('Troop %d (%s)', @params[1],
  1298.       self.troop_name(@params[1])) : @params[0] == 1 ? sprintf('Troop from %s',
  1299.       @sv1) : 'map-designated troop'
  1300.     @swvar_export = @params[0] == 1
  1301.   end
  1302.   #--------------------------------------------------------------------------
  1303.   # * If Win
  1304.   #--------------------------------------------------------------------------
  1305.   def self.command_601
  1306.     @cmd = "If Win"
  1307.     @arg = 'if win'
  1308.   end
  1309.   #--------------------------------------------------------------------------
  1310.   # * If Escape
  1311.   #--------------------------------------------------------------------------
  1312.   def self.command_602
  1313.     @cmd = "If Escape"
  1314.     @arg = 'if escape'
  1315.   end
  1316.   #--------------------------------------------------------------------------
  1317.   # * If Lose
  1318.   #--------------------------------------------------------------------------
  1319.   def self.command_603
  1320.     @cmd = "If Lose"
  1321.     @arg = 'if lose'
  1322.   end
  1323.   #--------------------------------------------------------------------------
  1324.   # * Shop Processing
  1325.   #--------------------------------------------------------------------------
  1326.   def self.command_302
  1327.     @cmd = "Shop Processing"
  1328.     if @params[4]
  1329.       @arg = "(purchase only)"
  1330.       self.export_command
  1331.     end
  1332.     goods = @params
  1333.     item = goods[0] == 0 ? $data_items[goods[1]] : goods[0] == 1 ? $data_weapons[goods[1]] :
  1334.       $data_armors[goods[1]]
  1335.     if item
  1336.       @arg = sprintf('%s %d (%s)', ['Item', 'Weapon', 'Armor'][goods[0]], item.id, item.name)
  1337.       @arg += goods[2] == 0 ? sprintf(' : %d', item.price) : sprintf(' : %d (price override)',
  1338.         goods[3])
  1339.     else
  1340.       @arg = sprintf('%s %d (%s)', ['Item', 'Weapon', 'Armor'][goods[0]], goods[1], 'undefined')
  1341.     end
  1342.     self.export_command
  1343.    
  1344.     while next_event_code == 605
  1345.       @cmdline += 1
  1346.       goods = @list[@cmdline].parameters
  1347.       item = goods[0] == 0 ? $data_items[goods[1]] : goods[0] == 1 ? $data_weapons[goods[1]] :
  1348.         $data_armors[goods[1]]
  1349.       if item
  1350.         @arg = sprintf('%s %d (%s)', ['Item', 'Weapon', 'Armor'][goods[0]], item.id, item.name)
  1351.         @arg += goods[2] == 0 ? sprintf(' : %d', item.price) : sprintf(' : %d (price override)',
  1352.           goods[3])
  1353.       else
  1354.         @arg = sprintf('%s %d (%s)', ['Item', 'Weapon', 'Armor'][goods[0]], goods[1], 'undefined')
  1355.       end
  1356.       self.export_command
  1357.     end
  1358.     @skip_export = true
  1359.   end
  1360.   #--------------------------------------------------------------------------
  1361.   # * Name Input Processing
  1362.   #--------------------------------------------------------------------------
  1363.   def self.command_303
  1364.     @cmd = "Name Input Processing"
  1365.     @arg = sprintf('Actor %d (%s), %d characters', @params[0], self.actor_name(@params[0]),
  1366.       @params[1])
  1367.   end
  1368.   #--------------------------------------------------------------------------
  1369.   # * Change HP
  1370.   #--------------------------------------------------------------------------
  1371.   def self.command_311
  1372.     @cmd = "Change HP"
  1373.     @arg = sprintf('%s %s',
  1374.       self.get_actor(@params[0], @params[1]),
  1375.       self.operate_value(@params[2], @params[4], @params[3] == 0))
  1376.     @arg += ' (allow knockout)' if @params[5]
  1377.   end
  1378.   #--------------------------------------------------------------------------
  1379.   # * Change MP
  1380.   #--------------------------------------------------------------------------
  1381.   def self.command_312
  1382.     @cmd = "Change MP"
  1383.     @arg = sprintf('%s %s', self.get_actor(@params[0], @params[1]),
  1384.       self.operate_value(@params[2], @params[4], @params[3] == 0))
  1385.   end
  1386.   #--------------------------------------------------------------------------
  1387.   # * Change State
  1388.   #--------------------------------------------------------------------------
  1389.   def self.command_313
  1390.     @cmd = "Change State"
  1391.     @arg = sprintf('%s %s %d (%s)', self.get_actor(@params[0], @params[1]),
  1392.       (@params[2] == 0 ? '+' : '-'), @params[3], self.state_name(@params[3]))
  1393.   end
  1394.   #--------------------------------------------------------------------------
  1395.   # * Recover All
  1396.   #--------------------------------------------------------------------------
  1397.   def self.command_314
  1398.     @cmd = "Recover All"
  1399.     @arg = self.get_actor(@params[0], @params[1])
  1400.   end
  1401.   #--------------------------------------------------------------------------
  1402.   # * Change EXP
  1403.   #--------------------------------------------------------------------------
  1404.   def self.command_315
  1405.     @cmd = "Change EXP"
  1406.     @arg = sprintf('%s %s', self.get_actor(@params[0], @params[1]),
  1407.       self.operate_value(@params[2], @params[4], @params[3] == 0))
  1408.     @arg += ' (show level up message)' if @params[5]
  1409.   end
  1410.   #--------------------------------------------------------------------------
  1411.   # * Change Level
  1412.   #--------------------------------------------------------------------------
  1413.   def self.command_316
  1414.     @cmd = "Change Level"
  1415.     @arg = sprintf('%s %s', self.get_actor(@params[0], @params[1]),
  1416.       self.operate_value(@params[2], @params[4], @params[3] == 0))
  1417.     @arg += ' (show level up message)' if @params[5]
  1418.   end
  1419.   #--------------------------------------------------------------------------
  1420.   # * Change Parameters
  1421.   #--------------------------------------------------------------------------
  1422.   def self.command_317
  1423.     @cmd = "Change Parameters"
  1424.     @arg = sprintf('%s %s %s', self.get_actor(@params[0], @params[1]),
  1425.       ['MHP', 'MMP', 'ATK', 'DEF', 'MAT', 'MDF', 'AGI', 'LUK'][@params[2]],
  1426.       self.operate_value(@params[3], @params[5], @params[4] == 0))
  1427.   end
  1428.   #--------------------------------------------------------------------------
  1429.   # * Change Skills
  1430.   #--------------------------------------------------------------------------
  1431.   def self.command_318
  1432.     @cmd = "Change Skills"
  1433.     @arg = sprintf('%s %s %d (%s)', self.get_actor(@params[0], @params[1]),
  1434.       (@params[2] == 0 ? "learn" : "forget"), @params[3],
  1435.       self.skill_name(@params[3]))
  1436.   end
  1437.   #--------------------------------------------------------------------------
  1438.   # * Change Equipment
  1439.   #--------------------------------------------------------------------------
  1440.   def self.command_319
  1441.     @cmd = "Change Equipment"
  1442.     @arg += sprintf('%s %s %d %s',
  1443.       self.get_actor(0, @params[0]), $data_system.terms.etypes[@params[1]],
  1444.       @params[2], (@params[2] == 0 ? "None" : (@params[1] == 0 ?
  1445.       self.weapon_name(@params[2]) : self.armor_name(@params[2]))))
  1446.   end
  1447.   #--------------------------------------------------------------------------
  1448.   # * Change Name
  1449.   #--------------------------------------------------------------------------
  1450.   def self.command_320
  1451.     @text_export = true
  1452.     @cmd = "Change Name"
  1453.     @arg = sprintf('Actor %d (%s) to %s', @params[0], self.actor_name(@params[0]),
  1454.       @params[1])
  1455.   end
  1456.   #--------------------------------------------------------------------------
  1457.   # * Change Class
  1458.   #--------------------------------------------------------------------------
  1459.   def self.command_321
  1460.     @cmd = "Change Class"
  1461.     @arg = sprintf('Actor %d (%s) to %d (%s)', @params[0],
  1462.       $data_actors[@params[0]].name, @params[1], self.class_name(@params[1]))
  1463.   end
  1464.   #--------------------------------------------------------------------------
  1465.   # * Change Actor Graphic
  1466.   #--------------------------------------------------------------------------
  1467.   def self.command_322
  1468.     @cmd = "Change Actor Graphic"
  1469.     @arg = sprintf('Actor %d (%s)  Character %s (%d)  Face %s (%d)',
  1470.       @params[0], self.actor_name(@params[0]), @params[1], @params[2],
  1471.       @params[3], @params[4])
  1472.   end
  1473.   #--------------------------------------------------------------------------
  1474.   # * Change Vehicle Graphic
  1475.   #--------------------------------------------------------------------------
  1476.   def self.command_323
  1477.     @cmd = "Change Vehicle Graphic"
  1478.     @arg = sprintf('%s  Character %s (%d)',
  1479.       self.get_vehicle(@params[0]), @params[1], @params[2])
  1480.   end
  1481.   #--------------------------------------------------------------------------
  1482.   # * Change Nickname
  1483.   #--------------------------------------------------------------------------
  1484.   def self.command_324
  1485.     @text_export = true
  1486.     @cmd = "Change Nickname"
  1487.     @arg = sprintf('Actor %d (%s) to %s', @params[0], $data_actors[@params[0]].name,
  1488.       @params[1])
  1489.   end
  1490.   #--------------------------------------------------------------------------
  1491.   # * Change Enemy HP
  1492.   #--------------------------------------------------------------------------
  1493.   def self.command_331
  1494.     @cmd = "Change Enemy HP"
  1495.     @arg = sprintf('%s %s', self.get_enemy(@params[0]),
  1496.       self.operate_value(@params[1], @params[3], @params[2] == 0))
  1497.     @arg += ' (allow knockout)' if @params[4]
  1498.   end
  1499.   #--------------------------------------------------------------------------
  1500.   # * Change Enemy MP
  1501.   #--------------------------------------------------------------------------
  1502.   def self.command_332
  1503.     @cmd = "Change Enemy MP"
  1504.     @arg = sprintf('%s %s', self.get_enemy(@params[0]),
  1505.       self.operate_value(@params[1], @params[3], @params[2] == 0))
  1506.   end
  1507.   #--------------------------------------------------------------------------
  1508.   # * Change Enemy State
  1509.   #--------------------------------------------------------------------------
  1510.   def self.command_333
  1511.     @cmd = "Change Enemy State"
  1512.     @arg = sprintf('%s %s %d (%s)', self.get_enemy(@params[0]),
  1513.       (@params[1] == 0 ? '+' : '-'), @params[2], self.state_name(@params[2]))
  1514.   end
  1515.   #--------------------------------------------------------------------------
  1516.   # * Enemy Recover All
  1517.   #--------------------------------------------------------------------------
  1518.   def self.command_334
  1519.     @cmd = "Enemy Recover All"
  1520.     @arg = self.get_enemy(@params[0])
  1521.   end
  1522.   #--------------------------------------------------------------------------
  1523.   # * Enemy Appear
  1524.   #--------------------------------------------------------------------------
  1525.   def self.command_335
  1526.     @cmd = "Enemy Appear"
  1527.     @arg = self.get_enemy(@params[0])
  1528.   end
  1529.   #--------------------------------------------------------------------------
  1530.   # * Enemy Transform
  1531.   #--------------------------------------------------------------------------
  1532.   def self.command_336
  1533.     @cmd = "Enemy Transform"
  1534.     @arg = sprintf('%s to %d (%s)', self.get_enemy(@params[0]), @params[1],
  1535.       self.enemy_name(@params[1]))
  1536.   end
  1537.   #--------------------------------------------------------------------------
  1538.   # * Show Battle Animation
  1539.   #--------------------------------------------------------------------------
  1540.   def self.command_337
  1541.     @cmd = "Show Battle Animation"
  1542.     @arg = sprintf('%d (%s) on %s', @params[1], self.animation_name(@params[1]),
  1543.       self.get_enemy(@params[0]))
  1544.   end
  1545.   #--------------------------------------------------------------------------
  1546.   # * Force Action
  1547.   #--------------------------------------------------------------------------
  1548.   def self.command_339
  1549.     @cmd = "Force Action"
  1550.     @arg = sprintf('%s skill %d (%s) on target %s',
  1551.       (@params[0] == 0 ? self.get_enemy(@params[1]) : self.get_actor(0, @params[1])),
  1552.       @params[2], self.skill_name(@params[2]), (@params[3] == -2 ? 'last target' :
  1553.       (@params[3] == -1 ? 'random target' : @params[3].to_s)))
  1554.   end
  1555.   #--------------------------------------------------------------------------
  1556.   # * Abort Battle
  1557.   #--------------------------------------------------------------------------
  1558.   def self.command_340
  1559.     @cmd = "Abort Battle"
  1560.     @arg = 'Abort'
  1561.   end
  1562.   #--------------------------------------------------------------------------
  1563.   # * Open Menu Screen
  1564.   #--------------------------------------------------------------------------
  1565.   def self.command_351
  1566.     @cmd = "Open Menu Screen"
  1567.     @arg = 'open menu screen'
  1568.   end
  1569.   #--------------------------------------------------------------------------
  1570.   # * Open Save Screen
  1571.   #--------------------------------------------------------------------------
  1572.   def self.command_352
  1573.     @cmd = "Open Save Screen"
  1574.     @arg = 'open save screen'
  1575.   end
  1576.   #--------------------------------------------------------------------------
  1577.   # * Game Over
  1578.   #--------------------------------------------------------------------------
  1579.   def self.command_353
  1580.     @cmd = "Game Over"
  1581.     @arg = 'game over'
  1582.   end
  1583.   #--------------------------------------------------------------------------
  1584.   # * Return to Title Screen
  1585.   #--------------------------------------------------------------------------
  1586.   def self.command_354
  1587.     @cmd = "Return to Title Screen"
  1588.     @arg = 'return to title screen'
  1589.   end
  1590.   #--------------------------------------------------------------------------
  1591.   # * Script
  1592.   #--------------------------------------------------------------------------
  1593.   def self.command_355
  1594.     @cmd = "Script"
  1595.     @arg = @params[0]
  1596.   end
  1597.   def self.command_655
  1598.     @cmd = "Script"
  1599.     @arg = @params[0]
  1600.   end
  1601.  
  1602.   def self.export_condition
  1603.     while @arg.gsub!(/  /) { " " } != nil
  1604.     end
  1605.    
  1606.     @expline += 1
  1607.    
  1608.     text = sprintf("%d%s%d%s%s%s%s%s%s%s%d%s%s%s%s%s%s%s",
  1609.       @expline, @cb, @event_seq, @cb, @event_type, @cb, @event_source, @cb,
  1610.       @event_tab, @cb, @line, @cb, 'Condition', @cb, @cmd, @cb, @arg, @lb)
  1611.      
  1612.     @file_all.print(text)
  1613.    
  1614.     if @swvar_export
  1615.       text = sprintf("%d%s%d%s%s%s%s%s%s%s%d%s%s%s%s%s%s%s%s%s",
  1616.         @expline, @cb, @event_seq, @cb, @event_type, @cb, @event_source, @cb,
  1617.         @event_tab, @cb, @line, @cb, 'Condition', @cb, @cmd, @cb, @sv1, @cb, @arg, @lb)
  1618.       @file_swvar.print(text)
  1619.       if @sv2
  1620.         text = sprintf("%d%s%d%s%s%s%s%s%s%s%d%s%s%s%s%s%s%s%s%s",
  1621.           @expline, @cb, @event_seq, @cb, @event_type, @cb, @event_source, @cb,
  1622.           @event_tab, @cb, @line, @cb, 'Condition', @cb, @cmd, @cb, @sv2, @cb, @arg, @lb)
  1623.         @file_swvar.print(text)
  1624.       end
  1625.       if @sv3
  1626.         text = sprintf("%d%s%d%s%s%s%s%s%s%s%d%s%s%s%s%s%s%s%s%s",
  1627.           @expline, @cb, @event_seq, @cb, @event_type, @cb, @event_source, @cb,
  1628.           @event_tab, @cb, @line, @cb, 'Condition', @cb, @cmd, @cb, @sv3, @cb, @arg, @lb)
  1629.         @file_swvar.print(text)
  1630.       end
  1631.     end
  1632.   end
  1633.    
  1634.    
  1635.  
  1636.   def self.export_command
  1637.     # get rid of any double spaces
  1638.     while @arg.gsub!(/  /) { " " } != nil
  1639.     end
  1640.    
  1641.     @expline += 1
  1642.    
  1643.     indchar = INDENT ? @ind * @indent : ""
  1644.    
  1645.     text = sprintf("%d%s%d%s%s%s%s%s%s%s%d%s%d%s%s%s%s%s%s",
  1646.       @expline, @cb, @event_seq, @cb, @event_type, @cb, @event_source, @cb,
  1647.       @event_tab, @cb, @line, @cb, @command.code, @cb, @cmd, @cb, indchar, @arg, @lb)
  1648.      
  1649.     @file_all.print(text)
  1650.     @file_text.print(text) if @text_export
  1651.     if @swvar_export
  1652.       text = sprintf("%d%s%d%s%s%s%s%s%s%s%d%s%d%s%s%s%s%s%s%s",
  1653.         @expline, @cb, @event_seq, @cb, @event_type, @cb, @event_source, @cb,
  1654.         @event_tab, @cb, @line, @cb, @command.code, @cb, @cmd, @cb, @sv1, @cb, @arg, @lb)
  1655.       @file_swvar.print(text)
  1656.       if @sv2
  1657.         text = sprintf("%d%s%d%s%s%s%s%s%s%s%d%s%d%s%s%s%s%s%s%s",
  1658.           @expline, @cb, @event_seq, @cb, @event_type, @cb, @event_source, @cb,
  1659.           @event_tab, @cb, @line, @cb, @command.code, @cb, @cmd, @cb, @sv2, @cb, @arg, @lb)
  1660.         @file_swvar.print(text)
  1661.       end
  1662.       if @sv3
  1663.         text = sprintf("%d%s%d%s%s%s%s%s%s%s%d%s%d%s%s%s%s%s%s%s",
  1664.           @expline, @cb, @event_seq, @cb, @event_type, @cb, @event_source, @cb,
  1665.           @event_tab, @cb, @line, @cb, @command.code, @cb, @cmd, @cb, @sv3, @cb, @arg, @lb)
  1666.         @file_swvar.print(text)
  1667.       end
  1668.     end
  1669.   end
  1670. end
  1671.    
  1672. EVExport.export
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement