Top Level Namespace
Defined Under Namespace
Modules: Audio, Graphics, Input, RPG Classes: Bitmap, Color, Font, Plane, RGSSError, RGSSReset, Rect, Sprite, Table, Tilemap, Tone, Viewport, Window
Instance Method Summary (collapse)
-
- (Object) load_data(filename)
Loads data from a file and constructs an object from the data.
-
- (nil) msgbox(arg = nil, *args)
Displays a message box with the values of the arguments passed into this method.
-
- (nil) msgbox_p(obj, *objs)
Displays objects in a human-readable format in a message box.
-
- (nil) rgss_main { ... }
Evaluates the provided block one time only.
-
- (void) rgss_stop
Stops execution and causes the game window to repeatedly redraw.
-
- (nil) save_data(obj, filename)
Saves an object to a file.
Instance Method Details
- (Object) load_data(filename)
Loads data from a file and constructs an object from the data. This method
is functionally equivalent to using Marshal.load
on a
file's contents. However, this method also supports loading files from
within encrypted archives.
36 37 38 39 40 |
# File 'lib/functions.rb', line 36 def load_data(filename) File.open(filename, 'rb') do |f| Marshal.load(f) end end |
- (nil) msgbox(arg = nil, *args)
Displays a message box with the values of the arguments passed into this
method. The arguments will be concatenated together without a separator.
Any arguments that are not a string will have #to_s
called on
them.
71 72 73 |
# File 'lib/functions.rb', line 71 def msgbox(arg = nil, *args) fail NotImplementedError end |
- (nil) msgbox_p(obj, *objs)
Displays objects in a human-readable format in a message box. The message
box is identical to the one presented by ##msgbox. The difference is that
this method calls #inspect
on all of the arguments and
concatenates them together with new-lines.
90 91 92 |
# File 'lib/functions.rb', line 90 def msgbox_p(obj, *objs) msgbox obj.inspect, "\n", *(objs.flat_map { |obj| [obj, "\n"] }[0...-1]) end |
- (nil) rgss_main { ... }
Evaluates the provided block one time only. Detects a reset within the block caused by a user pressing the F12 key and re-runs the block in the event of a reset. This method is usually placed after all of the other scripts. It is essentially the entry-point to the game.
10 11 12 |
# File 'lib/functions.rb', line 10 def rgss_main(&block) fail NotImplementedError end |
- (void) rgss_stop
This does not return and will not cause #rgss_main to return either. The only way to abort out of this method is to reset the game (F12).
This method returns an undefined value.
Stops execution and causes the game window to repeatedly redraw. Any pending graphics effects (such as transitions) will finish.
23 24 25 |
# File 'lib/functions.rb', line 23 def rgss_stop loop { Graphics.update } end |
- (nil) save_data(obj, filename)
Saves an object to a file. The data stored in the file can be loaded again by using #load_data.
51 52 53 54 55 56 |
# File 'lib/functions.rb', line 51 def save_data(obj, filename) File.open(filename, 'wb') do |f | Marshal.dump(obj, f) end nil end |