Class: Interpreter_RMXP

Inherits:
Object show all
Defined in:
scripts/00600 Script_RMXP/02400 Interpreter_1.rb,
scripts/00600 Script_RMXP/02500 Interpreter_2.rb,
scripts/00600 Script_RMXP/02600 Interpreter_3.rb,
scripts/00600 Script_RMXP/02700 Interpreter_4.rb,
scripts/00600 Script_RMXP/02800 Interpreter_5.rb,
scripts/00600 Script_RMXP/02900 Interpreter_6.rb,
scripts/00600 Script_RMXP/03000 Interpreter_7.rb

Overview

Interpreter of the event commands

Direct Known Subclasses

Interpreter

Constant Summary collapse

LiteRGSS2RGSS_Input =

Constant that holds the LiteRGSS input key to RGSS input Key

{
  A: 13, B: 12, X: 14, Y: 15,
  L: 17, R: 18,
  UP: 8, DOWN: 2, LEFT: 4, RIGHT: 6,
  L2: 16, R2: 25, L3: 23, R3: 29,
  START: 22, SELECT: 21
}
RGSS2LiteRGSS_Input =

Constant that holds the RGSS input key to LiteRGSS input key

LiteRGSS2RGSS_Input.invert
COMMAND_TRANSLATION =

Hash containing the command translation from code to method name

