this is the window class
#==============================================================================
# ** Window_HCommand_WI Modified from Blizzard's Window_HCommand By Ryex
#------------------------------------------------------------------------------
# This window deals with general command choices, but the display is
# horizontal.
#==============================================================================
class Window_Battle_command_WI < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# width : window width
# commands : command text string array
#--------------------------------------------------------------------------
def initialize(width, commands)
super(0, 0, width, 64)
self.width, self.height = width, 64
@commands = commands
@item_max = commands.size
@column_max = commands.size
self.contents = Bitmap.new( @item_max * 32, self.height - 32)
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
# color : text color
#--------------------------------------------------------------------------
def draw_item(i, color)
self.contents.font.color = color
w = 152
x = i * 152
rect = Rect.new(x, 0, w, 32)
#self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[i][1], 1)
self.contents.blt(x, 4, RPG::Cache.icon(@commands[i][0]),
Rect.new(0, 0, 24, 24))
end
#--------------------------------------------------------------------------
# * Disable Item
# index : item number
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
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
# 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 = 152
# Calculate cursor coordinates
x = @index * 152 - self.ox
# Update cursor rectangle
self.cursor_rect.set(x, 0, cursor_width, 32)
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
# If cursor is movable
if self.active and @item_max > 0 and @index >= 0
# If the right directional button was pressed
if Input.repeat?(Input::RIGHT)
# If column count is 2 or more, and cursor position is closer to front
# than (item count -1)
if @column_max >= 2 and @index < @item_max - 1
# Move cursor right
$game_system.se_play($data_system.cursor_se)
@index = (@index + @column_max) % @item_max
end
end
# If the left directional button was pressed
if Input.repeat?(Input::LEFT)
# If column count is 2 or more, and cursor position is more back than 0
if @column_max >= 2 and @index > 0
# Move cursor left
$game_system.se_play($data_system.cursor_se)
@index = (@index - @column_max + @item_max) % @item_max
end
end
end
# Update help text (update_help is defined by the subclasses)
if self.active and @help_window != nil
update_help
end
# Update cursor rectangle
update_cursor_rect
end
#--------------------------------------------------------------------------
# * Update Help Window
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(@commands[self.index][1])
end
end
this is so you know what it's referring too
module RyexCFG
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
BATTLE_MENU_ICONS = []
BATTLE_MENU_ICONS[1] = "Attack" #Icon name for the Attack option on the battle menu
BATTLE_MENU_ICONS[2] = "Skill" #Icon name for the Skill option on the battle menu
BATTLE_MENU_ICONS[3] = "Defend"#Icon name for the Defend option on the battle menu
BATTLE_MENU_ICONS[4] = "BattleItem" #Icon name for the Item option on the battle menu
#BATTLE_MENU_ICONS[5] = "Summon" #Icon name for the Summon option on the battle menu
#BATTLE_MENU_ICONS[6] = "Release" #Icon
#BATTLE_MENU_ICONS[7] = "Door" #Icon name for the Exit option on the main menu
#--------------------------------
# * Custom scenes
# If for some reason you want to use an item, equip, skill, status, save,
# exit, or option screen fallow the instrutions below.
#--------------------------------
end
this is how I'm calling it
commands = [[RyexCFG::BATTLE_MENU_ICONS[1], $data_system.words.attack],
[RyexCFG::BATTLE_MENU_ICONS[2], $data_system.words.skill],
[RyexCFG::BATTLE_MENU_ICONS[3], $data_system.words.guard],
[RyexCFG::BATTLE_MENU_ICONS[4], $data_system.words.item]]
@actor_command_window = Window_Battle_command_WI.new(640, commands)
@actor_command_window.x = 416
but for some reason it is only drawing the first command and none of the others, i can't figure out why for the life of me...
help?
For one, you should be using this in "refresh:"
def refresh
@items_max.times do |n|
draw_item(n, <color>)
end
end
yes well that still doesn't fix my problem...
Array indeces start at 0, not 1.
Also, your bitmap is much, much too small width-wise. Fix those and I'll give you an answer.
*shakes head* The width of your bitmap is 32 * the number of items. You probably want to change 32 to 152.
Quote from: Blizzard on June 19, 2009, 06:27:47 pm
*shakes head* The width of your bitmap is 32 * the number of items. You probably want to change 32 to 152.
Beat you, ha! But, hmm... that would still leave enough room for just a sliver of the second option, I believe.
Also, I believe that "..." is inclusive, which means that you're iterating one time too many. You'll want to use "..".
OMFG HOW DID I MISS THAT!!!!!!! :ninja: *is humiliated* well this is resolved. all you begining scripteres take note of my mistake because it could be yours next! :^_^':
"..." is exclusive, ".." is inclusive.
Quote from: Blizzard on June 19, 2009, 06:36:29 pm
"..." is exclusive, ".." is inclusive.
Blargh. I thought I might have it backwards >_<
BTW, you didn't beat me to it. :D
Quote from: My posting time« Reply #4 on: Today at 00:27:47 »
Quote from: Your edit time« Last Edit: Today at 00:28:07 by Longfellow »
20 sexy seconds. xD
Quote from: Blizzard on June 19, 2009, 06:43:33 pm
BTW, you didn't beat me to it. :D
Quote from: My posting time« Reply #4 on: Today at 00:27:47 »
Quote from: Your edit time« Last Edit: Today at 00:28:07 by Longfellow »
20 sexy seconds. xD
My post comes first :V