diff --git a/Data/Scripts/001_Technical/001_Debugging/002_DebugConsole.rb b/Data/Scripts/001_Technical/001_Debugging/002_DebugConsole.rb index 9b382213b..e5f181433 100644 --- a/Data/Scripts/001_Technical/001_Debugging/002_DebugConsole.rb +++ b/Data/Scripts/001_Technical/001_Debugging/002_DebugConsole.rb @@ -87,6 +87,13 @@ module Console echoln "" end + # Same as echoln_li but text is in green + def echoln_li_done(msg) + self.echo_li(markup_style(msg, text: :green), 0, :green) + echoln "" + echoln "" + end + # paragraph with markup def echo_p(msg) echoln markup(msg) @@ -170,7 +177,7 @@ module Console options_pool = options.select { |key, val| font_options.key?(key) && val } markup_pool = options_pool.keys.map { |opt| font_options[opt] }.join(";").squeeze # return formatted string - "\e[#{code_bg};#{markup_pool};#{code_text}m#{string}\e[0m".squeeze(";") + return "\e[#{code_bg};#{markup_pool};#{code_text}m#{string}\e[0m".squeeze(";") end #----------------------------------------------------------------------------- diff --git a/Data/Scripts/001_Technical/005_PluginManager.rb b/Data/Scripts/001_Technical/005_PluginManager.rb index 549ed7375..7eca8c3fd 100644 --- a/Data/Scripts/001_Technical/005_PluginManager.rb +++ b/Data/Scripts/001_Technical/005_PluginManager.rb @@ -295,7 +295,7 @@ module PluginManager def self.error(msg) Graphics.update t = Thread.new do - Console.echo_error "Plugin Error:\r\n#{msg}" + Console.echo_error("Plugin Error:\r\n#{msg}") print("Plugin Error:\r\n#{msg}") Thread.exit end @@ -594,7 +594,7 @@ module PluginManager # Check if plugins need compiling #----------------------------------------------------------------------------- def self.compilePlugins(order, plugins) - Console.echo_li "Compiling plugin scripts..." + Console.echo_li("Compiling plugin scripts...") scripts = [] # go through the entire order one by one order.each do |o| @@ -617,20 +617,19 @@ module PluginManager # collect garbage GC.start Console.echo_done(true) - echoln "" if scripts.length == 0 end #----------------------------------------------------------------------------- # Check if plugins need compiling #----------------------------------------------------------------------------- def self.runPlugins - Console.echo_h1 "Checking plugins" + Console.echo_h1("Checking plugins") # get the order of plugins to interpret order, plugins = self.getPluginOrder # compile if necessary if self.needCompiling?(order, plugins) self.compilePlugins(order, plugins) else - Console.echoln_li "Plugins were not compiled." + Console.echoln_li("Plugins were not compiled") end # load plugins scripts = load_data("Data/PluginScripts.rxdata") @@ -639,7 +638,7 @@ module PluginManager # get the required data name, meta, script = plugin if !meta[:essentials] || !meta[:essentials].include?(Essentials::VERSION) - Console.echo_warn "Plugin '#{name}' may not be compatible with Essentials v#{Essentials::VERSION}. Trying to load anyway." + Console.echo_warn("Plugin '#{name}' may not be compatible with Essentials v#{Essentials::VERSION}. Trying to load anyway.") end # register plugin self.register(meta) @@ -655,7 +654,7 @@ module PluginManager # try to run the code begin eval(code, TOPLEVEL_BINDING, fname) - Console.echoln_li "Loaded plugin: ==#{name}== (ver. #{meta[:version]})" if !echoed_plugins.include?(name) + Console.echoln_li("Loaded plugin: ==#{name}== (ver. #{meta[:version]})") if !echoed_plugins.include?(name) echoed_plugins.push(name) rescue Exception # format error message to display self.pluginErrorMsg(name, sname) @@ -664,10 +663,9 @@ module PluginManager end end if scripts.length > 0 - echoln "" - Console.echo_h2("Successfully loaded #{scripts.length} plugin(s)", text: :green) + Console.echoln_li_done("Successfully loaded #{scripts.length} plugin(s)") else - Console.echo_h2("No plugins found", text: :green) + Console.echoln_li_done("No plugins found") end end #----------------------------------------------------------------------------- diff --git a/Data/Scripts/002_Save data/003_SaveData_Conversion.rb b/Data/Scripts/002_Save data/003_SaveData_Conversion.rb index 9131f13a9..40a6e70c0 100644 --- a/Data/Scripts/002_Save data/003_SaveData_Conversion.rb +++ b/Data/Scripts/002_Save data/003_SaveData_Conversion.rb @@ -195,14 +195,13 @@ module SaveData conversions_to_run = self.get_conversions(save_data) return false if conversions_to_run.none? File.open(SaveData::FILE_PATH + ".bak", "wb") { |f| Marshal.dump(save_data, f) } - Console.echo_h1 "Running #{conversions_to_run.length} save file conversions" + Console.echo_h1(_INTL("Converting save file")) conversions_to_run.each do |conversion| - Console.echo_li "#{conversion.title}..." + Console.echo_li("#{conversion.title}...") conversion.run(save_data) Console.echo_done(true) end - echoln "" if conversions_to_run.length > 0 - Console.echo_h2("All save file conversions applied successfully", text: :green) + Console.echoln_li_done(_INTL("Successfully applied #{conversions_to_run.length} save file conversion(s)")) save_data[:essentials_version] = Essentials::VERSION save_data[:game_version] = Settings::GAME_VERSION return true diff --git a/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb b/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb index d76f36254..9a6dd6cae 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/003_Debug_MenuExtraCode.rb @@ -705,7 +705,7 @@ def pbDebugFixInvalidTiles t = Time.now.to_i Graphics.update total_maps = mapData.mapinfos.keys.length - Console.echo_h1 _INTL("Checking {1} maps for invalid tiles", total_maps) + Console.echo_h1(_INTL("Checking {1} maps for invalid tiles", total_maps)) mapData.mapinfos.keys.sort.each do |id| if Time.now.to_i - t >= 5 Graphics.update @@ -738,7 +738,7 @@ def pbDebugFixInvalidTiles end next if map_errors == 0 # Map was changed; save it - Console.echoln_li _INTL("{1} error tile(s) found on map {2}: {3}.", map_errors, id, mapData.mapinfos[id].name) + Console.echoln_li(_INTL("{1} error tile(s) found on map {2}: {3}.", map_errors, id, mapData.mapinfos[id].name)) total_errors += map_errors num_error_maps += 1 mapData.saveMap(id) @@ -749,7 +749,7 @@ def pbDebugFixInvalidTiles else echoln "" Console.echo_h2(_INTL("Done. {1} errors found and fixed.", total_errors), text: :green) - Console.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.") + Console.echo_warn(_INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")) echoln "" pbMessage(_INTL("{1} error(s) were found across {2} map(s) and fixed.", total_errors, num_error_maps)) pbMessage(_INTL("Close RPG Maker XP to ensure the changes are applied properly.")) diff --git a/Data/Scripts/020_Debug/003_Debug menus/008_Debug_FilenameUpdater.rb b/Data/Scripts/020_Debug/003_Debug menus/008_Debug_FilenameUpdater.rb index f4abbcc07..3b4d43de6 100644 --- a/Data/Scripts/020_Debug/003_Debug menus/008_Debug_FilenameUpdater.rb +++ b/Data/Scripts/020_Debug/003_Debug menus/008_Debug_FilenameUpdater.rb @@ -17,7 +17,7 @@ module FilenameUpdater def rename_berry_plant_charsets src_dir = "Graphics/Characters/" return false if !FileTest.directory?(src_dir) - Console.echo_li _INTL("Renaming berry tree charsets...") + Console.echo_li(_INTL("Renaming berry tree charsets...")) ret = false # generates a list of all graphic files files = readDirectoryFiles(src_dir, ["berrytree*.png"]) @@ -38,7 +38,7 @@ module FilenameUpdater mapData = Compiler::MapData.new t = Time.now.to_i Graphics.update - Console.echo_li _INTL("Checking {1} maps for used berry tree charsets...", mapData.mapinfos.keys.length) + Console.echo_li(_INTL("Checking {1} maps for used berry tree charsets...", mapData.mapinfos.keys.length)) idx = 0 mapData.mapinfos.keys.sort.each do |id| echo "." if idx % 20 == 0 @@ -71,19 +71,19 @@ module FilenameUpdater end def rename_files - Console.echo_h1 "Updating file names and locations" + Console.echo_h1(_INTL("Updating file names and locations")) change_record = [] # Add underscore to berry plant charsets if rename_berry_plant_charsets - Console.echo_warn _INTL("Berry plant charset files were renamed.") + Console.echo_warn(_INTL("Berry plant charset files were renamed.")) end change_record += update_berry_tree_event_charsets # Warn if any map data has been changed if !change_record.empty? - change_record.each { |msg| Console.echo_warn msg } - Console.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.") + change_record.each { |msg| Console.echo_warn(msg) } + Console.echo_warn(_INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")) end echoln "" - Console.echo_h2("Finished updating file names and locations", text: :green) + Console.echo_h2(_INTL("Finished updating file names and locations"), text: :green) end end diff --git a/Data/Scripts/021_Compiler/001_Compiler.rb b/Data/Scripts/021_Compiler/001_Compiler.rb index 0586a5d63..ab2e6edc3 100644 --- a/Data/Scripts/021_Compiler/001_Compiler.rb +++ b/Data/Scripts/021_Compiler/001_Compiler.rb @@ -740,12 +740,12 @@ module Compiler #============================================================================= def compile_pbs_file_message_start(filename) # The `` around the file's name turns it cyan - Console.echo_li _INTL("Compiling PBS file `{1}`...", filename.split("/").last) + Console.echo_li(_INTL("Compiling PBS file `{1}`...", filename.split("/").last)) end def write_pbs_file_message_start(filename) # The `` around the file's name turns it cyan - Console.echo_li _INTL("Writing PBS file `{1}`...", filename.split("/").last) + Console.echo_li(_INTL("Writing PBS file `{1}`...", filename.split("/").last)) end def process_pbs_file_message_end @@ -780,25 +780,25 @@ module Compiler end def compile_all(mustCompile) + Console.echo_h1(_INTL("Checking game data")) if !mustCompile - Console.echo_h1(_INTL("Game did not compile data")) + Console.echoln_li(_INTL("Game data was not compiled")) + echoln "" return end FileLineData.clear - Console.echo_h1 _INTL("Compiling all data") compile_pbs_files compile_animations compile_trainer_events(mustCompile) - Console.echo_li _INTL("Saving messages...") + Console.echo_li(_INTL("Saving messages...")) pbSetTextMessages MessageTypes.saveMessages MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat") Console.echo_done(true) - Console.echo_li _INTL("Reloading cache...") + Console.echo_li(_INTL("Reloading cache...")) System.reload_cache Console.echo_done(true) - echoln "" - Console.echo_h2("Successfully compiled all data", text: :green) + Console.echoln_li_done(_INTL("Successfully compiled all game data")) end def main diff --git a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb index 5c4c878ff..92c24bf0e 100644 --- a/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb +++ b/Data/Scripts/021_Compiler/002_Compiler_CompilePBS.rb @@ -1956,7 +1956,7 @@ module Compiler # Compile battle animations #============================================================================= def compile_animations - Console.echo_li _INTL("Compiling animations...") + Console.echo_li(_INTL("Compiling animations...")) begin pbanims = load_data("Data/PkmnAnimations.rxdata") rescue diff --git a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb index 0219d72f5..6d9b68116 100644 --- a/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb +++ b/Data/Scripts/021_Compiler/003_Compiler_WritePBS.rb @@ -962,7 +962,7 @@ module Compiler # Save all data to PBS files #============================================================================= def write_all - Console.echo_h1 _INTL("Writing all PBS files") + Console.echo_h1(_INTL("Writing all PBS files")) write_town_map write_connections write_types @@ -986,6 +986,6 @@ module Compiler write_dungeon_parameters write_phone echoln "" - Console.echo_h2("Successfully rewrote all PBS files", text: :green) + Console.echo_h2(_INTL("Successfully rewrote all PBS files"), text: :green) end end diff --git a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb index 9689bf171..ecf2107be 100644 --- a/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb +++ b/Data/Scripts/021_Compiler/004_Compiler_MapsAndEvents.rb @@ -1681,7 +1681,7 @@ module Compiler Graphics.update trainerChecker = TrainerChecker.new change_record = [] - Console.echo_li _INTL("Processing {1} maps...", mapData.mapinfos.keys.length) + Console.echo_li(_INTL("Processing {1} maps...", mapData.mapinfos.keys.length)) idx = 0 mapData.mapinfos.keys.sort.each do |id| echo "." if idx % 20 == 0 @@ -1725,11 +1725,11 @@ module Compiler end end Console.echo_done(true) - change_record.each { |msg| Console.echo_warn msg } + change_record.each { |msg| Console.echo_warn(msg) } changed = false Graphics.update commonEvents = load_data("Data/CommonEvents.rxdata") - Console.echo_li _INTL("Processing common events...") + Console.echo_li(_INTL("Processing common events...")) commonEvents.length.times do |key| newevent = fix_event_use(commonEvents[key], 0, mapData) if newevent @@ -1740,7 +1740,7 @@ module Compiler save_data(commonEvents, "Data/CommonEvents.rxdata") if changed Console.echo_done(true) if change_record.length > 0 || changed - Console.echo_warn _INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.") + Console.echo_warn(_INTL("RMXP data was altered. Close RMXP now to ensure changes are applied.")) end end end