{
  101 => :command_101,
  102 => :command_102, 402 => :command_402, 403 => :command_403,
  103 => :command_103,
  104 => :command_104,
  105 => :command_105,
  106 => :command_106,
  111 => :command_111, 411 => :command_411,
  112 => :command_112, 413 => :command_413,
  113 => :command_113,
  115 => :command_115,
  116 => :command_116,
  117 => :command_117,
  118 => :command_118,
  119 => :command_119,
  121 => :command_121,
  122 => :command_122,
  123 => :command_123,
  124 => :command_124,
  125 => :command_125,
  126 => :command_126,
  127 => :command_127,
  128 => :command_128,
  129 => :command_129,
  131 => :command_131,
  132 => :command_132,
  133 => :command_133,
  134 => :command_134,
  135 => :command_135,
  136 => :command_136,
  201 => :command_201,
  202 => :command_202,
  203 => :command_203,
  204 => :command_204,
  205 => :command_205,
  206 => :command_206,
  207 => :command_207,
  208 => :command_208,
  209 => :command_209,
  210 => :command_210,
  221 => :command_221,
  222 => :command_222,
  223 => :command_223,
  224 => :command_224,
  225 => :command_225,
  231 => :command_231,
  232 => :command_232,
  233 => :command_233,
  234 => :command_234,
  235 => :command_235,
  236 => :command_236,
  241 => :command_241,
  242 => :command_242,
  245 => :command_245,
  246 => :command_246,
  247 => :command_247,
  248 => :command_248,
  249 => :command_249,
  250 => :command_250,
  251 => :command_251,
  301 => :command_301, 601 => :command_601, 602 => :command_602, 603 => :command_603,
  302 => :command_302,
  303 => :command_303,
  311 => :command_311,
  312 => :command_312,
  313 => :command_313,
  314 => :command_314,
  315 => :command_315,
  316 => :command_316,
  317 => :command_317,
  318 => :command_318,
  319 => :command_319,
  320 => :command_320,
  321 => :command_321,
  322 => :command_322,
  331 => :command_331,
  332 => :command_332,
  333 => :command_333,
  334 => :command_334,
  335 => :command_335,
  336 => :command_336,
  337 => :command_337,
  338 => :command_338,
  339 => :command_339,
  340 => :command_340,
  351 => :command_351,
  352 => :command_352,
  353 => :command_353,
  354 => :command_354,
  355 => :command_355
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(depth = 0, main = false) ⇒ Interpreter_RMXP

Initialize the Interpreter

Parameters:

  • depth (Integer) (defaults to: 0)

    depth of the Interpreter

  • main (Boolean) (defaults to: false)

    if the interpreter is the main interpreter



9
10
11
12
13
14
15
16
17
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 9

def initialize(depth = 0, main = false)
  @depth = depth
  @main = main
  if depth > 100
    print('The common event call exceeded the upper boundary.')
    exit
  end
  clear
end

Instance Attribute Details

#event_idInteger (readonly)

Id of the event that started the Interpreter

Returns:



5
6
7
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 5

def event_id
  @event_id
end

Instance Method Details

#clear

Clear the state of the interpreter



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 20

def clear
  # Map ID where the Interpreter was started
  @map_id = 0
  # Event ID in the map that is currently running the Interpreter
  @event_id = 0
  # If the Interpreter is waiting for a message
  @message_waiting = false
  # If the Interpreter is waiting for events to complete their mouve_rotue
  @move_route_waiting = false
  # If the Interpreter is waiting for a specific event to complete its moves
  @move_route_waiting_id = nil
  # ID of the variable where the Interpreter should put the Input key value
  @button_input_variable_id = 0
  # Number of frame the Interpreter has to wait until next execution
  @wait_count = 0
  # Sub Interpreters
  @child_interpreter = nil
  # Branches (condition, choices etc...)
  @branch = {}
end

#command_101

Command that starts a message display, if followed by a choice/input num command, displays the choice/input num in the meantime



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 4

def command_101
  return false if $game_temp.message_text
  # $game_player.look_to(@event_id) unless $game_switches[::Yuki::Sw::MSG_Noturn]
  @message_waiting = true
  $game_temp.message_proc = proc { @message_waiting = false }
  $game_temp.message_text = @list[@index].parameters[0].force_encoding(Encoding::UTF_8) + "\n"
  loop do
    if @list[@index.next].code == 401 # Next Message Line
      $game_temp.message_text += @list[@index.next].parameters[0].force_encoding(Encoding::UTF_8) + "\n"
    else
      if @list[@index.next].code == 102 # Choice command right after
        @index += 1
        # $game_temp.choice_start = line_count # There was a line_count counting line for RMXP
        setup_choices(@list[@index].parameters)
      elsif @list[@index.next].code == 103 # Input Number call
        @index += 1
        $game_temp.num_input_start = -99 # line_count
        $game_temp.num_input_variable_id = @list[@index].parameters[0]
        $game_temp.num_input_digits_max = @list[@index].parameters[1]
      end
      return true
    end
    @index += 1
  end
  return true
ensure
  $game_temp.message_text.gsub!(/\n([^ ])|\n /, ' \1') if $game_switches[Yuki::Sw::MSG_Recalibrate]
end

#command_102

Command that display a choice if possible (no message)



34
35
36
37
38
39
40
41
42
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 34

def command_102
  return false if $game_temp.message_text
  @message_waiting = true
  $game_temp.message_proc = proc { @message_waiting = false }
  $game_temp.message_text = nil.to_s
  $game_temp.choice_start = 0
  setup_choices(@parameters)
  return true
end

#command_103

Display an input number if possible (no message)



63
64
65
66
67
68
69
70
71
72
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 63

def command_103
  return false if $game_temp.message_text
  @message_waiting = true
  $game_temp.message_proc = proc { @message_waiting = false }
  $game_temp.message_text = nil.to_s
  $game_temp.num_input_start = 0
  $game_temp.num_input_variable_id = @parameters[0]
  $game_temp.num_input_digits_max = @parameters[1]
  return true
end

#command_104

Change the message settings (position / frame type)



75
76
77
78
79
80
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 75

def command_104
  return false if $game_temp.message_window_showing
  $game_system.message_position = @parameters[0]
  $game_system.message_frame = @parameters[1]
  return true
end

#command_105

Start a store button id to variable process



83
84
85
86
87
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 83

def command_105
  @button_input_variable_id = @parameters[0]
  @index += 1
  return false
end

#command_106

Wait 2 times the number of frame requested



90
91
92
93
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 90

def command_106
  @wait_count = @parameters[0] * 2
  return true
end

#command_111

Conditionnal command



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 96

def command_111
  result = false
  case @parameters[0]
  when 0  # Switch test
    result = ($game_switches[@parameters[1]] == (@parameters[2] == 0))
  when 1  # Variable comparison
    value1 = $game_variables[@parameters[1]]
    if @parameters[2] == 0
      value2 = @parameters[3]
    else
      value2 = $game_variables[@parameters[3]]
    end
    case @parameters[4]
    when 0  # Equal
      result = (value1 == value2)
    when 1  # Greater or Equal
      result = (value1 >= value2)
    when 2  # Lesser or Equal
      result = (value1 <= value2)
    when 3  # Greater
      result = (value1 > value2)
    when 4  # Lesser
      result = (value1 < value2)
    when 5  # Different
      result = (value1 != value2)
    end
  when 2  # Local Switch Test
    if @event_id > 0
      key = [$game_map.map_id, @event_id, @parameters[1]]
      if @parameters[2] == 0
        result = ($game_self_switches[key] == true)
      else
        result = ($game_self_switches[key] != true)
      end
    end
  when 3  # Timer test
    if $game_system.timer_working
      sec = $game_system.timer / 60 # Graphics.frame_rate
      if @parameters[2] == 0
        result = (sec >= @parameters[1])
      else
        result = (sec <= @parameters[1])
      end
    end
  when 4 # Actor test
    actor = PFM::BattleInterface.get_actor(@parameters[1]) # $game_actors[@parameters[1]]
    if actor
      case @parameters[2]
      when 0 # Is in Party => Alive
        result = !actor.dead? # ($game_party.actors.include?(actor))
      when 1  # Name => Given Name
        result = (actor.given_name == @parameters[3])
      when 2  # Skill learnt
        result = actor.skill_learnt?(@parameters[3], true) # (actor.skill_learn?(@parameters[3]))
      when 3 # Weapon => Item holding
        result = (actor.item_holding == @parameters[3]) # (actor.weapon_id == @parameters[3])
      when 4 # Armor => Ability
        result = (actor.current_ability == @parameters[3])
      when 5 # Status
        result = (actor.status == @parameters[3]) # (actor.state?(@parameters[3]))
      end
    end
  when 5 # Enemy Test
    enemy = PFM::BattleInterface.get_enemy(@parameters[1]) # $game_troop.enemies[@parameters[1]]
    if enemy
      case @parameters[2]
      when 0 # Exists => alive
        result = !enemy.dead? # (enemy.exist?)
      when 1 # State
        result = (enemy.status == @parameters[3]) # (enemy.state?(@parameters[3]))
      end
    end
  when 6 # Character direction test
    if (character = get_character(@parameters[1]))
      result = (character.direction == @parameters[2])
    end
  when 7 # Money test
    if @parameters[2] == 0
      result = (PFM.game_state.money >= @parameters[1]) # ($game_party.gold >= @parameters[1])
    else
      result = (PFM.game_state.money <= @parameters[1]) # ($game_party.gold <= @parameters[1])
    end
  when 8 # Item is owned
    result = $bag.contain_item?(@parameters[1]) # ($game_party.item_number(@parameters[1]) > 0)
  when 9 # Weapon owned
    result = false # ($game_party.weapon_number(@parameters[1]) > 0)
  when 10 # Armor owned
    result = false # ($game_party.armor_number(@parameters[1]) > 0)
  when 11 # Key pressed
    result = Input.press?(RGSS2LiteRGSS_Input[@parameters[1]])
  when 12 # Script
    result = eval_condition_script(@parameters[1])
  end
  # Set current branch result
  @branch[@list[@index].indent] = result
  # If true, remove current branch and execute the next command
  if @branch[@list[@index].indent] == true
    @branch.delete(@list[@index].indent)
    return true
  end
  # If false, skip next command until false command are found
  return command_skip
end

#command_112

Loop command



226
227
228
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 226

def command_112
  return true
end

#command_113

Break loop command (try to go to the end of the loop)



240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 240

def command_113
  indent = @list[@index].indent
  temp_index = @index
  loop do
    temp_index += 1
    return true if temp_index >= @list.size - 1
    # If we find a repeat loop of the a parent loop, we stop there and let the command execute
    if @list[temp_index].code == 413 && @list[temp_index].indent < indent
      @index = temp_index
      return true
    end
  end
end

#command_115

End the interpretation of the current event



255
256
257
258
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 255

def command_115
  command_end
  return true
end

#command_116

erase this event



261
262
263
264
265
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 261

def command_116
  $game_map.events[@event_id].erase if @event_id > 0
  @index += 1
  return false
end

#command_117

Call a common event



268
269
270
271
272
273
274
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 268

def command_117
  if (common_event = $data_common_events[@parameters[0]])
    @child_interpreter = Interpreter.new(@depth + 1)
    @child_interpreter.setup(common_event.list, @event_id)
  end
  return true
end

#command_118

Label command



277
278
279
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 277

def command_118
  return true
end

#command_119

jump to a label



282
283
284
285
286
287
288
289
290
291
292
293
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 282

def command_119
  label_name = @parameters[0]
  temp_index = 0
  loop do
    return true if temp_index >= @list.size - 1
    if @list[temp_index].code == 118 && @list[temp_index].parameters[0] == label_name
      @index = temp_index
      return true
    end
    temp_index += 1
  end
end

#command_121

Multiple switch set



5
6
7
8
9
10
11
12
13
14
15
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 5

def command_121
  # 一括操作のためにループ
  for i in @parameters[0] .. @parameters[1]
    # スイッチを変更
    $game_switches[i] = (@parameters[2] == 0)
  end
  # マップをリフレッシュ
  $game_map.need_refresh = true
  # 継続
  return true
end

#command_122

Variable set



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 17

def command_122
  # 値を初期化
  value = 0
  # オペランドで分岐
  case @parameters[3]
  when 0  # 定数
    value = @parameters[4]
  when 1  # 変数
    value = $game_variables[@parameters[4]]
  when 2  # 乱数
    value = @parameters[4] + rand(@parameters[5] - @parameters[4] + 1)
  when 3  # アイテム
    value = $bag.item_quantity(@parameters[4]) #$game_party.item_number(@parameters[4])
  when 4  # アクター
    actor = $actors[@parameters[4]] #$game_actors[@parameters[4]]
    if actor != nil
      case @parameters[5]
      when 0  # レベル
        value = actor.level
      when 1  # EXP
        value = actor.exp
      when 2  # HP
        value = actor.hp
      when 3  # SP
        value = 0 #actor.sp
      when 4  # MaxHP
        value = actor.max_hp
      when 5  # MaxSP
        value = 0 #actor.maxsp
      when 6  # 腕力 / Force => Bonheur ?
        value = actor.loyalty #actor.str
      when 7  # 器用さ / Dextérité => Précision
        value = actor.acc_stage #actor.dex
      when 8  # 素早さ / Agilité => Vitesse
        value = actor.spd #actor.agi
      when 9  # 魔力 / Intelligence => Attaque spéciale
        value = actor.ats #actor.int
      when 10  # 攻撃力 / Attaque
        value = actor.atk
      when 11  # 物理防御 / Défense physique => Défense
        value = actor.dfe #actor.pdef
      when 12  # 魔法防御 / Défense magique => Défense spéciale
        value = actor.dfs #actor.mdef
      when 13  # 回避修正 / Evasion => Esquive
        value = actor.eva_stage #actor.eva
      end
    end
  when 5  # エネミー
    enemy = $actors[@parameters[4]] #$game_troop.enemies[@parameters[4]]
    if enemy != nil
      case @parameters[5]
      when 0  # HP
        value = enemy.hp
      when 1  # SP
        value = 0 #enemy.sp
      when 2  # MaxHP
        value = enemy.max_hp
      when 3  # MaxSP
        value = 0 #enemy.maxsp
      when 4  # 腕力 / Force => Bonheur ?
        value = enemy.loyalty #enemy.str
      when 5  # 器用さ / Dextérité => Précision
        value = enemy.acc_stage #enemy.dex
      when 6  # 素早さ / Agilité => Vitess
        value = enemy.spd #enemy.agi
      when 7  # 魔力 / Intelligence => Attaque spéciale
        value = enemy.ats #enemy.int
      when 8  # 攻撃力 / Attaque
        value = enemy.atk
      when 9  # 物理防御 / Défense physique => Défense
        value = enemy.dfe #enemy.pdef
      when 10  # 魔法防御 / Défense magique => Défense spéciale
        value = enemy.dfs #enemy.mdef
      when 11  # 回避修正 / Evasion => Esquive
        value = enemy.eva_stage #enemy.eva
      end
    end
  when 6  # キャラクター
    character = get_character(@parameters[4])
    if character != nil
      case @parameters[5]
      when 0  # X 座標
        value = character.x - ::Yuki::MapLinker.current_OffsetX
      when 1  # Y 座標
        value = character.y - ::Yuki::MapLinker.current_OffsetY
      when 2  # 向き
        value = character.direction
      when 3  # 画面 X 座標
        value = character.screen_x
      when 4  # 画面 Y 座標
        value = character.screen_y
      when 5  # 地形タグ
        value = character.terrain_tag
      end
    end
  when 7  # その他
    case @parameters[4]
    when 0  # マップ ID
      value = $game_map.map_id
    when 1  # パーティ人数
      value = $actors.size #$game_party.actors.size
    when 2  # ゴールド
      value = PFM.game_state.money #$game_party.gold
    when 3  # 歩数
      value = PFM.game_state.steps
    when 4  # プレイ時間
      value = Graphics.frame_count / 60#Graphics.frame_rate
    when 5  # タイマー
      value = $game_system.timer / 60#Graphics.frame_rate
    when 6  # セーブ回数
      value = $game_system.save_count
    end
  end
  # 一括操作のためにループ
  for i in @parameters[0] .. @parameters[1]
    # 操作で分岐
    case @parameters[2]
    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  # 除算
      if value != 0
        $game_variables[i] /= value
      end
    when 5  # 剰余
      if value != 0
        $game_variables[i] %= value
      end
    end
    # 上限チェック
    if $game_variables[i] > 99999999
      $game_variables[i] = 99999999
    end
    # 下限チェック
    if $game_variables[i] < -99999999
      $game_variables[i] = -99999999
    end
  end
  # マップをリフレッシュ
  $game_map.need_refresh = true
  # 継続
  return true
end

#command_123

Self Switch set



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 166

def command_123
  # イベント ID が有効の場合
  if @event_id > 0
    # セルフスイッチのキーを作成
    #key = [$game_map.map_id, @event_id, @parameters[0]]
    #> MapLinkerPatch
    event = $game_map.events[@event_id]
    return unless event
    event = event.event
    key = [event.original_map || $game_map.map_id, 
      event.original_id || @event_id, 
      @parameters[0]]
    # セルフスイッチを変更
    $game_self_switches[key] = (@parameters[1] == 0)
  end
  # マップをリフレッシュ
  $game_map.need_refresh = true
  # 継続
  return true
end

#command_124

Timer start / stop



187
188
189
190
191
192
193
194
195
196
197
198
199
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 187

def command_124
  # 始動の場合
  if @parameters[0] == 0
    $game_system.timer = @parameters[1] * 60#Graphics.frame_rate
    $game_system.timer_working = true
  end
  # 停止の場合
  if @parameters[0] == 1
    $game_system.timer_working = false
  end
  # 継続
  return true
end

#command_125

Earn gold command



201
202
203
204
205
206
207
208
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 201

def command_125
  # 操作する値を取得
  value = operate_value(@parameters[0], @parameters[1], @parameters[2])
  # ゴールドの増減
  $game_party.gain_gold(value)
  # 継続
  return true
end

#command_126

Get item command



211
212
213
214
215
216
217
218
219
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 211

def command_126
  # 操作する値を取得
  value = operate_value(@parameters[1], @parameters[2], @parameters[3])
  # アイテムの増減
  $bag.add_item(@parameters[0], value)
  Audio.me_play(data_item(@parameters[0]).me, 80) if value > 0
  # 継続
  return true
end

#command_127

Gain weapon command



222
223
224
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 222

def command_127
  return true
end

#command_128

Gain armor command



227
228
229
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 227

def command_128
  return true
end

#command_129

Add or remove actor command



231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 231

def command_129
  # アクターを取得
  actor = $game_actors[@parameters[0]]
  # アクターが有効の場合
  if actor != nil
    # 操作で分岐
    if @parameters[1] == 0
      if @parameters[2] == 1
        $game_actors[@parameters[0]].setup(@parameters[0])
      end
      $game_party.add_actor(@parameters[0])
    else
      $game_party.remove_actor(@parameters[0])
    end
  end
  # 継続
  return true
end

#command_131

Window skin change command



250
251
252
253
254
255
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 250

def command_131
  # ウィンドウスキン ファイル名を設定
  $game_system.windowskin_name = @parameters[0]
  # 継続
  return true
end

#command_132

Battle BGM change command



257
258
259
260
261
262
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 257

def command_132
  # バトル BGM を設定
  $game_system.battle_bgm = @parameters[0]
  # 継続
  return true
end

#command_133

Battle end ME change command



264
265
266
267
268
269
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 264

def command_133
  # バトル終了 ME を設定
  $game_system.battle_end_me = @parameters[0]
  # 継続
  return true
end

#command_134

Save disable command



271
272
273
274
275
276
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 271

def command_134
  # セーブ禁止フラグを変更
  $game_system.save_disabled = (@parameters[0] == 0)
  # 継続
  return true
end

#command_135

Menu disable command



278
279
280
281
282
283
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 278

def command_135
  # メニュー禁止フラグを変更
  $game_system.menu_disabled = (@parameters[0] == 0)
  # 継続
  return true
end

#command_136

Encounter disable command



285
286
287
288
289
290
291
292
# File 'scripts/00600 Script_RMXP/02700 Interpreter_4.rb', line 285

def command_136
  # エンカウント禁止フラグを変更
  $game_system.encounter_disabled = (@parameters[0] == 0)
  # エンカウント カウントを作成
  $game_player.make_encounter_count
  # 継続
  return true
end

#command_201

Warp command



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 5

def command_201
  # 戦闘中の場合
  if $game_temp.in_battle
    # 継続
    return true
  end
  # 場所移動中、メッセージ表示中、トランジション処理中の場合
  if $game_temp.player_transferring or
     $game_temp.message_window_showing or
     $game_temp.transition_processing
    # 終了
    return false
  end
  # 場所移動フラグをセット
  $game_temp.player_transferring = true
  # 指定方法が [直接指定] の場合
  if @parameters[0] == 0
    # プレイヤーの移動先を設定
    $game_temp.player_new_map_id = @parameters[1]
    $game_temp.player_new_x = @parameters[2] + ::Yuki::MapLinker.get_OffsetX
    $game_temp.player_new_y = @parameters[3] + ::Yuki::MapLinker.get_OffsetY
    $game_temp.player_new_direction = @parameters[4]
  # 指定方法が [変数で指定] の場合
  else
    # プレイヤーの移動先を設定
    $game_temp.player_new_map_id = $game_variables[@parameters[1]]
    $game_temp.player_new_x = $game_variables[@parameters[2]] + ::Yuki::MapLinker.get_OffsetX
    $game_temp.player_new_y = $game_variables[@parameters[3]] + ::Yuki::MapLinker.get_OffsetY
    $game_temp.player_new_direction = @parameters[4]
  end
  # インデックスを進める
  @index += 1
  # フェードありの場合
  if @parameters[5] == 0
    # トランジション準備
    Graphics.freeze
    # トランジション処理中フラグをセット
    $game_temp.transition_processing = true
    $game_temp.transition_name = nil.to_s
  end
  # 終了
  return false
end

#command_202

Displace command



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 49

def command_202
  # 戦闘中の場合
  if $game_temp.in_battle
    # 継続
    return true
  end
  # キャラクターを取得
  character = get_character(@parameters[0])
  # キャラクターが存在しない場合
  if character == nil
    # 継続
    return true
  end
  # 指定方法が [直接指定] の場合
  if @parameters[1] == 0
    # キャラクターの位置を設定
    character.moveto(@parameters[2] + ::Yuki::MapLinker.current_OffsetX, 
    @parameters[3] + ::Yuki::MapLinker.current_OffsetY)
  # 指定方法が [変数で指定] の場合
  elsif @parameters[1] == 1
    # キャラクターの位置を設定
    character.moveto($game_variables[@parameters[2]] + 
      ::Yuki::MapLinker.current_OffsetX,  $game_variables[@parameters[3]] + 
      ::Yuki::MapLinker.current_OffsetY)
  # 指定方法が [他のイベントと交換] の場合
  else
    old_x = character.x
    old_y = character.y
    character2 = get_character(@parameters[2])
    if character2 != nil
      character.moveto(character2.x, character2.y)
      character2.moveto(old_x, old_y)
    end
  end
  # キャラクターの向きを設定
  case @parameters[4]
  when 8  # 上
    character.turn_up
  when 6  # 右
    character.turn_right
  when 2  # 下
    character.turn_down
  when 4  # 左
    character.turn_left
  end
  # 継続
  return true
end

#command_203

Map scroll command



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 98

def command_203
  # 戦闘中の場合
  if $game_temp.in_battle
    # 継続
    return true
  end
  # すでにスクロール中の場合
  if $game_map.scrolling?
    # 終了
    return false
  end
  # スクロールを開始
  $game_map.start_scroll(@parameters[0], @parameters[1], @parameters[2])
  # 継続
  return true
end

#command_204

Map property change command



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 115

def command_204
  case @parameters[0]
  when 0  # パノラマ
    $game_map.panorama_name = @parameters[1]
    $game_map.panorama_hue = @parameters[2]
  when 1  # フォグ
    $game_map.fog_name = @parameters[1]
    $game_map.fog_hue = @parameters[2]
    $game_map.fog_opacity = @parameters[3]
    $game_map.fog_blend_type = @parameters[4]
    $game_map.fog_zoom = @parameters[5]
    $game_map.fog_sx = @parameters[6]
    $game_map.fog_sy = @parameters[7]
  when 2  # バトルバック
    $game_map.battleback_name = @parameters[1]
    $game_temp.battleback_name = @parameters[1]
#      Yuki::GemmeProc::battle_back_skip unless Yuki::GemmeProc::set_battle_back_var(@parameters[1])
  end
  # 継続
  return true
end

#command_205

Map Tone change command



137
138
139
140
141
142
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 137

def command_205
  # 色調変更を開始
  $game_map.start_fog_tone_change(@parameters[0], @parameters[1] * 2)
  # 継続
  return true
end

#command_206

Map fog opacity change command



144
145
146
147
148
149
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 144

def command_206
  # 不透明度変更を開始
  $game_map.start_fog_opacity_change(@parameters[0], @parameters[1] * 2)
  # 継続
  return true
end

#command_207

Display animation on character command



151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 151

def command_207
  # キャラクターを取得
  character = get_character(@parameters[0])
  # キャラクターが存在しない場合
  if character == nil
    # 継続
    return true
  end
  # アニメーション ID を設定
  character.animation_id = @parameters[1]
  # 継続
  return true
end

#command_208

Make player transparent command



165
166
167
168
169
170
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 165

def command_208
  # プレイヤーの透明状態を設定
  $game_player.transparent = (@parameters[0] == 0)
  # 継続
  return true
end

#command_209

Move route set command



172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 172

def command_209
  # キャラクターを取得
  character = get_character(@parameters[0])
  # キャラクターが存在しない場合
  if character == nil
    # 継続
    return true
  end
  # 移動ルートを強制
  character.force_move_route(@parameters[1])
  # 継続
  return true
end

#command_210

Wait until end of events move route



186
187
188
189
190
191
192
193
194
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 186

def command_210
  # 戦闘中でなければ
  unless $game_temp.in_battle
    # 移動完了待機中フラグをセット
    @move_route_waiting = true
  end
  # 継続
  return true
end

#command_221

Prepare transition command



196
197
198
199
200
201
202
203
204
205
206
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 196

def command_221
  # メッセージウィンドウ表示中の場合
  if $game_temp.message_window_showing
    # 終了
    return false
  end
  # トランジション準備
  Graphics.freeze
  # 継続
  return true
end

#command_222

Execute transition command



208
209
210
211
212
213
214
215
216
217
218
219
220
221
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 208

def command_222
  # トランジション処理中フラグがすでにセットされている場合
  if $game_temp.transition_processing
    # 終了
    return false
  end
  # トランジション処理中フラグをセット
  $game_temp.transition_processing = true
  $game_temp.transition_name = @parameters[0]
  # インデックスを進める
  @index += 1
  # 終了
  return false
end

#command_223

Screen tone change command



223
224
225
226
227
228
229
230
231
232
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 223

def command_223
  # 色調変更を開始
  if @parameters[0] != Game_Screen::NEUTRAL_TONE
    $game_screen.start_tone_change(@parameters[0], @parameters[1] * 2)
  else
    $game_screen.start_tone_change(Yuki::TJN.current_tone, @parameters[1] * 2)
  end
  # 継続
  return true
end

#command_224

Flash screen command



234
235
236
237
238
239
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 234

def command_224
  # フラッシュを開始
  $game_screen.start_flash(@parameters[0], @parameters[1] * 2)
  # 継続
  return true
end

#command_225

Shake screen command



241
242
243
244
245
246
247
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 241

def command_225
  # シェイクを開始
  $game_screen.start_shake(@parameters[0], @parameters[1],
    @parameters[2] * 2)
  # 継続
  return true
end

#command_231

Picture display command



249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 249

def command_231
  # ピクチャ番号を取得
  number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
  # 指定方法が [直接指定] の場合
  if @parameters[3] == 0
    x = @parameters[4]
    y = @parameters[5]
  # 指定方法が [変数で指定] の場合
  else
    x = $game_variables[@parameters[4]]
    y = $game_variables[@parameters[5]]
  end
  # ピクチャを表示
  $game_screen.pictures[number].show(@parameters[1], @parameters[2],
    x, y, @parameters[6], @parameters[7], @parameters[8], @parameters[9])
  # 継続
  return true
end

#command_232

Picture move command



268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 268

def command_232
  # ピクチャ番号を取得
  number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
  # 指定方法が [直接指定] の場合
  if @parameters[3] == 0
    x = @parameters[4]
    y = @parameters[5]
  # 指定方法が [変数で指定] の場合
  else
    x = $game_variables[@parameters[4]]
    y = $game_variables[@parameters[5]]
  end
  # ピクチャを移動
  $game_screen.pictures[number].move(@parameters[1] * 2, @parameters[2],
    x, y, @parameters[6], @parameters[7], @parameters[8], @parameters[9])
  # 継続
  return true
end

#command_233

Picture rotate command



287
288
289
290
291
292
293
294
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 287

def command_233
  # ピクチャ番号を取得
  number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
  # 回転速度を設定
  $game_screen.pictures[number].rotate(@parameters[1])
  # 継続
  return true
end

#command_234

Picture tone change command



296
297
298
299
300
301
302
303
304
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 296

def command_234
  # ピクチャ番号を取得
  number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
  # 色調変更を開始
  $game_screen.pictures[number].start_tone_change(@parameters[1],
    @parameters[2] * 2)
  # 継続
  return true
end

#command_235

Picture erase command



306
307
308
309
310
311
312
313
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 306

def command_235
  # ピクチャ番号を取得
  number = @parameters[0] + ($game_temp.in_battle ? 50 : 0)
  # ピクチャを消去
  $game_screen.pictures[number].erase
  # 継続
  return true
end

#command_236

Weather change command



315
316
317
318
319
320
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 315

def command_236
  # 天候を設定
  $game_screen.weather(@parameters[0], @parameters[1], @parameters[2])
  # 継続
  return true
end

#command_241

BGM play command



322
323
324
325
326
327
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 322

def command_241
  # BGM を演奏
  $game_system.bgm_play(@parameters[0])
  # 継続
  return true
end

#command_242

BGM fade command



329
330
331
332
333
334
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 329

def command_242
  # BGM をフェードアウト
  $game_system.bgm_fade(@parameters[0])
  # 継続
  return true
end

#command_245

BGS play command



336
337
338
339
340
341
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 336

def command_245
  # BGS を演奏
  $game_system.bgs_play(@parameters[0])
  # 継続
  return true
end

#command_246

BGS Fade command



343
344
345
346
347
348
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 343

def command_246
  # BGS をフェードアウト
  $game_system.bgs_fade(@parameters[0])
  # 継続
  return true
end

#command_247

BGM & BGS memorize command



350
351
352
353
354
355
356
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 350

def command_247
  # BGM / BGS を記憶
  $game_system.bgm_memorize
  $game_system.bgs_memorize
  # 継続
  return true
end

#command_248

BGM & BGS restore command



358
359
360
361
362
363
364
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 358

def command_248
  # BGM / BGS を復帰
  $game_system.bgm_restore
  $game_system.bgs_restore
  # 継続
  return true
end

#command_249

ME play command



366
367
368
369
370
371
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 366

def command_249
  # ME を演奏
  $game_system.me_play(@parameters[0])
  # 継続
  return true
end

#command_250

SE play command



373
374
375
376
377
378
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 373

def command_250
  # SE を演奏
  $game_system.se_play(@parameters[0])
  # 継続
  return true
end

#command_251

SE stop command



380
381
382
383
384
385
# File 'scripts/00600 Script_RMXP/02800 Interpreter_5.rb', line 380

def command_251
  # SE を停止
  Audio.se_stop
  # 継続
  return true
end

#command_301

Start battle command



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 5

def command_301
  # 無効なトループでなければ
  if $data_troops[@parameters[0]] != nil
    # バトル中断フラグをセット
    $game_temp.battle_abort = true
    # バトル呼び出しフラグをセット
    $game_temp.battle_calling = true
    $game_temp.battle_troop_id = @parameters[0]
    $game_temp.battle_can_escape = @parameters[1]
    $game_temp.battle_can_lose = @parameters[2]
    # コールバックを設定
    current_indent = @list[@index].indent
    $game_temp.battle_proc = Proc.new { |n| @branch[current_indent] = n }
  end
  # インデックスを進める
  @index += 1
  # 終了
  return false
end

#command_302

Call a shop command



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 65

def command_302
  # バトル中断フラグをセット
  $game_temp.battle_abort = true
  # ショップ呼び出しフラグをセット
  $game_temp.shop_calling = true
  # 商品リストに新しい項目を設定
  $game_temp.shop_goods = [@parameters]
  # ループ
  loop do
    # インデックスを進める
    @index += 1
    # 次のイベントコマンドがショップ 2 行目以降の場合
    if @list[@index].code == 605
      # 商品リストに新しい項目を追加
      $game_temp.shop_goods.push(@list[@index].parameters)
    # イベントコマンドがショップ 2 行目以降ではない場合
    else
      # 終了
      return false
    end
  end
end

#command_303

Name calling command



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 89

def command_303
  # 無効なアクターでなければ
  if $data_actors[@parameters[0]] != nil
    # バトル中断フラグをセット
    $game_temp.battle_abort = true
    # 名前入力呼び出しフラグをセット
    $game_temp.name_calling = true
    $game_temp.name_actor_id = @parameters[0]
    $game_temp.name_max_char = @parameters[1]
  end
  # インデックスを進める
  @index += 1
  # 終了
  return false
end

#command_311

Add or remove HP command



106
107
108
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 106

def command_311
  return true
end

#command_312

Add or remove SP command



111
112
113
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 111

def command_312
  return true
end

#command_313

Add or remove state command



116
117
118
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 116

def command_313
  return true
end

#command_314

Heal command



121
122
123
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 121

def command_314
  return true
end

#command_315

Add exp command



126
127
128
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 126

def command_315
  return true
end

#command_316

Add level command



131
132
133
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 131

def command_316
  return true
end

#command_317

Change stat command



136
137
138
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 136

def command_317
  return true
end

#command_318

Skill learn/forget command



141
142
143
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 141

def command_318
  return true
end

#command_319

Equip command



146
147
148
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 146

def command_319
  return true
end

#command_320

Name change command



151
152
153
154
155
156
157
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 151

def command_320
  # アクターを取得
  actor = $game_actors[@parameters[0]]
  actor.name = @parameters[1] if actor
  # 継続
  return true
end

#command_321

Class change command



160
161
162
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 160

def command_321
  return true
end

#command_322

Actor graphic change command



165
166
167
168
169
170
171
172
173
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 165

def command_322
  # アクターを取得
  actor = $game_actors[@parameters[0]]
  actor&.set_graphic(@parameters[1], @parameters[2], @parameters[3], @parameters[4])
  # プレイヤーをリフレッシュ
  $game_player.refresh
  # 継続
  return true
end

#command_331

Enemy HP change command



5
6
7
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 5

def command_331
  return true
end

#command_332

Enemy SP change command



10
11
12
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 10

def command_332
  return true
end

#command_333

Enemy state change command



15
16
17
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 15

def command_333
  return true
end

#command_334

Enemy heal command



20
21
22
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 20

def command_334
  return true
end

#command_335

Enemy show command



25
26
27
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 25

def command_335
  return true
end

#command_336

Enemy transform command



30
31
32
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 30

def command_336
  return true
end

#command_337

Play animation on battler



35
36
37
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 35

def command_337
  return true
end

#command_338

Damage on battler command



40
41
42
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 40

def command_338
  return true
end

#command_339

Battler force action command



45
46
47
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 45

def command_339
  return true
end

#command_340

End battle command



50
51
52
53
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 50

def command_340
  @index += 1
  return false
end

#command_351

Call menu command



56
57
58
59
60
61
62
63
64
65
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 56

def command_351
  # バトル中断フラグをセット
  $game_temp.battle_abort = true
  # メニュー呼び出しフラグをセット
  $game_temp.menu_calling = true
  # インデックスを進める
  @index += 1
  # 終了
  return false
end

#command_352

Call save command



68
69
70
71
72
73
74
75
76
77
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 68

def command_352
  # バトル中断フラグをセット
  $game_temp.battle_abort = true
  # セーブ呼び出しフラグをセット
  $game_temp.save_calling = true
  # インデックスを進める
  @index += 1
  # 終了
  return false
end

#command_353

Game Over command



80
81
82
83
84
85
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 80

def command_353
  # ゲームオーバーフラグをセット
  $game_temp.gameover = true
  # 終了
  return false
end

#command_354

Go to title command



88
89
90
91
92
93
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 88

def command_354
  # タイトル画面に戻すフラグをセット
  $game_temp.to_title = true
  # 終了
  return false
end

#command_355

Execute script command



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 96

def command_355
  # script に 1 行目を設定
  script = @list[@index].parameters[0] + "\n"
  # ループ
  loop do
    # 次のイベントコマンドがスクリプト 2 行目以降の場合
    if @list[@index+1].code == 655
      # script に 2 行目以降を追加
      script += @list[@index+1].parameters[0] + "\n"
    # イベントコマンドがスクリプト 2 行目以降ではない場合
    else
      # ループ中断
      break
    end
    # インデックスを進める
    @index += 1
  end
  # 評価
  eval_script(script)
  return true
end

#command_402

Command that execute the choice branch depending on the choice result



45
46
47
48
49
50
51
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 45

def command_402
  if @branch[@list[@index].indent] == @parameters[0]
    @branch.delete(@list[@index].indent)
    return true
  end
  return command_skip
end

#command_403

Command that execute the cancel branch if the result was 4 (max option in RMXP)



54
55
56
57
58
59
60
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 54

def command_403
  if @branch[@list[@index].indent] == 4
    @branch.delete(@list[@index].indent)
    return true
  end
  return command_skip
end

#command_411

Command testing the false section of condition



216
217
218
219
220
221
222
223
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 216

def command_411
  if @branch[@list[@index].indent] == false
    @branch.delete(@list[@index].indent)
    return true
  end
  # Skip commands until we find the normal commands (after conditition)
  return command_skip
end

#command_413

Repeat loop command (try to go back to the loop command of the same indent)



231
232
233
234
235
236
237
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 231

def command_413
  indent = @list[@index].indent
  loop do
    @index -= 1
    return true if @list[@index].indent == indent
  end
end

#command_601

勝った場合



26
27
28
29
30
31
32
33
34
35
36
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 26

def command_601
  # バトル結果が勝ちの場合
  if @branch[@list[@index].indent] == 0
    # 分岐データを削除
    @branch.delete(@list[@index].indent)
    # 継続
    return true
  end
  # 条件に該当しない場合 : コマンドスキップ
  return command_skip
end

#command_602

逃げた場合



39
40
41
42
43
44
45
46
47
48
49
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 39

def command_602
  # バトル結果が逃げの場合
  if @branch[@list[@index].indent] == 1
    # 分岐データを削除
    @branch.delete(@list[@index].indent)
    # 継続
    return true
  end
  # 条件に該当しない場合 : コマンドスキップ
  return command_skip
end

#command_603

負けた場合



52
53
54
55
56
57
58
59
60
61
62
# File 'scripts/00600 Script_RMXP/02900 Interpreter_6.rb', line 52

def command_603
  # バトル結果が負けの場合
  if @branch[@list[@index].indent] == 2
    # 分岐データを削除
    @branch.delete(@list[@index].indent)
    # 継続
    return true
  end
  # 条件に該当しない場合 : コマンドスキップ
  return command_skip
end

#command_end

Command that end the interpretation of the current event



20
21
22
23
24
25
26
27
28
# File 'scripts/00600 Script_RMXP/02500 Interpreter_2.rb', line 20

def command_end
  # 実行内容リストをクリア
  @list = nil
  # メインのマップイベント かつ イベント ID が有効の場合
  if @main and @event_id > 0
    # イベントのロックを解除
    $game_map.events[@event_id].unlock
  end
end

#command_skip

Command that skip the next commands until it find a command with the same indent



31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'scripts/00600 Script_RMXP/02500 Interpreter_2.rb', line 31

def command_skip
  # インデントを取得
  indent = @list[@index].indent
  # ループ
  loop do
    # 次のイベントコマンドが同レベルのインデントの場合
    if @list[@index+1].indent == indent
      # 継続
      return true
    end
    # インデックスを進める
    @index += 1
  end
end

#eval_condition_script(script)

Function that execute a script for the conditions

Parameters:



202
203
204
205
206
207
208
209
210
211
212
213
# File 'scripts/00600 Script_RMXP/02600 Interpreter_3.rb', line 202

def eval_condition_script(script)
  last_eval = Yuki::EXC.get_eval_script
  script = script.force_encoding('UTF-8')
  Yuki::EXC.set_eval_script(script)
  result = eval(script) ? true : false
  return result
rescue StandardError => e
  Yuki::EXC.run(e)
  return false
ensure
  Yuki::EXC.set_eval_script(last_eval)
end

#eval_script(script)

Function that execute a script

Parameters:



120
121
122
123
124
125
126
127
128
129
130
# File 'scripts/00600 Script_RMXP/03000 Interpreter_7.rb', line 120

def eval_script(script)
  last_eval = Yuki::EXC.get_eval_script
  script = script.force_encoding('UTF-8').gsub(/\n([(,])/, "\\1\n")
  Yuki::EXC.set_eval_script(script)
  eval(script)
rescue StandardError => e
  Yuki::EXC.run(e)
  $scene = nil # It's better to close the game in that case
ensure
  Yuki::EXC.set_eval_script(last_eval)
end

#execute_command

Execute a command of the current event



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'scripts/00600 Script_RMXP/02500 Interpreter_2.rb', line 3

def execute_command
  # We execute the fiber if it exists
  return @fiber.resume if @fiber
  # We stop interpretation if we reached the end of the list
  if @index >= @list.size - 1
    command_end
    return true
  end
  # We store the parameters in @parameters
  @parameters = @list[@index].parameters
  method_name = COMMAND_TRANSLATION[@list[@index].code]
  return true unless method_name

  return send(method_name)
end

#get_character(parameter) ⇒ Game_Event, ...

Command that retrieve a Game_Character object

Parameters:

  • parameter (Integer, Symbol)

    > 0 : id of the event, 0 : current event, -1 : player or follower, Symbol : alias

Returns:



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'scripts/00600 Script_RMXP/02500 Interpreter_2.rb', line 49

def get_character(parameter)
  # Get the character from alias if the parameter is a Symbol
  parameter = $game_map.events_sym_to_id[parameter] if parameter.is_a?(Symbol)
  # パラメータで分岐
  case parameter
  when -1 # プレイヤー
    if $game_variables[Yuki::Var::FM_Sel_Foll] > 0
      return Yuki::FollowMe.get_follower($game_variables[Yuki::Var::FM_Sel_Foll] - 1)
    end
    return $game_player
  when 0  # このイベント
    events = $game_map.events
    return events == nil ? nil : events[@event_id]
  else # 特定のイベント
    events = $game_map.events
    return events == nil ? nil : events[parameter]
  end
end

#input_button

Check if a button is triggered and store its id in a variable



151
152
153
154
155
156
157
158
159
160
161
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 151

def input_button
  n = 0
  LiteRGSS2RGSS_Input.each do |key, i|
    n = i if Input.trigger?(key)
  end
  if n > 0
    $game_variables[@button_input_variable_id] = n
    $game_map.need_refresh = true
    @button_input_variable_id = 0
  end
end

#iterate_actor(parameter)

Execute a block on a specific actor (parameter > 0) or every actors in the Party

Parameters:

  • parameter (Integer)

    whole party or id of an actor in the database



174
175
176
177
178
179
180
181
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 174

def iterate_actor(parameter)
  if parameter == 0
    $game_party.actors.each { |actor| yield actor }
  else
    actor = $game_actors[parameter]
    yield actor if actor
  end
end

#iterate_battler(parameter1, parameter2)

Execute a block on a every enemies (parameter1 == 0) or every actors (parameter2 == -1) or a specific actor in the party

Parameters:

  • parameter1 (Integer)

    if 0, execute a block on every enemies

  • parameter2 (Integer)

    whole party or index of an actor in the party



197
198
199
200
201
202
203
204
205
206
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 197

def iterate_battler(parameter1, parameter2)
  if parameter1 == 0
    iterate_enemy(parameter2) { |enemy| yield enemy }
  elsif parameter2 == -1
    $game_party.actors.each { |actor| yield actor }
  else
    actor = $game_party.actors[parameter2]
    yield actor if actor
  end
end

#iterate_enemy(parameter)

Execute a block on a specific enemy (parameter >= 0) or every enemies in the troop

Parameters:

  • parameter (Integer)

    whole troop or index of an enemy in the troop



185
186
187
188
189
190
191
192
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 185

def iterate_enemy(parameter)
  if parameter == -1
    $game_troop.enemies.each { |enemy| yield enemy }
  else
    enemy = $game_troop.enemies[parameter]
    yield enemy if enemy
  end
end

#launch_common_event(id)

Launch a common event in a child interpreter

Parameters:

  • id (Integer)

    id of the common event



43
44
45
46
47
48
49
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 43

def launch_common_event(id)
  common_event = $data_common_events[id]
  if common_event
    @child_interpreter = Interpreter.new(@depth + 1)
    @child_interpreter.setup(common_event.list, @event_id)
  end
end

#operate_value(operation, operand_type, operand)

Command that retrieve a value and negate it if wanted

Parameters:

  • operation (Integer)

    if 1 negate the value

  • operand_type (Integer)

    if 0 takes operand, otherwise take the game variable n°operand

  • operand (Integer)

    the value or index



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'scripts/00600 Script_RMXP/02500 Interpreter_2.rb', line 72

def operate_value(operation, operand_type, operand)
  # オペランドを取得
  if operand_type == 0
    value = operand
  else
    value = $game_variables[operand]
  end
  # 操作が [減らす] の場合は符号を反転
  if operation == 1
    value = -value
  end
  # value を返す
  return value
end

#running?Boolean

Tells if the interpreter is running or not

Returns:

  • (Boolean)


67
68
69
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 67

def running?
  return !@list.nil?
end

#setup(list, event_id, block = nil)

Setup the interpreter with a list of Commands

Parameters:

  • list (Array<RPG::Command>)

    list of commands

  • event_id (Integer)

    id of the event that launch the interpreter

  • block (Proc) (defaults to: nil)

    the ruby commands to execute using a fiber (list is ignored if this variable is set)



55
56
57
58
59
60
61
62
63
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 55

def setup(list, event_id, block = nil)
  clear
  @map_id = $game_map.map_id
  @event_id = event_id
  @list = block ? :fiber : list
  @index = 0
  @branch.clear
  create_fiber(block) if block
end

#setup_choices(parameters)

Setup choices in order to start a choice process



164
165
166
167
168
169
170
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 164

def setup_choices(parameters)
  $game_temp.choice_max = parameters[0].size
  $game_temp.choices = parameters[0].clone.each { |s| s.force_encoding(Encoding::UTF_8) }
  $game_temp.choice_cancel_type = parameters[1]
  current_indent = @list[@index].indent
  $game_temp.choice_proc = proc { |n| @branch[current_indent] = n }
end

#setup_starting_event

Setup the interpreter with an event (Game_Event / Game_CommonEvent) that can run



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 72

def setup_starting_event
  # Refresh the event page when switch/variable was changed
  $game_map.refresh if $game_map.need_refresh
  # Start common event if required
  if $game_temp.common_event_id > 0
    setup($data_common_events[$game_temp.common_event_id].list, 0)
    $game_temp.common_event_id = 0
    return
  end
  # Try to start an event
  $game_map.events.each_value do |event|
    next unless event.starting
    if event.trigger < 3
      event.clear_starting
      event.lock
    end
    return setup(event.list, event.id)
  end
  # Try to start a common event
  $data_common_events.each do |common_event|
    next unless common_event&.trigger == 1 && $game_switches[common_event.switch_id]
    return setup(common_event.list, 0)
  end
end

#update

Update the interpreter



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'scripts/00600 Script_RMXP/02400 Interpreter_1.rb', line 98

def update
  @loop_count = 0
  loop do
    update_loop_count
    # We set the current event_id to 0 if the map has changed
    # (to prevent messing with event that as the same id in other map)
    @event_id = 0 if $game_map.map_id != @map_id
    # If a child interpreter is running
    unless @child_interpreter.nil?
      # We update it
      @child_interpreter.update
      # And clear it if it's not running anymore
      @child_interpreter = nil unless @child_interpreter.running?
      # We also break the loop if it's still running
      break unless @child_interpreter.nil?
    end
    # If we're waiting for the message to process
    break if @message_waiting
    # If we used a Wait events command
    break if waiting_event?
    # Process input if asked (need to return)
    break input_button if @button_input_variable_id > 0
    # Return if we're waiting
    break @wait_count -= 1 if @wait_count > 0
    # Quit if we're forcing a battle action
    break unless $game_temp.forcing_battler.nil?
    # If we're calling a scene we immediately quit
    break if calling_scene?
    # If the event has terminated we try to call another event
    if @list.nil?
      setup_starting_event if @main
      break if @list.nil?
    end
    # Return if the command returned false
    break if execute_command == false
    # Process next command
    @index += 1
  end
end