[RGSS3] add command properties

Started by Calintz, October 21, 2012, 12:49:59 pm

Previous topic - Next topic

Calintz

i was wondering how i would go about assigning a different x value to the individual commands i create in a command window in RGSS3. could someone take a look for me please?

KK20

Well, in RMXP, you use index to find where the cursor is pointing. Here's the default menu scene:
      case @command_window.index
      when 0  # item
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to item screen
        $scene = Scene_Item.new
      when 1  # skill
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 2  # equipment
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 3  # status
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Make status window active
        @command_window.active = false
        @status_window.active = true
        @status_window.index = 0
      when 4  # save
        # If saving is forbidden
        if $game_system.save_disabled
          # Play buzzer SE
          $game_system.se_play($data_system.buzzer_se)
          return
        end
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to save screen
        $scene = Scene_Save.new
      when 5  # end game
        # Play decision SE
        $game_system.se_play($data_system.decision_se)
        # Switch to end game screen
        $scene = Scene_End.new
      end


@command_window is the actual menu window itself. The .index allows you to access where the cursor is currently at. Then use a case to determine what action to perform based on where the cursor is located.

Now if you're talking about x-values, ignore everything I just posted.

Other Projects
RPG Maker XP Ace  Upgrade RMXP to RMVXA performance!
XPA Tilemap  Tilemap rewrite with many features, including custom resolution!

Nintendo Switch Friend Code: 8310-1917-5318
Discord: KK20 Tyler#8901

Join the CP Discord Server!

Calintz

October 21, 2012, 01:16:47 pm #2 Last Edit: October 21, 2012, 01:21:12 pm by Basch
yep, just referring to the x-value. i'm making a small mod to the standard title screen and i want the "new game" option to be in its default place, but i want the "continue" option to have a custom x value so that i may position it slightly to the right of the "new game" option. same with "shutdown". all options will retain the default y values, but by changing the x value of the second options it will give a nice diagonal effect to their positioning; i just can't figure out how to manipulate each command's x values individually in RGSS3. thanks though!

Code:
Spoiler: ShowHide
  #--------------------------------------------------------------------------
 # * Create Command Window
 #--------------------------------------------------------------------------
 def create_command_window
   @command_window = Window_CalintzCTS.new
   @command_window.opacity = 0
   @command_window.set_handler(:new_game, method(:command_new_game))
   @command_window.set_handler(:continue, method(:command_continue))
   @command_window.set_handler(:shutdown, method(:command_shutdown))
 end


as you can see, they changed things around quite a bit since RGSS first came out. nowadays they allow you to assign methods to symbols which is where i'm getting lost. i tried to trace the set_handler method back but didn't find much. when i traced back the add_command method, it only gives you four default values which were something along the lines of the symbol, the associated method, the state of the symbol (whether it's active), and arbitrary extended data.

i actually have no clue what the arbitrary extended data does. can i assign the x value there and define it elsewhere?

diagostimo

go into window selectable and look for:

def item_rect_for_text(index)
    rect = item_rect(index)
    rect.x += 4
    rect.width -= 8
    rect
  end

change it to this:

  def item_rect_for_text(index)
    rect = item_rect(index)
    if SceneManager.scene_is?(Scene_Title)
      rect.x += 4 if index == 0
      rect.x += 32 if index >= 1
    else
      rect.x += 4
    end
    rect.width -= 8
    rect
  end

i must say i really hate the syntax of rgss 3 :/

Calintz

October 22, 2012, 01:20:05 pm #4 Last Edit: October 22, 2012, 01:35:46 pm by Basch
i'm going to look into this now. thank you for your input.

edit:
worked like a charm, many thanks and ++level for your help.