RGSS3 current_window_symbol

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 🙂
Hey! So I tried the two ways you gave me, and none works :/

Here is my code:

 

def update_help case @command_windowsave.current_symbol when :save1 then helptext(1) when :save2 then helptext(2) when :save3 then helptext(3) when :save4 then helptext(4) when :save5 then helptext(5) when :save6 then helptext(6) when :save7 then helptext(7) when :save8 then helptext(8) when :save9 then helptext(9) when :save10 then helptext(10) end end def helptext(idsave) if File.exists?(DataManager.make_filename(idsave-1)) text = "A save already exist here%02d",idsave @help_window.set_text(text) else text = "Empty%02d", idsave @help_window.set_text(text) endHere is what it gives me IG:

http://image.noelshack.com/fichiers/2015/29/1437064363-savetest.png

As you can see, the case always return "1", even if I am on another command :/
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)... 😛
I dont know how you have things setup, but it should be somewhat similar to this..

Spoiler
Code:
#==============================================================================# ** Window_CommandThing#------------------------------------------------------------------------------class Window_CommandThing < Window_Command  #--------------------------------------------------------------------------  # * Object Initialization  #--------------------------------------------------------------------------  def initialize    x = 120    y = 120    super(x, y)  end  #--------------------------------------------------------------------------  # * Get Window Width  #--------------------------------------------------------------------------  def window_width    return 180  end  #--------------------------------------------------------------------------  # * Update   #--------------------------------------------------------------------------  def update    super    update_helptext  end  #--------------------------------------------------------------------------  # Gets Helptext  #--------------------------------------------------------------------------  def helptext    @helptext || "ERROR: No Help Text Found!"  end  #--------------------------------------------------------------------------  # Update Window Helptext  #--------------------------------------------------------------------------  def update_helptext    return unless @helpindx != index    @helpindx = index    if FileText.exists?(DataManager.make_filename(index+1))      @helptext = ("A save already exist here %02d" % index+1)    else      @helptext = ("Empty %02d" % index+1)    end    end  #--------------------------------------------------------------------------  # * Create Command List  #--------------------------------------------------------------------------  def make_command_list    max_saves = 10    max_saves::times do |index|      add_command("Save %02d" % index, :save)    end  end  # End Classend#==============================================================================# ** Scene_SceneThing#------------------------------------------------------------------------------class Scene_SceneThing < Scene_MenuBase  #--------------------------------------------------------------------------  # * Start Processing  #--------------------------------------------------------------------------  def start    super    @command_window = Window_CommandThing.new    @command_window.set_handler(:save,method(:handle_save))    @command_window.set_handler(:cancel,method(:return_scene))  end  #--------------------------------------------------------------------------  # * Handle Saves  #--------------------------------------------------------------------------  def handle_save    # Do some stuffz..    @command_window.actvate  end  #--------------------------------------------------------------------------  # * Update Crap  #--------------------------------------------------------------------------  def update    super    # I never defined the @help_window, I assume this would be done    # within your version of the script.     @help_window.set_text(@command_window.helptext) if @help_window  end  # End Classend
Thank you all! I'm going to try this out ^^
Doing it this way:

Spoiler
class Window_SaveSelection < Window_Command def update_help if File.exists?(DataManager.make_filename(index)) text = sprintf("A save already exist here %02d",index+1) else text = sprintf("Empty %02d", index+1) end @help_window.set_text(text) end endclass Scene_CustomSave def start super create_help_win create_command_win end def create_help_win @helpy = Window_Help.new end def create_command_win @command = Window_SaveSelection.new # add your handlers here too... @command.help_window = @helpy end end
Is much simpler, in my opinion, and it is automated, no need to type in any extra checks, no need to touch so many methods either.

(I left out the irrelevant stuffs, like making the command list and so on, because it seems that part is already done in your code judging by that screenshot.)

But why would you check for 'File.exists?(DataManager.make_filename(index+1))' instead of 'File.exists?(DataManager.make_filename(index))' ?

That method called from the DataManager already adds +1 to the passed argument, so if the argument is 1, it would check for the file named "Save02" and not for "Save01".

If you got a reason for doing that, disregard my question. 😛
The +1 addition was my error I think ^_^
Okay, so, I might be really dumb, but I still don't get why I can't get this working :/

Here is my code:
 
 

