Script help

Started by nathmatt, April 15, 2009, 01:23:42 pm

Previous topic - Next topic

nathmatt

i need help lining up this

Spoiler: ShowHide


the h command im using by blizzard
#==============================================================================
# ** Window_HCommand
#------------------------------------------------------------------------------
#  This window deals with general command choices, but the display is
#  horizontal.
#==============================================================================

class Window_HCommand < Window_Command
  #--------------------------------------------------------------------------
  # * Object Initialization
  #     width    : window width
  #     commands : command text string array
  #--------------------------------------------------------------------------
  def initialize(width, commands)
    super
    self.width, self.height = commands.size * width + 32, 64
    @column_max = commands.size
    self.contents.dispose
    self.contents = Bitmap.new(self.width - 32, self.height - 32)
    refresh
    update_cursor_rect
  end
  #--------------------------------------------------------------------------
  # * Draw Item
  #     index : item number
  #     color : text color
  #--------------------------------------------------------------------------
  def draw_item(i, color)
    color = Color.new(100, 100, 255, 255)
    self.contents.font.color = color
    w = (self.width - 32) / @column_max
    x = i % @column_max * w
    rect = Rect.new(x, 0, self.contents.width / @column_max, 32)
    self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
    self.contents.draw_text(rect, @commands[i], 1)
  end
  #--------------------------------------------------------------------------
  # * Update Cursor Rectangle
  #--------------------------------------------------------------------------
  def update_cursor_rect
    # If cursor position is less than 0
    if @index < 0
      self.cursor_rect.empty
      return
    end
    # Get current row
    row = @index / @column_max
    # If current row is before top row
    if row < self.top_row
      # Scroll so that current row becomes top row
      self.top_row = row
    end
    # If current row is more to back than back row
    if row > self.top_row + (self.page_row_max - 1)
      # Scroll so that current row becomes back row
      self.top_row = row - (self.page_row_max - 1)
    end
    # Calculate cursor width
    cursor_width = (self.width - 32) / @column_max
    # Calculate cursor coordinates
    x = @index % @column_max * cursor_width
    # Update cursor rectangle
    self.cursor_rect.set(x, 0, cursor_width, 32)
  end
end

and the code im trying to use

class Scene_Calander
   
###########################################################
  def main
    @calander = Sprite.new
    @calander.bitmap = Bitmap.new("Graphics/Pictures/SPRING")
    @command_window = Window_HCommand.new(50, ["", "", "", "", "", "", ""])
    @command_window.x = 50
    @command_window.y = 143
    @command_window.opacity  = 0
    @command_window.index = 0
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    @calander.dispose
  end
  #####################################################3
  def update
    @command_window.update
    if @command_window.active
      update_command
      return
    end
  end
  ###################################################
  def update_command
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Map.new
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0 
        $game_system.se_play($data_system.decision_se)
      when 1
        $game_system.se_play($data_system.decision_se)
      when 2 
        $game_system.se_play($data_system.decision_se)
      when 3 
        $game_system.se_play($data_system.decision_se)
      when 4 
        $game_system.se_play($data_system.decision_se)
      when 5 
        $game_system.se_play($data_system.decision_se)
      end
      return
    end
  end
end
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script


Blizzard

If you use 2 instead of 1 in the line
self.contents.draw_text(rect, @commands[i], 1)

it will align the text to the right side of the rect used as drawing area.
Check out Daygames and our games:

King of Booze 2      King of Booze: Never Ever
Drinking Game for Android      Never have I ever for Android
Drinking Game for iOS      Never have I ever for iOS


Quote from: winkioI do not speak to bricks, either as individuals or in wall form.

Quote from: Barney StinsonWhen I get sad, I stop being sad and be awesome instead. True story.

nathmatt

i was trying to line it up with the picture i made is that possible or should i use conditions to make the numbers match up each season
Join Dead Frontier
Sorry, I will no longer be scripting for RMXP. I may or may not give support for my scripts. I don't have the will to script in RGSS anymore.
My script