I KNOW... IT'S ME AGAIN... SCRIPT QUESTION PLEASE.

Posts

Pages: 1
kitten2021
Returning from RMVX Death
1093
Ok, I know I have posted a lot today, real sorry folks... Takes a LOT of getting use to this scripting thing after being off of it for about 2 or 3 years. I am trying to create a simple enough script, an 'Honor Points', if you will, tracker. I have the scripting and everything set up for the window to appear correctly as shown bellow:

#==============================================================================
# ** Window_Honor
#------------------------------------------------------------------------------
# This window displays the amount of honor.
#==============================================================================

class Winow_Honor < Window_Base
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
#--------------------------------------------------------------------------
def initialize(x, y)
super(x, y, 200, WLH + 32)
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_currency_value($game_party.honor, 4, 0, 120)
end
end

However, in the Scene_Menu scripting, I have the following information present:

#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
@gold_window = Window_Gold.new(0, 360)
@honor_window = Window_Honor.new(0, 250)
@status_window = Window_MenuStatus.new(160, 0)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
@gold_window.dispose
@honor_window.dispose
@status_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@gold_window.update
@honor_window.update
@status_window.update
if @command_window.active
update_command_selection
elsif @status_window.active
update_actor_selection
end
end

Everytime I run my game and open the menu, I receive the following error:

Script 'Scene_Menu' line 23: NameError occurred.
uninitialized constant Scene_Menu::Window_Honor

I am not sure if this means that it does not recognize the menu's name and therefore is requiring me to 'make' the actual window and everything for it (which I thought was done with the first script I made) or if this is stating that the command I am issuing is none functional with the script all together.

Please assist me on this matter, it is greatly appreciated! (Psst... I will try not to bother any of you for the rest of the night, so so so SOO sorry about this.)

Thank you very much,
Kitten2021

(Oh, and how do I insert the script in a seperate window in my question like so many other people are doing? Save's space in the reply's and all if you ask me... Thanks again!)
You have "class Winow_Honor", you're missing the 'd' in window
kitten2021
Returning from RMVX Death
1093
I would like to thank you for catching that error (even though I am embarressed to death by it) but I am afraid all that did was allow a new error to show up:

Script 'Window_Honor' line 22: NoMethodError occured.
undegined method 'honor' for #<Game_Party:0x170a568>

Now that error, makes NO scense to me at all... Please, help... I'm now growing rather desperate... :-/

Thank you for all the help!
Kitten2021

(PS: I can not see anyone's name that is posting, why? No clue, so please at least tell me your name so I made credite you for helping. Thank you.)
The script problem is from the $game_party.honor call: The game_party class doesn't have any definition for honor. If you added "attr_reader :honor" or "attr_accessor :honor" then the script would work since the game_party class has a definition for honor. You can also use

def honor
return 0 (or other code here)
end


To give game_party a definition for honor.

My suggestion would be to add

class Game_Party
def honor
return $game_variables[whatever varible will keep track of the party's honor]
end
end


This will fix your current code, any time a script needs the party honors you just call $game_party.honor, and making changes to getting the party's honor is as simple as changing a single script function for the future. Plus since it uses $game_variables you can easily change the party's honor through event commands.

Also RMN pisses in the eye of older browsers. If you can't see user names you probably have to update Internet Explorer/whatever Internet browser you use
kitten2021
Returning from RMVX Death
1093
Wow, ok... Let me give it a try. I will edit my message if it works! :) Thanks a bunch! BRB

EDIT:
Sweet mercifull goodness! 8-D
It worked! I can not thank you enough!! Thank you very, very VERY much! :)

What is your user name so I may credit you for that? :)
(BTW, I usually use Mozilla Firefox, but its currently having issues of its own, so I'm using an older version of Explorer... :-/ I kind of figured it was this thing that was causing the issue..)

Thank you very much again, your name shall be added to my credits,
Kitten2021
Don't worry about adding me to your credits, I'm just glad it works well for you

ps I'm GreatRedSpirit
kitten2021
Returning from RMVX Death
1093
Well then, thank you GreatRedSpirit. :)
Pages: 1