GideonNorel
Member
Hey all,
Hoping someone can assist.
Attempting to do a little scripting in RMXP, but having issues with a conflict between, what looks like, Windows_Command and Dargor's Command Manager (I am also using Cogwheel's RTAB 1.16, and the error, so far, only happens at the start of a battle). Windows_Command returns a TypeError Line 41: cannot convert nil to String.
Here's the Command Manager code, a little modified as to not cause issues with SDK.
If there's anything else, let me know.
Gideon.
khmp: Code goes in code tags. You can delete this line when you see it.
Hoping someone can assist.
Attempting to do a little scripting in RMXP, but having issues with a conflict between, what looks like, Windows_Command and Dargor's Command Manager (I am also using Cogwheel's RTAB 1.16, and the error, so far, only happens at the start of a battle). Windows_Command returns a TypeError Line 41: cannot convert nil to String.
Here's the Command Manager code, a little modified as to not cause issues with SDK.
Code:
#==============================================================================
# ** Commands Manager
#------------------------------------------------------------------------------
# Author: Dargor
# Version 1.0
# 25/06/2007
#==============================================================================
# * Instructions
#------------------------------------------------------------------------------
# - To add a command to the command window use:
# @command_window.add_command("command")
# - To remove a command to the command window use:
# @command_window.remove_command("command")
# - To rearrange the commands in the command window use:
# @command_window.set_commands(["cmd1","cmd2","cmd3"...])
# - You can also rearrange the default menu commands using:
# $game_system.menu_commands = ["cmd1","cmd2","cmd3"...]
#------------------------------------------------------------------------------
# * Note
#------------------------------------------------------------------------------
# - This script rewrites the update_command and update_status methods
# in Scene_Menu.
#==============================================================================
#==============================================================================
# ** Game_System
#------------------------------------------------------------------------------
# This class handles data surrounding the system. Backround music, etc.
# is managed here as well. Refer to "$game_system" for the instance of
# this class.
#==============================================================================
class Game_System
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :default_commands # default commands
attr_accessor :menu_commands # menu commands
end
#==============================================================================
# ** Window_Command
#------------------------------------------------------------------------------
# This window deals with general command choices.
#==============================================================================
class Window_Command < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_accessor :commands # commands
#--------------------------------------------------------------------------
# * Add Command (command)
#--------------------------------------------------------------------------
def add_command(commands)
return if @commands.include?(commands)
@commands.push(commands)
@item_max = @commands.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.height = 32 + (32 * 6)
end
#--------------------------------------------------------------------------
# * Remove Command (command)
#--------------------------------------------------------------------------
def remove_command(commands)
@commands.delete(commands)
@item_max = @commands.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.height = 32 + (32 * 6)
end
#--------------------------------------------------------------------------
# * Set Commands (commands)
#--------------------------------------------------------------------------
def set_commands(commands)
return if commands == [] or commands == nil
@commands = commands
@item_max = @commands.size
self.contents = Bitmap.new(width - 32, @item_max * 32)
refresh
self.height = 32 + (32 * 6)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs menu screen processing.
#==============================================================================
class Scene_Menu
#--------------------------------------------------------------------------
# * Alias listing
#--------------------------------------------------------------------------
alias add_remove_command_main main
alias add_remove_command_update update
#--------------------------------------------------------------------------
# * Main Processing
#--------------------------------------------------------------------------
def main
# Default menu commands
@default_commands = $game_system.default_commands
# Create an empty array of command
@commands = []
# Call the original main method
add_remove_command_main
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
@command_window.set_commands($game_system.menu_commands)
# Set the array equal to the current commands
@commands = @command_window.commands
# Defined the height to make the window scroll
@command_window.height = 6 * 32 + 32
# Call the original update method
add_remove_command_update
end
end
If there's anything else, let me know.
Gideon.
khmp: Code goes in code tags. You can delete this line when you see it.