I don't know very much about RGSS or Ruby, but I decided I would try to write a very simple script. What it does is, it makes an option in the menu called "Help". When you go to it, it has a little summary of what you're supposed to be doing at that point in the game. In order to change what this text says, you just use a script call and change a variable. Unfortunately, I'm getting an error.
#===========================================================================
# *** Help Menu ***
# *** Version 1.0
#---------------------------------------------------------------------------
# by lonely_cubone
#---------------------------------------------------------------------------
# Insert somewhere between the default scripts and main
#=============================================================================
#
# To set the help settings, use the following code:
# $helpsettings.help_title = "Title"
# $helpsettings.help_info = "Information"
#
# Replace the strings with whatever you want to say.
#
#==============================================================================
# ** HelpSettings
#------------------------------------------------------------------------------
# This class stores the values for the help menu.
#==============================================================================
class HelpSettings
attr_accessor :help_title
attr_accessor :help_info
def initialize
@help_title = "Eat Pie"
@help_info = "Find some pie, and eat it."
end
end
#==============================================================================
# ** Window_HelpTitle
#------------------------------------------------------------------------------
# This window displays the help title.
#==============================================================================
class Window_HelpTitle < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 22, 608, 32, $HelpSettings.help_title.to_s, 1)
end
end
#==============================================================================
# ** Window_HelpInfo
#------------------------------------------------------------------------------
# This window displays the help information.
#==============================================================================
class Window_HelpInfo < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 96, 640, 384)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(0, 22, 608, 32, $helpsettings.help_info.to_s, 1)
end
end
#==============================================================================
# ** Scene_Help
#------------------------------------------------------------------------------
# This class handles help screen processing.
#==============================================================================
class Scene_Help
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make main window
HelpSettings.new
HelpSettings.initialize
@title_window = Window_HelpTitle.new
@info_window = Window_HelpInfo.new
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
update
# Abort loop if screen is changed
if $scene != self
break
end
end
# Prepare for transition
Graphics.freeze
# Dispose of windows
@title_window.dispose
@info_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to menu screen
$scene = Scene_Menu.new(0)
return
end
end
end
The error says " Script 'Help Menu' line 95: NoMethodError occurred. private method 'initialize' called for HelpSettings:Class" and it occurs when Scene_Help is called (I added it to the menu inside Scene_Menu, because I have no clue how to from another script).
I'm sure most of my coding is really inefficient, because I know very little about what I'm doing. I can't figure out why it is that this one method is private, when my other ones aren't (I've commented out sections of the code to just draw the windows, and it works fine). I'm sure it's just something stupid. And please, although it would probably be easier than explaining this, don't just write the script for me. I'm trying to learn how to write a simple script like this.