Auto-translated
function visit_crypt(hero)
QuestionBox(GetMapDataPath() .. 'visit_crypt.txt', 'crypt_ok', 'crypt_cancel')
end
Trigger(4, 'crypt', 'visit_crypt')
function crypt_ok() -- this function is called when the player presses the OK button
-- ...
end
function crypt_cancel() -- this function is called when the player presses the Cancel button
-- ...
endAdded 15 minutes later
You can also create a function that will immediately return the player's answer, instead of calling another function. I think this is a bit more convenient.
function QuestionBoxRef(msg)
question_box_ref_answer = -1
QuestionBox(msg, "question_box_ref_answer=1 --", "question_box_ref_answer=0 --")
while question_box_ref_answer == -1 do
sleep()
end
return question_box_ref_answer == 1
end
-- example of usage
function visit_crypt(hero)
if QuestionBoxRef(GetMapDataPath() .. 'visit_crypt.txt') then
-- the player agrees
else
-- the player declines
end
end
Trigger(4, 'crypt', 'visit_crypt')