Answering yes/no to a question

AnssiR
24 Oct 2011, 08:26
Hi,
In the very beginning of a WIP, I would like to present a question to the player:
"Would you like to restore a saved game (y/n)?"
If the player answers 'y' or 'yes', the restore window would pop up. If 'n' or 'no', the screen would be cleared and the intro would start. How to go about this? I tried to experiment with the switch statement but couldn't get it to work. I am using the GUI.

-Anssi

Ifrit7th
24 Oct 2011, 14:39
I think Yes/no questions are handled by the 'if' statement, should be at the bottom of the drop down list of conditions.

AnssiR
24 Oct 2011, 17:07
OK, thank you! However, how do I call the restore action in the script?
And also, if the player answers 'no' or something else, how do I cover those situations?

-Anssi

Ifrit7th
24 Oct 2011, 18:11
I'm not sure about restoring actions, but "no" could be handled by the else clause, not the Else-if clause, of the if statement.

Pertex
25 Oct 2011, 06:57
There is an example in the wiki how to use the ask-command: http://quest5.net/wiki/Ask
but I dont think its possible to load a savegame from script.

Alex
25 Oct 2011, 07:42
Correct, you can't load a saved game from a script. I don't see why you would want to - that functionality should be provided by the interpreter surely. What would happen when the game is played online?

AnssiR
25 Oct 2011, 10:03
Thanks for the help to all of you.
I was thinking of using this trick mainly because the intro part in the WIP would be rather long with some clear-screens etc and a player having made a save wouldn't have to make all those keypresses again, before arriving at the first prompt to type 'restore'.
But anyway, having to make do without it is no big deal.

-Anssi

AnssiR
25 Oct 2011, 10:36
And of course, only now did I realise that you can click on a Quest save file and the game is automatically resumed at the save point. So, there is no problem at all. Thanks again to all the responses.

-Anssi