xgamexfreakx
Member
ok. I'm working on my scripting skills right now, and I made a little script that lets the player define certian options in the game, such as the windowskin. I've been getting a syntax error at the end of the script, which last I checked, meant that I either have one too many, or not enough ends in the script. I've been playing around with both and have not been able to fix this error. I was wondering if anyone could help by helping me fix this problem. I was also wondering if someone would take the time and help me clean up the scirpt and getting working right, (because I'm pretty sure that it is not working right because it is proably the worst script you will ever see...).
This first code goes in the Window section of the scripts. It should define the parameters of the window, correct?
This second script is just an update to Scene_Menu which modifies the menu accept the options choice.
This third script, which is also the one with problems, is the main part of the script and goes in the Scene section.
Thanks in advance for any help i get. Thanks!!
This first code goes in the Window section of the scripts. It should define the parameters of the window, correct?
Code:
#==============================================================================
# ** Window_GameOption
#------------------------------------------------------------------------------
# This window shows options for the games settings.
#==============================================================================
class Window_Help < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
end
#--------------------------------------------------------------------------
# * Set Text
# text : text string displayed in window
# align : alignment (0..flush left, 1..center, 2..flush right)
#--------------------------------------------------------------------------
def set_text(text, align = 0)
# If at least one part of text and alignment differ from last time
if text != @text or align != @align
# Redraw text
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
end
This second script is just an update to Scene_Menu which modifies the menu accept the options choice.
Code:
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
end
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make command window
s1 = $data_system.words.item
s2 = $data_system.words.skill
s3 = $data_system.words.equip
s4 = "Status"
s5 = "Options"
s6 = "Save"
s7 = "End Game"
@command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
@command_window.index = @menu_index
@command_window.x = 0
@command_window.y = 0
# If number of party members is 0
if $game_party.actors.size == 0
# Disable items, skills, equipment, and status
@command_window.disable_item(0)
@command_window.disable_item(1)
@command_window.disable_item(2)
@command_window.disable_item(3)
end
# If save is forbidden
if $game_system.save_disabled
# Disable save
@command_window.disable_item(4)
end
# Make gold window
@gold_window = Window_Gold.new
@gold_window.x = 0
@gold_window.y = 400
# Make location window
@location_window = Window_Location.new
@location_window.x = 480
@location_window.y = 440
# Make status window
@status_window = Window_MenuStatus.new
@status_window.x = 160
@status_window.y = 0
# 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
@command_window.dispose
@gold_window.dispose
@status_window.dispose
@location_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update windows
@command_window.update
@gold_window.update
@status_window.update
@location_window.update
# If command window is active: call update_command
if @command_window.active
update_command
return
end
# If status window is active: call update_status
if @status_window.active
update_status
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when command window is active)
#--------------------------------------------------------------------------
def update_command
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Switch to map screen
$scene = Scene_Map.new
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# If command other than save or end game, and party members = 0
if $game_party.actors.size == 0 and @command_window.index < 4
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Branch by command window cursor position
case @command_window.index
when 0 # item
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to item screen
$scene = Scene_Item.new
when 1 # skill
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make status window active
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 4 # options
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to options screen
$scene = Scene_GameOption.new
when 5 # save
# If saving is forbidden
if $game_system.save_disabled
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to save screen
$scene = Scene_Save.new
when 6 # end game
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to end game screen
$scene = Scene_End.new
end
return
end
end
#--------------------------------------------------------------------------
# * Frame Update (when status window is active)
#--------------------------------------------------------------------------
def update_status
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Make command window active
@command_window.active = true
@status_window.active = false
@status_window.index = -1
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 1 # skill
# If this actor's action limit is 2 or more
if $game_party.actors[@status_window.index].restriction >= 2
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
return
end
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
when 3 # status
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
return
end
end
end
This third script, which is also the one with problems, is the main part of the script and goes in the Scene section.
Code:
#==============================================================================
# ** Scene_GameOption
#------------------------------------------------------------------------------
# This class performs game options screen processing.
#==============================================================================
class Scene_GameOption
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Make Options Window
@game_window = Window_GameOption.new
# Make Options for game
s1 = Windowskin Style
@command_window = Window_Command.new(160, [s1])
@command_window.index = @menu_index
@command_window.x = 20
@command_window.y = 40
# 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
@game_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update window
@game_window.update
update_gameoption
return
end
#--------------------------------------------------------------------------
# * Frame Update (gameoption)
#--------------------------------------------------------------------------
def update_gameoption
# If B button was pressed
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
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window.index
when 0 # Windowskin
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Make new choices
s1 = Style1
s2 = Style2
@command_window2 = Window_Command.new(160, [s1, s2])
@command_window2.index = @menu_index
@command_window2.x = 600
@command_window2.y = 440
# Execute transition
Graphics.transition
# Main loop
loop do
# Update game screen
Graphics.update
# Update input information
Input.update
# Frame update
choiceupdate
# Abort loop if screen is changed
if $scene != self
break
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
# Update window
@game_window.update
update_choiceoption
return
end
#--------------------------------------------------------------------------
# * Frame Update (gameoption)
#--------------------------------------------------------------------------
def update_choiceoption
# If B button was pressed
if Input.trigger?(Input::B)
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
# Exit Choices
update
return
end
# If C button was pressed
if Input.trigger?(Input::C)
# Branch by command window cursor position
case @command_window2.index
when 0 # Windowskin Style1
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set Windowskin
# 001-Blue01
when 1 # Windowskin Style2
# Play decision SE
$game_system.se_play($data_system.decision_se)
# Set Windowskin
# windowskin2
end
return
end
end
end
Thanks in advance for any help i get. Thanks!!