Here are the scripts:
CODE
#===========================================================================
# Tankentai Menus BETA
# by jmoresca
# June 16, 2009
#===========================================================================
#
# Where to put:
# just put anywhere on the Materials Section
#
# How to use:
# nothing to configure.
#
# FAQ's
# I can't see the menu
# probably an error.
#
# Compatibility
# Compatible with any script that doesnt not modify Tankentai Battle Menus
#
#============================================================================
class Scene_Battle < Scene_Base
def start_skill_selection
@help_window = Window_TanHelp.new(0,0) if @help_window == nil
@help_window.visible = true
@skill_window = Window_TanSkill.new(0, 56, 544, 232, @commander)
@skill_window.z = 250
@skill_window.help_window = @help_window
@actor_command_window.active = false
end
def start_item_selection
@help_window = Window_TanHelp.new(0,0) if @help_window == nil
@help_window.visible = true
@item_window = Window_TanItem.new(0, 56, 544, 232)
@item_window.z = 250
@item_window.help_window = @help_window
@actor_command_window.active = false
end
def end_party_command
$in_party_command = false
$in_command = true
@status_window.refresh
@message_window.visible = false
@party_command_window.active = false
@party_command_window.hide
@actor_command_window.active = true
@party_command_window.visible = false
@actor_command_window.index = @pre_a_index
@status_window.index = @commander.index
@status_window.active = true
end
def end_command
return if !@commander.inputable?
$in_command = false
$in_select = false
# カーソル消去
@cursor.visible = false
@command_phase = false
# アクション実行時間チェック
act_type = charge_set(@commander)
# 行動ゲージに切り替え
@spriteset.change_act(act_type, true, @commander.index)
# 動けるキャラのみコマンド戻りアクションを
@spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
# チャージアクション
make_charge_action(@commander)
# 合体攻撃チェック
union_skill?(@commander) if @commander.action.skill? && @partners == nil
# ウインドウ初期化
@party_command_window.active = @actor_command_window.active = false
@actor_command_window_on = false
@actor_command_window.hide
@status_window.index = @actor_index = @actor_command_window.index = -1
@command_members.delete(@commander)
@commander = nil
end
end
class Window_TanSkill < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@column_max = 2
self.index = 0
self.opacity = 0
self.back_opacity = 0
@bmp_cur = Sprite.new()
@bmp_cur.bitmap = Cache.system("com_Cursor")
@bmp_cur.x = self.cursor_rect.x - 10
@bmp_cur.y = self.cursor_rect.y + 67
refresh
end
#--------------------------------------------------------------------------
# * Get Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for skill in @actor.skills
@data.push(skill)
if skill.id == @actor.last_skill_id
self.index = @data.size - 1
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.skill_can_use?(skill)
enabled = @actor.union_skill_can_use?(skill.id) if @actor.union_skill?(skill.id)
draw_item_bg(rect, rect.x, rect.y - 5)
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
def draw_item_bg(rect, x, y)
bitmap = Cache.system("Item Items Bg")
rect = Rect.new(0, 0, 260, 50)
self.contents.blt(x, y, bitmap, rect, 255)
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
@bmp_cur.x = self.cursor_rect.x - 10
@bmp_cur.y = self.cursor_rect.y + 67
@bmp_cur.z = 255
end
def dispose
self.contents.dispose
if @bmp_cur.disposed? == false
@bmp_cur.dispose
end
super
end
def hide_cursor_bg
@bmp_cur.visible = false
end
def show_cursor_bg
@bmp_cur.visible = true
end
end
class Window_TanItem < Window_AnimSelectable
def initialize(x, y, width, height, view_only = "none")
super(x, y, width, height, 10, view_only)
@column_max = 2
if view_only == "sell"
@column_max = 1
end
self.index = 0
refresh
self.back_opacity = 0
self.opacity = 0
@bmp_cur = Sprite.new()
@bmp_cur.bitmap = Cache.system("com_Cursor")
@bmp_cur.x = self.cursor_rect.x
@bmp_cur.y = self.cursor_rect.y + 65
end
def item
return @data[self.index]
end
def include?(item)
return false if item == nil
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
if @view_only == "key"
if item.description.include?("[KEY]") == true
return true
else
return false
end
elsif @view_only == "usable"
if $game_party.item_can_use?(item) and item.description.include?("[KEY]") == false
return true
else
return false
end
elsif @view_only == "equip"
if item.description.include?("[KEY]") == false and item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
return true
else
return false
end
else
if item.description.include?("[KEY]") == true
return false
else
return true
end
end
end
def enable?(item)
return $game_party.item_can_use?(item)
end
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_bg(rect, rect.x, rect.y - 5)
draw_item_name(item, rect.x + 10, rect.y, enabled)
self.contents.draw_text(rect.x-10, rect.y, rect.width, rect.height, sprintf(":%2d", number), 2)
end
end
def draw_item_bg(rect, x, y)
bitmap = Cache.system("Item Items Bg")
rect = Rect.new(0, 0, 260, 50)
self.contents.blt(x, y, bitmap, rect, 255)
end
def update_help
if self.active or self.index = -1
@help_window.set_text(item == nil ? "" : item.description)
@bmp_cur.visible = true
@bmp_cur.x = self.cursor_rect.x
@bmp_cur.y = self.cursor_rect.y + 65
@bmp_cur.z = 250
end
end
def dispose
self.contents.dispose
if @bmp_cur.disposed? == false
@bmp_cur.dispose
end
super
end
def hide_bg_cursor
@bmp_cur.visible = false
end
end
class Window_TanHelp < Window_Base
def initialize(x, y)
super(x, y, 544, 60)
self.back_opacity = 0
self.opacity = 0
@help_bg = Sprite.new
@help_bg.bitmap = Cache.system("Menu Help")
end
def set_text(text)
self.contents.clear
self.contents.draw_text(0, 0, 520, 32, text)
end
def dispose
self.contents.dispose
@help_bg.dispose
super
end
end
class Window_ActorCommand < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(128, [], 1, 4)
self.active = false
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 0
@bg = Sprite.new
@bg.bitmap = Cache.system("")
@bg.x = 400
@bg.y = 300
end
#--------------------------------------------------------------------------
# * Setup
# actor : actor
#--------------------------------------------------------------------------
def setup(actor)
s1 = Vocab::attack
s2 = Vocab::skill
s3 = Vocab::guard
s4 = Vocab::item
if actor.class.skill_name_valid # Skill command name is valid?
s2 = actor.class.skill_name # Replace command name
end
@commands = [s1, s2, s3, s4]
@item_max = 4
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
def update
super
if $in_command == true
@bg.visible = true
end
case self.index
when 0
@bg.bitmap = Cache.system("BC Attack")
when 1
@bg.bitmap = Cache.system("BC Skill")
when 2
@bg.bitmap = Cache.system("BC Guard")
when 3
@bg.bitmap = Cache.system("BC Item")
end
end
def dispose
@bg.dispose
super
end
def hide
@bg.visible = false
end
end
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 416, 128)
refresh
self.active = false
self.opacity = 0
self.back_opacity = 0
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.members.size
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : Item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
actor = $game_party.members[index]
draw_item_bg(rect, rect.x, rect.y - 5)
draw_actor_name(actor, 4, rect.y)
draw_actor_state(actor, 114, rect.y, 48)
draw_actor_hp(actor, 174, rect.y, 120)
draw_actor_mp(actor, 310, rect.y, 70)
end
def draw_item_bg(rect, x, y)
bitmap = Cache.system("Battle Status")
rect = Rect.new(0, 0, 380, 26)
self.contents.blt(x, y, bitmap, rect, 255)
end
end
class Window_PartyCommand2 < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 234, 544, 56)
@item_max = 2
@column_max = 2
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 0
@party_bg = Sprite.new
@party_bg.bitmap = Cache.system("")
@party_bg.y = 234
self.contents.draw_text(32, 0, 96, WLH, "#{Vocab.fight}", 2)
self.contents.draw_text(310, 0, 96, WLH, "#{Vocab.escape}", 2) if $game_troop.can_escape
self.contents.font.color.alpha = 128
self.contents.draw_text(310, 0, 96, WLH, "#{Vocab.escape}", 2) if !$game_troop.can_escape
self.active = false
end
def update
super
if $in_party_command == true
@party_bg.visible = true
end
case self.index
when 0
@party_bg.bitmap = Cache.system("Battle Fight")
when 1
@party_bg.bitmap = Cache.system("Battle Escape")
end
end
def dispose
super
@party_bg.dispose
end
def hide
@party_bg.visible = false
end
end
# Tankentai Menus BETA
# by jmoresca
# June 16, 2009
#===========================================================================
#
# Where to put:
# just put anywhere on the Materials Section
#
# How to use:
# nothing to configure.
#
# FAQ's
# I can't see the menu
# probably an error.
#
# Compatibility
# Compatible with any script that doesnt not modify Tankentai Battle Menus
#
#============================================================================
class Scene_Battle < Scene_Base
def start_skill_selection
@help_window = Window_TanHelp.new(0,0) if @help_window == nil
@help_window.visible = true
@skill_window = Window_TanSkill.new(0, 56, 544, 232, @commander)
@skill_window.z = 250
@skill_window.help_window = @help_window
@actor_command_window.active = false
end
def start_item_selection
@help_window = Window_TanHelp.new(0,0) if @help_window == nil
@help_window.visible = true
@item_window = Window_TanItem.new(0, 56, 544, 232)
@item_window.z = 250
@item_window.help_window = @help_window
@actor_command_window.active = false
end
def end_party_command
$in_party_command = false
$in_command = true
@status_window.refresh
@message_window.visible = false
@party_command_window.active = false
@party_command_window.hide
@actor_command_window.active = true
@party_command_window.visible = false
@actor_command_window.index = @pre_a_index
@status_window.index = @commander.index
@status_window.active = true
end
def end_command
return if !@commander.inputable?
$in_command = false
$in_select = false
# カーソル消去
@cursor.visible = false
@command_phase = false
# アクション実行時間チェック
act_type = charge_set(@commander)
# 行動ゲージに切り替え
@spriteset.change_act(act_type, true, @commander.index)
# 動けるキャラのみコマンド戻りアクションを
@spriteset.set_action(true, @commander.index,@commander.command_a) if @commander.inputable?
# チャージアクション
make_charge_action(@commander)
# 合体攻撃チェック
union_skill?(@commander) if @commander.action.skill? && @partners == nil
# ウインドウ初期化
@party_command_window.active = @actor_command_window.active = false
@actor_command_window_on = false
@actor_command_window.hide
@status_window.index = @actor_index = @actor_command_window.index = -1
@command_members.delete(@commander)
@commander = nil
end
end
class Window_TanSkill < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
# x : window x-coordinate
# y : window y-coordinate
# width : window width
# height : window height
# actor : actor
#--------------------------------------------------------------------------
def initialize(x, y, width, height, actor)
super(x, y, width, height)
@actor = actor
@column_max = 2
self.index = 0
self.opacity = 0
self.back_opacity = 0
@bmp_cur = Sprite.new()
@bmp_cur.bitmap = Cache.system("com_Cursor")
@bmp_cur.x = self.cursor_rect.x - 10
@bmp_cur.y = self.cursor_rect.y + 67
refresh
end
#--------------------------------------------------------------------------
# * Get Skill
#--------------------------------------------------------------------------
def skill
return @data[self.index]
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
@data = []
for skill in @actor.skills
@data.push(skill)
if skill.id == @actor.last_skill_id
self.index = @data.size - 1
end
end
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
skill = @data[index]
if skill != nil
rect.width -= 4
enabled = @actor.skill_can_use?(skill)
enabled = @actor.union_skill_can_use?(skill.id) if @actor.union_skill?(skill.id)
draw_item_bg(rect, rect.x, rect.y - 5)
draw_item_name(skill, rect.x, rect.y, enabled)
self.contents.draw_text(rect, @actor.calc_mp_cost(skill), 2)
end
end
def draw_item_bg(rect, x, y)
bitmap = Cache.system("Item Items Bg")
rect = Rect.new(0, 0, 260, 50)
self.contents.blt(x, y, bitmap, rect, 255)
end
#--------------------------------------------------------------------------
# * Update Help Text
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(skill == nil ? "" : skill.description)
@bmp_cur.x = self.cursor_rect.x - 10
@bmp_cur.y = self.cursor_rect.y + 67
@bmp_cur.z = 255
end
def dispose
self.contents.dispose
if @bmp_cur.disposed? == false
@bmp_cur.dispose
end
super
end
def hide_cursor_bg
@bmp_cur.visible = false
end
def show_cursor_bg
@bmp_cur.visible = true
end
end
class Window_TanItem < Window_AnimSelectable
def initialize(x, y, width, height, view_only = "none")
super(x, y, width, height, 10, view_only)
@column_max = 2
if view_only == "sell"
@column_max = 1
end
self.index = 0
refresh
self.back_opacity = 0
self.opacity = 0
@bmp_cur = Sprite.new()
@bmp_cur.bitmap = Cache.system("com_Cursor")
@bmp_cur.x = self.cursor_rect.x
@bmp_cur.y = self.cursor_rect.y + 65
end
def item
return @data[self.index]
end
def include?(item)
return false if item == nil
if $game_temp.in_battle
return false unless item.is_a?(RPG::Item)
end
if @view_only == "key"
if item.description.include?("[KEY]") == true
return true
else
return false
end
elsif @view_only == "usable"
if $game_party.item_can_use?(item) and item.description.include?("[KEY]") == false
return true
else
return false
end
elsif @view_only == "equip"
if item.description.include?("[KEY]") == false and item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor)
return true
else
return false
end
else
if item.description.include?("[KEY]") == true
return false
else
return true
end
end
end
def enable?(item)
return $game_party.item_can_use?(item)
end
def refresh
@data = []
for item in $game_party.items
next unless include?(item)
@data.push(item)
if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id
self.index = @data.size - 1
end
end
@data.push(nil) if include?(nil)
@item_max = @data.size
create_contents
for i in 0...@item_max
draw_item(i)
end
end
def draw_item(index)
rect = item_rect(index)
self.contents.clear_rect(rect)
item = @data[index]
if item != nil
number = $game_party.item_number(item)
enabled = enable?(item)
rect.width -= 4
draw_item_bg(rect, rect.x, rect.y - 5)
draw_item_name(item, rect.x + 10, rect.y, enabled)
self.contents.draw_text(rect.x-10, rect.y, rect.width, rect.height, sprintf(":%2d", number), 2)
end
end
def draw_item_bg(rect, x, y)
bitmap = Cache.system("Item Items Bg")
rect = Rect.new(0, 0, 260, 50)
self.contents.blt(x, y, bitmap, rect, 255)
end
def update_help
if self.active or self.index = -1
@help_window.set_text(item == nil ? "" : item.description)
@bmp_cur.visible = true
@bmp_cur.x = self.cursor_rect.x
@bmp_cur.y = self.cursor_rect.y + 65
@bmp_cur.z = 250
end
end
def dispose
self.contents.dispose
if @bmp_cur.disposed? == false
@bmp_cur.dispose
end
super
end
def hide_bg_cursor
@bmp_cur.visible = false
end
end
class Window_TanHelp < Window_Base
def initialize(x, y)
super(x, y, 544, 60)
self.back_opacity = 0
self.opacity = 0
@help_bg = Sprite.new
@help_bg.bitmap = Cache.system("Menu Help")
end
def set_text(text)
self.contents.clear
self.contents.draw_text(0, 0, 520, 32, text)
end
def dispose
self.contents.dispose
@help_bg.dispose
super
end
end
class Window_ActorCommand < Window_Command
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(128, [], 1, 4)
self.active = false
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 0
@bg = Sprite.new
@bg.bitmap = Cache.system("")
@bg.x = 400
@bg.y = 300
end
#--------------------------------------------------------------------------
# * Setup
# actor : actor
#--------------------------------------------------------------------------
def setup(actor)
s1 = Vocab::attack
s2 = Vocab::skill
s3 = Vocab::guard
s4 = Vocab::item
if actor.class.skill_name_valid # Skill command name is valid?
s2 = actor.class.skill_name # Replace command name
end
@commands = [s1, s2, s3, s4]
@item_max = 4
refresh
self.index = 0
end
def refresh
self.contents.clear
for i in 0...@item_max
draw_item(i)
end
end
def update
super
if $in_command == true
@bg.visible = true
end
case self.index
when 0
@bg.bitmap = Cache.system("BC Attack")
when 1
@bg.bitmap = Cache.system("BC Skill")
when 2
@bg.bitmap = Cache.system("BC Guard")
when 3
@bg.bitmap = Cache.system("BC Item")
end
end
def dispose
@bg.dispose
super
end
def hide
@bg.visible = false
end
end
class Window_BattleStatus < Window_Selectable
#--------------------------------------------------------------------------
# * Object Initialization
#--------------------------------------------------------------------------
def initialize
super(0, 0, 416, 128)
refresh
self.active = false
self.opacity = 0
self.back_opacity = 0
end
#--------------------------------------------------------------------------
# * Dispose
#--------------------------------------------------------------------------
def dispose
super
end
#--------------------------------------------------------------------------
# * Refresh
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@item_max = $game_party.members.size
for i in 0...@item_max
draw_item(i)
end
end
#--------------------------------------------------------------------------
# * Draw Item
# index : Item number
#--------------------------------------------------------------------------
def draw_item(index)
rect = item_rect(index)
rect.x += 4
rect.width -= 8
self.contents.clear_rect(rect)
self.contents.font.color = normal_color
actor = $game_party.members[index]
draw_item_bg(rect, rect.x, rect.y - 5)
draw_actor_name(actor, 4, rect.y)
draw_actor_state(actor, 114, rect.y, 48)
draw_actor_hp(actor, 174, rect.y, 120)
draw_actor_mp(actor, 310, rect.y, 70)
end
def draw_item_bg(rect, x, y)
bitmap = Cache.system("Battle Status")
rect = Rect.new(0, 0, 380, 26)
self.contents.blt(x, y, bitmap, rect, 255)
end
end
class Window_PartyCommand2 < Window_Selectable
#--------------------------------------------------------------------------
# ● オブジェクト初期化
#--------------------------------------------------------------------------
def initialize
super(0, 234, 544, 56)
@item_max = 2
@column_max = 2
self.opacity = 0
self.back_opacity = 0
self.contents_opacity = 0
@party_bg = Sprite.new
@party_bg.bitmap = Cache.system("")
@party_bg.y = 234
self.contents.draw_text(32, 0, 96, WLH, "#{Vocab.fight}", 2)
self.contents.draw_text(310, 0, 96, WLH, "#{Vocab.escape}", 2) if $game_troop.can_escape
self.contents.font.color.alpha = 128
self.contents.draw_text(310, 0, 96, WLH, "#{Vocab.escape}", 2) if !$game_troop.can_escape
self.active = false
end
def update
super
if $in_party_command == true
@party_bg.visible = true
end
case self.index
when 0
@party_bg.bitmap = Cache.system("Battle Fight")
when 1
@party_bg.bitmap = Cache.system("Battle Escape")
end
end
def dispose
super
@party_bg.dispose
end
def hide
@party_bg.visible = false
end
end
The script needed for the Tankentai menus to work:
CODE
#==============================================================================
# Window_AnimSelectable
# by jmoresca
# June 2, 2009
#==============================================================================
#
# Where to put:
# just put below Animated Menu
#
# How to use:
# Automatic
#
# Customization:
# See module TitleSkip
#
# FAQ's
# Compatibility
# Compatible with any script.
#
#============================================================================
class Window_AnimSelectable < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :item_max # item count
attr_reader :column_max # digit count
attr_reader :index # cursor position
attr_reader :help_window # help window
attr_reader :view_only
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
# width : window width
# height : window height
# spacing : width of empty space when items are arranged horizontally
#--------------------------------------------------------------------------
def initialize(x, y, width, height, spacing = 32, view_only = "none")
@item_max = 1
@column_max = 1
@index = -1
@spacing = spacing
super(x, y, width, height)
@view_only = view_only
end
#--------------------------------------------------------------------------
# * Create Window Contents
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max)
end
#--------------------------------------------------------------------------
# * Set Cursor Position
# index : new cursor position
#--------------------------------------------------------------------------
def index=(index)
@index = index
update_cursor
call_update_help
end
#--------------------------------------------------------------------------
# * Get Row Count
#--------------------------------------------------------------------------
def row_max
return (@item_max + @column_max - 1) / @column_max
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
return self.oy / WLH
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
row = 0 if row < 0
row = row_max - 1 if row > row_max - 1
self.oy = row * WLH
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
return (self.height - 32) / WLH
end
#--------------------------------------------------------------------------
# * Get Number of Items Displayable on 1 Page
#--------------------------------------------------------------------------
def page_item_max
return page_row_max * @column_max
end
#--------------------------------------------------------------------------
# * Get bottom row
#--------------------------------------------------------------------------
def bottom_row
return top_row + page_row_max - 1
end
#--------------------------------------------------------------------------
# * Set bottom row
# row : Row displayed at the bottom
#--------------------------------------------------------------------------
def bottom_row=(row)
self.top_row = row - (page_row_max - 1)
end
#--------------------------------------------------------------------------
# * Get rectangle for displaying items
# index : item number
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH
return rect
end
#--------------------------------------------------------------------------
# * Set Help Window
# help_window : new help window
#--------------------------------------------------------------------------
def help_window=(help_window)
@help_window = help_window
call_update_help
end
#--------------------------------------------------------------------------
# * Determine if cursor is moveable
#--------------------------------------------------------------------------
def cursor_movable?
return false if (not visible or not active)
return false if (index < 0 or index > @item_max or @item_max == 0)
return false if (@opening or @closing)
return true
end
#--------------------------------------------------------------------------
# * Move cursor down
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
@index = (@index + @column_max) % @item_max
end
end
#--------------------------------------------------------------------------
# * Move cursor up
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
if (@index >= @column_max) or (wrap and @column_max == 1)
@index = (@index - @column_max + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# * Move cursor right
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
if (@column_max >= 2) and
(@index < @item_max - 1 or (wrap and page_row_max == 1))
@index = (@index + 1) % @item_max
end
end
#--------------------------------------------------------------------------
# * Move cursor left
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
if (@column_max >= 2) and
(@index > 0 or (wrap and page_row_max == 1))
@index = (@index - 1 + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# * Move cursor one page down
#--------------------------------------------------------------------------
def cursor_pagedown
if top_row + page_row_max < row_max
@index = [@index + page_item_max, @item_max - 1].min
self.top_row += page_row_max
end
end
#--------------------------------------------------------------------------
# * Move cursor one page up
#--------------------------------------------------------------------------
def cursor_pageup
if top_row > 0
@index = [@index - page_item_max, 0].max
self.top_row -= page_row_max
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if cursor_movable?
last_index = @index
if Input.repeat?(Input::DOWN)
cursor_down(Input.trigger?(Input::DOWN))
end
if Input.repeat?(Input::UP)
cursor_up(Input.trigger?(Input::UP))
end
if Input.repeat?(Input::RIGHT)
cursor_right(Input.trigger?(Input::RIGHT))
end
if Input.repeat?(Input::LEFT)
cursor_left(Input.trigger?(Input::LEFT))
end
if Input.repeat?(Input::R)
cursor_pagedown
end
if Input.repeat?(Input::L)
cursor_pageup
end
if @index != last_index
Sound.play_cursor
end
end
update_cursor
call_update_help
end
#--------------------------------------------------------------------------
# * Update cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # If the cursor position is less than 0
self.cursor_rect.empty # Empty cursor
else # If the cursor position is 0 or more
row = @index / @column_max # Get current row
if row < top_row # If before the currently displayed
self.top_row = row # Scroll up
end
if row > bottom_row # If after the currently displayed
self.bottom_row = row # Scroll down
end
rect = item_rect(@index) # Get rectangle of selected item
rect.y -= self.oy # Match rectangle to scroll position
self.cursor_rect = rect # Refresh cursor rectangle
end
end
#--------------------------------------------------------------------------
# * Call help window update method
#--------------------------------------------------------------------------
def call_update_help
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# * Update help window (contents are defined by the subclasses)
#--------------------------------------------------------------------------
def update_help
end
def update_cursor_bg
end
end
# Window_AnimSelectable
# by jmoresca
# June 2, 2009
#==============================================================================
#
# Where to put:
# just put below Animated Menu
#
# How to use:
# Automatic
#
# Customization:
# See module TitleSkip
#
# FAQ's
# Compatibility
# Compatible with any script.
#
#============================================================================
class Window_AnimSelectable < Window_Base
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
attr_reader :item_max # item count
attr_reader :column_max # digit count
attr_reader :index # cursor position
attr_reader :help_window # help window
attr_reader :view_only
#--------------------------------------------------------------------------
# * Object Initialization
# x : window X coordinate
# y : window Y coordinate
# width : window width
# height : window height
# spacing : width of empty space when items are arranged horizontally
#--------------------------------------------------------------------------
def initialize(x, y, width, height, spacing = 32, view_only = "none")
@item_max = 1
@column_max = 1
@index = -1
@spacing = spacing
super(x, y, width, height)
@view_only = view_only
end
#--------------------------------------------------------------------------
# * Create Window Contents
#--------------------------------------------------------------------------
def create_contents
self.contents.dispose
self.contents = Bitmap.new(width - 32, [height - 32, row_max * WLH].max)
end
#--------------------------------------------------------------------------
# * Set Cursor Position
# index : new cursor position
#--------------------------------------------------------------------------
def index=(index)
@index = index
update_cursor
call_update_help
end
#--------------------------------------------------------------------------
# * Get Row Count
#--------------------------------------------------------------------------
def row_max
return (@item_max + @column_max - 1) / @column_max
end
#--------------------------------------------------------------------------
# * Get Top Row
#--------------------------------------------------------------------------
def top_row
return self.oy / WLH
end
#--------------------------------------------------------------------------
# * Set Top Row
# row : row shown on top
#--------------------------------------------------------------------------
def top_row=(row)
row = 0 if row < 0
row = row_max - 1 if row > row_max - 1
self.oy = row * WLH
end
#--------------------------------------------------------------------------
# * Get Number of Rows Displayable on 1 Page
#--------------------------------------------------------------------------
def page_row_max
return (self.height - 32) / WLH
end
#--------------------------------------------------------------------------
# * Get Number of Items Displayable on 1 Page
#--------------------------------------------------------------------------
def page_item_max
return page_row_max * @column_max
end
#--------------------------------------------------------------------------
# * Get bottom row
#--------------------------------------------------------------------------
def bottom_row
return top_row + page_row_max - 1
end
#--------------------------------------------------------------------------
# * Set bottom row
# row : Row displayed at the bottom
#--------------------------------------------------------------------------
def bottom_row=(row)
self.top_row = row - (page_row_max - 1)
end
#--------------------------------------------------------------------------
# * Get rectangle for displaying items
# index : item number
#--------------------------------------------------------------------------
def item_rect(index)
rect = Rect.new(0, 0, 0, 0)
rect.width = (contents.width + @spacing) / @column_max - @spacing
rect.height = WLH
rect.x = index % @column_max * (rect.width + @spacing)
rect.y = index / @column_max * WLH
return rect
end
#--------------------------------------------------------------------------
# * Set Help Window
# help_window : new help window
#--------------------------------------------------------------------------
def help_window=(help_window)
@help_window = help_window
call_update_help
end
#--------------------------------------------------------------------------
# * Determine if cursor is moveable
#--------------------------------------------------------------------------
def cursor_movable?
return false if (not visible or not active)
return false if (index < 0 or index > @item_max or @item_max == 0)
return false if (@opening or @closing)
return true
end
#--------------------------------------------------------------------------
# * Move cursor down
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_down(wrap = false)
if (@index < @item_max - @column_max) or (wrap and @column_max == 1)
@index = (@index + @column_max) % @item_max
end
end
#--------------------------------------------------------------------------
# * Move cursor up
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_up(wrap = false)
if (@index >= @column_max) or (wrap and @column_max == 1)
@index = (@index - @column_max + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# * Move cursor right
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_right(wrap = false)
if (@column_max >= 2) and
(@index < @item_max - 1 or (wrap and page_row_max == 1))
@index = (@index + 1) % @item_max
end
end
#--------------------------------------------------------------------------
# * Move cursor left
# wrap : Wraparound allowed
#--------------------------------------------------------------------------
def cursor_left(wrap = false)
if (@column_max >= 2) and
(@index > 0 or (wrap and page_row_max == 1))
@index = (@index - 1 + @item_max) % @item_max
end
end
#--------------------------------------------------------------------------
# * Move cursor one page down
#--------------------------------------------------------------------------
def cursor_pagedown
if top_row + page_row_max < row_max
@index = [@index + page_item_max, @item_max - 1].min
self.top_row += page_row_max
end
end
#--------------------------------------------------------------------------
# * Move cursor one page up
#--------------------------------------------------------------------------
def cursor_pageup
if top_row > 0
@index = [@index - page_item_max, 0].max
self.top_row -= page_row_max
end
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
if cursor_movable?
last_index = @index
if Input.repeat?(Input::DOWN)
cursor_down(Input.trigger?(Input::DOWN))
end
if Input.repeat?(Input::UP)
cursor_up(Input.trigger?(Input::UP))
end
if Input.repeat?(Input::RIGHT)
cursor_right(Input.trigger?(Input::RIGHT))
end
if Input.repeat?(Input::LEFT)
cursor_left(Input.trigger?(Input::LEFT))
end
if Input.repeat?(Input::R)
cursor_pagedown
end
if Input.repeat?(Input::L)
cursor_pageup
end
if @index != last_index
Sound.play_cursor
end
end
update_cursor
call_update_help
end
#--------------------------------------------------------------------------
# * Update cursor
#--------------------------------------------------------------------------
def update_cursor
if @index < 0 # If the cursor position is less than 0
self.cursor_rect.empty # Empty cursor
else # If the cursor position is 0 or more
row = @index / @column_max # Get current row
if row < top_row # If before the currently displayed
self.top_row = row # Scroll up
end
if row > bottom_row # If after the currently displayed
self.bottom_row = row # Scroll down
end
rect = item_rect(@index) # Get rectangle of selected item
rect.y -= self.oy # Match rectangle to scroll position
self.cursor_rect = rect # Refresh cursor rectangle
end
end
#--------------------------------------------------------------------------
# * Call help window update method
#--------------------------------------------------------------------------
def call_update_help
if self.active and @help_window != nil
update_help
end
end
#--------------------------------------------------------------------------
# * Update help window (contents are defined by the subclasses)
#--------------------------------------------------------------------------
def update_help
end
def update_cursor_bg
end
end
and here is a link to Engine Melody: http://rpgmaker.net/scripts/45/
Thanks again!