Here's the script. (Replace Window_Command with this)
This script was made to be SDK compliant, however it will also work if you don't have the SDK. For those of you have no idea what I'm talking about, simply enjoy the peace of ignorance *it's a joke, no offense intended*#=========================================================
# * VH_Window_Command
#---------------------------------------------------------
# Make Horizontal or Vertical Menus with or without icons
#---------------------------------------------------------
# Version 2
# 12.12.05
#---------------------------------------------------------
# Tsunokiette
# * Give Credit *
#=========================================================
#*********************************
# * SDK Log Script
#*********************************
SDK.log('Tsunokiette', 'VH_Window_Command', 2, '12.12.05') unless defined?(SDK) == false
#*********************************
# Window_Command Begins
#_________________________________
# Sub-Class of (Window_Selectable)
#*********************************
class VH_Window_Command < Window_Selectable
#------------------------------------------------------------------------
# Initialization
#________________________________________________________________________
# type = what kind of menu you want (set to 'vertical' or 'horizontal')
# commands = text commands
# icons = icons to go with commands (leave empty if you don't want icons)
#------------------------------------------------------------------------
def initialize(type = 'vertical', commands = [], icons = nil)
case type
when 'vertical'
super(0, 0, 182, commands.size * 32 + 32)
when 'horizontal'
super(0, 0, 640, 64)
end
unless icons.nil?
for i in 0...icons.size
@icons[i] = RPG::Cache.icons("#{icons[i]}")
end
end
@item_max = commands.size
@column_max = commands.size unless type != 'horizontal'
@commands = commands
@type = type
self.contents = Bitmap.new(width - 32, height - 32)
font_properties
refresh
self.index = 0
end
#------------------------
# Set the Font Properties
#------------------------
def font_properties
self.contents.font.name = 'Times New Roman'
self.contents.font.size = 22
end
#------------------------------
# Refresh the Window's Contents
#------------------------------
def refresh
self.contents.clear
case @type
when 'vertical'
if @icons.nil?
for i in 0...@item_max
draw_v(i, normal_color)
end
else
for i in 0...@item_max
draw_v_icon(i, normal_color)
end
end
when 'horizontal'
if @icons.nil?
for i in 0...@item_max
draw_h(i, normal_color)
end
else
for i in 0...@item_max
draw_h_icon(i, normal_color)
end
end
end
end
#------------------------------------
# Draw Contents Vertically With Icons
#____________________________________
# Index = Command Location
# Color = Text Color
#------------------------------------
def draw_v_icon(index, color)
self.contents.font.color = color
x = 24
y = 32 * index
w = self.contents.width - 24
h = 32
ix = 0
iy = ((32 * index) + 4)
rect = Rect.new(x, y, w, h)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
@icon_sprite[index] = Sprite.new
@icon_sprite[index].bitmap = @icons[index]
@icon_sprite[index].x = ix
@icon_sprite[index].y = iy
end
#---------------------------------------
# Draw Contents Vertically Without Icons
#_______________________________________
# Index = Command Location
# Color = Text Color
#---------------------------------------
def draw_v(index, color)
self.contents.font.color = color
x = 0
y = 32 * index
w = self.contents.width
h = 32
rect = Rect.new(x,y,w,h)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
#--------------------------------------
# Draw Contents Horizontally With Icons
#______________________________________
# Index = Command Location
# Color = Text Color
#--------------------------------------
def draw_h_icon(index, color)
self.contents.font.color = color
x = (((640 / @commands.size) * @index) + 24)
y = 0
w = ((640 / @commands.size) - 24)
h = 32
ix = ((640 / @commands.size) * @index)
iy = 4
rect = Rect.new(x,y,w,h)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
@icon_sprite[index] = Sprite.new
@icon_sprite[index].bitmap = @icons[index]
@icon_sprite[index].x = ix
@icon_sprite[index].y = iy
end
#-----------------------------------------
# Draw contents Horizontally Without Icons
#_________________________________________
# Index = Command Location
# Color = Text Color
#-----------------------------------------
def draw_h(index, color)
self.contents.font.color = color
x = ((640 / @commands.size) * @index)
y = 0
w = 640 / @commands.size
h = 32
rect = Rect.new(x,y,w,h)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(rect, @commands[index], 1)
end
#-------------------------
# Disable Command
#_________________________
# Index = Command Location
#-------------------------
def disable_item(index)
case @type
when 'vertical'
if @icons.nil?
draw_v(index, normal_color)
else
draw_v_icon(index, normal_color)
end
when 'horizontal'
if @icons.nil?
draw_h(index, normal_color)
else
draw_h_icon(index, normal_color)
end
end
end
#--------------
# Update Cursor
#--------------
def update_cursor_rect
unless @index >= 0
self.cursor_rect.empty unless @index >= 0
return
end
case @type
when 'vertical'
x = 0
y = @index * 32
w = self.contents.width
h = 32
self.cursor_rect.set(x, y, w, h)
when 'horizontal'
x = ((640 / @commands.size) * @index)
y = 0
w = 640 / @commands.size
h = 32
self.cursor_rect.set(x,y,w,h)
end
end
#--------------
# Alias Dispose
#--------------
alias :tsuno_UpdatedWindowCommand_VHWindowCommand_dispose :dispose
def dispose
unless @icons.nil?
for i in 0...@icons.size
@icon_sprite[i].dispose
end
end
tsuno_UpdatedWindowCommand_VHWindowCommand_dispose
end
end
#*********************************
# Window_Command Ends
#*********************************
Use like this-
For Vertical Menu With Iconsc1 = 'Option'
c2 = 'Option'
c3 = 'Option'
i1 = 'icon name'
i2 = 'icon name'
i3 = 'icon name'
@Command_Menu = VH_Window_Command.new('vertical', [c1,c2,c3], [i1,i2,i3])
For Vertical Menu Without Iconsc1 = 'Option'
c2 = 'Option'
c3 = 'Option'
@Command_Menu = VH_Window_Command.new('vertical', [c1,c2,c3])
For Horizontal Menu With Iconsc1 = 'Option'
c2 = 'Option'
c3 = 'Option'
i1 = 'icon name'
i2 = 'icon name'
i3 = 'icon name'
@Command_Menu = VH_Window_Command.new('horizontal', [c1,c2,c3], [i1,i2,i3])
For Horizontal Menu Without Iconsc1 = 'Option'
c2 = 'Option'
c3 = 'Option'
@Command_Menu = VH_Window_Command.new('horizontal', [c1,c2,c3])