# # 注釈を使ったイベントコマンド拡張用必須スクリプトVer1.03(RGSS2) #  (C)2007-2008 TYPE74RX-T # #============================================================================== # ■ Game_Temp #------------------------------------------------------------------------------ #  セーブデータに含まれない、一時的なデータを扱うクラスです。このクラスのイン # スタンスは $game_temp で参照されます。 #============================================================================== class Game_Temp #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- alias rx_rgss2ic_initialize initialize def initialize # メソッドを呼び戻す rx_rgss2ic_initialize @rx_temp_argument = 0 # ★ 一時的な引数 end #-------------------------------------------------------------------------- # ★ 一時的な引数 #-------------------------------------------------------------------------- def rx_temp_argument return @rx_temp_argument end #-------------------------------------------------------------------------- # ★ 一時的な引数の設定 #-------------------------------------------------------------------------- def rx_temp_argument=(arg) @rx_temp_argument = arg end end #============================================================================== # ■ Game_Interpreter #------------------------------------------------------------------------------ #  イベントコマンドを実行するインタプリタです。このクラスは Game_Map クラス、 # Game_Troop クラス、Game_Event クラスの内部で使用されます。 #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ★ コマンドから先の文字列を全取得 #-------------------------------------------------------------------------- def rx_get_all_str(parameter, cmd_words) return parameter.slice(cmd_words.size, parameter.size) end #-------------------------------------------------------------------------- # ★ コマンドを含めた注釈の内容を全取得 #-------------------------------------------------------------------------- def rx_get_all_parameter(parameter) # 複数行にわたって設定している場合、それらを全て変数に代入する rx_str = parameter i = 1 loop do # 次の行に文字列がある場合 if @list[@index+i].code == 408 rx_str += @list[@index+i].parameters[0] i += 1 else break end end return rx_str end #-------------------------------------------------------------------------- # ★ コマンドを含めた注釈の内容から文字列のみ抜き出したものを配列化 #-------------------------------------------------------------------------- def rx_get_str_strrays(string) return string.split(/[\s\-]+/) end #-------------------------------------------------------------------------- # ★ アクターのハッシュを生成 #-------------------------------------------------------------------------- def rx_make_actors_hash result = {} for i in 1...$data_actors.size result[$data_actors[i].name] = $data_actors[i].id end return result end #-------------------------------------------------------------------------- # ★ 注釈から数字の文字列のみ取得し、数字の配列として返す #-------------------------------------------------------------------------- def rx_get_str_arrays(string) rx_str = string.scan(/[-10-9]+/) for i in 0...rx_str.size rx_str[i] = rx_str[i].to_i end return rx_str end #-------------------------------------------------------------------------- # ★ 変数の操作(独立式) #-------------------------------------------------------------------------- def rx_variables_control(a, b, control, value) for i in a .. b # 一括操作ループ case control # 操作 when 0 # 代入 $game_variables[i] = value when 1 # 加算 $game_variables[i] += value when 2 # 減算 $game_variables[i] -= value when 3 # 乗算 $game_variables[i] *= value when 4 # 除算 $game_variables[i] /= value if value != 0 when 5 # 剰余 $game_variables[i] %= value if value != 0 end if $game_variables[i] > 99999999 # 上限チェック $game_variables[i] = 99999999 end if $game_variables[i] < -99999999 # 下限チェック $game_variables[i] = -99999999 end end end #-------------------------------------------------------------------------- # ● イベントコマンドの実行 #-------------------------------------------------------------------------- alias rx_rgss2ic_execute_command execute_command def execute_command # 実行内容リストの最後に到達しておらず、コマンドコードが「注釈」である場合 if not @index >= @list.size - 1 and @list[@index].code == 108 # イベントコマンドのパラメータを @parameters で参照可能に @parameters = @list[@index].parameters # 「注釈」処理へ return command_108 end # メソッドを呼び戻す rx_rgss2ic_execute_command end #-------------------------------------------------------------------------- # ★ 注釈(コモンメソッド) #-------------------------------------------------------------------------- def command_108 # aliasに対応しやすくするためのコモンメソッドです。 # 注釈を使ったオリジナルイベントコマンドに対応するため # このメソッド自体の末尾にはtrueもfalseも返しません。 end end