不确定。基本上我希望用户点击对话框。如果NPC有250,重复25次。无论NPC重演/ 10次。
它一直给我一个rtimes未定义的错误,rtimes应该在if语句中定义
代码:
(choose from list {"50", "100", "200", "250"} ¬
with prompt "How many does the NPC have?")
set list_answer to result
set tom to result
set rtimes to (tom / 10)
if tom is equal to 50 then
set rtimes to 5
end if
if tom is equal to 100 then
set rtimes to 10
end if
if tom is equal to 200 then
set rtimes to 20
end if
if tom is equal to 250 then
set rtimes to 25
end if
display dialog tom
display dialog rtimes
答案 0 :(得分:2)
我的脚本没有出现任何错误,但这是一种更简洁的方式来编写您想要完成的内容:
set tom to (choose from list {"50", "100", "200", "250"} ¬
with prompt "How many does the NPC have?")
set rtimes to (tom / 10) as integer
display dialog "tom: " & tom & return & "rtimes: " & rtimes