累计送礼: 0 个 累计收礼: 1 个 TA的每日心情 开心 前天 04:10
签到天数: 209 天
连续签到: 2 天
[LV.7]常住居民III
管理员
VIP
7
卡币
22931
OK点
16
推广点
0
同能卷
50
积分 28287
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:
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[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_class(si) return sprintf("[%.3d:%s]", si, get_base_name($data_classes[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_skill(si) return sprintf("[%.3d:%s]", si, get_base_name($data_skills[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_item(si) return sprintf("[%.3d:%s]", si, get_base_name($data_items[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_weapon(si) return sprintf("[%.3d:%s]", si, get_base_name($data_weapons[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_armor(si) return sprintf("[%.3d:%s]", si, get_base_name($data_armors[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_enemy(si) return sprintf("[%.3d:%s]", si, get_base_name($data_enemies[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_troop(si) return sprintf("[%.3d:%s]", si, get_base_name($data_troops[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_state(si) return sprintf("[%.3d:%s]", si, get_base_name($data_states[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_animation(si) return sprintf("[%.3d:%s]", si, get_base_name($data_animations[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_tileset(si) return sprintf("[%.3d:%s]", si, get_base_name($data_tilesets[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_common_event(si) return sprintf("[%.3d:%s]", si, get_base_name($data_common_events[si])) end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_map(si) return sprintf("[%.3d:%s]", si, get_base_name($data_mapinfos[si])) 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[si]) : "???") end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_switch(si) return sprintf("[%.4d:%s]", si, $data_system.switches[si] || "???") end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_variable(si) return sprintf("[%.4d:%s]", si, $data_system.variables[si] || "???") 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[sp]}" when 5 return "[#{st}. ]'s #{VARIABLE_OP_ENEMY[sp]}" when 6 return "#{get_character(st)}'s #{VARIABLE_OP_CHARACTER[sp]}" when 7 return VARIABLE_OP_MISC[st] end end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.enemy_present(si) return @@current_troop && @@current_troop.members[si] end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_troop_enemy(si) return "[#{si}. #{enemy_present(si) ? get_enemy(@@current_troop.members[si].enemy_id) : ""}]" end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_branch_content(*sp) case sp[0] when 0 return "Switch #{get_switch(sp[1])} == #{SWITCH_STATES[sp[2]]}" when 1 return "Variable #{get_variable(sp[1])} #{COMPARERS[sp[4]]} #{sp[2] == 1 ? get_variable(sp[3]) : sp[3]}" when 2 return "Self Switch #{sp[1]} == #{SWITCH_STATES[sp[2]]}" when 3 return "Timer #{sp[1] / 60} min #{sp[1] % 60} sec #{MORE_LESS[sp[2]]}" when 4 return "#{get_actor(sp[1])} is #{get_actor_condition(sp[2], sp[3])} #{ACTOR_CONDITION[sp[2]]}" when 5 return "Enemy #{get_troop_enemy(sp[1])} is #{get_enemy_condition(sp[2], sp[3])} #{ENEMY_CONDITION[sp[2]]}" when 6 return "#{get_character(sp[1])} is facing #{FACING_DIR[sp[2]]}" when 7 return "Gold #{sp[1]} #{MORE_LESS[sp[2]]}" when 8 return "Item #{get_item(sp[1])} in Inventory" when 9 return "Weapon #{get_weapon(sp[1])} in Inventory" when 10 return "Armor #{get_armor(sp[1])} in Inventory" when 11 return "The #{GAME_BUTTONS[sp[1]]} button is being pressed" when 12 return "Script: #{sp[1]}" 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[sd] + TRANSFER_FADE[sf] end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.set_location(st, sx, sy, sd) return sprintf("(%.3d,%.3d)#{TRANSFER_DIR[sd]}", sx, sy) if st == 0 return sprintf("Variable [%.4d][%.4d]#{TRANSFER_DIR[sd]}", sx, sy) if st == 1 return "Switch with #{get_character(sx)}#{TRANSFER_DIR[sd]}" end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.map_panorama(*sp) return "Panorama = '#{sp[1]}', #{sp[2]}" end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.map_fog(*sp) return "Fog = '#{sp[1]}', #{sp[2]}, #{sp[3]}, #{BLENDINGS[sp[4]]}, #{sp[5]}, #{sp[6]}, #{sp[7]}" end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.map_back(*sp) return "Battleback = '#{sp[1]}'" 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[se - 1]}" when 14 return "<>Jump: #{sp[0]}, #{sp[1]}" when 15 return "<>Wait: #{sp[0]} frame(s)" when 16..26 return "<>#{ROUTE_TURNS[se - 16]}" when 27 return "<>Switch ON: #{get_switch(sp[0])}" when 28 return "<>Switch OFF: #{get_switch(sp[0])}" when 29 return "<>Change Speed: #{sp[0]}" when 30 return "<>Change Freq: #{sp[0]}" when 31..40 return "<>#{ROUTE_SWITCHES[se - 31]}" when 41 return "<>Graphic: '#{sp[0]}', #{sp[1]}, #{sp[2]}, #{sp[3]}" when 42 return "<>Change Opacity: #{sp[0]}" when 43 return "<>Change Blending: #{BLENDINGS[sp[0]]}" when 44 return "<>SE: #{get_audio_file(sp[0])}" when 45 return "<>Script: #{sp[0]}" 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[sb]} (#{pic_pos(st, sx, sy)})" end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.pic_move(si, sw, sb, st, sx, sy) return "#{si}, @#{sw}, #{PIC_BASE[sb]} (#{pic_pos(st, sx, sy)})" end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.set_weather(st, sp) return st == 0 ? WEATHER[0] : "#{WEATHER[st]}, #{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[so]} #{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[sp] end #-------------------------------------------------------------------------- # * #-------------------------------------------------------------------------- def self.get_target(so, se) return "#{FORCED_TARGETS[so - 2]}#{FORCED_EXEC[se]}" 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[0]}" when 401 ": : #{sp[0]}" when 102 @@choice_list = sp[0].dup @@choice_cancel = sp[1] "<>Show Choices: [#{@@choice_list.join("], [")}]#{choice_cancel(sp[1])}" when 402 ": When [#{@@choice_list[sp[0]]}]#{is_choice_cancel(sp[0] + 1)}" when 403 ": When Cancel" when 404 ": Branch End" when 103 "<>Input Number: #{get_variable(sp[0])}, #{sp[1]} digit(s)" when 104 "<>Change Text Options: #{TEXTOPTIONS_POS[sp[0]]}, #{TEXTOPTIONS_WINDOW[sp[1]]}" when 105 "<>Button Input Processing: #{get_variable(sp[0])}" when 106 "<>Wait: #{sp[0]} frame(s)" when 108 "<>Comment: #{sp[0]}" when 408 ": : #{sp[0]}" 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[0])}" when 118 "<>Label: #{sp[0]}" when 119 "<>Jump to Label: #{sp[0]}" when 121 "<>Control Switches: #{get_switches(sp[0], sp[1])} = #{SWITCH_STATES[sp[2]]}" when 122 "<>Control Variables: #{get_variables(sp[0], sp[1])} OPERATORS[sp[2]] #{get_var_config(sp[3], sp[4], sp[5])}" when 123 "<>Control Self Switch: #{sp[0]} = #{SWITCH_STATES[sp[1]]}" when 124 "<>Control Timer: #{get_timer_data(sp[0], sp[1])}" when 125 "<>Change Gold: #{AMOUNT_OP[sp[0]]} #{value_or_var(sp[1], sp[2])}" when 126 "<>Change Items: #{get_item(sp[0])} #{AMOUNT_OP[sp[1]]} #{value_or_var(sp[2], sp[3])}" when 127 "<>Change Weapons: #{get_weapon(sp[0])} #{AMOUNT_OP[sp[1]]} #{value_or_var(sp[2], sp[3])}" when 128 "<>Change Armors: #{get_armor(sp[0])} #{AMOUNT_OP[sp[1]]} #{value_or_var(sp[2], sp[3])}" when 129 "<>Change Party Member: #{AMOUNT_OP[sp[1]]} #{get_actor(sp[1])}#{sp[2] == 1 ? ", Initialize" : ""}" when 131 "<>Change Windowskin: '#{sp[0]}'" when 132 "<>Change Battle BGM: #{get_audio_file(sp[0])}" when 133 "<>Change Battle End ME: #{get_audio_file(sp[0])}" when 134 "<>Change Save Access: #{DISENABLERS[sp[0]]}" when 135 "<>Change Menu Access: #{DISENABLERS[sp[0]]}" when 136 "<>Change Encounter: #{DISENABLERS[sp[0]]}" when 201 "<>Transfer Player: #{map_or_var(sp[0], sp[1])}, #{transfer_pos(sp[0], sp[2], sp[3], sp[4] / 2, sp[5])}" when 202 "<>Set Event Location: #{get_character(sp[0])}, #{set_location(sp[1], sp[2], sp[3], sp[4] / 2)}" when 203 "<>Scroll Map: #{FACING_DIR[sp[0] / 2]}, #{sp[1]}, #{sp[2]}" when 204 "<>Change Map Settings: #{sp[0] == 0 ? map_panorama(*sp) : sp[0] == 1 ? map_fog(*sp) : map_back(*sp)}" when 205 "<>Change Fog Color Tone: #{get_tone_data(sp[0])}, @#{sp[1]}" when 206 "<>Change Fog Opacity: #{sp[0]}, @#{sp[1]}" when 207 "<>Show Animation: #{get_character(sp[0])}, #{get_animation(sp[1])}" when 208 "<>Change Transparent Flag: #{PLAYER_VISIBLE[sp[0]]}" when 209 "<>Set Move Route: #{get_character(sp[0])}#{route_options(sp[1])}#{generate_route(sp[1].list)}" when 509 return nil when 210 "<>Wait for Move's Completion" when 221 "<>Prepare for Transition" when 222 "<>Execute Transition: '#{sp[0]}'" when 223 "<>Change Screen Color Tone: #{get_tone_data(sp[0])}, @#{sp[1]}" when 224 "<>Screen Flash: #{get_color_data(sp[0])}, @#{sp[1]}" when 225 "<>Screen Shake: #{sp[0]}, #{sp[1]}, @#{sp[2]}" when 231 "<>Show Picture: #{pic_show(*sp[0..5])}, (#{sp[6]}%,#{sp[7]}%), #{sp[8]}, #{BLENDINGS[sp[9]]}" when 232 "<>Move Picture: #{pic_move(*sp[0..5])}, (#{sp[6]}%,#{sp[7]}%), #{sp[8]}, #{BLENDINGS[sp[9]]}" when 233 "<>Rotate Picture: #{sp[0]}, #{sp[1] < 0 ? "" : "+"}#{sp[1]}" when 234 "<>Change Picture Color Tone: #{sp[0]}, #{get_tone_data(sp[1])}, #{sp[2]}" when 235 "<>Erase Picture: #{sp[0]}" when 236 "<>Set Weather Effects: #{set_weather(sp[0], sp[1])}, @#{sp[2]}" when 241 "<>Play BGM: #{get_audio_file(sp[0])}" when 242 "<>Fade Out BGM: #{sp[0]} sec." when 245 "<>Play BGS: #{get_audio_file(sp[0])}" when 246 "<>Fade Out BGS: #{sp[0]} sec." when 247 "<>Memorize BGM/BGS" when 248 "<>Restore BGM/BGS" when 249 "<>Play ME: #{get_audio_file(sp[0])}" when 250 "<>Play SE: #{get_audio_file(sp[0])}" when 251 "<>Stop SE" when 301 "<>Battle Processing: #{get_troop(sp[0])}" when 601 ": If Win" when 602 ": If Escape" when 603 ": If Lose" when 604 ": Branch End" when 302 "<>Shop Processing: #{add_shop_item(sp[0], sp[1])}" when 605 ": : #{add_shop_item(sp[0], sp[1])}" when 303 "<>Name Input Processing: #{get_actor(sp[0])}, #{sp[1]} characters" when 311 "<>Change HP: #{change_hpsp(party_or_actor(sp[0]), sp[1], sp[2], sp[3], sp[4])}" when 312 "<>Change SP: #{change_hpsp(party_or_actor(sp[0]), sp[1], sp[2], sp[3], false)}" when 313 "<>Change State: #{party_or_actor(sp[0])}, #{AMOUNT_OP[sp[1]]} #{get_state(sp[2])}" when 314 "<>Recover All: #{party_or_actor(sp[0])}" when 315 "<>Change EXP: #{party_or_actor(sp[0])}, #{AMOUNT_OP[sp[1]]} #{value_or_var(sp[2], sp[3])}" when 316 "<>Change Level: #{party_or_actor(sp[0])}, #{AMOUNT_OP[sp[1]]} #{value_or_var(sp[2], sp[3])}" when 317 "<>Change Parameters: #{get_actor(sp[0])}, #{LVSTAT[sp[1]]} #{AMOUNT_OP[sp[2]]} #{value_or_var(sp[3], sp[4])}" when 318 "<>Change Skills: #{get_actor(sp[0])}, #{AMOUNT_OP[sp[1]]} #{get_skill(sp[2])}" when 319 "<>Change Equipment: #{get_actor(sp[0])}, #{EQUIPS[sp[1]]} = #{get_equip(sp[1], sp[2])}" when 320 "<>Change Actor Name: #{get_actor(sp[0])}, '#{sp[1]}'" when 321 "<>Change Actor Class: #{get_actor(sp[0])}, #{get_class(sp[1])}" when 322 "<>Change Actor Graphic: #{get_actor(sp[0])}, '#{sp[1]}', #{sp[2]}, '#{sp[3]}', #{sp[4]}" when 331 "<>Change Enemy HP: #{change_hpsp(troop_or_enemy(sp[0]), sp[1], sp[2], sp[3], sp[4])}" when 332 "<>Change Enemy SP: #{change_hpsp(troop_or_enemy(sp[0]), sp[1], sp[2], sp[3], false)}" when 333 "<>Change Enemy State: #{troop_or_enemy(sp[0])}, #{AMOUNT_OP[sp[1]]} #{get_state(sp[2])}" when 334 "<>Enemy Recover All: #{troop_or_enemy(sp[0])}" when 335 "<>Enemy Appearance: #{get_troop_enemy(sp[0])}" when 336 "<>Enemy Transform: #{get_troop_enemy(sp[0])}, #{get_enemy(sp[1])}" when 337 "<>Show Battle Animation: #{actors_or_enemies(sp[0], sp[1])}, #{get_animation(sp[2])}" when 338 "<>Deal Damage: #{actors_or_enemies(sp[0], sp[1])}, #{AMOUNT_OP[sp[2]]} #{value_or_var(sp[3], sp[4])}" when 339 "<>Force Action: #{actors_or_enemies(sp[0], sp[1])}, #{get_action(sp[2], sp[3])}, #{get_target(sp[4], sp[5])}" 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[0]}" when 655 ": : #{sp[0]}" 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[Event #%.3d: #{@@current_map.events[si].name}]\n\t\t\n\t\t", si) @@current_map.events[si].pages.each_with_index do |sp, sj| @@output += "\n\t\t\n\t\t[Page ##{sj + 1}]" @@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[Code]\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[Map #%.3d: %s]", 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[CE #%.3d: %s]\n\n", si, so.name) @@output += "Trigger Type: #{TRIGGER_TYPES[so.trigger]}\nSwitch: #{get_switch(so.switch_id)}\n\t\n\t" @@output += "\n\t\n\t\n\t[Code]\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[Troop #%.3d: %s] (%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[Page ##{sj + 1}]" @@output += "\n\t\t\n\t\tCode Size: #{sp.list.size}\n\t\tTrigger Span: #{TROOP_SPAN[sp.span]}" @@output += "\n\t\t\n\t\t\n\t\t[Code]\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 = "[rv20220318] © 2022 KotatsuAkira" @@text_ver.bitmap.draw_text(0, 0, 640, 24, st, 1) st = "Press [L+R] to start or [B] 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[sk]) } @@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 [C] to save to "EventExport.txt" or [B] 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/
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?立即注册
x