#==============================================================================
# ** RMXP Standard Development Kit (SDK) - Part I
#------------------------------------------------------------------------------
# Build Date - 2005-11-22
# Version 1.0 - Near Fantastica - 2005-11-22
# Version 1.1 - SephirothSpawn - 2005-12-18 - (Near Fantastica)
# Version 1.2 - Near Fantastica - 2005-12-18 - (Wachunga)
# Version 1.3 - Wachunga - 2005-12-19 - (Near Fantastica)
# Version 1.4 - Prexus - 2006-03-02 - (SephirothSpawn)
# Version 1.5 - Jimme Reashu - 2006-03-25 - (Near Fantastica)
# Version 2.0 - SephirothSpawn / Trickster /
# Der Drake / Sandgolem - 2007-02-22 - (SDK Team)
# Version 2.1 - tibuda /alexanderpas / Mr. Mo - 2007-02-25 - (SephirothSpawn)
# Version 2.2 - SephirothSpawn / Trickster /
# tibuda - 2007-04-04 - (SDK Team)
#==============================================================================
#==============================================================================
# ** SDK
#==============================================================================
module SDK
#--------------------------------------------------------------------------
# * Version & Parts Log
#--------------------------------------------------------------------------
Version = 2.2
Parts = [1]
#--------------------------------------------------------------------------
# * Show Disable Messages
#--------------------------------------------------------------------------
Show_Error_Disable_Message = true
Show_Method_Overwrite_Error = true
#--------------------------------------------------------------------------
# * Script, Alias, Overwrite & Method Branch Log Logging
#
# List : 'script' => [scripter, version, date]
# Enabled : 'script' => boolean
# Aliases : 'script' => [ [class, old, new], ... ]
# Overwrites : 'script' => [ [class, method], ... ]
# Branches : [class, method] => [ method, ... ]
#--------------------------------------------------------------------------
@list = {}
@enabled = {}
@aliases = {}
@overwrites = {}
@method_branch_log = {}
@enabled.default = false
@aliases.default = []
@overwrites.default = []
@last_script = 'SDK'
#--------------------------------------------------------------------------
# * Logs a custom script
#--------------------------------------------------------------------------
def self.log(script, name, ver, date)
# Logs Script
@list[script] = [name, ver, date]
# Enables Script
@enabled[script] = true
# Sets Last Script
@last_script = script
end
#--------------------------------------------------------------------------
# * Logs an alias
#--------------------------------------------------------------------------
def self.log_alias(classname, oldmethodname, newmethodname)
# Gets Value
value = [classname, oldmethodname, newmethodname]
# Convert Values to Symbols
value.collect! { |x| (x.is_a?(Symbol) ? x : x.to_s.to_sym) }
# Creates Array
@aliases[@last_script] = [] unless @aliases.has_key?(@last_script)
# Stop if Method Logged
return if @aliases[@last_script].include?(value)
# Logs Alias
@aliases[@last_script] << value
# Check for overwrites
self.check_for_overwrites(value) if Show_Method_Overwrite_Error
end
#--------------------------------------------------------------------------
# * Logs an overwrite
#--------------------------------------------------------------------------
def self.log_overwrite(classname, methodname)
# Gets Value
value = [classname, methodname]
# Convert Values to Symbols
value.collect! { |x| (x.is_a?(Symbol) ? x : x.to_s.to_sym)}
# Creates Array
@overwrites[@last_script] = [] unless @overwrites.has_key?(@last_script)
# Stop if Overwrite Logged
return if @overwrites[@last_script].include?(value)
# Log Overwrite
@overwrites[@last_script] << value
# Check for aliases
self.check_for_aliases(value) if Show_Method_Overwrite_Error
end
#--------------------------------------------------------------------------
# * Logs an method branch
#--------------------------------------------------------------------------
def self.log_branch(classname, methodname, *sub_methods)
# Creates Key
key = [classname, methodname]
# Convert Values to Symbols
key.collect! { |x| (x.is_a?(Symbol) ? x : x.to_s.to_sym)}
# Creates Sub Method List (if none yet recorded)
@method_branch_log[key] = [] unless @method_branch_log.has_key?(key)
# Adds New Sub Methods
@method_branch_log[key] << sub_methods
# Organize Sub Method List
@method_branch_log[key].flatten!
@method_branch_log[key].uniq!
end
#--------------------------------------------------------------------------
# * Check Requirements
#--------------------------------------------------------------------------
def self.check_requirements(version = 2.2, parts = [1], scripts = [])
# Start Missing Requirements
missing_reqs = {}
# Checks Version
unless Version >= version
missing_reqs[0] = version
end
# Checks Required Part
for part in parts
unless Parts.include?(part)
missing_reqs[1] = parts
break
end
end
# Checks Required Scripts
if scripts.is_a?(Array)
for script in scripts
unless self.enabled?(script)
missing_reqs[2] = [] unless missing_reqs.has_key?(2)
missing_reqs[2] << script
end
end
elsif scripts.is_a?(Hash)
scripts.each do |script, v|
if self.enabled?(script) == false
missing_reqs[2] = [] unless missing_reqs.has_key?(2)
missing_reqs[2] << script
next
else
if @list[script][1] < v
missing_reqs[3] = {} unless missing_reqs.has_key?(3)
missing_reqs[3][script] = v
end
end
end
end
# If Script Needing Disabled
unless missing_reqs.size == 0
# Disable Script
self.disable(@last_script)
# If Show Auto Disable Script Message
if Show_Error_Disable_Message
# Show Error Message
self.auto_disable_script_message(@last_script, missing_reqs)
end
end
end
#--------------------------------------------------------------------------
# * Enabled Test
#--------------------------------------------------------------------------
def self.enabled?(script, version = nil)
if version != nil && @list.has_key?(script)
return false unless @list[script][1] >= version
end
return @enabled[script]
end
#--------------------------------------------------------------------------
# * Enables the passed script
#--------------------------------------------------------------------------
def self.enable(script)
@enabled[script] = true
end
#--------------------------------------------------------------------------
# * Disables the passed script
#--------------------------------------------------------------------------
def self.disable(script)
# Disable Script
@enabled[script] = false
end
#--------------------------------------------------------------------------
# * Returns a list of custom scripts
#--------------------------------------------------------------------------
def self.return_log(script = '')
return script == '' || @list.include?(script) == false ?
self.sorted_log : @list[script]
end
#--------------------------------------------------------------------------
# * Returns a list of enabled scripts
#--------------------------------------------------------------------------
def self.return_enabled_log(script = '')
return script == '' || self.enabled?(script) == false ?
self.sorted_enabled_log : @enabled[script]
end
#--------------------------------------------------------------------------
# * Returns alias log
#--------------------------------------------------------------------------
def self.return_alias_log(script = '')
return script == '' || @list.include?(script) == false ?
self.sorted_alias_log : @aliases[script]
end
#--------------------------------------------------------------------------
def self.return_overwrite_log(script = '')
return script == '' || @list.include?(script) == false ?
self.sorted_alias_log : @aliases[script]
end
#--------------------------------------------------------------------------
# * Writes a list of the custom scripts to a file
#--------------------------------------------------------------------------
def self.write(scripts = self.sorted_log)
# Opens / Creates File & Writes Script Listings
file = File.open('Scripts List.txt', 'wb')
for script in scripts
l = "#{script[0]} : #{script[1]} Version #{script[2]} (#{script[3]})\n"
file.write(l)
end
file.close
end
#--------------------------------------------------------------------------
# * Writes a list of the enabled scripts to a file
#--------------------------------------------------------------------------
def self.write_enabled
self.write(self.sorted_enabled_log)
end
#--------------------------------------------------------------------------
# * Writes a list of the aliases
#--------------------------------------------------------------------------
def self.write_aliases
# Opens / Creates File & Writes Script Listings
file = File.open('Alias List.txt', 'wb')
for sname in @aliases.keys.sort
for a in @aliases[sname]
c, o, n = "Class: #{a[0]}", "Old Name: #{a[1]}", "New Name: #{a[2]}"
file.write("#{sname} - #{c} - #{o} - #{n}\n")
end
end
file.close
end
#--------------------------------------------------------------------------
# * Writes a list of the overwrites
#--------------------------------------------------------------------------
def self.write_overwrites
# Opens / Creates File & Writes Script Listings
file = File.open('Overwrites List.txt', 'wb')
for sname in @overwrites.keys.sort
for o in @overwrites[sname]
file.write("#{sname} - Class: #{o[0]} - Method:#{o[1]}\n")
end
end
file.close
end
#--------------------------------------------------------------------------
# * Sort Script List
#
# sort_type : 0 - Scripter, 1 - Script Name
#--------------------------------------------------------------------------
def self.sorted_log(sort_type = 0)
# Creates Sorted Nested Array
nested = @list.sort do |a, b|
sort_type == 0 ? a[1][0] <=> b [1][0] : a[0] <=> b[0]
end
# Creates Sorted List
lst = []
nested.each do |x|
x.flatten!
lst << ((sort_type == 0 ? [x[1], x[0]] : [x[0], x[1]]) << x[2] << x[3])
end
# Return List
return lst
end
#--------------------------------------------------------------------------
# * Sort Enabled Script List
#
# sort_type : 0 - Scripter, 1 - Script Name
#--------------------------------------------------------------------------
def self.sorted_enabled_log(sort_type = 0)
# Creates Sorted Nested Array
nested = @list.sort do |a, b|
sort_type == 0 ? a[1][0] <=> b [1][0] : a[0] <=> b[0]
end
# Creates Sorted List
lst = []
nested.each do |x|
next unless @enabled[x[0]]
x.flatten!
lst << ((sort_type == 0 ? [x[1], x[0]] : [x[0], x[1]]) << x[2] << x[3])
end
# Return List
return lst
end
#--------------------------------------------------------------------------
# * Show Auto Disable Error Message
#
# Missing Reqs = { type => parameters }
#
# Type 0 : Not High Enough Version
# Parameters : [version_required]
#
# Type 1 : SDK Parts Missing
# Parameters : [part, ...]
#
# Type 2 : Missing Script
# Parameters : [script, ...]
#
# Type 3 : Not High Enough Script Version
# Parameters : {script => version, ...}
#--------------------------------------------------------------------------
def self.auto_disable_script_message(script, missing_reqs)
# Start Message Text
t = 'The following script has been disabled : ' + script
# If Missing Reqs Specified
unless missing_reqs.size == 0
# Adds Message Text
t += ' for the following reasons : '
ta = []
# Pass Through Missing Reqs
missing_reqs.each do |type, parameters|
# Branch By Type
case type
when 0 # Not High Enough SDK Version
ta << 'SDK version not high enough version. Please update to ' +
'at least version ' + parameters.to_s
when 1 # Missing SDK Part
ta << 'You are missing part of the SDK. Please add the following ' +
'parts - ' + parameters.join(' & ')
when 2 # Missing Scripts
parameters.each do |script|
ta << 'Script missing - ' + script
end
when 3 # Not High Enough Version
parameters.each do |script, v|
ta << 'Script not high enough version - ' + script +
' (Required ' + v.to_s + 'or higher)'
end
end
end
# Add Message Text
t += ta.join(' ; ')
end
# Print Error Message
p t
end
#--------------------------------------------------------------------------
# * Check for Overwrites
#
# Value = [classname, oldmethodname, newmethodname]
#--------------------------------------------------------------------------
def self.check_for_overwrites(value)
# Pass Through All Method Branches
@method_branch_log.each do |classmethod, submethods|
# If Class name matches & Sub Methods Include Method
if classmethod[0] == value[0] && submethods.include?(value[1])
# Pass Throug All Script Overwrites
@overwrites.each do |script, overwrites|
# Pass Through Overwrite List
overwrites.each do |cm|
# If Method Matches
if classmethod == cm
# Print Error
p 'The following script will not work : ' + @last_script,
'Reason : The (' + script + ') overwrites the ' +
'method ' + cm[1].to_s + ' erasing the branched method ' +
value[1].to_s + ' branched from ' + value[0].to_s + ' that ' +
'the ' + script + ' uses'
return
end
end
end
end
end
end
#--------------------------------------------------------------------------
# * Check for Aliases
#
# Value = [classname, methodname]
#--------------------------------------------------------------------------
def self.check_for_aliases(value)
# Check If Method Ever Aliased
@aliases.each do |script, list|
# Pass Through Alias List
list.each do |con|
# If Class & Method Match
if con[0] == value[0] && con[1] == value[1]
# Print Error
p 'The following script will not work : ' + script,
'Reason : The (' + @last_script + ') overwrites the method ' +
value[1].to_s + ' aliased from ' + "#{con[1]} to #{con[2]}" +
'found in class ' + value[0]
end
end
end
# Pass Through All Method Branches
@method_branch_log.each do |classmethod, submethods|
# If Class name matches & Sub Methods Include Method
if classmethod == value
# Pass Through Aliases
@aliases.each do |script, list|
# Pass Through Alias List
list.each do |con|
# If Sub Methods Include Old Method
if submethods.include?(con[1])
# Print Error
p 'The following script will not work : ' + script,
'Reason : The (' + @last_script + ') overwrites the ' +
'method ' + con[1].to_s + ' erasing the branched method ' +
value[1].to_s + ' branched from ' + value[0].to_s + ' that '+
'the ' + script + ' uses'
end
end
end
end
end
end
#--------------------------------------------------------------------------
# * Evals text from an input source
#--------------------------------------------------------------------------
def self.text_box_input(element, index)
return if index == 0
commands = element.split('|')
eval(commands[index])
end
#--------------------------------------------------------------------------
# * Returns a list of parameters from an event's comments
#--------------------------------------------------------------------------
def self.event_comment_input(*args)
parameters = []
list = *args[0].list
elements = *args[1]
trigger = *args[2]
return nil if list == nil
return nil unless list.is_a?(Array)
for item in list
next unless item.code == 108 || item.code == 408
if item.parameters[0] == trigger
start = list.index(item) + 1
finish = start + elements
for id in start...finish
end
next if !list[id]
parameters.push(list[id].parameters[0])
return parameters
end
end
return nil
end
end
#==============================================================================
# ** SDK::Scene Base
#==============================================================================
class SDK::Scene_Base
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
main_variable # Main Variable Initialization
main_spriteset # Main Spriteset Initialization
main_sprite # Main Sprite Initialization
main_window # Main Window Initialization
main_audio # Main Audio Initialization
main_transition # Main Transition Initialization
loop do # Scene Loop
main_loop # Main Loop
break if main_break? # Break If Breakloop Test
end # End Scene Loop
Graphics.freeze # Prepare for transition
main_dispose # Main Dispose
main_end # Main End
end
#--------------------------------------------------------------------------
# * Main Processing : Variable Initialization
#--------------------------------------------------------------------------
def main_variable ; end
#--------------------------------------------------------------------------
# * Main Processing : Spriteset Initialization
#--------------------------------------------------------------------------
def main_spriteset ; end
#--------------------------------------------------------------------------
# * Main Processing : Sprite Initialization
#--------------------------------------------------------------------------
def main_sprite ; end
#--------------------------------------------------------------------------
# * Main Processing : Window Initialization
#--------------------------------------------------------------------------
def main_window ; end
#--------------------------------------------------------------------------
# * Main Processing : Audio Initialization
#--------------------------------------------------------------------------
def main_audio ; end
#--------------------------------------------------------------------------
# * Main Processing : Transition
#--------------------------------------------------------------------------
def main_transition
Graphics.transition
end
#--------------------------------------------------------------------------
# * Main Processing : Loop
#--------------------------------------------------------------------------
def main_loop
Graphics.update # Update game screen
Input.update # Update input information
main_update # Update scene objects
update # Update Processing
end
#--------------------------------------------------------------------------
# * Main Processing : Break Loop Test
#--------------------------------------------------------------------------
def main_break?
return $scene != self # Abort loop if sceen is changed
end
#--------------------------------------------------------------------------
# * Main Processing : Disposal
#--------------------------------------------------------------------------
def main_dispose
# Passes Through All Instance Variables
self.instance_variables.each do |object_name|
# Evaluates Object
object = eval object_name
# Pass Object To Auto Dispose
auto_dispose(object)
end
end
#--------------------------------------------------------------------------
# * Main Processing : Ending
#--------------------------------------------------------------------------
def main_end ; end
#--------------------------------------------------------------------------
# * Main Processing : Update
#--------------------------------------------------------------------------
def main_update
# Passes Through All Instance Variables
self.instance_variables.each do |object_name|
# Evaluates Object
object = eval object_name
# Pass Object To Auto Update
auto_update(object)
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update ; end
#--------------------------------------------------------------------------
# * Main Processing : Auto Dispose
#--------------------------------------------------------------------------
def auto_dispose(object)
# Return If Object isn't a Hash, Array or Respond to Dispose
return unless object.is_a?(Hash) || object.is_a?(Array) ||
object.respond_to?(:dispose)
# If Hash Object
if object.is_a?(Hash)
object.each do |key, value|
# Pass Key & Value to Auto Dispose
auto_dispose(key) ; auto_dispose(value)
end
return
end
# If Array Object
if object.is_a?(Array)
# Pass All Object to Auto Dispose
object.each {|obj| auto_dispose(obj)}
return
end
# If Responds to Dispose
if object.respond_to?(:dispose)
# If Responds to Disposed? && is Disposed or Responds to Disable
# Dispose and dispose is disabled
if (object.respond_to?(:disposed?) && object.disposed?) ||
(object.respond_to?(:disable_dispose?) && object.disable_dispose?)
# Return
return
end
# Dispose Object
object.dispose
end
end
#--------------------------------------------------------------------------
# * Main Processing : Auto Update
#--------------------------------------------------------------------------
def auto_update(object)
# Return If Object isn't a Hash, Array or Respond to Update
return unless object.is_a?(Hash) || object.is_a?(Array) ||
object.respond_to?(:update)
# If Hash Object
if object.is_a?(Hash)
object.each do |key, value|
# Pass Key & Value to Auto Update
auto_update(key) ; auto_update(value)
end
return
end
# If Array Object
if object.is_a?(Array)
# Pass All Object to Auto Update
object.each {|obj| auto_update(obj)}
return
end
# If Responds to Update
if object.respond_to?(:update)
# If Responds to Disable Update & Update Disabled
if object.respond_to?(:disable_update?) && object.disable_update?
# Return
return
end
# Update Object
object.update
end
end
end
#==============================================================================
# ** Object
#==============================================================================
class Object
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :disable_dispose, :disable_update
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
if @sdk_disableupdate_stack.nil?
alias_method :sdk_disableupdate_object_init, :initialize
@sdk_disableupdate_stack= true
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
# Original Initialization
sdk_disableupdate_object_init
# Turn Disable Flags Off
@disable_dispose, @disable_update = false, false
end
#--------------------------------------------------------------------------
# * Disable Dispose
#--------------------------------------------------------------------------
def disable_dispose?
return @disable_dispose
end
#--------------------------------------------------------------------------
# * Disable Update
#--------------------------------------------------------------------------
def disable_update?
return @disable_update
end
end
#==============================================================================
# ** Module
#==============================================================================
class Module
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
if @sdk_logalias_stack.nil?
alias sdk_aliaslog_aliasmethod alias_method
@sdk_logalias_stack= true
end
#--------------------------------------------------------------------------
# * Alias Method
#--------------------------------------------------------------------------
def alias_method(newmethodname, oldmethodname)
# Log Alias
SDK.log_alias(self, oldmethodname, newmethodname)
# Original Alias Method
sdk_aliaslog_aliasmethod(newmethodname, oldmethodname)
end
end
#==============================================================================
# ** Bitmap
#==============================================================================
class Bitmap
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :disable_dispose
#--------------------------------------------------------------------------
# * Alias Listings
#--------------------------------------------------------------------------
if @sdk_bitmap_stack.nil?
alias_method :sdk_bitmap_init, :initialize
@sdk_bitmap_stack = true
end
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(*args)
# Original Initialization
sdk_bitmap_init(*args)
# Turn Disable Dispose ON
@disable_dispose = true
end
end
#==============================================================================
# ** RPG::Event::Page::Condition
#==============================================================================
class RPG::Event::Page::Condition
#--------------------------------------------------------------------------
# * Conditions Met?
#--------------------------------------------------------------------------
def conditions_met?(map_id, event_id)
# Switch 1 condition confirmation
if @switch1_valid && $game_switches[@switch1_id] == false
return false
end
# Switch 2 condition confirmation
if @switch2_valid && $game_switches[@switch2_id] == false
return false
end
# Variable condition confirmation
if @variable_valid && $game_variables[@variable_id] < @variable_value
return false
end
# Self switch condition confirmation
if @self_switch_valid
key = [map_id, event_id, @self_switch_ch]
if $game_self_switches[key] == false
return false
end
end
# Returns True
return true
end
end
#==============================================================================
# ** Window_Base
#------------------------------------------------------------------------------
# This class is for all in-game windows.
#==============================================================================
class Window_Base
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
return if self.disposed?
# Dispose if window contents bit map is set
if self.contents != nil
self.contents.dispose
end
super
end
end
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :commands
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command(index = self.index)
return @commands[index]
end
#--------------------------------------------------------------------------
# * Commands
#--------------------------------------------------------------------------
def commands=(commands)
# Return if Commands Are Same
return if @commands == commands
# Reset Commands
@commands = commands
# Resets Item Max
item_max = @item_max
@item_max = @commands.size
# If Item Max Changes
unless item_max == @item_max
# Deletes Existing Contents (If Exist)
unless self.contents.nil?
self.contents.dispose
self.contents = nil
end
# Recreates Contents
self.contents = Bitmap.new(width - 32, @item_max * 32)
end
# Refresh Window
refresh
end
end
#==============================================================================
# ** Window_HorizCommand
#------------------------------------------------------------------------------
# This window deals with general command choices. (Horizontal)
#==============================================================================
class Window_HorizCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :commands
attr_accessor :c_spacing
attr_accessor :alignment
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(width, commands, c_spacing = (width - 32) / commands.size)
# Compute window height from command quantity
super(0, 0, width, 64)
@commands = commands
@item_max = commands.size
@column_max = @item_max
@c_spacing = c_spacing
@alignment = 1
self.contents = Bitmap.new(@item_max * @c_spacing, height - 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command(index = self.index)
return @commands[index]
end
#--------------------------------------------------------------------------
# * Commands
#--------------------------------------------------------------------------
def commands=(commands)
# Return if Commands Are Same
return if @commands == commands
# Reset Commands
@commands = commands
# Resets Item Max
item_max = @item_max
@item_max = @commands.size
@column_max = @item_max
# If Item Max Changes
unless item_max == @item_max
# Deletes Existing Contents (If Exist)
unless self.contents.nil?
self.contents.dispose
self.contents = nil
end
# Recreates Contents
self.contents = Bitmap.new(@item_max * @c_spacing, height - 32)
end
# Refresh Window
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index, color)
command = commands[index]
x = index * @c_spacing + 4
self.contents.font.color = color
self.contents.draw_text(x, 0, @c_spacing - 8, 32, command, @alignment)
end
#--------------------------------------------------------------------------
# * Disable Item
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
self.cursor_rect.set(@c_spacing * @index, 0, @c_spacing, 32)
end
end
#==============================================================================
# ** Window_SaveFile
#------------------------------------------------------------------------------
# This window displays save files on the save and load screens.
#==============================================================================
class Window_SaveFile < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# file_index : save file index (0-3)
# filename : file name
#--------------------------------------------------------------------------
def initialize(file_index, filename)
super(0, 64 + file_index % 4 * 104, 640, 104)
self.contents = Bitmap.new(width - 32, height - 32)
@file_index = file_index
@filename = filename
@time_stamp = Time.at(0)
@file_exist = FileTest.exist?(@filename)
if @file_exist
file = File.open(@filename, "r")
@time_stamp = file.mtime
@characters = Marshal.load(file)
@frame_count = Marshal.load(file)
@game_system = Marshal.load(file)
@game_switches = Marshal.load(file)
@game_variables = Marshal.load(file)
@total_sec = @frame_count / Graphics.frame_rate
file.close
end
refresh
@selected = false
end
end
#==============================================================================
# ** Interpreter
#------------------------------------------------------------------------------
# This interpreter runs event commands. This class is used within the
# Game_System class and the Game_Event class.
#==============================================================================
class Interpreter
#--------------------------------------------------------------------------
# * Script
#--------------------------------------------------------------------------
def command_355
# Set first line to script
script = @list[@index].parameters[0] + "\n"
# Loop
loop do
# If next event command is second line of script or after
if @list[@index+1].code == 655
# Add second line or after to script
script += @list[@index+1].parameters[0] + "\n"
# If event command is not second line or after
else
# Abort loop
break
end
# Advance index
@index += 1
end
# Evaluation
eval(script)
# Continue
return true
end
end