Spoiler
#==============================================================================# ** Window_MenuCommand#------------------------------------------------------------------------------# This command window appears on the menu screen.#==============================================================================class Window_SaveCommand < Window_Command#--------------------------------------------------------------------------# * Initialize Command Selection Position (Class Method)#--------------------------------------------------------------------------def self.init_command_position@@last_command_symbol = nilend#--------------------------------------------------------------------------# * Object Initialization#--------------------------------------------------------------------------def initializesuper(150, 100)end#--------------------------------------------------------------------------# * Get Window Width#--------------------------------------------------------------------------def window_widthreturn 160end#--------------------------------------------------------------------------# * Update#--------------------------------------------------------------------------def updatesuperupdate_helpend#--------------------------------------------------------------------------# Gets Helptext#--------------------------------------------------------------------------def help@helptext || "ERROR: No Help Text Found!"end#--------------------------------------------------------------------------# Update Window Helptext#--------------------------------------------------------------------------def update_helpreturn unless @helpindx != index@helpindx = indexif File.exists?(DataManager.make_filename(index+1))@help = ("A save already exist here")else@help = ("Empty")endend#--------------------------------------------------------------------------# * Get Number of Lines to Show#--------------------------------------------------------------------------def visible_line_numberitem_maxend#--------------------------------------------------------------------------# * Create Command List#--------------------------------------------------------------------------def make_command_listadd_main_commandsend#--------------------------------------------------------------------------# * Add Main Commands to List#--------------------------------------------------------------------------def add_main_commandsadd_command("Save 1", :save1, save_enabled)add_command("Save 2", :save2, save_enabled)add_command("Save 3", :save3, save_enabled)add_command("Save 4", :save4, save_enabled)add_command("Save 5", :save5, save_enabled)add_command("Save 6", :save6, save_enabled)add_command("Save 7", :save7, save_enabled)add_command("Save 8", :save8, save_enabled)add_command("Save 9", :save9, save_enabled)add_command("Save 10", :save10, save_enabled)end#--------------------------------------------------------------------------# * Get Activation State of Save#--------------------------------------------------------------------------def save_enabled!$game_system.save_disabledend#----------------------------------------------------------------------# * Processing When OK Button Is Pressed#--------------------------------------------------------------------------def process_ok@@last_command_symbol = current_symbolsuperend#--------------------------------------------------------------------------# * Restore Previous Selection Position#--------------------------------------------------------------------------def select_lastselect_symbol(@last_command_symbol)endendclass Scene_Menu < Scene_Base#--------------------------------------------------------------------------####* SECTION SAVE####--------------------------------------------------------------------------def command_savecreate_help_windowcreate_command_windowsave@help_window.x = 150@help_window.width = Graphics.width-150@idsave = 1update_helpend#--------------------------------------------------------------------------# create_command_window#--------------------------------------------------------------------------def create_command_windowsave@command_windowsave = Window_SaveCommand.new@command_windowsave.set_handler🙂save1, method🙂save1))@command_windowsave.set_handler🙂save2, method🙂save2))@command_windowsave.set_handler🙂save3, method🙂save3))@command_windowsave.set_handler🙂save4, method🙂save4))@command_windowsave.set_handler🙂save5, method🙂save5))@command_windowsave.set_handler🙂save6, method🙂save6))@command_windowsave.set_handler🙂save7, method🙂save7))@command_windowsave.set_handler🙂save8, method🙂save8))@command_windowsave.set_handler🙂save9, method🙂save9))@command_windowsave.set_handler🙂save10,method🙂save10))@command_windowsave.set_handler🙂cancel, method🙂on_save_cancel))@command_windowsave.help_window = @help_windowenddef on_save_cancel@command_windowsave.close@help_window.close@command_window.activateend#--------------------------------------------------------------------------# command_to_title#--------------------------------------------------------------------------def save1save_game(1)enddef save2save_game(2)enddef save3save_game(3)enddef save4save_game(4)enddef save5save_game(5)enddef save6save_game(6)enddef save7save_game(7)enddef save8save_game(8)enddef save9save_game(9)enddef save10save_game(10)enddef save_game(id)Command.save_game(id)@command_windowsave.close@help_window.close@command_window.activateenddef update_helpcase @command_windowsave.current_symbolwhen :save1 then helptext(1)when :save2 then helptext(2)when :save3 then helptext(3)when :save4 then helptext(4)when :save5 then helptext(5)when :save6 then helptext(6)when :save7 then helptext(7)when :save8 then helptext(8)when :save9 then helptext(9)when :save10 then helptext(10)endenddef helptext(idsave)if File.exists?(DataManager.make_filename(idsave-1))text = "A save already exist"@help_window.set_text(text)elsetext = "Empty"@help_window.set_text(text)endend#--------------------------------------------------------------------------#* FIN DE SECTION#--------------------------------------------------------------------------end
 
I know that I'm missing something and that my code is messy.
By the way, all the Command.stuff are commands added by another script I'm using, and I don't have any problem with them.

Thank you a lot for helping me anyway ^^

EDIT: By the way, what I'm trying to do is to have everything in a single scene, not dispatched into several ones. If I wanted to do that, I would have kept the original save system and edited it a bit.

EDIT 2: 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!
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!

Original thread: https://forums.rpgmakerweb.com/threads/rgss3-current_window_symbol.42390/