Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # Dynamic Script Menu v1.02 by Zetu
- #===============================================================================
- module Z
- module Menu
- SCRIPTS = [
- #/regex/, script call.
- [/item/i, %Q{$scene = Scene_Item.new}],
- [/skill/i, %Q{$next = "Scene_Skill.new(@status_window.index)"
- start_actor_selection}],
- [/equip/i, %Q{$next = "Scene_Equip.new(@status_window.index)"
- start_actor_selection}],
- [/status/i, %Q{$next = "Scene_Status.new(@status_window.index)"
- start_actor_selection}],
- [/save/i, %Q{$scene = Scene_File.new(true, false, false)}],
- [/end/i, %Q{$scene = Scene_End.new}]
- ]
- end
- end
- class Scene_Menu < Scene_Base
- alias zmenu_start start
- def start
- zmenu_start
- @status_window.x = 35
- @status_window.y = 88
- @gold_window.y = 0
- end
- def create_command_window
- @command_window = Scriptletter.new(0, 424, 640)
- end
- def update_command_selection
- JetInput.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif JetInput.trigger?(JetInput::RETURN)
- JetInput.update
- run_regexp(@command_window.text)
- end
- end
- def update
- super
- update_menu_background
- @command_window.update
- @gold_window.update
- @status_window.update
- if @status_window.active
- update_actor_selection
- else
- update_command_selection
- end
- end
- def update_actor_selection
- JetInput.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_actor_selection
- elsif JetInput.trigger?(JetInput::RETURN)
- $game_party.last_actor_index = @status_window.index
- Sound.play_decision
- $scene = eval($next)
- end
- end
- def run_regexp(string)
- @command_window.clear
- for param in Z::Menu::SCRIPTS
- if string =~ param[0]
- eval(param[1])
- return
- end
- end
- print "No command found!"
- end
- 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
- class Window_MenuStatus < Window_Selectable
- def initialize(x, y)
- super(x, y, 570, 304)
- refresh
- self.active = false
- self.index = -1
- @column_max = 2
- @spacing = 4
- refresh
- end
- def refresh
- self.contents.clear
- @item_max = $game_party.members.size
- for actor in $game_party.members
- rect = item_rect(actor.index)
- x = rect.x + 6; y = rect.y + 19
- draw_actor_face(actor, x+2, y-10, 92)
- draw_actor_name(actor, x + 100, y)
- draw_actor_class(actor, x + 100, y+WLH)
- draw_actor_level(actor, x+ 192, y + WLH*1)
- draw_actor_hp(actor, x+100, y + WLH * 2, 148)
- draw_actor_mp(actor, x+100, y + WLH * 3, 148)
- draw_actor_state(actor, x, y + WLH * 4 - 12)
- end
- end
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- elsif @index < @item_max or @index >= 100
- rect = item_rect(@index)
- self.cursor_rect.set(rect.x, rect.y, rect.width, rect.height)
- else
- self.cursor_rect.set(0, 0, contents.width, contents.height)
- end
- end
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = self.contents.width / @column_max - @spacing
- rect.height = self.contents.height / (Game_Party::MAX_MEMBERS / @column_max) - @spacing
- rect.x = index % @column_max * (rect.width + 4) + @spacing/2
- rect.y = index / @column_max * (rect.height + 4) + @spacing/2
- return rect
- end
- end
- #===============================================================================
- # Dynamic Script Menu v1.02 by Zetu
- #===============================================================================
- module Z
- module Menu
- SCRIPTS = [
- #/regex/, script call.
- [/item/i, %Q{$scene = Scene_Item.new}],
- [/skill/i, %Q{$next = "Scene_Skill.new(@status_window.index)"
- start_actor_selection}],
- [/equip/i, %Q{$next = "Scene_Equip.new(@status_window.index)"
- start_actor_selection}],
- [/status/i, %Q{$next = "Scene_Status.new(@status_window.index)"
- start_actor_selection}],
- [/save/i, %Q{$scene = Scene_File.new(true, false, false)}],
- [/end/i, %Q{$scene = Scene_End.new}]
- ]
- end
- end
- class Scene_Menu < Scene_Base
- alias zmenu_start start
- def start
- zmenu_start
- @status_window.x = 35
- @status_window.y = 88
- @gold_window.y = 0
- end
- def create_command_window
- @command_window = Scriptletter.new(0, 424, 640)
- end
- def update_command_selection
- JetInput.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- elsif JetInput.trigger?(JetInput::RETURN)
- JetInput.update
- run_regexp(@command_window.text)
- end
- end
- def update
- super
- update_menu_background
- @command_window.update
- @gold_window.update
- @status_window.update
- if @status_window.active
- update_actor_selection
- else
- update_command_selection
- end
- end
- def update_actor_selection
- JetInput.update
- if Input.trigger?(Input::B)
- Sound.play_cancel
- end_actor_selection
- elsif JetInput.trigger?(JetInput::RETURN)
- $game_party.last_actor_index = @status_window.index
- Sound.play_decision
- $scene = eval($next)
- end
- end
- def run_regexp(string)
- @command_window.clear
- for param in Z::Menu::SCRIPTS
- if string =~ param[0]
- eval(param[1])
- return
- end
- end
- print "No command found!"
- end
- 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
- class Window_MenuStatus < Window_Selectable
- def initialize(x, y)
- super(x, y, 570, 304)
- refresh
- self.active = false
- self.index = -1
- @column_max = 2
- @spacing = 4
- refresh
- end
- def refresh
- self.contents.clear
- @item_max = $game_party.members.size
- for actor in $game_party.members
- rect = item_rect(actor.index)
- x = rect.x + 6; y = rect.y + 19
- draw_actor_face(actor, x+2, y-10, 92)
- draw_actor_name(actor, x + 100, y)
- draw_actor_class(actor, x + 100, y+WLH)
- draw_actor_level(actor, x+ 192, y + WLH*1)
- draw_actor_hp(actor, x+100, y + WLH * 2, 148)
- draw_actor_mp(actor, x+100, y + WLH * 3, 148)
- draw_actor_state(actor, x, y + WLH * 4 - 12)
- end
- end
- def update_cursor
- if @index < 0
- self.cursor_rect.empty
- elsif @index < @item_max or @index >= 100
- rect = item_rect(@index)
- self.cursor_rect.set(rect.x, rect.y, rect.width, rect.height)
- else
- self.cursor_rect.set(0, 0, contents.width, contents.height)
- end
- end
- def item_rect(index)
- rect = Rect.new(0, 0, 0, 0)
- rect.width = self.contents.width / @column_max - @spacing
- rect.height = self.contents.height / (Game_Party::MAX_MEMBERS / @column_max) - @spacing
- rect.x = index % @column_max * (rect.width + 4) + @spacing/2
- rect.y = index / @column_max * (rect.height + 4) + @spacing/2
- return rect
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement