Page 1 of 1

"answer" command code samples?

Posted: Wed Oct 21, 2009 4:04 am
by BattleWolf
Hi everyone,

I am very new to Revolution and am bashing my head against the wall with the "answer" command. The pseudo code that I want to have is as follows:

if (answer "Is this OK?" with "Yes" or "No") = "Yes" then
(do "Yes" code)
else
(do "No" code)
end if

I tried with variables, I tried all sorts of things. The documentation does not make it clear what happens here and I can't readily find any sample scripts written by others. How does answer give feedback on which button was pushed? And how can I use that in my IF statement?

Thanks for your help!

Posted: Wed Oct 21, 2009 4:38 am
by FourthWorld
Back when Jeanne DeVoto was working on the docs they had more end-to-end examples. Now they usually show only the one line with the token being discussed, without any context to show how it's used. In short, I feel your pain. :)

The trick with the answer command is it. I mean literally, "it", a local variable used for all sorts of things in RevTalk, including for replies to the answer, ask, answer file, ask file and other commands:

Code: Select all

answer "Is this OK?" with "Yes" or "No"
If it is "No" then
   answer "Whinger!"
else
  DoSomethingMoreInteresting
end if

Thanks

Posted: Wed Oct 21, 2009 4:46 am
by BattleWolf
Thanks, that did the trick! I am sure I will have quite a few more questions in the days to come... :)