Scripts/Main.rb in rmxp_extractor-1.7 vs Scripts/Main.rb in rmxp_extractor-1.8
- old
+ new
@@ -1,13 +1,50 @@
-# Setup debugger
+#==============================================================================
+# ** Main
+#------------------------------------------------------------------------------
+# After defining each class, actual processing begins here.
+#==============================================================================
-# ENV["RUBY_DEBUG_PORT"] = "12345"
-# require "debug/start"
+at_exit do
+ Wallpaper.reset
+ save unless $game_switches[99] || ($game_system.map_interpreter.running? || !$scene.is_a?(Scene_Map))
+end
-list_path = File.join("Ruby-files/", "_scripts.txt")
-IO.foreach(list_path) do |name|
- name.strip!
- next if name.empty? || name.start_with?("#")
- puts "Loading #{name}"
+begin
+ $console = Graphics.fullscreen
+ Graphics.frame_rate = 60
+ Font.default_size = 20
- require_relative "Ruby-files/#{name}"
+ # Load persistent data
+ Persistent.load
+
+ # Prepare for transition
+ Graphics.freeze
+ $demo = false
+ $GDC = false
+ # Make scene object (title screen)
+ $scene = Scene_Title.new
+ Oneshot.allow_exit false
+ Oneshot.exiting false
+
+# x = Oneshot.textinput("Foo Bar")
+# print("#{x}")
+
+ # Call main method as long as $scene is effective
+ while $scene != nil
+ $scene.main
+ end
+ # Fade out
+ Oneshot.exiting true
+ Graphics.transition(20)
+
+ if Journal.active?
+ Journal.set ''
+ end
+
+ Oneshot.allow_exit true
+rescue Errno::ENOENT
+ # Supplement Errno::ENOENT exception
+ # If unable to open file, display message and end
+ filename = $!.message.sub("No such file or directory - ", "")
+ print("Unable to find file #{filename}.")
end