TheoAllen

Theo - Disable Event Command

Oct 14th, 2013
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.12 KB | None | 0 0
  1. # =============================================================================
  2. # TheoAllen - Disable Event Command
  3. # Version : 1.0
  4. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  5. # (This script documentation is written in informal indonesian language)
  6. # =============================================================================
  7. ($imported ||= {})[:Theo_DisableEventCmd] = true
  8. # =============================================================================
  9. # CHANGE LOGS:
  10. # -----------------------------------------------------------------------------
  11. # 2013.10.14 - Finished script
  12. # =============================================================================
  13. =begin
  14.  
  15.   Perkenalan :
  16.   Script ini untuk ngedisable command yang ada dalam event untuk keperluan
  17.   debugging.
  18.  
  19.   Cara penggunaan :
  20.   Pasang script ini dibawah material namun diatas main
  21.   Gunakan label <event skip> untuk memulai skip event command yang ga dipake
  22.   Gunakan label </event skip> untuk mengakhiri skip event command
  23.  
  24.   Terms of use :
  25.   Ini cuman buat debuggging doank. Ga dikredit pun gapapa :v
  26.  
  27. =end
  28. # =============================================================================
  29. # Tidak ada konfigurasi
  30. # =============================================================================
  31. class Game_Interpreter
  32.  
  33.   alias theo_decmd_init initialize
  34.   def initialize(*args)
  35.     theo_decmd_init(*args)
  36.     @event_skip = false
  37.   end
  38.  
  39.   alias theo_decmd_118 command_118
  40.   def command_118
  41.     theo_decmd_118
  42.     if !(@params[0] =~ /<event skip>/i).nil?
  43.       @event_skip = true
  44.     elsif !(@params[0] =~ /<\/event skip>/i).nil?
  45.       @event_skip = false
  46.     end
  47.   end
  48.  
  49.   alias theo_decmd_exe_cmd execute_command
  50.   def execute_command
  51.     return skip_event_command if @event_skip
  52.     return theo_decmd_exe_cmd
  53.   end
  54.  
  55.   def skip_event_command
  56.     command = @list[@index]
  57.     @params = command.parameters
  58.     @indent = command.indent
  59.     if command.code == 118
  60.       method_name = "command_#{command.code}"
  61.       send(method_name) if respond_to?(method_name)
  62.     else
  63.       command_skip
  64.     end
  65.   end
  66.  
  67. end
Advertisement
Add Comment
Please, Sign In to add comment