03-08-2008, 06:11 AM
L's Simple Main Menu VX - DMS Edit
This is VX version of my XP DMS Edit. Posted on rmxp.org March, 2008(rev1 was done at April 5th or 6th).
Screenshot
Script (Initial version)
Code:
#============================================================================
#L's Custom Menu - Simple DMS Edit (RMVX ver.)
#============================================================================
module MenuCommand
Item = 'Item'
Skill = 'Skill'
Equip = 'Equip'
Status = 'Status'
Save = 'Save'
Load = 'Load'
End_Game = 'Exit'
Order = 'Order'
Party = 'Party'
Option = 'Option'
Quest = 'Quest'
System = 'System'
end
#------------------------------------------------------------------------------
# Game_Map
#------------------------------------------------------------------------------
class Game_Map
#------------------------------------------------------------------------------
# Name
#------------------------------------------------------------------------------
def name
$map_infos[@map_id]
end
end
#========================================
# Scene_Title
#--------------------------------------------------------------------------------
# Setting functions for the Title
#========================================
class Scene_Title
$map_infos = load_data("Data/MapInfos.rvdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
class Window_MapName < Window_Base
def initialize(x, y)
super(x, y, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Location")
self.contents.font.color = normal_color
self.contents.draw_text(4, WLH, 120, 32, $game_map.name.to_s, 2)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
commands_init
@changer = 0 #Change Party Order by Yargovish
@where = 0 #
@checker = 0 #
end
#--------------------------------------------------------------------------
# * Set Commands
#--------------------------------------------------------------------------
def commands_init
@commands = []
s1 = MenuCommand::Item
s2 = MenuCommand::Skill
s3 = MenuCommand::Equip
s4 = MenuCommand::Status
s5 = MenuCommand::Order
s6 = MenuCommand::System
@commands.push(s1, s2, s3, s4, s5, s6).flatten!
@sys_commands = []
o1 = MenuCommand::Option
o2 = MenuCommand::Save
o3 = MenuCommand::Load
o4 = MenuCommand::End_Game
@sys_commands.push(o1, o2, o3, o4).flatten!
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
create_system_window
@gold_window = Window_Gold.new(0, 264)
@status_window = Window_MenuStatus.new(160, 0)
@mapname_window = Window_MapName.new(0, 320)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
@sys_command_window.dispose
@gold_window.dispose
@status_window.dispose
@mapname_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@sys_command_window.update
@gold_window.update
@status_window.update
@mapname_window.update
if @command_window.active
update_command_selection
elsif @sys_command_window.active
@sys_command_window.z = +500
update_sys_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_Command.new(160, @commands)
@command_window.index = @menu_index
if $game_party.members.size == 0 # If number of party members is 0
@command_window.draw_item(0, false) # Disable item
@command_window.draw_item(1, false) # Disable skill
@command_window.draw_item(2, false) # Disable equipment
@command_window.draw_item(3, false) # Disable status
end
if $game_party.members.size <= 1
@command_window.draw_item(4, false) # Disable ordering
end
end
#--------------------------------------------------------------------------
# * Create System Command Window
#--------------------------------------------------------------------------
def create_system_window
@sys_command_window = Window_Command.new(128, @sys_commands)
@sys_command_window.visible = false
@sys_command_window.active = false
@sys_command_window.x = 100
@sys_command_window.y = 130
@sys_command_window.z = 0
check_save_available
check_load_available
end
#-----------------
def check_save_available
if $game_system.save_disabled # If save is forbidden
@sys_command_window.draw_item(1, false) # Disable save
end
end
#-----------------
def check_load_available
#Check if saved file exists
@load_enabled = (Dir.glob('Save*.rvdata').size > 0)
if !@load_enabled
#Put your @command_window.draw_item(index, false)
@sys_command_window.draw_item(2, false)
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
if $game_party.members.size == 0 and @command_window.index < 4
Sound.play_buzzer
return
elsif $game_party.members.size <= 1 and @command_window.index == 4
Sound.play_buzzer
return
end
Sound.play_decision
case @command_window.index
when 0 # Item
$scene = Scene_Item.new
when 1,2,3 # Skill, equipment, status
start_actor_selection
when 4 # Order
@checker = 0
@command_window.active = false
@status_window.active = true
@status_window.index = 0
when 5 # call system submenu
@sys_command_window.active = true
@sys_command_window.visible = true
@command_window.active = false
end
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_sys_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@sys_command_window.active = false
@sys_command_window.visible = false
@sys_command_window.index = 0
@sys_command_window.z = -500
return
elsif Input.trigger?(Input::C)
if $game_system.save_disabled and @sys_command_window.index == 1
Sound.play_buzzer
return
elsif !@load_enabled and @sys_command_window.index == 2
Sound.play_buzzer
return
end
Sound.play_decision
case @sys_command_window.index
when 0 # Option
#Put your command
when 1 # Save
$scene = Scene_File.new(true, false, false)
when 2 # Load
$scene = Scene_File.new(false, false, false)
when 3 # End Game
$scene = Scene_End.new
end
end
end
#--------------------------------------------------------------------------
# * Start Actor Selection
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# * End Actor Selection
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_actor_selection
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case @command_window.index
when 1 # skill
$scene = Scene_Skill.new(@status_window.index)
when 2 # equipment
$scene = Scene_Equip.new(@status_window.index)
when 3 # status
$scene = Scene_Status.new(@status_window.index)
when 4 # party order
#Change Party Order by Yargovish
if @checker == 0
@changer = $game_party.members[@status_window.index]
@where = @status_window.index
@checker = 1
else
$game_party.members[@where] = $game_party.members[@status_window.index]
$game_party.members[@status_window.index] = @changer
@checker = 0
@status_window.refresh
$game_player.refresh #
end
end
end
end
end
Script (Revision 1)
Code:
#============================================================================
#L's Custom Menu - Simple DMS Edit (RMVX ver.) Rev.1
#============================================================================
module MenuCommand
#Default menu commands +1
Item = 'Item'
Skill = 'Skill'
Equip = 'Equip'
Status = 'Status'
Save = 'Save'
Load = 'Load'
End_Game = 'Exit'
#Optional menu commands
Order = 'Order'
Party = 'Party'
Option = 'Option'
Quest = 'Quest'
System = 'System'
end
#------------------------------------------------------------------------------
# Game_Map
#------------------------------------------------------------------------------
class Game_Map
#------------------------------------------------------------------------------
# Name
#------------------------------------------------------------------------------
def name
$map_infos[@map_id]
end
end
#========================================
# Scene_Title
#--------------------------------------------------------------------------------
# Setting functions for the Title
#========================================
class Scene_Title
$map_infos = load_data("Data/MapInfos.rvdata")
for key in $map_infos.keys
$map_infos[key] = $map_infos[key].name
end
end
class Window_MapName < Window_Base
def initialize(x, y)
super(x, y, 160, 96)
self.contents = Bitmap.new(width - 32, height - 32)
refresh
end
def refresh
self.contents.clear
self.contents.font.color = system_color
self.contents.draw_text(4, 0, 120, 32, "Location")
self.contents.font.color = normal_color
self.contents.draw_text(4, WLH, 120, 32, $game_map.name.to_s, 2)
end
end
#==============================================================================
# ** Scene_Menu
#------------------------------------------------------------------------------
# This class performs the menu screen processing.
#==============================================================================
class Scene_Menu < Scene_Base
#--------------------------------------------------------------------------
# * Object Initialization
# menu_index : command cursor's initial position
#--------------------------------------------------------------------------
def initialize(menu_index = 0)
@menu_index = menu_index
commands_init
@changer = 0 #Change Party Order by Yargovish
@where = 0 #
@checker = 0 #
end
#--------------------------------------------------------------------------
# * Set Commands
#--------------------------------------------------------------------------
def commands_init
@commands = []
s1 = MenuCommand::Item
s2 = MenuCommand::Skill
s3 = MenuCommand::Equip
s4 = MenuCommand::Status
s5 = MenuCommand::Order
s6 = MenuCommand::System
@commands.push(s1, s2, s3, s4, s5, s6).flatten!
@sys_commands = []
o1 = MenuCommand::Option
o2 = MenuCommand::Save
o3 = MenuCommand::Load
o4 = MenuCommand::End_Game
@sys_commands.push(o1, o2, o3, o4).flatten!
end
#--------------------------------------------------------------------------
# * Start processing
#--------------------------------------------------------------------------
def start
super
create_menu_background
create_command_window
create_system_window
@gold_window = Window_Gold.new(0, 264)
@status_window = Window_MenuStatus.new(160, 0)
@mapname_window = Window_MapName.new(0, 320)
end
#--------------------------------------------------------------------------
# * Termination Processing
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@command_window.dispose
@sys_command_window.dispose
@gold_window.dispose
@status_window.dispose
@mapname_window.dispose
end
#--------------------------------------------------------------------------
# * Frame Update
#--------------------------------------------------------------------------
def update
super
update_menu_background
@command_window.update
@sys_command_window.update
@gold_window.update
@status_window.update
@mapname_window.update
if @command_window.active
update_command_selection
elsif @sys_command_window.active
@sys_command_window.z = +500
update_sys_command_selection
elsif @status_window.active
update_actor_selection
end
end
#--------------------------------------------------------------------------
# * Create Command Window
#--------------------------------------------------------------------------
def create_command_window
@command_window = Window_Command.new(160, @commands)
@command_window.index = @menu_index
if $game_party.members.size == 0 # If number of party members is 0
@command_window.draw_item(0, false) # Disable item
@command_window.draw_item(1, false) # Disable skill
@command_window.draw_item(2, false) # Disable equipment
@command_window.draw_item(3, false) # Disable status
end
if $game_party.members.size <= 1
@command_window.draw_item(4, false) # Disable ordering
end
end
#--------------------------------------------------------------------------
# * Create System Command Window
#--------------------------------------------------------------------------
def create_system_window
@sys_command_window = Window_Command.new(128, @sys_commands)
@sys_command_window.visible = false
@sys_command_window.active = false
@sys_command_window.x = 100
@sys_command_window.y = 130
@sys_command_window.z = 0
check_save_available
check_load_available
end
#-----------------
def check_save_available
if $game_system.save_disabled # If save is forbidden
@sys_command_window.draw_item(1, false) # Disable save
end
end
#-----------------
def check_load_available
#Check if saved file exists
@load_enabled = (Dir.glob('Save*.rvdata').size > 0)
if !@load_enabled
#Put your @command_window.draw_item(index, false) to disable load
@sys_command_window.draw_item(2, false)
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
$scene = Scene_Map.new
elsif Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
Sound.play_buzzer
return
end
main_command_input
end
end
#--------------------------------------------------------------------------
# * Update Command Selection
#--------------------------------------------------------------------------
def update_sys_command_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@command_window.active = true
@sys_command_window.active = false
@sys_command_window.visible = false
@sys_command_window.index = 0
@sys_command_window.z = -500
return
elsif Input.trigger?(Input::C)
# Return if Disabled Command
if disabled_main_command?
# Play buzzer SE
Sound.play_buzzer
return
end
sys_command_input
end
end
#--------------------------------------------------------------------------
# * Disabled Main Command? Test
#--------------------------------------------------------------------------
def disabled_main_command?
# Gets Current Command
command = @commands[@command_window.index]
sys_command = @sys_commands[@sys_command_window.index]
# Gets Menu Commands
c = MenuCommand
# If 0 Party Size
if $game_party.members.size == 0
# If Item, Skill, Equip or Status Selected
if [c::Item, c::Skill, c::Equip, c::Status].include?(command)
return true
end
elsif $game_party.members.size <= 1
# If the command is changing member order
if [c::Order].include?(command)
return true
end
end
# If Save Disabled && Command is Save
return true if $game_system.save_disabled and sys_command == c::Save
# If Load Disabled && Command is Load
return true if !@load_enabled && sys_command == c::Load
return false
end
#--------------------------------------------------------------------------
# * Update Command Check
#--------------------------------------------------------------------------
def main_command_input
# Loads Current Command
command = @commands[@command_window.index]
# Play decision SE
Sound.play_decision
# Checks Commands
case command
when MenuCommand::Item #item
command_item
when MenuCommand::Skill, MenuCommand::Equip, MenuCommand::Status #skill, equip, status
start_actor_selection
when MenuCommand::Order #order
command_order
when MenuCommand::System #call system submenu
@sys_command_window.active = true
@sys_command_window.visible = true
@command_window.active = false
end
end
#--------------------------------------------------------------------------
# * Update System Command Check
#--------------------------------------------------------------------------
def sys_command_input
# Loads Current Command
sys_command = @sys_commands[@sys_command_window.index]
# Play decision SE
Sound.play_decision
# Checks Commands
case sys_command
when MenuCommand::Option #option
command_option
when MenuCommand::Save #save
command_save
when MenuCommand::Load #load
command_load
when MenuCommand::End_Game #exit
command_endgame
end
end
#--------------------------------------------------------------------------
# * Start Actor Selection
#--------------------------------------------------------------------------
def start_actor_selection
@command_window.active = false
@status_window.active = true
if $game_party.last_actor_index < @status_window.item_max
@status_window.index = $game_party.last_actor_index
else
@status_window.index = 0
end
end
#--------------------------------------------------------------------------
# * End Actor Selection
#--------------------------------------------------------------------------
def end_actor_selection
@command_window.active = true
@status_window.active = false
@status_window.index = -1
end
#--------------------------------------------------------------------------
# * Update Actor Selection
#--------------------------------------------------------------------------
def update_actor_selection
# Loads Current Command
command = @commands[@command_window.index]
if Input.trigger?(Input::B)
Sound.play_cancel
end_actor_selection
elsif Input.trigger?(Input::C)
$game_party.last_actor_index = @status_window.index
Sound.play_decision
case command
when MenuCommand::Skill # skill
command_skill
when MenuCommand::Equip # equipment
command_equip
when MenuCommand::Status # status
command_status
end
end
end
#--------------------------------------------------------------------------
# * Command Item
#--------------------------------------------------------------------------
def command_item
# Switch to item screen
$scene = Scene_Item.new
end
#--------------------------------------------------------------------------
# * Command Skill
#--------------------------------------------------------------------------
def command_skill
# Switch to skill screen
$scene = Scene_Skill.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Equip
#--------------------------------------------------------------------------
def command_equip
# Switch to equipment screen
$scene = Scene_Equip.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Status
#--------------------------------------------------------------------------
def command_status
# Switch to status screen
$scene = Scene_Status.new(@status_window.index)
end
#--------------------------------------------------------------------------
# * Command Order
#--------------------------------------------------------------------------
def command_order
# If Main Command Active
if @command_window.active
# Activate Status Window
start_actor_selection
@checker = 0
return
end
#Change Party Order by Yargovish
if @checker == 0
@changer = $game_party.members[@status_window.index]
@where = @status_window.index
@checker = 1
else
$game_party.members[@where] = $game_party.members[@status_window.index]
$game_party.members[@status_window.index] = @changer
@checker = 0
@status_window.refresh
$game_player.refresh #
end
end
#--------------------------------------------------------------------------
# * Command Party
#--------------------------------------------------------------------------
def command_party
# Switch to party change screen
#Put your Party Change Scene here
end
#--------------------------------------------------------------------------
# * Command Option
#--------------------------------------------------------------------------
def command_option
# Switch to party change screen
#Put your Option Scene here
end
#--------------------------------------------------------------------------
# * Command Quest
#--------------------------------------------------------------------------
def command_quest
# Switch to party change screen
#Put your Quest Scene here
end
#--------------------------------------------------------------------------
# * Command Save
#--------------------------------------------------------------------------
def command_save
# Switch to save screen
$scene = Scene_File.new(true, false, false)
end
#--------------------------------------------------------------------------
# * Command Load
#--------------------------------------------------------------------------
def command_load
# Switch to load screen
$scene = Scene_File.new(false, false, false)
end
#--------------------------------------------------------------------------
# * Command End Game
#--------------------------------------------------------------------------
def command_endgame
# Switch to end game screen
$scene = Scene_End.new
end
end
Note:
- 'Order' command doesn't work. (I tried to apply Yargovish's code(which was once at phylomortis.com) to VX, but although there's no syntax error, it doesn't work)
- The optional commands('Quest', 'Party'...) are dummy, like XP version. You should add them for yourself.
- This script doesn't use 'Vocab' module.
Since I'm quite retired for a year or more, maybe I cannot answer your questions. Feel free to use this script. Modifying to make it better is always welcome.