I’m writing a story for a class I’m taking the objective is to have the player quit the game thus achieving victory. But I’ve been unable to figure out how to successfully code that action. I’m running out of time and ideas so any help would be greatly appreciated.
How to code that depends on what programming language you’re using. Inform? TADS? Something else? (You posted in the General Game Design subforum, and not one of the language specific ones, so we have no way of knowing.)
sorry my bad, Im working in inform 7 on playfic
To clarify, would it be a ‘fake’ quit, or are you saying when they actually quit the game proper you want it to tell them they’ve won and then end the game?
Edited to add: if you’re in a real rush, you might want to post again in the Inform 7 forum. You’ll get a quicker response, and I’m sure no-one will mind if it’s to help the kids out!
the point of the game is to allow players to interact with concept of Huizinga’s magic circle. The victory condition of the game is intended to force player to stop playing the game thus breaking the circle if the player doesn’t quit and takes any of the actions they’ve been directed to take the game will restart.
in execution this could be a fake quit or a real one the aim is simply for the player to get frustrated and enter “quit” into the command line.
This sounds like a case for the “game within a game” design, since of course it is very difficult for a program to tell you have won after it has ceased to operate.
War Games: The Game.
*** Congratulations! The only way to win is not to play! ***
(I did quit to win too, another one of the tweet-length IFs that I didn’t enter into TWIFComp; the way I did this doesn’t give you the “Are you sure you want to quit?” message, which the solution EmacsUser posted in the other thread does. Note also that quitting doesn’t get you the best ending.)
A word of warning: players generally don’t type “quit” to quit the game, they just close the intepreter or the web page. This is probably even more common online because many people have already learned that “quit” doesn’t actually do anything in Parchment (whereas offline “quit” usually also closes the interpreter). I have almost 10,000 recorded transcripts from people playing online, and only 90 of them (that’s 0.9%) have commanded “quit”.
You could capture the browser window close event with Vorple, but that might go beyond a class assignment’s scope. And as an exercise or class assignment it’s of course fine to have features that won’t necessarily work in “real” games.