("list_party_troops", [#this script will check the target party (stored in "$party_to_check") and return a list of the troop types in the party(try_begin),[assign,"$party_stack_count",0],
(try_for_range,reg(6),"trp_player","trp_end_troops"),
[party_count_companions_of_type, reg(7),"$party_to_check", reg(6)], [gt, reg(7),0],
[troop_set_slot,"trp_end_troops","$party_stack_count",reg(6)],
[val_add,"$party_stack_count",1],
(end_try),#在这里,“$party_stack_count”变量中保存的是“party_to_check”这支部队中的兵种数目;
#同时,这个变量也可以配合try_for_range循环操作使用,作为其结束循环时的函数值(这个值要比保存部队数据的寄存器中的数值大1),
#此外,“trp_end_troops”中的各个虚拟入口所指向的地址则储存了该部队中每种兵种的兵种ID。(end_try),
]),
("player_has_troops", [#这段脚本对list_party_troops的用法作了示范。这个函数将检测玩家的部队构成,并在屏幕上显示出来(try_begin), [assign,"$party_to_check","p_main_party"],#将“$party_to_check”的对象设置为玩家的部队,并将其作为list_party_troops的输入值(call_script,"script_list_party_troops"),#调用list_party_troops函数,以得到玩家部队中的兵种构成列表[str_store_party_name,3,"$party_to_check"],
(display_message,"str_party_contains"),#在屏幕上标示出部队的名称和兵种的数量(try_for_range, reg(6),0,"$party_stack_count"),#循环遍历部队中的所有的兵种。“$party_stack_count”中记录着兵种的数目,我们以这个参数作为遍历的结束参量[troop_get_slot,reg(7),"trp_end_troops", reg(6)], [str_store_troop_name,3, reg(7)], (display_message,"str_string3"),#兵种的编号(ID)储存在虚拟的部队“trp_end_troops”中,从第0位(slot 0)开始排列。Reg(7)则对应当前的兵种编号,
#而兵种的名称则被存入临时字符串s(3),并显示在屏幕上(end_try),
(end_try),
]),