<<if $pain gte 5>><<set $gameendflag = true>><<display "GameEndLose">><<else>><<set $gameendflag = false>><<endif>>
!Pain and Progress\nUse the SugarCane story format.\n\nWrite a general introduction here. This is seen only on page load and not seen when the game replays.\n\nThis minimal gamestory skeleton is here as a demonstration of how to do these types of story in Twine >1.3.5\n\nBy Emmanuel King Turner (eturnerx.com / @stormrose) 20140823. Creative Commons Share-Alike, Attribute.\n\nWould you like instructions?\n[[Yes|Instructions]]\n[[No, let's play|InitGame]]
<<if $progress gte 3>>Yeah, it's a bit boring if the same things always happens. So this passage (::MainActionProgress) is where you could add a bit of randomness.<<endif>>\n<<set $progress = $progress + 1>><<display "CheckProgress">><<if $gameendflag neq true>>\nProgress makes you feel like a winner.\n\n<<display "MainEventLoop">>\n<<endif>>
<<silently>>\nPut status displays in their own passages so they can be used from anywhere.\n<<endsilently>>\nProgress: <<print $progress>> / 5\nPain: <<print $pain>> / 5
<<if $pain gte 3>>Yeah, it's a bit boring if the same things always happens. So this passage (::MainActionPain) is where you could add a bit of randomness.<<endif>>\n<<set $pain = $pain + 1>><<display "CheckPain">><<if $gameendflag neq true>>That was painful.\n\n<<display "MainEventLoop">>\n<<endif>>
Thanks for trying.
<<display "RealStart">>
You look at your status...\n<<display "MainStatus">>\n\n...and choose to\n[[Hurt yourself|MainActionPain]]\n[[Carry on|MainActionProgress]]
<<if $progress gte 5>><<set $gameendflag = true>><<display "GameEndWin">><<else>><<set $gameendflag = false>><<endif>>
Does progress really always result in a win or is the winning in the journey? Either way the game is informing you that you've reached a big milestone. Well done.\n\n<<display "PlayAgain">>
<<silently>>\nI like using SILENTLY here so that I can make my variables easier to read. And cleanly document them.\n\ngameendflag is used to avoid displaying follow-up text when the various display macros return. Yeah, it's a bit of a hack but it works.\n<<set $gameendflag = false>>\n\nThe next two variables track things of interest to the game state. They could be anything, like fuel, life counters, distance travelled\n<<set $pain = 1>>\n<<set $progress = 1>>\n\n<<endsilently>>\nThis is the initial text you'd expect to be shown at the beginning of the game. Time to progress and avoid pain. I secretly set some variables while you weren't watching.\n\n<<display "MainEventLoop">>
Would you like to play again? [[Yes|InitGame]] | [[No|PlayAgainNo]]
There's only so much pain one person can take. This is where the game informs you that you've lost.\n\n<<display "PlayAgain">>
Progress in the game without hurting yourself.\n\n[[Understood, let's play|InitGame]]