Well after weeks of trying I still don't get it. I've fooled around long enough. I'm trying to turn the command window in to a bar that displays the commands horizontally but I can't seem to do it. I can add the columns but I can't get the commands the display in another column.
can some one help?
basicly it will look like this
(http://i15.photobucket.com/albums/a400/ryex/untitled1.jpg)
I suggest making a command window based off the shop command window. If you want I'll script the commands for you.
I've looked ate all the selectable windows that display things in more that one column but I can't figure it out. If perhaps you or some one else could make a very simple window example with two windows that are identical except on is vertical and the other in horizontal I would be able to figure it out exspsualy if you explained the difference in santax.
please help me!
I'll make it on monday since the computer at my dads doesn't have rpg maker xp and a limited user.
thanks!
So basically a horizontal command window?
yep
I cant get it ot go horizontal thats my problem
Damn, I thought I had the code. This is what I am using:
#==============================================================================
# Window_Horizontal
#==============================================================================
class Window_Horizontal < Window_Base
attr_reader :commands
def initialize(w, commands)
super(0, 0, 3 * w + 32, 64)
@item_max = commands.size
@commands = commands
if @item_max > 0
self.contents = Bitmap.new((@item_max + 4) * w, height - 32)
else
self.contents = Bitmap.new(32, height - 32)
end
@dir = 0
self.contents.font.name, self.contents.font.size = 'Brush Script', 26
self.opacity = self.index = 0
refresh
end
def refresh
self.contents.clear
(0...@item_max+4).each {|i| draw_item(i, (i + @item_max - 2) % @item_max)}
end
def get_command
return @commands[(@index + @item_max) % @item_max]
end
def draw_item(i, index, color = nil)
rect = Rect.new((self.width - 32)/3 * i, 0, (self.width - 32)/3, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
if color.is_a?(Color)
self.contents.font.color = color
else
self.contents.font.color = case @commands[index]
when 'And again!', 'Und nochmal!' then text_color(3)
when 'Warrior', 'Krieger' then text_color(6)
when 'Exerion' then text_color(2)
when 'Options', 'Optionen' then text_color(1)
when 'Debug Room' then text_color(8)
when 'Lost Memories', 'Erinnerungen' then text_color(9)
when 'Hexahax' then Color.new(0, 192, 255)
when 'Lexima One' then Color.new(0, 255, 96)
else
normal_color
end
end
self.contents.draw_text_outline(rect, @commands[index], 1)
end
def disable_item(index)
draw_item((index + 2) % @item_max, index, disabled_color)
draw_item((index + 2) % @item_max + @item_max, index, disabled_color)
draw_item((index + 2) % @item_max + @item_max*2, index, disabled_color)
end
def size
return @commands.size
end
def update
super
if moving?
case @dir.abs
when 1 then self.ox -= 5 * @dir.sgn
when 2 then self.ox -= 10 * @dir.sgn
when 3 then self.ox -= 20 * @dir.sgn
when 4 then self.ox -= 45 * @dir.sgn
when 5 then self.ox -= 45 * @dir.sgn
when 6 then self.ox -= 20 * @dir.sgn
when 7 then self.ox -= 10 * @dir.sgn
when 8 then self.ox -= 5 * @dir.sgn
end
@dir -= @dir.sgn
end
if !moving? && self.active && @item_max > 0
if Input.repeat?($controls.right)
$game_system.se_play($data_system.cursor_se)
@index = @index % @item_max + 1
if self.ox == (@item_max + 1)* (self.width - 32)/3
self.ox -= @item_max * (self.width - 32)/3
@index = 1
end
@dir = -8
elsif Input.repeat?($controls.left)
$game_system.se_play($data_system.cursor_se)
@index = (@index + @item_max - 2) % @item_max + 1
if self.ox == (self.width - 32)/3
self.ox += @item_max * (self.width - 32)/3
@index = @item_max - 1
end
@dir = 8
end
end
update_cursor_rect
end
def moving?
return (@dir != 0)
end
def index=(index)
@index = index
self.ox = (index + 1) * (self.width - 32)/3
update_help if self.active && @help_window != nil
update_cursor_rect
end
def update_cursor_rect
self.cursor_rect.set((self.width - 32)/3, 0, (self.width - 32)/3, 32)
end
end
But it's the command window that moves around as well. Hm... I remember somebody posting a horizontal command window at the old CP forum. You could try looking for it there.
All the more better if it moves as well! I think GAX asked for this.
so it is not a simmple edit of the origanal Window_command class to make it display horizontaly?
oh and GAx did ask for a horizontal title command window for th title screen on the old fourms but I want the menu command window horizontal
No, it's not. If i'm not wrong somebody posted a horizontal command window script first. You may wanna try RMRK, I think I saw that once there.
@FTS: You can't use it directly, you'll have to edit it. :P
Input.repeat?($controls.left)
aaaaaa Found it!!!!
http://rmrk.net/index.php/topic,5889.msg56274.html (http://rmrk.net/index.php/topic,5889.msg56274.html)
Tsunokiette made it.
it is a premade script that can creat the command window to you liking whtn you call it.
I did it I think for GAX on the old forums if there's a list of things you want horizontal you could just make another version of window_selectable and change the inputs
@Bliz: lol! that's ONE of the many things. Do you mind if I edit it and use it?
No problem, be my guest.
Thank you :D
Just lol! I completely forgot that I have used a horizontal command windows in CoSLAL. Here you go:
#==============================================================================
# ** 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)
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
As alternative you can use the horizontal window from the SDK:
#==============================================================================
# ** Window_HorizCommand
#------------------------------------------------------------------------------
# This window deals with general command choices. (Horizontal)
#==============================================================================
class Window_HorizCommand < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :commands
attr_accessor :c_spacing
attr_accessor :alignment
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize(width, commands, c_spacing = (width - 32) / commands.size)
# Compute window height from command quantity
super(0, 0, width, 64)
@commands = commands
@item_max = commands.size
@column_max = @item_max
@c_spacing = c_spacing
@alignment = 1
self.contents = Bitmap.new(@item_max * @c_spacing, height - 32)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# * Command
#--------------------------------------------------------------------------
def command(index = self.index)
return @commands[index]
end
#--------------------------------------------------------------------------
# * Commands
#--------------------------------------------------------------------------
def commands=(commands)
# Return if Commands Are Same
return if @commands == commands
# Reset Commands
@commands = commands
# Resets Item Max
item_max = @item_max
@item_max = @commands.size
@column_max = @item_max
# If Item Max Changes
unless item_max == @item_max
# Deletes Existing Contents (If Exist)
unless self.contents.nil?
self.contents.dispose
self.contents = nil
end
# Recreates Contents
self.contents = Bitmap.new(@item_max * @c_spacing, height - 32)
end
# Refresh Window
refresh
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i, normal_color)
end
end
#--------------------------------------------------------------------------
# * Draw Item
#--------------------------------------------------------------------------
def draw_item(index, color)
command = commands[index]
x = index * @c_spacing + 4
self.contents.font.color = color
self.contents.draw_text(x, 0, @c_spacing - 8, 32, command, @alignment)
end
#--------------------------------------------------------------------------
# * Disable Item
#--------------------------------------------------------------------------
def disable_item(index)
draw_item(index, disabled_color)
end
#--------------------------------------------------------------------------
# * Cursor Rectangle Update
#--------------------------------------------------------------------------
def update_cursor_rect
if @index < 0
self.cursor_rect.empty
else
self.cursor_rect.set(@c_spacing * @index, 0, @c_spacing, 32)
end
end
end