Nathmatt's Command_Window
Authors: Nathmatt
Version: 1.00
Type: Command-replacement
Key Term:Menu Add-on
IntroductionA replacement for the normal command window
Features
- Allows you to set the height so you can fit the command any where you want
- Allows you to choose an alignment default 0 (left)
- Allows you to add as many commands you want without increasing the height past the height
Screenshotsno screenshot needed
DemoNo Demo
ScriptAbove Main
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Nathmatt's Command_Window by Nathmatt
# Version: 1.00
# Type: Command-replacement
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This work is protected by the following license:
# #----------------------------------------------------------------------------
# #
# # Creative Commons - Attribution-NonCommercial-ShareAlike 3.0 Unported
# # ( http://creativecommons.org/licenses/by-nc-sa/3.0/ )
# #
# # You are free:
# #
# # to Share - to copy, distribute and transmit the work
# # to Remix - to adapt the work
# #
# # Under the following conditions:
# #
# # Attribution. You must attribute the work in the manner specified by the
# # author or licensor (but not in any way that suggests that they endorse you
# # or your use of the work).
# #
# # Noncommercial. You may not use this work for commercial purposes.
# #
# # Share alike. If you alter, transform, or build upon this work, you may
# # distribute the resulting work only under the same or similar license to
# # this one.
# #
# # - For any reuse or distribution, you must make clear to others the license
# # terms of this work. The best way to do this is with a link to this web
# # page.
# #
# # - Any of the above conditions can be waived if you get permission from the
# # copyright holder.
# #
# # - Nothing in this license impairs or restricts the author's moral rights.
# #
# #-----------------------------------------------------------------------------
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Directions
#------------------------------------------------------------------------------
# Window_Commands.new(width,height,commands,align)
#
# width ~ is the width of the command window.
# height ~ is the height of the command window.
# commands ~ is the array of the commands same as normal command.
# align ~ set align to 1 to center the text and to 2 to right-align it.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#==============================================================================
# ** Window_Commands
#------------------------------------------------------------------------------
# This window displays the command list
#==============================================================================
class Window_Commands < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# actor : actor
#--------------------------------------------------------------------------
def initialize(width,height,commands = [],align = 0)
super(0, 0, width, height)
@commands = commands
@width = width - 32
@align = align
@column_max = 1
@size = @commands.size
refresh
end
#--------------------------------------------------------------------------
# * Get Item
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# Add item
(0...@size).each { |i| @data.push(@commands[i])}
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
(0...@item_max).each{ |i| draw_item(i)}
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = index % 1 * (@width)
y = index / 1 * 32
rect = Rect.new(x, y, self.width / @column_max - 32, 32)
self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
self.contents.draw_text(x, y, @width, 32, item,@align)
end
end
Instructions Window_
Commands.new(width,height,commands,align)
width ~ is the width of the command window.
height ~ is the height of the command window.
commands ~ is the array of the commands same as normal command.
align ~ set align to 1 to center the text and to 2 to right-align it.
Compatibilityno compatibility issues known
Credits and Thanks