| 作者: moonlight | |
| 2005-03-24 | |
|
JASS有一个功能是在特定条件下跳出循环,比方我按下ESE开始一个循环,每秒显示信息1,一直循环到单位A死亡为止,单位死亡后执行动作,显示信息2,可以写成 event Player 1 skips a cinematic sequence action loop exitwhen IsUnitDeadBJ(A) call DisplayTextToForce(GetPlayersAll(),"1") call PolledWait(1) endloop call DisplayTextToForce(GetPlayersAll(),"2") 但是在trigger中的循环必须规定循环次数,并且只能以数字作为跳出循环的条件,虽然可以通过修改forloopAIndex来实现,但是必须用到customscript,因此对于大多数人来说还是不很普及,但是可以用run trigger来模拟exitwhen,现在我详细讲解一下... 还是以上面那个显示1个为例,可以写成这样: TRIGGER1 event Player 1 skips a cinematic sequence action run trigger2(Ignoring Condition) TRIGGER2 event 无 action If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions ((A) is alive) Equal to True Then - Actions Game - Display to (All players) the text: 1 Wait 1.00 game-time seconds run TRIGGER2(Ignoring Condition) Else - Actions Game - Display to (All players) the text: 2 其实就是在条件满足的情况下反复RUN自己来模拟,这个对于很多情况很有帮助。 |
责任编辑:admin
进入论坛参与针对本文章的讨论
