Default Cursor Position

Discussion in 'Learning Ruby and RGSSx' started by donbrendo, Mar 8, 2017.

  1. donbrendo

    donbrendo Villager Member

    Messages:
    6
    Likes Received:
    0
    First Language:
    English
    Hello all. I am trying to set the default cursor position for Menu Command to be something other than the first in the index (Items). I'm able to accomplish by fiddling with the "@index = index" line in Window_Selectable. Changing "index" to a number will cause the cursor to appear on the desired command, but it will be locked in that position. How can I allow the cursor to move from the new default index position? Thanks!
     
    #1
  2. donbrendo

    donbrendo Villager Member

    Messages:
    6
    Likes Received:
    0
    First Language:
    English
    Anyone?
     
    #2
  3. donbrendo

    donbrendo Villager Member

    Messages:
    6
    Likes Received:
    0
    First Language:
    English
    Bump
     
    #3
  4. Roninator2

    Roninator2 Gamer Veteran

    Messages:
    1,639
    Likes Received:
    362
    Location:
    Canada
    First Language:
    English
    Primarily Uses:
    RMVXA
    If there is a way to do this, hopefully someone will come along and advise you.
    Otherwise Playing around with the windows selectable is not a good thing. What you did was tell it to go to command (number) and never move. Similarly if you set it to @index = index + 1 would cause the menu selection to skip every second command.
    Another option is Window_Command. Line 16 select(0). If you set it to 3 then command 3 will always be selected first. However this will be true for any window you open. Going into items will select key items first not the default items.
     
    #4
  5. donbrendo

    donbrendo Villager Member

    Messages:
    6
    Likes Received:
    0
    First Language:
    English
    Hi Roninator, thanks for your reply and for letting me know how select() works!
    So I got this to work by adding an if/else statement to "initialize" in Window_Command that checks if a certain scene (in this case, the Menu Scene) is currently open and, if so, changes "select(0)" to (5). Not sure if this is the most elegant method but it doesn't seem to have had any adverse effects on my game so it's good enough for me. In case anyone cares, this is how I set it up (lines 10-23)...

    def initialize(x, y)
    clear_command_list
    make_command_list
    super(x, y, window_width, window_height)
    refresh
    if SceneManager.scene_is?(Scene_Menu)
    select(5)
    activate
    else
    select(0)
    activate
    end
    end
     
    #5

Share This Page