Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- # ╔════════════════════════════════════════╗
- # ║ ▼ Dark's Set Move Route IF Conditional ║
- # ║ ▼ Author: Nhat Nguyen (Dark Sky) ║
- # ║ ▼ Release Date: March 23rd 2016 ║
- # ║ ▼ Forum: TaoTroChoi.com ║
- # ╚════════════════════════════════════════╝
- #-------------------------------------------------------------------------------
- # Version 1.0: Release!
- #-------------------------------------------------------------------------------
- # Yêu cầu: None
- #-------------------------------------------------------------------------------
- # Chức năng: Set Self Switch bằng lệnh IF trong Set Move Route. (Event Only)
- #-------------------------------------------------------------------------------
- # Script call (Trong Set Move Route): =if("Điều kiện",KEY,BOOLEAN)
- # "Điều kiện" : Điều kiện bật/tắt self switch.
- # "KEY" : Là tên self switch gồm A,B,C,D.
- # "BOOLEAN : true (bật) hoặc false (tắt).
- # Ví dụ: =if("\v[1] >= 5 && \s[4] == false",A,true)
- # Công dụng: Nếu var có id là 1 >= 5 và switch có id là 4 = false thì Bật self switch A.
- #===============================================================================
- VAR_TOKEN = /=if\(\s*"(.+)"\s*,\s*(A|B|C|D),(true|false)\)/i
- #===============================================================================
- class Game_Event
- alias :dark_if_condition_setmoveroute_process_move_command :process_move_command
- #--------------------------------------------------------------------------
- # * Process Move Command
- #--------------------------------------------------------------------------
- def process_move_command(command)
- if command.code == ROUTE_SCRIPT
- params = command.parameters
- if params[0] =~ VAR_TOKEN
- self_switch_key = $2.to_s
- self_switch_status = $3.to_s
- if $1.to_s.include?("v[") || $1.to_s.include?("s[")
- check = false
- var_s = $1.to_s.gsub("\\v[") { "$game_variables[" }
- var_s.gsub!("\\s[") { "$game_switches[" }
- var_s = "if #{var_s};check = true;end;"
- eval(var_s)
- if check == true
- key = [@map_id, @event.id, self_switch_key]
- eval("$game_self_switches[#{key}] = #{self_switch_status}")
- setup_page_settings
- refresh
- end
- return
- end
- end
- eval(params[0])
- else
- dark_if_condition_setmoveroute_process_move_command(command)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment