I would like that the game closes in some part of the story. But not just that the story ends, but the game and the windows closes. I know if I type QUIT, the game will do it. But my question is how do I put that function in the source code. I want something like this:
say “You enter a room. And a monster attacks you. Do you try to escape? S/N”;
if the player consents:
say “You exit the room, avoiding being killed by the monster.”;
say “The monster kills you.”;
wait for any key;
[this will be the part where the game quits and the window closes];
I tried different things, like “try quitting”, but nothing works.
If you include the extension Basic Screen Effects by Emily Short, you can get this by the phrase “stop game abruptly.” This is mentioned in documentation example 383, “The Battle of Ridgefield.”
(I’m not positive that this will close the window–that behavior may vary from interpreter to interpreter. Also be aware that this might annoy the player a lot!)
I use the Basic screen library and it works. I wanted to do that because it’s for some kind of special ending. One of the BAD endings to make it a little more scary. Thanks.
I don’t think it will close the window. I think it was Basic Screen Effects I used to completely hard-restart the game in Baker of Shireton.
I second Matt’s suggestion that you probably don’t want to do that. I’d suggest maybe using Basic Screen Effects to clear the screen, perhaps with a message like GAME OVER rather than simulating what to the player will seem like the game or the interpreter crashed.
I use it on Windows Glulex and it does close the game. But the more I think about it, I guess you’re right. It can be tedious for the players. And they could think that the game crashes or something like that. So yeah, I think I’ll use an “end the story;” with an GAME OVER. Thanks for helping me.