Shepher Admin
Número de Mensagens : 87 Idade : 28
| Assunto: [RGSS]RGSS Debugger Ter Jun 01, 2010 3:39 pm | |
| RGSS Debugger por KGC
Introdução Uma ferramenta para que está criando um projeto. Esse script adiciona mais opções ao Debug do jogo, facilitando sua vida na hora de testar seu projeto Características • Adiciona novas opções no Scene_Debug ScreenshotsComo usarPara instalá-lo, apenas cole o script acima do main. DemoNão necessita de Demo Script- Spoiler:
- Código:
-
#============================================================================== # RGSSDebugger # Por KGC #============================================================================== # Uma ferramenta para que está criando um projeto # Esse script adiciona mais opções ao Scene_Debug # Facilitando sua vida na hora de testar seu projeto #==============================================================================
#============================================================================== #??Modulo KGC? #============================================================================== module KGC RGSSDEBUG_VARIABLE_MAX = 99999999 RGSSDEBUG_PLAYTIME_MAX = 99999999 RGSSDEBUG_STEPS_MAX = 99999999 RGSSDEBUG_SAVE_COUNT_MAX = 99999999 end
#============================================================================== # ? Game_Temp #============================================================================== class Game_Temp #-------------------------------------------------------------------------- attr_accessor :debug_top_row_switch, :debug_top_row_item, :debug_top_row_party, :debug_index_switch, :debug_index_item, :debug_index_other #-------------------------------------------------------------------------- alias initialize_KGC_RGSSDebugger initialize def initialize initialize_KGC_RGSSDebugger @debug_top_row_switch = @debug_top_row_item = @debug_top_row_party = 0 @debug_index_switch = @debug_index_item = @debug_index_other = 0 end end
#============================================================================== # ? Game_Party #============================================================================== class Game_Party attr_accessor :steps end
#============================================================================== # ? Window_RGSSDebugCommand #============================================================================== class Window_RGSSDebugCommand < Window_Selectable #-------------------------------------------------------------------------- def initialize super(0, 0, 640, 64) self.contents = Bitmap.new(width - 32, height - 32) @commands = ["Switchs/Variáveis", "Itens", "Outros"] @item_max = @commands.size @column_max = @commands.size @item_width = (width - 32) / @commands.size self.index = 0 self.active = true refresh end #-------------------------------------------------------------------------- def refresh @commands.each_with_index { |command, i| rect = Rect.new(@item_width * i, 0, @item_width, 32) self.contents.fill_rect(rect, Color.new(0, 0, 0, 0)) self.contents.font.color = system_color self.contents.draw_text(rect, command, 1) } end #-------------------------------------------------------------------------- def update_cursor_rect self.cursor_rect.set(@item_width * index, 0, @item_width, 32) if index != -1 end #-------------------------------------------------------------------------- def update_help @help_window.set_text(KGC::SCP_HELP[self.index]) end end
#============================================================================== # ? Window_RGSSDebugSwitchList #============================================================================== class Window_RGSSDebugSwitchList < Window_Selectable #-------------------------------------------------------------------------- def initialize super(0, 64, 192, 416) self.index = 0 self.active = false refresh end #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @switch_max = ($data_system.switches.size - 1 + 9) / 10 @variable_max = ($data_system.variables.size - 1 + 9) / 10 @item_max = @switch_max + @variable_max self.contents = Bitmap.new(width - 32, @item_max * 32) @switch_max.times { |i| self.contents.draw_text(4, i * 32, 152, 32, sprintf("S [%04d-%04d]", i * 10 + 1, i * 10 + 10)) } @variable_max.times { |i| self.contents.draw_text(4, (i + @switch_max) * 32, 152, 32, sprintf("V [%04d-%04d]", i * 10 + 1, i * 10 + 10)) } end #-------------------------------------------------------------------------- def mode return self.index < @switch_max ? 0 : 1 end #-------------------------------------------------------------------------- def top_id if self.index < @switch_max return self.index * 10 + 1 else return (self.index - @switch_max) * 10 + 1 end end end
#============================================================================== # ? Window_RGSSDebugSwitch #============================================================================== class Window_RGSSDebugSwitch < Window_Selectable attr_reader :mode, :top_id #-------------------------------------------------------------------------- def initialize super(192, 64, 448, 352) self.contents = Bitmap.new(width - 32, height - 32) self.index = -1 self.active = false @item_max = 10 @mode = 0 @top_id = 1 refresh end #-------------------------------------------------------------------------- def index=(value) @index = [[value, -1].max, @item_max].min end #-------------------------------------------------------------------------- def refresh self.contents.clear 10.times { |i| if @mode == 0 name = $data_system.switches[@top_id + i] status = $game_switches[@top_id + i] ? "[ON]" : "[OFF]" else name = $data_system.variables[@top_id + i] status = $game_variables[@top_id + i].to_s end name = '' if name == nil id_text = sprintf("%04d:", @top_id + i) width = self.contents.text_size(id_text).width self.contents.draw_text(4, i * 32, width, 32, id_text) self.contents.draw_text(12 + width, i * 32, 296 - width, 32, name) self.contents.draw_text(312, i * 32, 100, 32, status, 2) } end #-------------------------------------------------------------------------- def mode=(mode) if @mode != mode @mode = mode refresh end end #-------------------------------------------------------------------------- def top_id=(id) if @top_id != id @top_id = id refresh end end end
#============================================================================== # ? Window_RGSSDebugItemList #============================================================================== class Window_RGSSDebugItemList < Window_Selectable #-------------------------------------------------------------------------- def initialize super(0, 64, 192, 416) self.index = 0 self.active = false refresh end #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @items = ($data_items.size - 1 + 9) / 10 @weapons = ($data_weapons.size - 1 + 9) / 10 @armors = ($data_armors.size - 1 + 9) / 10 @item_max = @items + @weapons + @armors self.contents = Bitmap.new(width - 32, @item_max * 32) @items.times { |i| self.contents.draw_text(4, i * 32, 152, 32, sprintf("I [%04d-%04d]", i * 10 + 1, i * 10 + 10)) } @weapons.times { |i| self.contents.draw_text(4, (i + @items) * 32, 152, 32, sprintf("W [%04d-%04d]", i * 10 + 1, i * 10 + 10)) } @armors.times { |i| self.contents.draw_text(4, (i + @items + @weapons) * 32, 152, 32, sprintf("A [%04d-%04d]", i * 10 + 1, i * 10 + 10)) } end #-------------------------------------------------------------------------- def mode if self.index < @items return 0 elsif self.index < @items + @weapons return 1 else return 2 end end #-------------------------------------------------------------------------- def top_id if self.index < @items return self.index * 10 + 1 elsif self.index < @items + @weapons return (self.index - @items) * 10 + 1 else return (self.index - @items - @weapons) * 10 + 1 end end end
#============================================================================== # ? Window_RGSSDebugItem #============================================================================== class Window_RGSSDebugItem < Window_Selectable attr_reader :mode, :top_id #-------------------------------------------------------------------------- def initialize super(192, 64, 448, 352) self.contents = Bitmap.new(width - 32, height - 32) self.index = -1 self.active = false @item_max = 10 @mode = 0 @top_id = 1 refresh end #-------------------------------------------------------------------------- def index=(value) @index = [[value, -1].max, @item_max].min end #-------------------------------------------------------------------------- def refresh self.contents.clear 10.times { |i| case @mode when 0 break if $data_items[@top_id + i] == nil name = $data_items[@top_id + i].name status = $game_party.item_number(@top_id + i).to_s when 1 break if $data_weapons[@top_id + i] == nil name = $data_weapons[@top_id + i].name status = $game_party.weapon_number(@top_id + i).to_s when 2 break if $data_armors[@top_id + i] == nil name = $data_armors[@top_id + i].name status = $game_party.armor_number(@top_id + i).to_s end id_text = sprintf("%03d:", @top_id + i) width = self.contents.text_size(id_text).width self.contents.draw_text(4, i * 32, width, 32, id_text) self.contents.draw_text(12 + width, i * 32, 296 - width, 32, name) self.contents.draw_text(312, i * 32, 100, 32, status, 2) } end #-------------------------------------------------------------------------- def mode=(mode) if @mode != mode @mode = mode refresh end end #-------------------------------------------------------------------------- def top_id=(id) if @top_id != id @top_id = id refresh end end end
#============================================================================== # ? Window_RGSSDebugOther #============================================================================== class Window_RGSSDebugOther < Window_Selectable COMMANDS = ["Dinheiro", "Tempo de Jogo", "Passos", "Contador de Saves", "Desabilitar Save", "Desabilitar Menu", "Desabilitar Encontros", "Operação de Tempo", "Aumentar Exp"] #-------------------------------------------------------------------------- def initialize super(0, 64, 640, 416) self.index = 0 self.active = false refresh end #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @item_max = COMMANDS.size self.contents = Bitmap.new(width - 32, @item_max * 32) @item_max.times { |i| self.contents.draw_text(4, i * 32, 400, 32, COMMANDS[i]) draw_item(i) } end #-------------------------------------------------------------------------- def draw_item(index) self.contents.fill_rect(404, index * 32, 100, 32, Color.new(0, 0, 0, 0)) case index when 0 self.contents.draw_text(404, 0, 100, 32, $game_party.gold.to_s, 2) when 1 self.contents.draw_text(404, 32, 100, 32, (Graphics.frame_count / Graphics.frame_rate).to_s, 2) when 2 self.contents.draw_text(404, 64, 100, 32, $game_party.steps.to_s, 2) when 3 self.contents.draw_text(404, 96, 100, 32, $game_system.save_count.to_s, 2) when 4 self.contents.draw_text(404, 128, 100, 32, $game_system.save_disabled ? "[ON]" : "[OFF]", 2) when 5 self.contents.draw_text(404, 160, 100, 32, $game_system.menu_disabled ? "[ON]" : "[OFF]", 2) when 6 self.contents.draw_text(404, 192, 100, 32, $game_system.encounter_disabled ? "[ON]" : "[OFF]", 2) when 7 self.contents.draw_text(404, 224, 100, 32, $game_system.timer_working ? "[ON]" : "[OFF]", 2) end end #-------------------------------------------------------------------------- def update super if @last_sec != Graphics.frame_count / Graphics.frame_rate draw_item(1) end end end
#============================================================================== # ? Window_RGSSDebuggerNumber #============================================================================== class Window_RGSSDebuggerNumber < Window_Base attr_reader :value #-------------------------------------------------------------------------- def initialize super(80, 208, 480, 64) @digits_max = 8 dummy_bitmap = Bitmap.new(32, 32) @cursor_width = dummy_bitmap.text_size("0").width + 8 dummy_bitmap.dispose self.contents = Bitmap.new(width - 32, height - 32) self.back_opacity = 160 self.active = false self.visible = false self.z = 1000 @cursor_position = 0 @max = 0 @value = 0 @index = 0 @negative = false @integer = false end #-------------------------------------------------------------------------- def get_value return @value * (@negative ? -1 : 1) end #-------------------------------------------------------------------------- def value=(nv) @value = [[nv, 0].max, @max].min refresh end #-------------------------------------------------------------------------- def reset(value, max, digits, integer = false) @digits_max = digits + (integer ? 1 : 0) @max = max @negative = value < 0 @value = value.abs @index = @digits_max - 1 @integer = integer self.width = @digits_max * @cursor_width + 32 self.x = 320 - self.width / 2 self.contents.dispose self.contents = Bitmap.new(self.width - 32, self.height - 32) refresh end #-------------------------------------------------------------------------- def refresh self.contents.clear self.contents.font.color = normal_color if @integer text = sprintf("%s%0#{@digits_max - 1}d", @negative ? "-" : "+", @value) else text = sprintf("%0#{@digits_max}d", @value) end text.length.times { |i| x = (i - 1) * @cursor_width self.contents.draw_text(x, 0, 32, 32, text[i, 1], 2) } end #-------------------------------------------------------------------------- def update_cursor_rect x = @cursor_position + @index * @cursor_width self.cursor_rect.set(x, 0, @cursor_width, 32) end #-------------------------------------------------------------------------- def update super return unless self.active if Input.repeat?(Input::UP) || Input.repeat?(Input::DOWN) $game_system.se_play($data_system.cursor_se) if !@integer || @index > 0 place = 10 ** (@digits_max - 1 - @index) n = self.value / place % 10 self.value -= n * place n = (n + 1) % 10 if Input.repeat?(Input::UP) n = (n + 9) % 10 if Input.repeat?(Input::DOWN) self.value += n * place else @negative = !@negative refresh end end if Input.repeat?(Input::RIGHT) if @digits_max >= 2 $game_system.se_play($data_system.cursor_se) @index = (@index + 1) % @digits_max end end if Input.repeat?(Input::LEFT) if @digits_max >= 2 $game_system.se_play($data_system.cursor_se) @index = (@index + @digits_max - 1) % @digits_max end end update_cursor_rect end end
#============================================================================== # ? Scene_Map #============================================================================== class Scene_Map #-------------------------------------------------------------------------- def call_debug $game_temp.debug_calling = false $game_system.se_play($data_system.decision_se) $game_player.straighten $scene = Scene_RGSSDebugger.new end end
#============================================================================== # ? Scene_RGSSDebugger #============================================================================== class Scene_RGSSDebugger #-------------------------------------------------------------------------- def main @command_window = Window_RGSSDebugCommand.new @switch_list_window = Window_RGSSDebugSwitchList.new @switch_window = Window_RGSSDebugSwitch.new @item_list_window = Window_RGSSDebugItemList.new @item_window = Window_RGSSDebugItem.new @other_window = Window_RGSSDebugOther.new @number_window = Window_RGSSDebuggerNumber.new @command_window.active = true hide_window case $game_temp.debug_index when 0 @switch_list_window.visible = true @switch_window.visible = true when 1 @item_list_window.visible = true @item_window.visible = true when 2 @other_window.visible = true end @help_window = Window_Base.new(192, 416, 448, 64) @help_window.contents = Bitmap.new(406, 32) @command_window.index = $game_temp.debug_index @switch_list_window.top_row = $game_temp.debug_top_row_switch @switch_window.index = $game_temp.debug_index_switch @item_list_window.top_row = $game_temp.debug_top_row_item @item_window.index = $game_temp.debug_index_item @switch_window.mode = @switch_list_window.mode @switch_window.top_id = @switch_list_window.top_id @item_window.mode = @item_list_window.mode @item_window.top_id = @item_list_window.top_id Graphics.transition loop { Graphics.update Input.update update break if $scene != self } $game_map.refresh Graphics.freeze @command_window.dispose @switch_list_window.dispose @switch_window.dispose @item_list_window.dispose @item_window.dispose @other_window.dispose @number_window.dispose @help_window.dispose end #-------------------------------------------------------------------------- def hide_window @switch_list_window.visible = false @switch_window.visible = false @item_list_window.visible = false @item_window.visible = false @other_window.visible = false @number_window.visible = false end #-------------------------------------------------------------------------- def update @command_window.update @switch_window.mode = @switch_list_window.mode @switch_window.top_id = @switch_list_window.top_id @switch_list_window.update @switch_window.update @item_window.mode = @item_list_window.mode @item_window.top_id = @item_list_window.top_id @item_list_window.update @item_window.update @other_window.update @number_window.update $game_temp.debug_index = @command_window.index $game_temp.debug_top_row_switch = @switch_list_window.top_row $game_temp.debug_index_switch = @switch_list_window.index $game_temp.debug_top_row_item = @item_list_window.top_row $game_temp.debug_index_item = @item_list_window.index $game_temp.debug_index_other = @other_window.index if @command_window.active update_command elsif @switch_list_window.active update_switch_list elsif @switch_window.active update_switch elsif @item_list_window.active update_item_list elsif @item_window.active update_item elsif @other_window.active update_party elsif @number_window.active update_number end end #-------------------------------------------------------------------------- def update_command if @last_command_index != @command_window.index hide_window case @command_window.index when 0 @switch_list_window.visible = true @switch_window.visible = true @help_window.visible = true when 1 @item_list_window.visible = true @item_window.visible = true @help_window.visible = true when 2 @other_window.visible = true @help_window.visible = false end @last_command_index = @command_window.index end if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) $scene = Scene_Map.new return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) case @command_window.index when 0 @command_window.active = false @switch_list_window.active = true when 1 @command_window.active = false @item_list_window.active = true when 2 @command_window.active = false @other_window.active = true end return end end #-------------------------------------------------------------------------- def update_switch_list if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @switch_list_window.active = false return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) if @switch_list_window.mode == 0 @help_window.contents.draw_text(4, 0, 406, 32, "C (Enter) : ON / OFF") else @help_window.contents.draw_text(4, 0, 406, 32, "C (Enter) : Edit") end @switch_list_window.active = false @switch_window.active = true return end end #-------------------------------------------------------------------------- def update_switch if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @switch_list_window.active = true @switch_window.active = false @help_window.contents.clear return end current_id = @switch_window.top_id + @switch_window.index if @switch_window.mode == 0 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) $game_switches[current_id] = !$game_switches[current_id] @switch_window.refresh return end elsif @switch_window.mode == 1 if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @switch_window.active = false @number_window.reset($game_variables[current_id], KGC::RGSSDEBUG_VARIABLE_MAX, Math.log10(KGC::RGSSDEBUG_VARIABLE_MAX).to_i + 1, true) @number_window.active = true @number_window.visible = true return end end end #-------------------------------------------------------------------------- def update_item_list if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @item_list_window.active = false return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @help_window.contents.draw_text(4, 0, 406, 32, "C (Enter) : Edit") @item_list_window.active = false @item_window.active = true return end end #-------------------------------------------------------------------------- def update_item if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @item_list_window.active = true @item_window.active = false @help_window.contents.clear return end if Input.trigger?(Input::C) current_id = @item_window.top_id + @item_window.index $game_system.se_play($data_system.decision_se) @item_window.active = false case @item_window.mode when 0 @last_num = $game_party.item_number(current_id) when 1 @last_num = $game_party.weapon_number(current_id) when 2 @last_num = $game_party.armor_number(current_id) end max = $imported["LimitBreak"] ? KGC::LB_ITEM_LIMIT : 99 @number_window.reset(@last_num, max, Math.log10(max).to_i + 1) @number_window.active = true @number_window.visible = true return end end #-------------------------------------------------------------------------- def update_party if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) @command_window.active = true @other_window.active = false return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) case @other_window.index when 0 @last_num = $game_party.gold max = $imported["LimitBreak"] ? KGC::LB_GOLD_LIMIT : 9999999 @other_window.active = false when 1 @last_num = Graphics.frame_count / Graphics.frame_rate max = KGC::RGSSDEBUG_PLAYTIME_MAX @other_window.active = false when 2 @last_num = $game_party.steps max = KGC::RGSSDEBUG_STEPS_MAX @other_window.active = false when 3 @last_num = $game_system.save_count max = KGC::RGSSDEBUG_SAVE_COUNT_MAX @other_window.active = false when 4 $game_system.save_disabled = !$game_system.save_disabled when 5 $game_system.menu_disabled = !$game_system.menu_disabled when 6 $game_system.encounter_disabled = !$game_system.encounter_disabled when 7 $game_system.timer_working = !$game_system.timer_working when 8 @last_num = 0 max = 999999 @other_window.active = false end unless @other_window.active @number_window.reset(@last_num, max, Math.log10(max).to_i + 1) @number_window.active = true @number_window.visible = true else @other_window.refresh end return end end #-------------------------------------------------------------------------- def update_number if Input.trigger?(Input::B) $game_system.se_play($data_system.cancel_se) if @switch_window.visible @switch_window.active = true elsif @item_window.visible @item_window.active = true elsif @other_window.visible @other_window.active = true end @number_window.active = false @number_window.visible = false return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) if @switch_window.visible current_id = @switch_window.top_id + @switch_window.index $game_variables[current_id] = @number_window.get_value @switch_window.refresh @switch_window.active = true elsif @item_window.visible current_id = @item_window.top_id + @item_window.index case @item_window.mode when 0 $game_party.gain_item(current_id, @number_window.value - @last_num) when 1 $game_party.gain_weapon(current_id, @number_window.value - @last_num) when 2 $game_party.gain_armor(current_id, @number_window.value - @last_num) end @item_window.refresh @item_window.active = true elsif @other_window.visible case @other_window.index when 0 $game_party.gain_gold(@number_window.value - $game_party.gold) when 1 Graphics.frame_count = @number_window.value * Graphics.frame_rate when 2 $game_party.steps = @number_window.value when 3 $game_system.save_count = @number_window.value when 8 for i in 0...$game_party.actors.size actor = $game_party.actors[i] if actor.cant_get_exp? == false last_level = actor.level actor.exp += @number_window.value end end end @other_window.refresh @other_window.active = true end @number_window.active = false @number_window.visible = false return end end end Perguntas Frequentes - Citação :
- Pergunta:Fuincona no VX? Você pode fazer um para VX?
Resposta:Respectivamente: não e não. Se desejam algo parecido para VX terão que buscar por versões criadas especialmente para o VX. Créditos e Agradecimentos• Feito por KGC | |
|