じ☆ve冰风 发表于 2026-7-12 16:04:36

Event Exportexter for RPGXP (rv20220318)

Event Exportexter for RPGXP
(rv20220318)

by KotatsuAkira / AkiraKotatsuhime​


Introduction
I was in need of a litte practice in Ruby again and somebody else was in need of a feature to export events into a textfile, so I gave it a try. This script, when executed, exports all events on all of your maps, all CEs in the database and all troop-pages into one single TXT file in an easily readable format.

I mostly tested this little developer tool with the samplegame KNight-Blade, the mass of the result, which is saved to "EventExport.txt" in the game's folder, is around 2MB, so better expect a very big file to pop up. Warning: Opening it with Windows' default Notepad may take some (long) time.


Features
On what this script does, see the introduction above, that described feature is the only purpose it has. The text-format of eventcode-lines MOSTLY resemble how they look in the english RPGXP itself, but there are some cases where I altered or extended how information about a command is written down. And since "@>" is ugly, "<>" is being used as prefix instead.


Screenshots
There isn't much to show off, but here you go, that's how it looks while processing data. The black background is transparent, so you'll see other stuff behind it if running midgame.

Spoiler







How to Use
USE AT YOUR OWN RISK. Put the script anywhere above "Main", I'd suggest it to be placed directly above. To execute, you need to put the following line of code somewhere (e.g. into "Main" or as script-call in an event).

                Ruby:        
Event_Exportexter.run


Afterwards, it will ask you to confirm start of data-processing by pressing game-buttons L+R. You can also cancel here by pressing B instead. It will start to lookup all maps, then the common-events and at last the troop-pages, progress being displayed in three green bars at game-screen's bottom meanwhile (see screenshot above).


FAQ
Q: Who should I credit?
A: Me, of course. But actually, it'd be nice if you remove the script from your project before distribution. You can always keep backups and redistribute this code for free standalone as long as the enclosed copyright notice stays the way it is.
Q: Is this compatible with (insert script here)?
A: I don't know. But as long as your game is made with RPGXP, uses the default data-structures (database and map-files) and there is no other module named "Event_Exportexter" in it, it should be fine.
Q: Will there be a version for (insert RPG Maker here)?
A: You better don't expect that to happen.
Q: Why are there "Unknown Command" entries in my textfile?
A: That's interesting. If your event-data is not manipulated or corrupted, please show me where they occur.
Q: An error occured while processing a command, why?
A: Ouh, I may have overseen some mistakes in the syntax or something. Please tell me which commands are affected.
Q: My computer exploded!
A: That's not even a question. And did I already mention you are using this at your own risk?


Demo
There'd be no sense in making a demonstration project for this if you ask me.


Script
                Ruby:        
#==============================================================================
# ** Event Exportexter for RPGXP (rv20220318)
#------------------------------------------------------------------------------
#Export event code content from all maps, CEs and troops to a textfile.
#------------------------------------------------------------------------------
#© 2022 KotatsuAkira
#This is a developer tool for temporary usage only.
#Do not include this with public demo or game releases.
#Redistribute only with this copyright notice intact.
#==============================================================================

module Event_Exportexter
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
TEXTOPTIONS_POS = ["Top", "Middle", "Bottom"]
TEXTOPTIONS_WINDOW = ["Show", "Hide"]
SWITCH_STATES = ["ON", "OFF"]
COMPARERS = ["==", ">=", "<=", ">", "<", "!="]
AMOUNT_OP = ["+", "-"]
MORE_LESS = ["or more", "or less"]
ACTOR_CONDITION = ["in the party", "applied", "learned", "equipped", "equipped", "inflicted"]
ENEMY_CONDITION = ["appeared", "inflicted"]
FACING_DIR = ["Down", "Left", "Right", "Up"]
GAME_BUTTONS = ["Down", "Left", "Right", "Up", "A", "B", "C", "X", "Y", "Z", "L", "R"]
OPERATORS = ["=", "+", "-", "*", "/", "%"]
VARIABLE_OP_ACTOR = ["Level", "EXP", "HP", "SP", "MaxHP", "MaxSP", "STR", "DEX", "AGI", "INT", "ATK", "PDEF", "MDEF", "EVA"]
VARIABLE_OP_ENEMY = ["HP", "SP", "MaxHP", "MaxSP", "STR", "DEX", "AGI", "INT", "ATK", "PDEF", "MDEF", "EVA"]
VARIABLE_OP_CHARACTER = ["Map X", "Map Y", "Direction", "Screen X", "Screen Y", "Terrain Tag"]
VARIABLE_OP_MISC = ["Map ID", "Party Members", "Gold", "Steps", "Play Time", "Timer", "Save Count"]
DISENABLERS = ["Disable", "Enable"]
TRANSFER_DIR = ["", ", Down", ", Left", ", Right", ", Up"]
TRANSFER_FADE = ["", ", No Fade"]
PLAYER_VISIBLE = ["Transparency", "Normal"]
ROUTE_STEPS = ["Move Down", "Move Left", "Move Right", "Move Up", "Move Lower Left", "Move Lower Right", "Move Upper Left", "Move Upper Right", "Move at Random", "Move toward Player", "Move away from Player", "1 Step Forward", "1 Step Backward"]
ROUTE_TURNS = ["Turn Down", "Turn Left", "Turn Right", "Turn Up", "Turn 90 Right", "Turn 90 Left", "Turn 180", "Turn 90 Right or Left", "Turn at Random", "Turn toward Player", "Turn away from Player"]
ROUTE_SWITCHES = ["Move Animation ON", "Move Animation OFF", "Stop Animation ON", "Stop Animation OFF", "Direction Fix ON", "Direction Fix OFF", "Through ON", "Through OFF", "Always on Top ON", "Always on Top OFF"]
BLENDINGS = ["Normal", "Add", "Sub"]
PIC_BASE = ["Upper Left", "Center"]
WEATHER = ["None", "Rain", "Storm", "Snow"]
LVSTAT = ["MaxHP", "MaxSP", "STR", "DEX", "AGI", "INT"]
EQUIPS = ["Weapon", "Shield", "Helmet", "Armor", "Accessory"]
FORCED_ACTIONS = ["Attack", "Defend", "Escape", "Do Nothing"]
FORCED_TARGETS = ["Last Target", "Random", "Index 1", "Index 2", "Index 3", "Index 4", "Index 5", "Index 6", "Index 7", "Index 8"]
FORCED_EXEC = ["", ", Execute Now"]
TRIGGER_TYPES = ["None", "Autorun", "Parallel"]
TROOP_SPAN = ["Battle", "Turn", "Moment"]
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.new_line
    return "#{" " * @@indent}#{@@new_line}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_base_name(so)
    return so ? so.name : "???"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_actor(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_actors))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_class(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_classes))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_skill(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_skills))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_item(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_items))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_weapon(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_weapons))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_armor(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_armors))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_enemy(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_enemies))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_troop(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_troops))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_state(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_states))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_animation(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_animations))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_tileset(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_tilesets))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_common_event(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_common_events))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_map(si)
    return sprintf("[%.3d:%s]", si, get_base_name($data_mapinfos))
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_character(si)
    return "Player" if si == -1
    return "This Event" if si == 0
    return sprintf("[%.3d:%s]", si, @@current_map ? get_base_name(@@current_map.events) : "???")
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_switch(si)
    return sprintf("[%.4d:%s]", si, $data_system.switches || "???")
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_variable(si)
    return sprintf("[%.4d:%s]", si, $data_system.variables || "???")
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_switches(s1, s2)
    return s1 == s2 ? get_switch(s1) : sprintf("[%.4d..%.4d]", s1, s2)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_variables(s1, s2)
    return s1 == s2 ? get_variable(s1) : sprintf("[%.4d..%.4d]", s1, s2)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_actor_condition(sc, sp)
    case sc
    when 0
      return ""
    when 1
      return "'#{sp}'"
    when 2
      return get_skill(sp)
    when 3
      return get_weapon(sp)
    when 4
      return get_armor(sp)
    when 5
      return get_state(sp)
    end
    return "???"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_enemy_condition(sc, sp)
    return sc == 0 ? "" : sc == 1 ? get_state(sp) : "???"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.choice_cancel(si)
    return si == 0 ? "" : si == 5 ? " (Cancel: Additional)" : " (Cancel: ##{si})"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.is_choice_cancel(si)
    return si == @@choice_cancel ? " (Triggered by Cancel)" : ""
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_var_config(sc, st, sp)
    case sc
    when 0
      return st.to_i
    when 1
      return get_variable(st)
    when 2
      return "Random No. (#{st}...#{sp})"
    when 3
      return "#{get_item(st)} in Inventory"
    when 4
      return "#{get_actor(st)}'s #{VARIABLE_OP_ACTOR}"
    when 5
      return "[#{st}. ]'s #{VARIABLE_OP_ENEMY}"
    when 6
      return "#{get_character(st)}'s #{VARIABLE_OP_CHARACTER}"
    when 7
      return VARIABLE_OP_MISC
    end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.enemy_present(si)
    return @@current_troop && @@current_troop.members
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_troop_enemy(si)
    return "[#{si}. #{enemy_present(si) ? get_enemy(@@current_troop.members.enemy_id) : ""}]"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_branch_content(*sp)
    case sp
    when 0
      return "Switch #{get_switch(sp)} == #{SWITCH_STATES]}"
    when 1
      return "Variable #{get_variable(sp)} #{COMPARERS]} #{sp == 1 ? get_variable(sp) : sp}"
    when 2
      return "Self Switch #{sp} == #{SWITCH_STATES]}"
    when 3
      return "Timer #{sp / 60} min #{sp % 60} sec #{MORE_LESS]}"
    when 4
      return "#{get_actor(sp)} is #{get_actor_condition(sp, sp)} #{ACTOR_CONDITION]}"
    when 5
      return "Enemy #{get_troop_enemy(sp)} is #{get_enemy_condition(sp, sp)} #{ENEMY_CONDITION]}"
    when 6
      return "#{get_character(sp)} is facing #{FACING_DIR]}"
    when 7
      return "Gold #{sp} #{MORE_LESS]}"
    when 8
      return "Item #{get_item(sp)} in Inventory"
    when 9
      return "Weapon #{get_weapon(sp)} in Inventory"
    when 10
      return "Armor #{get_armor(sp)} in Inventory"
    when 11
      return "The #{GAME_BUTTONS]} button is being pressed"
    when 12
      return "Script: #{sp}"
    end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_timer_data(st, sp)
    return st == 1 ? "Stop" : "Startup (#{sp / 60} min. #{sp % 60} sec.)"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.value_or_var(st, sp)
    return st == 0 ? sp.to_s : "Variable #{get_variable(sp)}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_audio_file(sf)
    return "'#{sf.name}', #{sf.volume}, #{sf.pitch}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.map_or_var(st, sp)
    return st == 0 ? get_map(sp) : sprintf("Variable [%.4d]", sp)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.transfer_pos(st, sx, sy, sd, sf)
    return sprintf(st == 0 ? " (%.3d,%.3d)" : "[%.4d][%.4d]", sx, sy) + TRANSFER_DIR + TRANSFER_FADE
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.set_location(st, sx, sy, sd)
    return sprintf("(%.3d,%.3d)#{TRANSFER_DIR}", sx, sy) if st == 0
    return sprintf("Variable [%.4d][%.4d]#{TRANSFER_DIR}", sx, sy) if st == 1
    return "Switch with #{get_character(sx)}#{TRANSFER_DIR}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.map_panorama(*sp)
    return "Panorama = '#{sp}', #{sp}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.map_fog(*sp)
    return "Fog = '#{sp}', #{sp}, #{sp}, #{BLENDINGS]}, #{sp}, #{sp}, #{sp}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.map_back(*sp)
    return "Battleback = '#{sp}'"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_color_data(sc)
    return "(#{sc.red.to_i},#{sc.green.to_i},#{sc.blue.to_i},#{sc.alpha.to_i})"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_tone_data(st)
    return "(#{st.red.to_i},#{st.green.to_i},#{st.blue.to_i},#{st.gray.to_i})"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.add_route_step(se, *sp)
    case se
    when 1..13
      return "<>#{ROUTE_STEPS}"
    when 14
      return "<>Jump: #{sp}, #{sp}"
    when 15
      return "<>Wait: #{sp} frame(s)"
    when 16..26
      return "<>#{ROUTE_TURNS}"
    when 27
      return "<>Switch ON: #{get_switch(sp)}"
    when 28
      return "<>Switch OFF: #{get_switch(sp)}"
    when 29
      return "<>Change Speed: #{sp}"
    when 30
      return "<>Change Freq: #{sp}"
    when 31..40
      return "<>#{ROUTE_SWITCHES}"
    when 41
      return "<>Graphic: '#{sp}', #{sp}, #{sp}, #{sp}"
    when 42
      return "<>Change Opacity: #{sp}"
    when 43
      return "<>Change Blending: #{BLENDINGS]}"
    when 44
      return "<>SE: #{get_audio_file(sp)}"
    when 45
      return "<>Script: #{sp}"
    end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.route_options(sr)
    return new_line unless sr.repeat || sr.skippable
    return " (Repeat Action)#{sr.list.empty? ? "" : new_line}" if sr.repeat && !sr.skippable
    return " (Ignore If Can't Move)#{sr.list.empty? ? "" : new_line}" if sr.skippable && !sr.repeat
    return " (Repeat Action, Ignore If Can't Move)#{sr.list.empty? ? "" : new_line}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.step_indent
    return "#{" " * @@indent}:               : "
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.generate_route(sl)
    sl.pop
    return (sl.collect {|se| "#{step_indent}#{add_route_step(se.code, *se.parameters)}" }).join(new_line)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.pic_pos(st, sx, sy)
    return sprintf(st == 0 ? "%d,%d" : "Variable [%.4d][%.4d]", sx, sy)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.pic_show(si, sn, sb, st, sx, sy)
    return "#{si}, '#{sn}', #{PIC_BASE} (#{pic_pos(st, sx, sy)})"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.pic_move(si, sw, sb, st, sx, sy)
    return "#{si}, @#{sw}, #{PIC_BASE} (#{pic_pos(st, sx, sy)})"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.set_weather(st, sp)
    return st == 0 ? WEATHER : "#{WEATHER}, #{sp}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.item_type(st)
    return st == 1 ? "Weapon" : st == 2 ? "Armor" : "Item"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_item_by_type(st, sp)
    return st == 1 ? get_weapon(sp) : st == 2 ? get_armor(sp) : get_item(sp)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.add_shop_item(st, sp)
    return "#{item_type(st)} #{get_item_by_type(st, sp)}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.party_or_actor(si)
    return si == 0 ? "Entire Party" : get_actor(si)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.troop_or_enemy(si)
    return si == 0 ? "Entire Troop" : get_troop_enemy(si)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.knockout_possible(sf)
    return sf == 1 ? ", Allow Knockout in Battle" : 0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.change_hpsp(sk, so, st, sv, sf)
    return "#{sk} #{AMOUNT_OP} #{value_or_var(st, sv)}#{knockout_possible(sf)}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_equip(sl, sp)
    return sl == 0 ? get_weapon(sp) : get_armor(sp)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_action(st, sp)
    return st == 1 ? get_skill(sp) : FORCED_ACTIONS
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.get_target(so, se)
    return "#{FORCED_TARGETS}#{FORCED_EXEC}"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.actors_or_enemies(st, si)
    return st == 1 ? troop_or_enemy(si) : party_or_actor(si)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.troop_member(se, sx, sy, sh, si)
    return "\n#{se} (X#{sx}, Y#{sy}#{sh ? ", HIDDEN" : ""}#{si ? ", IMMORTAL" : ""})"
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.write_command(si, sd, *sp)
    case si
    when 0
      "<>"
    when 101
      "<>Show Text: #{sp}"
    when 401
      ":          : #{sp}"
    when 102
      @@choice_list = sp.dup
      @@choice_cancel = sp
      "<>Show Choices: [#{@@choice_list.join("], [")}]#{choice_cancel(sp)}"
    when 402
      ": When [#{@@choice_list]}]#{is_choice_cancel(sp + 1)}"
    when 403
      ": When Cancel"
    when 404
      ": Branch End"
    when 103
      "<>Input Number: #{get_variable(sp)}, #{sp} digit(s)"
    when 104
      "<>Change Text Options: #{TEXTOPTIONS_POS]}, #{TEXTOPTIONS_WINDOW]}"
    when 105
      "<>Button Input Processing: #{get_variable(sp)}"
    when 106
      "<>Wait: #{sp} frame(s)"
    when 108
      "<>Comment: #{sp}"
    when 408
      ":      : #{sp}"
    when 111
      "<>Conditional Branch: #{get_branch_content(*sp)}"
    when 411
      ": Else"
    when 412
      ": Branch End"
    when 112
      "<>Loop"
    when 413
      ": Repeat Above"
    when 113
      "<>Break Loop"
    when 115
      "<>Exit Event Processing"
    when 116
      "<>Erase Event"
    when 117
      "<>Call Common Event: #{get_common_event(sp)}"
    when 118
      "<>Label: #{sp}"
    when 119
      "<>Jump to Label: #{sp}"
    when 121
      "<>Control Switches: #{get_switches(sp, sp)} = #{SWITCH_STATES]}"
    when 122
      "<>Control Variables: #{get_variables(sp, sp)} OPERATORS] #{get_var_config(sp, sp, sp)}"
    when 123
      "<>Control Self Switch: #{sp} = #{SWITCH_STATES]}"
    when 124
      "<>Control Timer: #{get_timer_data(sp, sp)}"
    when 125
      "<>Change Gold: #{AMOUNT_OP]} #{value_or_var(sp, sp)}"
    when 126
      "<>Change Items: #{get_item(sp)} #{AMOUNT_OP]} #{value_or_var(sp, sp)}"
    when 127
      "<>Change Weapons: #{get_weapon(sp)} #{AMOUNT_OP]} #{value_or_var(sp, sp)}"
    when 128
      "<>Change Armors: #{get_armor(sp)} #{AMOUNT_OP]} #{value_or_var(sp, sp)}"
    when 129
      "<>Change Party Member: #{AMOUNT_OP]} #{get_actor(sp)}#{sp == 1 ? ", Initialize" : ""}"
    when 131
      "<>Change Windowskin: '#{sp}'"
    when 132
      "<>Change Battle BGM: #{get_audio_file(sp)}"
    when 133
      "<>Change Battle End ME: #{get_audio_file(sp)}"
    when 134
      "<>Change Save Access: #{DISENABLERS]}"
    when 135
      "<>Change Menu Access: #{DISENABLERS]}"
    when 136
      "<>Change Encounter: #{DISENABLERS]}"
    when 201
      "<>Transfer Player: #{map_or_var(sp, sp)}, #{transfer_pos(sp, sp, sp, sp / 2, sp)}"
    when 202
      "<>Set Event Location: #{get_character(sp)}, #{set_location(sp, sp, sp, sp / 2)}"
    when 203
      "<>Scroll Map: #{FACING_DIR / 2]}, #{sp}, #{sp}"
    when 204
      "<>Change Map Settings: #{sp == 0 ? map_panorama(*sp) : sp == 1 ? map_fog(*sp) : map_back(*sp)}"
    when 205
      "<>Change Fog Color Tone: #{get_tone_data(sp)}, @#{sp}"
    when 206
      "<>Change Fog Opacity: #{sp}, @#{sp}"
    when 207
      "<>Show Animation: #{get_character(sp)}, #{get_animation(sp)}"
    when 208
      "<>Change Transparent Flag: #{PLAYER_VISIBLE]}"
    when 209
      "<>Set Move Route: #{get_character(sp)}#{route_options(sp)}#{generate_route(sp.list)}"
    when 509
      return nil
    when 210
      "<>Wait for Move's Completion"
    when 221
      "<>Prepare for Transition"
    when 222
      "<>Execute Transition: '#{sp}'"
    when 223
      "<>Change Screen Color Tone: #{get_tone_data(sp)}, @#{sp}"
    when 224
      "<>Screen Flash: #{get_color_data(sp)}, @#{sp}"
    when 225
      "<>Screen Shake: #{sp}, #{sp}, @#{sp}"
    when 231
      "<>Show Picture: #{pic_show(*sp)}, (#{sp}%,#{sp}%), #{sp}, #{BLENDINGS]}"
    when 232
      "<>Move Picture: #{pic_move(*sp)}, (#{sp}%,#{sp}%), #{sp}, #{BLENDINGS]}"
    when 233
      "<>Rotate Picture: #{sp}, #{sp < 0 ? "" : "+"}#{sp}"
    when 234
      "<>Change Picture Color Tone: #{sp}, #{get_tone_data(sp)}, #{sp}"
    when 235
      "<>Erase Picture: #{sp}"
    when 236
      "<>Set Weather Effects: #{set_weather(sp, sp)}, @#{sp}"
    when 241
      "<>Play BGM: #{get_audio_file(sp)}"
    when 242
      "<>Fade Out BGM: #{sp} sec."
    when 245
      "<>Play BGS: #{get_audio_file(sp)}"
    when 246
      "<>Fade Out BGS: #{sp} sec."
    when 247
      "<>Memorize BGM/BGS"
    when 248
      "<>Restore BGM/BGS"
    when 249
      "<>Play ME: #{get_audio_file(sp)}"
    when 250
      "<>Play SE: #{get_audio_file(sp)}"
    when 251
      "<>Stop SE"
    when 301
      "<>Battle Processing: #{get_troop(sp)}"
    when 601
      ": If Win"
    when 602
      ": If Escape"
    when 603
      ": If Lose"
    when 604
      ": Branch End"
    when 302
      "<>Shop Processing: #{add_shop_item(sp, sp)}"
    when 605
      ":                : #{add_shop_item(sp, sp)}"
    when 303
      "<>Name Input Processing: #{get_actor(sp)}, #{sp} characters"
    when 311
      "<>Change HP: #{change_hpsp(party_or_actor(sp), sp, sp, sp, sp)}"
    when 312
      "<>Change SP: #{change_hpsp(party_or_actor(sp), sp, sp, sp, false)}"
    when 313
      "<>Change State: #{party_or_actor(sp)}, #{AMOUNT_OP]} #{get_state(sp)}"
    when 314
      "<>Recover All: #{party_or_actor(sp)}"
    when 315
      "<>Change EXP: #{party_or_actor(sp)}, #{AMOUNT_OP]} #{value_or_var(sp, sp)}"
    when 316
      "<>Change Level: #{party_or_actor(sp)}, #{AMOUNT_OP]} #{value_or_var(sp, sp)}"
    when 317
      "<>Change Parameters: #{get_actor(sp)}, #{LVSTAT]} #{AMOUNT_OP]} #{value_or_var(sp, sp)}"
    when 318
      "<>Change Skills: #{get_actor(sp)}, #{AMOUNT_OP]} #{get_skill(sp)}"
    when 319
      "<>Change Equipment: #{get_actor(sp)}, #{EQUIPS]} = #{get_equip(sp, sp)}"
    when 320
      "<>Change Actor Name: #{get_actor(sp)}, '#{sp}'"
    when 321
      "<>Change Actor Class: #{get_actor(sp)}, #{get_class(sp)}"
    when 322
      "<>Change Actor Graphic: #{get_actor(sp)}, '#{sp}', #{sp}, '#{sp}', #{sp}"
    when 331
      "<>Change Enemy HP: #{change_hpsp(troop_or_enemy(sp), sp, sp, sp, sp)}"
    when 332
      "<>Change Enemy SP: #{change_hpsp(troop_or_enemy(sp), sp, sp, sp, false)}"
    when 333
      "<>Change Enemy State: #{troop_or_enemy(sp)}, #{AMOUNT_OP]} #{get_state(sp)}"
    when 334
      "<>Enemy Recover All: #{troop_or_enemy(sp)}"
    when 335
      "<>Enemy Appearance: #{get_troop_enemy(sp)}"
    when 336
      "<>Enemy Transform: #{get_troop_enemy(sp)}, #{get_enemy(sp)}"
    when 337
      "<>Show Battle Animation: #{actors_or_enemies(sp, sp)}, #{get_animation(sp)}"
    when 338
      "<>Deal Damage: #{actors_or_enemies(sp, sp)}, #{AMOUNT_OP]} #{value_or_var(sp, sp)}"
    when 339
      "<>Force Action: #{actors_or_enemies(sp, sp)}, #{get_action(sp, sp)}, #{get_target(sp, sp)}"
    when 340
      "<>Abort Battle"
    when 351
      "<>Call Menu Screen"
    when 352
      "<>Call Save Screen"
    when 353
      "<>Game Over"
    when 354
      "<>Return to Title Screen"
    when 355
      "<>Script: #{sp}"
    when 655
      ":       : #{sp}"
    else
      "<>Unknown Command ##{si} [#{sp.join(", ")}]"
    end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.add_command(sc, sr="")
    @@indent = sc.indent
    st = write_command(sc.code, sc.indent, *sc.parameters)
    @@output += "#{" " * @@indent}#{st}\n#{sr}" if st
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.add_page_conditions(sc)
    @@output += "\n\t\t\tSwitch #{get_switch(sc.switch1_id)} == ON" if sc.switch1_valid
    @@output += "\n\t\t\tSwitch #{get_switch(sc.switch2_id)} == ON" if sc.switch2_valid
    @@output += "\n\t\t\tVariable #{get_variable(sc.variable_id)} >= #{sc.variable_value}" if sc.variable_valid
    @@output += "\n\t\t\tSelf Switch #{sc.self_switch_ch} == ON" if sc.self_switch_valid
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.add_event(si)
    @@output += sprintf("\n\t\n\t\n\t.name}]\n\t\t\n\t\t", si)
    @@current_map.events.pages.each_with_index do |sp, sj|
      @@output += "\n\t\t\n\t\t"
      @@output += "\n\t\t\t\n\t\t\tCode Size: #{sp.list.size}\n\t\t\t"
      add_page_conditions(sp.condition)
      @@output += "\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t"
      sp.list.each {|sc| add_command(sc, "\t\t\t") }
    end
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.progress_maps
    return @@counter_maps.to_f / $data_mapinfos.keys.size.to_f
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.progress_ces
    return @@counter_ces.to_f / ($data_common_events.size.to_f - 1)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.progress_troops
    return @@counter_troops.to_f / ($data_troops.size.to_f - 1)
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.add_map(si, so)
    Graphics.update
    @@counter_maps += 1
    @@current_map = load_data(sprintf("Data/Map%03d.rxdata", si))
    @@output += sprintf("\n\n\n\n", si, so.name)
    @@output += " (#{@@current_map.width}×#{@@current_map.height})\n\n"
    @@output += "Parent Map ID: #{so.parent_id}\nTree Order: #{so.order}"
    @@current_map.events.keys.sort.each {|se| add_event(se) }
    @@progressbar_maps.zoom_x = progress_maps * 640.0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.add_common_event(si, so)
    return unless so
    Graphics.update
    @@counter_ces += 1
    @@current_ce = so
    @@output += sprintf("\n\n\n\n\n\n", si, so.name)
    @@output += "Trigger Type: #{TRIGGER_TYPES}\nSwitch: #{get_switch(so.switch_id)}\n\t\n\t"
    @@output += "\n\t\n\t\n\t\n\t\n\t"
    @@current_ce.list.each {|sc| add_command(sc, "\t") }
    @@progressbar_ces.zoom_x = progress_ces * 640.0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.add_troop(si, so)
    return unless so
    Graphics.update
    @@counter_troops += 1
    @@current_troop = so
    @@output += sprintf("\n\n\n\n (%d member(s))\n\n", si, so.name, so.members.size)
    so.members.each {|se| @@output += troop_member(get_enemy(se.enemy_id), se.x, se.y, se.hidden, se.immortal) }
    @@current_troop.pages.each_with_index do |sp, sj|
      @@output += "\n\t\n\t\n\t"
      @@output += "\n\t\t\n\t\tCode Size: #{sp.list.size}\n\t\tTrigger Span: #{TROOP_SPAN}"
      @@output += "\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t"
      sp.list.each {|sc| add_command(sc, "\t\t") }
    end
    @@progressbar_troops.zoom_x = progress_troops * 640.0
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.terminate
    if @@progress_bitmap
      @@progress_bitmap.dispose
      @@progressbar_maps.dispose
      @@progressbar_ces.dispose
      @@progressbar_troops.dispose
    end
    @@text_title.bitmap.dispose
    @@text_ver.bitmap.dispose
    @@text_press.bitmap.dispose
    @@text_done.bitmap.dispose
    @@text_exit.bitmap.dispose
    @@back_bars.bitmap.dispose
    @@background.bitmap.dispose
    @@text_title.dispose
    @@text_ver.dispose
    @@text_press.dispose
    @@text_done.dispose
    @@text_exit.dispose
    @@back_bars.dispose
    @@background.dispose
    @@viewport.dispose
end
#--------------------------------------------------------------------------
# *
#--------------------------------------------------------------------------
def self.run
    $data_actors ||= load_data("Data/Actors.rxdata")
    $data_classes ||= load_data("Data/Classes.rxdata")
    $data_skills ||= load_data("Data/Skills.rxdata")
    $data_items ||= load_data("Data/Items.rxdata")
    $data_weapons ||= load_data("Data/Weapons.rxdata")
    $data_armors ||= load_data("Data/Armors.rxdata")
    $data_enemies ||= load_data("Data/Enemies.rxdata")
    $data_troops ||= load_data("Data/Troops.rxdata")
    $data_states ||= load_data("Data/States.rxdata")
    $data_animations ||= load_data("Data/Animations.rxdata")
    $data_tilesets ||= load_data("Data/Tilesets.rxdata")
    $data_common_events = load_data("Data/CommonEvents.rxdata")
    $data_system ||= load_data("Data/System.rxdata")
    $data_mapinfos ||= load_data("Data/MapInfos.rxdata")
    @@viewport = Viewport.new(0, 0, 640, 480)
    @@viewport.z = 0x7FFFFFFC
    @@background = Sprite.new(@@viewport)
    @@background.bitmap = Bitmap.new(1, 1)
    @@background.bitmap.set_pixel(0, 0, Color.new(0, 0, 0, 128))
    @@background.zoom_x = 640.0
    @@background.zoom_y = 480.0
    @@background.z = 0x7FFFFFFC
    @@back_bars = Sprite.new(@@viewport)
    @@back_bars.bitmap = Bitmap.new(1, 1)
    @@back_bars.bitmap.set_pixel(0, 0, Color.new(40, 200, 64, 64))
    @@back_bars.zoom_x = 640.0
    @@back_bars.zoom_y = 48.0
    @@back_bars.y = 432
    @@back_bars.z = 0x7FFFFFFD
    @@text_title = Sprite.new(@@viewport)
    @@text_title.y = 0
    @@text_title.z = 0x7FFFFFFE
    @@text_title.bitmap = Bitmap.new(640, 48)
    @@text_title.bitmap.font.size = 36
    @@text_title.bitmap.font.bold = true
    @@text_ver = Sprite.new(@@viewport)
    @@text_ver.y = 56
    @@text_ver.z = 0x7FFFFFFE
    @@text_ver.bitmap = Bitmap.new(640, 24)
    @@text_ver.bitmap.font.size = 20
    @@text_ver.bitmap.font.bold = true
    @@text_press = Sprite.new(@@viewport)
    @@text_press.bitmap = Bitmap.new(640, 32)
    @@text_press.bitmap.font.size = 24
    @@text_press.y = 96
    @@text_press.z = 0x7FFFFFFE
    @@text_done = Sprite.new(@@viewport)
    @@text_done.bitmap = Bitmap.new(640, 32)
    @@text_done.bitmap.font.size = 24
    @@text_done.y = 120
    @@text_done.z = 0x7FFFFFFE
    @@text_exit = Sprite.new(@@viewport)
    @@text_exit.bitmap = Bitmap.new(640, 24)
    @@text_exit.bitmap.font.size = 20
    @@text_exit.y = 160
    @@text_exit.z = 0x7FFFFFFE
    st = "Event Exportexter for RPGXP"
    @@text_title.bitmap.draw_text(0, 0, 640, 48, st, 1)
    st = " © 2022 KotatsuAkira"
    @@text_ver.bitmap.draw_text(0, 0, 640, 24, st, 1)
    st = "Press to start or to cancel"
    @@text_press.bitmap.draw_text(0, 0, 640, 32, st, 1)
    @@progress_bitmap = nil
    loop do
      Graphics.update
      Input.update
      break if Input.press?(Input::B)
      next unless Input.press?(Input::L) && Input.press?(Input::R)
      @@text_press.bitmap.font.color.set(160, 160, 160, 255)
      @@text_press.bitmap.clear
      st = "Processing data..."
      @@text_press.bitmap.draw_text(0, 0, 640, 32, st, 1)
      @@output = ""
      @@current_map = nil
      @@current_ce = nil
      @@current_troop = nil
      @@progress_bitmap = Bitmap.new(1, 1)
      @@progress_bitmap.set_pixel(0, 0, Color.new(40, 200, 64, 255))
      @@progressbar_maps = Sprite.new(@@viewport)
      @@progressbar_ces = Sprite.new(@@viewport)
      @@progressbar_troops = Sprite.new(@@viewport)
      @@progressbar_maps.bitmap = @@progress_bitmap
      @@progressbar_ces.bitmap = @@progress_bitmap
      @@progressbar_troops.bitmap = @@progress_bitmap
      @@progressbar_maps.y = 432
      @@progressbar_ces.y = 448
      @@progressbar_troops.y = 464
      @@progressbar_maps.zoom_x = 0.0
      @@progressbar_ces.zoom_x = 0.0
      @@progressbar_troops.zoom_x = 0.0
      @@progressbar_maps.zoom_y = 16.0
      @@progressbar_ces.zoom_y = 16.0
      @@progressbar_troops.zoom_y = 16.0
      @@progressbar_maps.z = 0x7FFFFFFE
      @@progressbar_ces.z = 0x7FFFFFFE
      @@progressbar_troops.z = 0x7FFFFFFE
      @@new_line = "\n\t\t\t"
      @@counter_maps = 0
      $data_mapinfos.keys.sort.each {|sk| add_map(sk, $data_mapinfos) }
      @@current_map = nil
      @@new_line = "\n\t"
      @@counter_ces = 0
      $data_common_events.each_with_index {|se, si| add_common_event(si, se) }
      @@current_ce = nil
      @@new_line = "\n\t\t"
      @@counter_troops = 0
      $data_troops.each_with_index {|se, si| add_troop(si, se) }
      @@current_troop = nil
      @@text_press.bitmap.font.color.set(255, 255, 255, 255)
      @@text_press.bitmap.clear
      st = "Processing done (#{@@output.size} bytes)!"
      @@text_press.bitmap.draw_text(0, 0, 640, 32, st, 1)
      st = "Press to save to \"EventExport.txt\" or to cancel."
      @@text_done.bitmap.draw_text(0, 0, 640, 32, st, 1)
      st = "The program will exit afterwards."
      @@text_exit.bitmap.draw_text(0, 0, 640, 24, st, 1)
      loop do
      Graphics.update
      Input.update
      if Input.trigger?(Input::B)
          break
      elsif Input.trigger?(Input::C)
          File.open("EventExport.txt", "w") {|sf| sf.write(@@output) }
          break
      end
      end
      terminate
      exit
      break
    end
    terminate
end
end




本贴来自国际rpgmaker官方论坛作者:AkiraKotatsuhime处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/event-exportexter-for-rpgxp-rv20220318.144987/
页: [1]
查看完整版本: Event Exportexter for RPGXP (rv20220318)