Hey!
I'm new to scripting, I just began a few weeks ago, and I'm actually trying to make my own menu for my game.
My problem is that I want to do some sort of a helpbox, thit if the cursor is on a given symbol, it says something. How do I do this? I searched everywhere in the documentation, but no one talks about current symbols or help windows.
I know that this exist, because helpbox exist.
So could someone be gentle enough to help me out? ^^
# Creates your command window# replace 'Command_Window_Class' with the # class name for your command window..# NOTE: you ay need to provide new parameters# within the new method, depending on the class..@command_window = Command_Window_Class.new# Checks command winows current symbol# and processes differently for each case @command_window.current_symbolwhen :command_one then # do some crapwhen :command_two then # do some other crapendHows that? 🙂
Thanks! 😀
But is there any way to retrieve the number in a variable?
I am doing a Save system, so if the save attached to the symbol exist, the help windows says that it actually exist, if not, then it will say the opposite.
If there is no way to do this, I'll use what you gave me,
Thanks a lot anyway 😀 .
the number? I assume you mean the command number that is currently selected?
You can use @command_window.index for that. 🙂
Seriously? I actually thought that was the window's ID x)
Thank you!
I'll try these out, and tell you if it worked 😀
The window ID? Not sure what you mean by that, there is a few things that one could consider the window 'id', such as...
# Ruby Object ID@command_window.object_id# Windows Class Name@command_window.class.name 🙂
Question how are you calling your update_help method?
It could be your only updating it once thus it will only show the first index.
I'm calling it in the def start of the menu
Indeed, I think that's the problem, but, what should I do to update it at every frame?
I would suggest in the update_cursor method have a line that says something like this:
if @index != last_index update_helpendCause you only really want to call it if the index has changed.
If you are adding that code into your command window class (like you should do), you don't need the '@command_windowsave.' before the current_symbol.
And I see you are using numbers for arguments in the methods inside the case statements...
That means you can simplify that part by a lot simply by doing this:
def update_help helptext(index)endYeah, a one liner. 😀 Also your arguments are higher than you need, than you decide to subtract 1 from them?
Nahh, don't do that! You can use 0 as an argument too, so the code should look like the above example, and remove that -1 from the 'make_filename' argument.
The text you try to draw is not coded correctly either.
It should be:
text = sprintf("A save already exist here %02d",idsave)Same for the other one, use sprintf in these cases.The 'update_help' method is a default, built-in method for any selectable windows and will update the assigned help window every time the index of the command window changes.
To use it, you must assign a help window for your command window in your scene class.
Assigning it is a one liner:
@command_window.help_window = @help_windowNote that the help window must be initialized in the scene before you can call that line.When you assigned the help window, you can change the default 'update_help' to anything you like, and whatever you add in there will be executed every time the cursor changes it's position.
I must still be sleepy to have forgotten where the update_help method was located (and a default method at that)... 😛
Thank you all! I'm going to try this out ^^
The +1 addition was my error I think ^_^
Oh ok, I finally got this working. The problem is that I put the update_help in the Scene_Menu. I put it in the Window class, and now, it works!
Thank you all!