"Honk!" by Alex Harby

VOLUME - SETTINGS

Book - Project Settings

Part - Extensions

Include Hybrid Choices by AW Freyr.
Include Basic Screen Effects by Emily Short.
Include Menus by Emily Short.
Include Gender Options by Nathanael Nerode.

Part - Little Helpers

[much of the following imported from Vampire Ltd]
[*idea: export this to an extension to clean up the project]

Chapter - BBCode-style styling

[shortcut phrases for text effects. I don't use them all the time because Inform's text substitution rules can introduce unwanted line breaks, and it's just quicker and easier sometimes to say "[roman type]" than to say "[/b][run paragraph on]" or whatever]

To say b:
	say "[bold type]".
To say /b:
	say "[roman type]".
	
To say i:
	say "[italic type]".
To say /i:
	say "[roman type]".
	
To say p:
	say "[paragraph break]".

Chapter - Substitutions for punctuation to avoid unwanted line-breaks

[Borrowed from zarf: https://intfiction.org/t/line-breaks-with-regard-to-text-substitutions-and-conditions/13213/3]

To say period: (- print "."; -);
To say exclam: (- print "!"; -);
To say questi: (- print "?"; -); [I added this one, and that's about the limit of my Inform 6 ability]
	
Chapter - Bypass every turn (rule for failed actions)

[allows an in-world action to fail without costing a turn. This allows for custom error messages. I don't think I'm actually using this in Honk! at the moment, but it served me well in Vampire Ltd and I want to keep it on hand]

[bypass every turn code credit: climbingstars on the IntFiction forums: https://intfiction.org/t/i7-can-i-understand-persuasion-as-a-mistake/5496/2]

Bypass check is a truth state that varies. Bypass check is false.
To say bypass every turn: now bypass check is true.
This is the bypass every turn rule:
	if bypass check is true:
		now bypass check is false;
		rule succeeds.
The bypass every turn rule is listed before the every turn stage rule in the turn sequence rules.

Book - Game Settings

Part - Publishing

Chapter - Metadata

The story headline is "A Fair Game".
The story genre is "Comedy".

The story description is "A berserker's at the circus, and they're ruining everyone's performances! And all you have to stop them is a stack of custard pies, a squeaky red nose and your own wits. But the show must go on!

A parser-based puzzler."

The story creation year is 2023.

The release number is 1.

Chapter - Release settings

Release along with cover art ("Three of Honk's main characters - Adagio the magician, Freda the strongwoman, and Lawn the goose-tamer - depicted in the style of a modern circus poster."), a solution, the library card, the private source text and an introductory postcard.

Part - Structural stuff

Chapter - Printing the title

To say Honk:
	say "[i]Honk[exclam][/i]".
	
Chapter - The Status Line

[This part uses example code from Basic Screen Effects to construct a status line.]

Rule for constructing the status line:
	fill status bar with Table of Clown Status;
	rule succeeds.
	
Table of Clown Status
left	central	right
" [location]"	"[press space]"	"Exits:[exit list] "

["press space" above is saving a space for a pause indicator, to be defined in the next part]
	
When play begins (this is the increase right align of status line rule):
	now right alignment depth is 17. [necessary to allow all exits to fit in RmStands and RmStaffS]
	
[the following is straight from Inform 7 documentation example 350 "Ways Out"]

To say exit list: 
	let place be location; 
	repeat with way running through directions: 
		let place be the room way from the location; 
		if place is a room, say " [way]". 

Rule for printing the name of a direction (called the way) while constructing the status line: 
	choose row with a heading of the way in the Table of Exit Abbreviation; 
	say "[shortcut entry]". 

Table of Exit Abbreviation
heading	shortcut
north	"N"
northeast	"NE"
northwest	"NW"
east	"E"
southeast	"SE"
south	"S"
southwest	"SW"
west	"W"
up	"U"
down	"D"
inside	"IN"
outside	"OUT"


Chapter - Slightly improved SPACE pausing

[Emily Short's Basic Screen Effects has a "wait for the SPACE key" phrase that is really useful for introducing a pause without clearing the screen. However, it lacks an indication to the player to press SPACE. Writing one in the text would put a lot of unwanted prompts in the transcript (especially in the Unmasking scene, which uses a lot of pauses to introduce timing and tension to a certain joke). So we'll use the status line instead, updating it with an indication to press SPACE when the game is paused. I've put a space for the indicator in the centre of the status line (see above), and in this part I'll hook it up to a new phrase and truth state that builds on Short's original code.]
[update to the above - the status line indicator isn't as noticeable as I thought - I had to put prompts in the transcript anyway. Oh well!]

To say press space:
	say "[if space-waiting is true]Press SPACE...[no line break][end if]".
	
Space-waiting is a truth state that varies.
Space-waiting is false.

[this line of code by Dannii Willis: https://intfiction.org/t/basic-screen-effects-wierd-behavior-solved/9397/2]
To redraw status line: (- DrawStatusLine(); -).
[using the "constructing the status line" activity breaks the game in a really interesting way (the world model still runs but the text display stops updating), so we use this snippet of Inform 6 code instead]

To SPACE-pause:
	now space-waiting is true;
	redraw status line;
	say "[bracket][press space][close bracket]";
	wait for the SPACE key;
	now space-waiting is false;
	redraw status line.


Book - Testing - Not for release

Part - Goto

Gotoing is an action applying to one thing. Understand "goto [any room]" as gotoing.
Carry out gotoing:
	cyoa teleport to the noun.
	
Part - Test paper

[just an object I have on hand to quickly test new rules and responses. Dummied out of the testing releases now to fix conflict with the paperwork, but was present in releases for alpha and beta testers]

[Lola carries the test paper. Description of the test paper is "This is a blank object with no specific commands attached to it. It can be lost without making the game unwinnable. If you're testing the game, feel free to use this object however you can imagine. If you're playing the final game, whoops! You shouldn't be able to see this! Please contact the author if you can read this."]

Part - Greet testers

When play begins (this is the greet testers rule):
	try introing;
	say "* * *[paragraph break]".
	
Introing is an action out of world.
Understand "intro" as introing.
Report introing:
	say "[bracket]Hi, testers! Thank you for helping me out! Honk is well on the way to being releasable. It's not likely that the design of the game will change much at this point. However, I'm still on the lookout for bugs, typos, missing scenery and guess-the-verb issues.

Please record a transcript of your play sessions (by typing '[fixed letter spacing]> script[variable letter spacing]' when you load the game - this creates and updates a text file I-don't-know-where, either somewhere you get to choose if you're playing this as a file on your computer or somewhere in your browser's files if you're playing online). Then flag up anything strange or broken with a ! or ? at the start of a command (e.g. '[fixed letter spacing]> ! there is a typo here[variable letter spacing]'). When you're done, send me your transcript if you can find it. This helps me search through your play sessions more easily to find your comments.

If you need to see this message again, type '[fixed letter spacing]> intro[variable letter spacing]'. Thanks! -rabbit[close bracket][paragraph break]".
	
The greet testers rule is listed first in the when play begins rules.

Part - Acknowledge comments

[this code lifted straight outta Inform 7 documentation example 414 "Alpha"]

After reading a command (this is the ignore beta-comments rule): 
	if the player's command matches the regular expression "^\p": 
		say "[bracket]!Comment noted![close bracket][paragraph break]"; 
		reject the player's command. 
		
Part - Count moves

[this was just for my own curiosity, to count moves in the minimal walkthrough]

[Every turn:
	say "*** TURN COUNT: [turn count]."]

[the walkthrough is 125 moves, though this doesn't count dialogue options and pressing space, so it's probably more like 150]

VOLUME - RULES

BOOK - Conversation

[Part - Allow talking to certain things

This is the should only talk to talkables rule:
	if the noun provides the property greeting, do nothing; 
	otherwise say "Hello, [noun]." instead.

The should only talk to talkables rule substitutes for the can only talk to talkables rule.]

Part - Personlike - adjective which defines groups of people

A thing can be personlike. A thing is usually not personlike.

Chapter - Expanding verbs to apply to personlike things

Understand "give [something preferably held] to [something personlike]" as giving it to.
Understand "give [something personlike] [something preferably held]" as giving it to (with nouns reversed).

Part - Talking to (basic verb in addition to ask/tell)

Talking to is an action applying to one visible thing.

Understand "talk to [something]" and "talk [something]" and "t [something]" as talking to.

[Understand "talk to [something]" as talking to. [Understand the command "talk" as "talk to". ]Understand the command "t" as "talk to".]

[Singular-talking is an action applying to nothing. Understand "talk to" and "talk" and "t" as singular-talking. Before singular-talking: try talking to nothing instead.]

Before talking to when the noun is nothing:
	say "What do you want to talk to?" instead.

Check talking to (this is the check that the noun can be talked to rule):
	unless the noun provides the property greeting:
		say "[The noun] snubs you." instead.
	
Carry out talking to (this is the open conversation tree rule):
	unless the location of the noun is the location of the player:
		say "[bracket]both of you first raising your voices to be heard across the Big Top[close bracket][line break]";
	switch to cyoa at the greeting of the noun.

Part - Greetings and general conversation trees

[Talking to switches to a set of CYOA pages for each person. The greeting is the first page of this set, and it flips to a hub page of conversation topics. The intent is to use greetings for small talk and big questions. The ask/tell system can be used to drill down on deeper topics.]

A person has a page called the greeting.
The greeting of a person is usually Placeholder.

Placeholder is a page.
"DEBUGDEBUGDEBUG This is a placeholder conversation for testing and debugging."

Placeholder_opt1 is a page.
"This is option 1 for the placeholder conversation."
The cdesc is "Option 1." It is for Placeholder. It is a dead-end.

Placeholder_opt2 is a page.
"This is option 2 for the placeholder conversation."
The cdesc is "Option 2." It is for Placeholder. It is a dead-end.

Placeholder_end is a page.
"This ends the placeholder conversation."
The cdesc is "Exit." It is for Placeholder. It is an end-page.

[
Placeholder2 is a page.
"ZZZZZ This is a second placeholder conversation for testing and debugging."

Placeholder2_opt1 is a page.
"This is option 1 for the second placeholder conversation."
The cdesc is "Option 1." It is for Placeholder2. It is a dead-end.

Placeholder2_end is a page.
"This ends the second placeholder conversation."
The cdesc is "Exit." It is for Placeholder2. It is an end-page.
]

Part - Asking about and specific conversation trees

Chapter - Item-asking it about - Ask about objects / people

[borrowed from example 297]

[Keep track of what things the player has encountered]
A thing can be known or unknown.
[this is supposed to be so that the player can't ask about items that Lola doesn't know about yet. It's proven to be more trouble than it's worth. Example 297's implementation turns out to be really poor - there's a hundred ways you can encounter an item without it being officially "known". I should rewrite this mechanic, but then I would have a hundred "the x is known" statements to weed out, and I'm writing this comment five weeks before the IFComp deadline and it's just easier to leave it in at this stage.]

To make (target - an object) known:
	now the target is known;
	let L be the list of things which are worn by the target;
	if the number of entries in L is greater than 0:
		repeat with item running through L:
			now item is known.

[when an item is described, it becomes known]
Before printing the name of something (called the target) (this is the named things become known rule):
	make the target known.
			
[when an item is examined, it must be known (this catches scenery the player spots and things the player finds while investigating)]
Before doing anything to something (called the target) (this is the interacted things become known rule):
	make the target known.
	
[Allow asking about things as well as topics]
Understand "ask [something] about [any known thing]" and "tell [something] about [any known thing]" as item-asking it about. Item-asking it about is an action applying to two visible things. 

[Redirect show, display, present to interrogating - allows asking about objects not visible]
Understand the commands "show" and "display" and "present" as something new. 

Understand "show [something] to [something]" or "display [something] to [something]" or "present [something] to [something]" as item-asking it about (with nouns reversed). Understand "show [something] [something]" as item-asking it about.

Check item-asking something about something (this is the check for person or personlike first noun rule):
	if the noun is personlike:
		say "You ask around about [the second noun], but you don't hear anything useful." instead;
	unless the noun is a person:
		say "[The noun] doesn't respond." instead.

A person has some text called the item unknown response.
The item unknown response of a person is usually "[The noun] doesn't have much to say about [the second noun].".

Carry out item-asking something about something (this is the default response to item-asking rule):
	if the noun provides the property item unknown response:
		say "[item unknown response of the noun][paragraph break]";
	otherwise:
		say "DEBUGDEBUGDEBUG default response to item-asking. No response has been implemented here."

[Define item-tables]
Every person has a table name called the item-table. The item-table of a person is usually the Table of Placeholder Items.

Carry out item-asking something about an item listed in the item-table of the noun (this is the item-asking refers to table rule):
	say "[reply entry]" instead.

Table of Placeholder Items
item	reply
red nose	"DEBUGDEBUGDEBUG placeholder item table used for red nose.[p]"
Lola	"[lola item-ask debug response]"

To say lola item-ask debug response:
	say "DEBUGDEBUGDEBUG placeholder item table used for asking about Lola.";
	switch to cyoa at Placeholder.
	

Chapter - Default asking it about response

The block asking rule is not listed in the report asking it about rulebook.

[Redirect tell to ask]
Before telling someone about something (this is the redirect tell to ask rule):
	try asking the noun about it instead.

A person has some text called the topic unknown response.
The topic unknown response of a person is usually "[The noun] isn't sure what you're asking about.".

Check asking someone about something (this is the default response to asking about unknown topic rule):
	if the noun provides the property topic unknown response:
		say "[topic unknown response of the noun][paragraph break]";
	otherwise:
		say "DEBUGDEBUGDEBUG asking about a topic - should show default response for character, or should skip to a relevant part of the conversation tree.".
	
Part - Modifications to Hybrid Choices

Chapter - Undo rule

[This code is adapted from Vampire Ltd. I think I got the idea to change the undo response from a thread on the IntFiction forums, but I didn't credit it in the Vampire Ltd source code and I forget where I found it now. Just to be safe, thank you to the entire IntFiction community]

Immediately undo rule response (E) is "[undoForCYOA]".
To say undoForCYOA:
	say "[bracket]Previous turn undone.[close bracket][if in CYOA mode][paragraph break][refresh choices token][run paragraph on][end if]".
To say refresh choices token:
	refresh choices.

[
The above code recreates the default successful undo response, "Immediately undo rule response (E)", and adds a check for CYOA mode. If in CYOA mode, we reprint the CYOA choices by invoking Hybrid Choice's built-in "refresh choices" phrase via a text substitution "refresh choices token".

However, "refresh choices" adds a line break after every choice, and then Inform wants to add a paragraph break after the undo response, leading to a line break plus a paragraph break - two skipped lines before the command prompt > instead of just one. To resolve this, we need "run paragraph on". Now Inform prints a line break as "refresh choices" instructs, then ignores its instinct to add a paragraph break at the end of the response as "run paragraph on" instructs, then prints another line break because it hits the command prompt and needs to separate it from the story text. So you get two line breaks before the command prompt, which is a normal paragraph break.

At least, I *think* that's what's happening. I'm referring to Nathanael Nerode's Nathanael's Cookbook extension, which is a great reference document, but I still don't feel like I get it.
] 

Part - Cannot instruct other characters

A person has some text called the persuasion refusal.
The persuasion refusal of a person is usually "You can't boss [the person asked] around so easily. You just don't have the authority".

Persuasion rule for asking someone to try doing something:
	if the person asked provides the property persuasion refusal:
		say "[the persuasion refusal of the person asked]."; [see below]
	otherwise:
		say "DEBUGDEBUGDEBUG checking that new persuasion rule works.";
	persuasion fails.
	
[I don't like the full stop baked into the persuasion rule here. But if I move it into the persuasion refusal, there's no paragraph break afterwards. So far so normal-for-Inform-7. But if I then put in a [paragraph break] after that full stop, the persuasion rule doesn't seem to run the "persuasion fails" part, so that the game prints an extra "the x has better things to do" response. Bizarre. Anyway I'm working on lots of finicky bugs and features and I'm out of patience with Inform 7 so I'm just going to let it have this misplaced full stop.]

To say Lola wants to go it alone:
	say "After what the Phantom did to the wheel, it looks like things are getting really dangerous. You'd better do it yourself. You don't want anyone getting injured on your account".
[this token is used during persuasion refusals during the endgame (i.e. climactic scenes)]


BOOK - Custom responses

Part - Inventory rules

The print empty inventory rule response (A) is "[We] [are] juggling nothing."
The print standard inventory rule response (A) is "[We] [are] juggling:[line break]".

Part - Reaching into things (ie scope)

Can't reach inside rooms rule response (A) is "You're too far away here. You'll need to go over there to do that."
[why did I have this again? Surely it's being immediately overwritten by below? Keeping it for fear of breaking something ten days from deadline]

Can't reach inside rooms rule response (A) is "[if the noun is RmRing]Not from all the way out by these seats, you can't. You'll need to go back into the ring first[otherwise][We] [can't] reach that from over here[end if]."
[only relevant to interacting with things in RmRing while player is in RmStands]

Part - Attacking

The block attacking rule is not listed in the check attacking rulebook.

Check attacking:
	unless the player carries the stack of pies:
		say "No, you're not that sort of clown!" instead;
	otherwise:
		say "(with a custard pie)";
		try throwing the stack of pies at the noun instead.
		
Part - Burning

Block burning rule response (A) is "This dangerous but very cool act [would achieve] little."
		
Part - Climbing

Block climbing rule response (A) is "You don't love getting too far off the ground. It might be important elsewhere, but not here.".

Check climbing someone (this is the response to climbing people rule):
	if the noun is an animal:
		say "That wouldn't be very kind to the poor little [noun]." instead;
	otherwise if a showtime scene is happening or a climactic scene is happening:
		say "You don't have time for piggyback rides right now!" instead;
	otherwise unless the noun is Freda:
		say "As you've learned, [the noun] doesn't like giving you piggyback rides on short notice." instead;
	otherwise:
		say "Freda lets you climb up on her back, and the two of you run round in a little circle for a few seconds. Wheee!" instead.
		
Part - Dropping

Can't drop yourself rule response (A) is "Not today - pratfalls are funny, but they really hurt your back."

Part - Eating

Understand "bite [something preferably held]" as eating.

Can't eat unless edible rule response (A) is "You're a clown, not a [noun]-swallower.".

Check eating (this is the can't eat animals or people rule):
	if the noun is an animal:
		say "Not a nice thing to think about someone's pet." instead;
	if the noun is a person:
		say "You were taught not to bite people when you were a baby." instead.

The can't eat animals or people rule is listed before the can't eat unless edible rule in the check eating rules.

Part - Going

Can't go that way rule response (A) is "There's no exit that way.".

Part - Inserting it into

Check inserting something into a person (this is the put something in person response rule):
	if the second noun is Lola:
		try eating the noun instead;
	otherwise if the second noun is the Phantom:
		say "You're not sure [the Phantom] contains any multitudes, or even any solitudes, but you still can't use [if Unmasking has happened]him[otherwise]them[end if] as a container." instead;
	otherwise:
		say "[The second noun] contains multitudes, so there's no room for [a noun]." instead.

Part - Singing

Singing is an action applying to nothing. Understand "sing" and "hum" as singing.

Carry out singing:
	say "You hum a little ditty."
	
Report singing when the player is in the location of the goose:
	say "The goose cocks its head at you attentively, but quickly loses interest."

Part - Sleeping

Block sleeping rule response (A) is "A quick ten-second catnap, and you're ready to go again.".

Part - Smelling

Report smelling rule response (A) is "Not that you can smell that much with the red nose on, but nothing smells unusual here.".

Part - Taking

Standard report taking rule response (A) is "[one of]Got [regarding the noun][them].[or][regarding the noun][They're] yours now.[or]Yoink![or]Finders keepers![as decreasingly likely outcomes]".

Can't take yourself rule response (A) is "You can always pick yourself up when you're down, but doing it literally is going to be a problem."

Part - Thinking

Block thinking rule response (A) is "No thanks, ignorance is bliss. [first time][paragraph break][i][bracket]This is a one-time message: if you were looking for a puzzle hint, try the HELP command![close bracket][/i][only]".

Part - Touching (ie petting)

Report touching yourself rule response (A) is "You give yourself a good scratch behind the ears.".

Report touching other people rule response (A) is "You don't have that kind of a relationship with [the noun].".

Report touching things rule response (A) is "You close your eyes and try to guess what [the noun] is by feel alone. You guess [one of]right[or]right[or]right[or]right[or]right[or]right[or]right[or]right[or]right[or]right[or]right[or]wrong this time. Nuts[then at random]!".

Before touching someone when a climactic scene is happening (this is the petting people during endgame rule):
	say "Not really a good time for petting, to be honest. You're not really feeling it." instead.
Before touching something when a climactic scene is happening (this is the petting objects during endgame rule):
	say "You close your eyes and start to play the guessing game until the others tell you to concentrate." instead.
The petting people during endgame rule is listed before the petting objects during endgame rule in the before rulebook.


BOOK - Extra Synonyms

Part - Standing on (climbing)

Understand "stand on [something]" as climbing.

Part - Letting go (dropping - natural synonyms for balloons)

Understand "let [things preferably held] go" and "let go of [things preferably held]" and "release [things preferably held]" as dropping.

Part - Riding (entering)

Understand "ride [something]" as entering.

Part - Exiting

Understand "dismount" as exiting.

Part - Feeding (giving it to)

Understand "feed [something] to [something]" as giving it to.
Understand "feed [something] [something]" as giving it to (with nouns reversed).

Part - Rolling (pushing - for barbell and probably car)

Understand "roll [something]" as pushing.
Understand "roll [something] [direction]" and "roll [something] to [direction]" as pushing it to.

Part - Tugging (pulling)

Understand "tug [something]" as pulling.

Part - Honking (squeezing)

Understand "honk [something]" as squeezing.

Part - Petting (touching)

Understand "pet [something]" as touching.

Part - Spinning (turning)

Understand "spin [something]" as turning.

Part - Wrapping, sticking (tying it to)

Understand "wrap [something] around [something]" or "stick [something] to [something]" as tying it to.


BOOK - New actions

Part - Driving - get into car

Driving is an action applying to nothing. Understand "drive" as driving.

Check driving:
	if the player is in the clown car:
		say "You're already in your car! Try picking a direction to go." instead;
	otherwise if the player is in the location of the clown car:
		try entering the clown car instead;
	otherwise if the player is in the buggy:
		say "This buggy moves automatically." instead;
	otherwise if the player is in RmRingmaster or the player is in RmFreda or the player is in RmAdagio:
		say "This isn't your vehicle. You don't like driving things this big anyway. Vehicles shouldn't be any longer than four feet." instead;
	otherwise if the player is in RmLawn or the player is in RmLola:
		say "This is just a caravan. It's not drivable on its own, it gets pulled by another car." instead;
	otherwise if the player is in RmCarnivalNW:
		try going north instead; [i.e. enter Monster Manor];
	otherwise:
		say "Nothing to drive here!" instead.

Object-driving is an action applying to one thing. Understand "drive [something]" as object-driving.

Check object-driving:
	try driving instead.
[this is a total hack - stuff like "drive pie" will redirect - but it will do.]



Part - Gesturing - catch-all for attempting goose gestures

[This action never has a practical effect. It is for players who want to attempt the goose gestures themselves. In a puzzle context (i.e. doing gestures to the goose, outside of or during the Beast Show), the response tries to lead players away from the idea; in other contexts, the player might get an interesting reaction from other characters.]

[By the way, IMPLEMENTING THIS WAS A NIGHTMARE!!!!! THERE WILL BE ALL SORTS OF STUPID BUGS I DON'T KNOW ABOUT!!!!!!! DON'T PUT BODY GESTURES IN YOUR GAME!!!!!! THIS IS NOT A PLACE OF HONOUR!!!!!]

Chapter - Try our best to catch all reasonable synonyms for gesturing

Section - Set up body parts

[New authors reading this code looking for advice on putting body parts in your game: Don't put body parts in your game. Especially don't add body parts 14 months into the project just to support an optional action which exists only as a hint to other actions. I've done it as simply as I can here by only implementing a couple of parts for only the player character and redirecting most sensible things you can do to other actions. But even this is going to cause problems for players who look for problems.]

The arms are part of Lola. Understand "arm" and "arms" and "hand" and "hands" as the arms. The arms are plural-named.
Check examining the arms:
	try examining Lola instead.
Check pushing the arms:
	try gesturing instead.
Check dropping the arms:
	try gesturing instead.
Check opening the arms:
	try gesturing instead.
Check swinging the arms:
	say "Come on, it's time to go, do... something something. Anyway, that doesn't do much for you now." instead.
	
The torso is part of Lola. Understand "torso" and "chest" as the torso.
Check examining the torso:
	try examining Lola instead.
Check putting something on the torso:
	if the noun is the arms:
		try gesturing instead;
	otherwise:
		try wearing the noun instead.
Understand "put [something] to [something]" as putting it on. [catches "put arms to chest" via the above redirect]
Check dropping the torso:
	try sleeping instead.
	


Section - Gesturing without a noun

Gesturing is an action applying to nothing. Understand "[gverb]" as gesturing.

Understand "gesture" or "gesticulate" or "point [gdown]" or "point down" as "[gverb]".

Understand "at floor" or "at the floor" as "[gdown]". [no "down" in this list to avoid conflict with down the direction]

Section - Gesturing by raising arms

Raise-gesturing is an action applying to one thing. Understand "[glift] [something]" as raise-gesturing.

Understand "raise" or "lift" as "[glift]".

Check raise-gesturing:
	if the noun is the arms:
		try gesturing instead;
	otherwise if the noun is the torso:
		try jumping instead;
	otherwise:
		try taking the noun instead.
		
Spread-gesturing is an action applying to one thing. Understand "[gspread] [something]" as spread-gesturing.

Understand "spread" as "[gspread]".

Check spread-gesturing:
	if the noun is the arms:
		try gesturing instead;
	otherwise:
		try attacking the noun instead.

Section - Gesturing with torso (ie raising arms to chest)

Torso-gesturing is an action applying to two things. Understand "[glift] [something] to [something]" as torso-gesturing.

Check torso-gesturing:
	if the second noun is the torso:
		if the noun is the arms:
			try gesturing instead;
		otherwise:
			try wearing the noun instead;
	otherwise if the second noun is a person:
		try item-asking the second noun about the noun instead;
	otherwise:
		if the noun is the arms:
			try taking the second noun instead;
		otherwise if the noun is the torso:
			try climbing the second noun instead;
		otherwise:
			try item-asking the second noun about the noun instead.
			
Section - Gesturing to person

Person-gesturing is an action applying to one thing. Understand "[gverb] to [something]" or "[gverb] at [something]" or "[gverb] with [something]" as person-gesturing.

Check person-gesturing:
	try gesturing instead.
	

Chapter - Responses for gesturing

LolaKnowsGestures is a truth state that varies. LolaKnowsGestures is false.
[this is switched on by Lawn's conversation, and is just here to control some text in the report rule for the event that a repeat player tries the gestures without officially "knowing" what they are.]

Check gesturing (this is the responses for gesturing during bad moments rule):
	if the player is inside the clown car:
		if the location of the player is RmMotorway:
			say "You gesticulate wildly, the car swerving across lanes. Everyone screams at you to focus on the road." instead;
		otherwise:
			say "You bump your elbows on the inside of the little car." instead;
	otherwise if the player is in RmLakeside:
		say "[if the flock is in RmLakeside]You gesture at the geese, and get no response from them or the Phantom[otherwise]The Phantom ignores your hand gestures. He has a point to prove[end if]." instead.
[I should divvy up these scenarios into their respective scenes, but this works just fine]

Every person has some text called the gesture reaction.
The gesture reaction of a person is usually "[The item described] looks at you curiously".

Definition: a person is npc if he is not the player.
[slightly adapted from Inform 7 docs example 236]
[for some reason this doesn't apply to the rabbit even though the rabbit should be a person. Not sure why but I'll take it. Bug in the code is working in my favour for once]

Report gesturing (this is the responses to gesturing rule):
	if the location of the goose is the location of the player:
		say "You [if LolaKnowsGestures is false]vaguely remember Ken Lawn telling you once about using certain body gestures to control geese? You give one a try[otherwise]try one of Lawn's goose-training gestures[end if]. The goose fails to respond[hint about goose gestures].";
	otherwise:
		let the reactor be a random npc person in the location of the player; ["npc" defined immediately above]
		unless the reactor is nothing:
			say "You gesticulate. [The gesture reaction of the reactor][line break]";
		otherwise if the location of the player is the location of the crowd:
			say "You gesticulate. The crowd [if Unmasking has happened]is too unnerved to pay attention[otherwise]watches attentively, in case you start telling jokes[end if]."; [I don't think that if clause ever fires because the NPCs follow you around after Unmasking and their responses take priority over the crowd, but it's there just in case]
		otherwise:
			say "You gesticulate to nobody in particular."

To say hint about goose gestures:
	if Beast Show is happening:
		say ".[paragraph break]'It won't work if [i]you[/i] do it, and the Goose can't see anyway! Think of something else!' hisses Lawn from within the cage";
	otherwise if LolaKnowsGestures is true:
		say ". Hmm, didn't Ken say something about it being only him who can control this goose like this? And the goose is being blindfolded anyway, right? Is there another way to get a goose to do anything? Maybe Ken knows something".
		

Part - Inflating - for balloons, with a couple of responses for other people

A thing can be inflatable. A thing is usually not inflatable.

Inflating is an action applying to one visible thing. Understand "blow up [something]" and "inflate [something]" as inflating.

Check inflating:
	if the noun is not inflatable:
		say "You don't see how you could inflate [the noun]." instead;
	otherwise if the player is not carrying the helium canister:
		say "Not with your lung capacity, you won't." instead.
	
Check inflating a person:
	unless the noun is Lola:
		say "[The noun] doesn't deserve that sort of treatment." instead;
	otherwise:
		if the player is not carrying the helium canister:
			say "Can't really do that. You puff out your cheeks a little to simulate it." instead;
		otherwise:
			try eating the helium canister instead.
			
Chapter - Inflating it with - alternate form which takes a second noun and redirects to normal verb

Inflating it with is an action applying to two visible things. Understand "blow up [something preferably held] with [something]" or "inflate [something preferably held] with [something]" as inflating it with.

Check inflating it with:
	if the second noun is Lola:
		say "Not with your lung capacity, you won't." instead;
	otherwise if the second noun is the helium canister:
		try inflating the noun instead;
	otherwise:
		say "You won't be inflating anything with [the second noun]." instead.
		

Part - Playing

[this is more or less a dummy action to get "play" as a flexible synonym. It redirects to squeezing for the red nose and car horn, and has its own response for the French horn]

An instrument is a kind of thing. 

Playing is an action applying to one carried thing. Understand "play [something preferably held]" as playing.

Before playing a person (this is the response to play person rule):
	say "You play [the noun] like a fiddle!" instead.
	
Check playing (this is the can't play non-instrument rule):
	if the noun is not an instrument:
		say "You can't play [the noun]. You don't know any songs for [regarding the noun][them]."

Chapter - Blowing - synonym for playing with extra check for gutter-minded players

[it's reasonable to expect that players will blow the French horn instead of playing it, and this should get the same result here. We define blow as a verb here which won't do anything except play the French horn and hide a response for anyone who thinks they're playing I-0.]

Blowing is an action applying to one touchable thing. Understand "blow [something]" as blowing.

Check blowing a person (this is the response to blowing people rule):
	say "Come on, now." instead.
	
Check blowing the bendy balloons:
	try inflating the bendy balloons instead.
	
Carry out blowing (this is the standard blow response rule):
	say "You blow some air on [the noun], to little effect."


Part - Screaming

Screaming is an action applying to nothing. Understand "scream" as screaming.

Check screaming (this is the don't startle the boss rule):
	if the Ringmaster is in the location of the player:
		say "Not in front of the boss. His nervous disposition is acting up again, bless him." instead.
		
Carry out screaming (this is the now scream rule):
	say "[one of][or]W[at random]AAAAAAAA[one of]A[or]AA[or]AAA[or]AAAA[or]AAAAA[or]AAAAAA[or]AAAAAAA[at random][one of][or]G[or]RG[or]UG[at random]H[one of]H[or]HH[or]HHH[at random][one of][or][exclam][or][exclam][exclam][at random]!!!".
	
Report screaming (this is the other characters react to scream rule):
	if Lawn is in the location of the player:
		say "'[one of]Quiet[or]Cut it out[or]Hush[at random],' says Lawn.";
	otherwise if Adagio is in the location of the player:
		unless Magic Show is happening:
			say "'[one of]No need for that[or]Please don't do that, Lola[at random],' says Adagio mildly.";
	otherwise if Freda is in the location of the player:
		unless Strength Show is happening:
			say "Freda joins in.".
			

Part - Untying

[very very skeletal action meant to forbid untying contraption rope. Also acts as synonym for unhook in places]

Untying is an action applying to one visible thing. Understand "untie [something]" or "loosen [something]" or "unknot [something]" as untying.

Check untying:
	say "[regarding the noun][They] [aren't] tied up." instead.


Part - Xyzzying

Xyzzying is an action out of world. Understand "xyzzy" as xyzzying.

Carry out xyzzying:
	say "A hollow voice says 'Clown.'"


BOOK - Object properties used in multiple locations in the source

Part - Hats

[some rules useful to both the purple top hat and the black top hat]

A hat is a kind of container.
A hat is usually open, not openable, and opaque.
A hat is usually wearable.



Part - Other properties (burgpart)

[
BURGPART: property held by parts of burger - this is defined under rest of burger code in RmEntranceTent
]

Part - Room properties - exterior/tall-interior/short-interior

[Property that makes a distinction between being outside, being inside in a room with high ceilings, and being inside in a smaller room. Used for dropping helium balloons; defined here so that the code knows what "short-interior" is before I describe the rooms as such]

A room can be exterior, tall-interior or short-interior. A room is usually exterior.





BOOK - Other rules and definitions

Part - Object-exiting - allow "exit car" and similar synonyms to work

Object-exiting is an action applying to one thing. Understand "dismount [something]" and "exit [something]" and "get out of [something]" and "get off [something]" and "leave [something]" as object-exiting.

Check object-exiting:
	if the player is inside the noun:
		try exiting instead;
	otherwise if the player is on the noun:
		try exiting instead;
	otherwise:
		say "But you aren't in or on that right now." instead.


Part - Custom phrase for going inside in certain places

[For use in places where "in" could refer to more than one direction, e.g. standing by two campers/caravans]

To ask which in the player means:
	say "There's more than one way to go inside here. You'll have to specify a compass direction here.". 


Part - People can be set to follow the player

[At certain points, NPCs start following the player. The intended points when this happens are:
	- the Ringmaster starts following when Unmasking starts (i.e. right after the third show has been solved)
	- Freda, Adagio and Lawn follow when the Phantom escapes;
	- Jenny from the balloon stand follows when Freda removes the tyre
]

The list of followers is a list of people that varies. The list of followers is { }.

Every turn (this is the people follow the player rule):
	let didSomeoneMove be 0;
	[make everyone on the list follow the player]
	repeat with NPC running through the list of followers:
		if the location of NPC is not the location of the player:
			now didSomeoneMove is 1;
			let the way be the best route from the location of NPC to the location of the player, using doors; 
			silently try NPC going the way;
	[then report (done silently above and reported here to avoid loads of "Adagio arrives from the east. Freda arrives from the east. Lawn arrives...")]
	if didSomeoneMove is 1:
		if the number of entries in the list of followers is 1:
			[say "[The list of followers with definite articles] [one of]runs to keep up[or]follows you[or]arrives after you[purely at random].";]
			say "[one of]Behind you[or]Chasing after you[purely at random], [the list of followers with definite articles] [one of]runs to keep up[or]arrives[or]nervously enters[purely at random].";
		otherwise if the number of entries in the list of followers is more than 1:
			say "[one of][A list of followers with definite articles][or]The rest[or]The others[then at random] [one of]chase after you[or]follow you[room transition][or]bundle[room transition] after you[purely at random][vehicle check].". ["room transition" defined after the below comment; "vehicle check" is defined in EndgameA where it's used to riff on good-but-wrong solutions to the car puzzle]
			
[This is not good practice - if the "silently try" part fails, the subsequent report will be a lie. However, I don't think it will fail, because there are no restrictions on NPC movement that don't also apply to Lola, so they should always be able to go where the player goes. This rule also doesn't account for the different characters being split up in some way (e.g. one arriving from the east, the rest from the north), but again, I'm pretty sure you can't do that to them.]
			
To say room transition:
	if the last location is exterior:
		if the location of the player is tall-interior:
			say " in";
		otherwise if the location of the player is short-interior:
			say " in";
	otherwise:
		if the location of the player is exterior:
			say " out".

Part - Go to last location

[keep track of the last room the player was in]
Last location is a room that varies. Last location is RmRingmaster.
Carry out going (this is the track last location rule):
	now last location is the location of the player.
The track last location rule is listed before the move player and vehicle rule in the carry out going rulebook.

[tracking last location ensures that player is only being chased to rooms they've been, i.e. can't use this to phase through a locked door]

To send player to last location:
	let buffered-last location be the location of the player;
	move the player to last location;
	now last location is buffered-last location.

[*TODO: keep an eye on this code - liable to break. e.g. disable in Endgame if goose is present or else player might be chased out of endgame rooms]

Part - Rearrangement

[going certain verbs together so I don't have to redirect pushing/pulling to taking for scenrery objects. Syntax to use is "Instead of rearrangement when the noun is the X:..."]
[IMPORTANT NOTE: BECAUSE TAKING IS INCLUDED, "INSTEAD OF REARRANGEMENT: TRY TAKING" CAUSES A RUNTIME ERROR! WRITE CAREFULLY]

Taking something is rearrangement.
Pulling something is rearrangement.
Pushing something is rearrangement.
Turning something is rearrangement.

Part - Chitchat

Talking to someone is chitchat.
Asking someone about is chitchat.
Item-asking someone about is chitchat.

Part - Redirect looking under

Before looking under something:
	try searching the noun instead.
[a bit blunt but gets the job done. the job here is stopping the player trying to look under the black hat while the RM is wearing it]

Part - Big Head Mode

[this does nothing.]

BigHeadMode is a truth state that varies.
BigHeadMode is false.

Bigheading is an action out of world.
Understand "big head mode" as bigheading.

Carry out bigheading:
	now BigHeadMode is true.
	
Report bigheading:
	say "Big Head Mode is [one of]ON[or]STILL ON[or]IRREVERSIBLE[stopping]."


VOLUME - CHARACTERS

BOOK - Lola the Clown (the player)

Lola is a woman. Lola is known.

The player is Lola. Understand "lola" and "clown" as yourself.
[*TODO: this understand phrase doesn't actually do anything]

Description of Lola is "You are Lola, the greatest and only clown in the whole circus! Your special skills include pie-throwing, balloon-animal-making and nose-honking."

Lola is in RmRingmaster.

PART - Red nose

Lola wears the red nose. Description of the nose is "Your honkable red nose really ties your whole face together."

The red nose is known.

Chapter - Don't take off the red nose

[The player is forced to wear the red nose throughout the game, partly as a character tic of Lola's, but mostly because the red nose is a necessary item for the endgame and thus must not be dropped before then]

Check taking off the red nose (this is the 'the nose stays ON during gameplay' rule):
	say "Unthinkable!" instead.
	
Before inserting the red nose into (this is the prevent actions that imply removing red nose rule):
	say "And take off the red nose? Unthinkable!" instead.

Chapter - Honking (squeezing) the red nose

Check playing the red nose:
	try squeezing the red nose instead.
	
Check squeezing Lola:
	try squeezing the red nose instead.

Carry out squeezing the red nose (this is the honk nose rule):
	say "Honk!".
Report squeezing the red nose: do nothing instead.

Chapter - Throwing pie at the red nose

Instead of throwing the stack of pies at the red nose:
	try throwing the stack of pies at Lola.

Chapter - Shooting yourself in the nose

Instead of shooting the red nose with the bow:
	say "Now then. This would be a great visual gag, and very funny for anyone watching. But you [i]are[/i] wearing the nose. (Don't even [i]think[/i] of taking the nose off.) Are you sure this is such a good idea?";
	if the player consents:
		say "It's not an easy task, firing a bow backwards. But you find a way. You level the bow at your own red nose, and fire at point-blank range. The way the arrow judders out of the nose is very funny. The nose even makes a sad 'hooonk' kind of sound as it deflates. It's incredibly good. There's just one small problem, which is that, well, you've just shot yourself in the face.";
		end the story saying "Hospital time";
	otherwise:
		say "Yeah. On balance, you probably shouldn't shoot yourself in the face."



Part - Other bits and pieces about Lola

Chapter - pie reaction

The pie reaction of Lola is "It's true what they say - it [i]does[/i] burn your eyes!".


BOOK - Adagio the Magician

Adagio is a woman.
Understand "amazing" and "dadge" and "magician" as Adagio.
Adagio is known.

Adagio is in RmAdagio.

Description of Adagio is "Your friend the Amazing Adagio is a great magician. You've watched her pull off many incredible feats over the years, among them pulling a rabbit out of a hat, sawing herself in half, transitioning her gender, and pulling a rabbit out of a different hat. These days, Adagio dabbles in escapology[if the purple top hat is worn by Adagio]. She's wearing a purple top hat (an unusual style for her)[otherwise if the black top hat is worn by Adagio]. She's sporting her black top hat with [the rabbit] in it[otherwise if Magic Show is happening]. She's presently being lowered into the water tank of the Diabolical Contraption, and not looking too happy about it[end if]."

[Description of Adagio is "The Amazing Adagio is a great magician, absolutely dedicated to her craft. She's been on the estradiol for a few years, and the two of you have supported each other for a while now, high-fiving as you ride shopping trolleys past each other through the supermarket aisle of gender[if the purple top hat is worn by Adagio]. She's wearing a purple top hat (an unusual style for her)[otherwise if the black top hat is worn by Adagio]. She's sporting her black top hat with the rabbit in it[otherwise if Magic Show is happening]. She's presently being lowered into the water tank of the Diabolical Contraption, and not looking too happy about it[end if]."]

Initial appearance of Adagio is "Adagio [if Adagio is in RmRing]is tied up in the Diabolical Contraption, being lowered into the water[otherwise]lounges here, idly shuffling a deck of cards[end if]."
[this looks like it should break when Adagio is in RmRing and the Magic Show is not happening. However, because I set the "handled" property on all the major NPCs to collapse their initial appearances once Unmasking begins, you won't see this text from Unmasking onwards.]

Part - Deck of cards

The deck of cards is carried by Adagio.
The deck of cards is known.

Description of the deck of cards is "A normal, unmarked set of cards, as far as you can tell (and you've stared and stared at those cards during your poker games)."

Check taking the deck of cards:
	say "With a flick of her wrists, Adagio makes the cards disappear. She waits patiently for you to stop looking for them before she reappears them." instead.
	
Check shooting the deck of cards with the bow:
	if a climactic scene is happening:
		say "'Not now, Lola,' says Adagio." instead;
	otherwise:
		say "'Alright, name your card, Lola,' says Adagio. You do. She throws the cards in the air, and you shoot.[paragraph break]Adagio picks up one card with a hole through the centre. It's not your card. 'Too bad,' she sighs. 'That's why I don't try this trick during the show.' She clears away the scattered cards and materialises a fresh deck in her hands." instead.

Part - Purple top hat

The purple top hat is a hat.
The purple top hat is worn by Adagio.

Description of the purple top hat is "A fuzzy purple hat[if the purple top hat is worn by Adagio]. It doesn't seem to fit with the rest of Adagio's outfit[otherwise if the purple top hat is worn by the Ringmaster]. It suits the boss[end if]."

After going to RmAdagio:
	now the purple top hat is known;
	continue the action.
[prevents the purple top hat coming up in disambiguation for the ringmaster during the intro]


Part - Giving to Adagio

Chapter - Giving the purple top hat to Adagio

Check giving the purple top hat to Adagio (this is the Adagio refuses to take back the purple hat rule):
	say "'No, no,' says Adagio. 'That's not my hat. It must belong to the Ringmaster.'" instead.
	
[
The following shouldn't be needed anymore since as soon as you bring the black hat into RmAdagio, RabbitEatsSalad scene takes over. Keeping it here just in case.

Chapter - Giving the black top hat to Adagio

Instead of giving the black top hat to Adagio:
	now Adagio wears the black top hat;
	now the wicker bowl of salad is nowhere;
	say "'Ah! Thank you, Lola.' Adagio takes the black hat off you, and holds it up to the rabbit hutch.

A little nose peeks out of the hat, swivelling like a periscope until it detects the little wicker bowl of salad. The rabbit launches itself out, and what happens next is a bit like those old cartoons, you know? Where two characters get in a fight and it's just a big spinning dust cloud with arms and legs popping out? Well, when the dust settles, even the wicker bowl has been devoured.

The sated rabbit hops back into the hat. Adagio shrugs and puts the hat on. 'Suppose he prefers it in here.'".
]


Part - Talking to Adagio 

Chapter - Adagio main conversation

[define page types to let us swap out show-related conversation options once the Magic Show is solved]
A page can be NotMagic, PreMagic or PostMagic. A page is usually NotMagic.

Section - Greetings

The greeting of Adagio is Adag_hello.

Adag_hello is a page.
"'Oh, hullo, Lola,' says Adagio. She squares up her deck of cards. 'What brings you here?'"
It flips to Adag_hub.

Adag_hello_unmask is a page.
"'We spotted the Phantom lurking about the Wheel,' says Adagio. 'Would you care to do the honours and unmask our spectre?'"
It flips to Adag_hub.

Adag_hub is a page.

Section - Adag_problem - asking about Adagio's problem

Adag_problem1 is a page.
"'I'm afraid so, yes. It's... to do with one of my tricks.' Adagio flicks the corners of her deck for a little while. It looks like she's agonising over something. 'Lola? I know I can trust you. I'm going to tell you about this trick, and maybe you can help me with it. But I need you to keep the secret, okay? Can you promise me?'"
The cdesc is "'I'm told some Phantom's been giving you grief.'" It is for Adag_hub. It is a one-off. It is needed by Adag_show, Adag_blade, Adag_rope and Adag_plant. It flips to Adag_problem_hub. It is PreMagic.

Adag_problem_promise1 is a page.
"'Thank you, Lola.'"
The cdesc is "'I won't tell a soul.'" It is for Adag_problem_hub. It flips to Adag_problem2. It is PreMagic.

Adag_problem_promise2a is a page.
"'No. I need it to stay a secret, please.'"
The cdesc is "'Can I tell Freda?'" It is for Adag_problem_hub. It is a one-off. It is a dead-end. It is needed by Adag_problem_promise2b. It is PreMagic.

Adag_problem_promise2b is a page.
"'No, not him, either.'"
The cdesc is "'Can I tell Ken?'" It is for Adag_problem_hub. It is a one-off. It is a dead-end. It is needed by Adag_problem_promise2c. It is PreMagic.

Adag_problem_promise2c is a page.
"'No.'"
The cdesc is "'Can I tell the boss?'" It is for Adag_problem_hub. It is a one-off. It is a dead-end. It is needed by Adag_problem_promise2d and Adag_problem_promise2ca. It is PreMagic.

Adag_problem_promise2ca is a page.
"'Well...' Adagio looks uncomfortable. 'Look, I know I ought to let him know, but he's not a very discreet man, is he? I can hear him panicking from three caravans away, bless him. No, I'd better not tell him.'"
The cdesc is "'Wait, the boss doesn't know how you do it?? Doesn't he buy the tricks?'" It is for Adag_problem_hub. It is a one-off. It is a dead-end. It is PreMagic.

Adag_problem_promise2d is a page.
"'No.'"
The cdesc is "'Can I tell my brothers?'" It is for Adag_problem_hub. It is a one-off. It is a dead-end. It is needed by Adag_problem_promise2e. It is PreMagic.

Adag_problem_promise2e is a page.
"'No. Lola, I know when you're trying to wind me up.'"
The cdesc is "'Can I tell the guy who runs the Monster Manor?'" It is for Adag_problem_hub. It is a one-off. It is a dead-end. It is needed by Adag_problem_promise2f. It is PreMagic.

Adag_problem_promise2f is a page.
"'N- well. Okay, you can tell the goose. But you have to whisper.'"
The cdesc is "'Can I tell the goose?'" It is for Adag_problem_hub. It is a one-off. It is a dead-end. It is PreMagic.

Adag_problem_promise3 is a page.
"'Not my choice, Lola. Magic Society rules. They have your legs broken if they find out you've been giving away secrets, you know. But, Lola, I know I can trust you because you've helped me with some of my tricks before, and you've never said anything. I just need you to promise me again, alright?'"
The cdesc is "'Why are you so worried about people finding out how it's done?'" It is for Adag_problem_hub. It is a one-off. It is a dead-end. It is PreMagic.

Adag_problem2 is a page.
"Adagio pockets the deck. 'Do you remember the escape trick I sometimes do at the end of the show? The one where an audience volunteer ties me up with the rope which lowers me into the water tank. You were trying to guess how I escape the ropes?'"

Adag_problem_guess1 is a page.
"'Well, you're half-right,' smiles Adagio. 'But it's more simple than I think you're imagining. [adag_problem desc]".
The cdesc is "'I still think there's something funny with the pulleys.'" It is for Adag_problem2. It flips to Adag_hub. It is PreMagic. It is PreMagic.

Adag_problem_guess2 is a page.
"Adagio gives a wry smile. 'You're exactly right, Lola. Maybe it's too obvious? Yes, [adag_problem desc]".
The cdesc is "'I still think you cut the ropes somehow.'"  It is for Adag_problem2. It flips to Adag_hub. It is PreMagic.

Adag_problem_guess3 is a page.
"'Not a bad guess. That's what some other magicians do. But you choose the volunteers yourself when you're being my assistant, Lola. If I was using a plant, you'd know who it is by now. No, [adag_problem desc]".
The cdesc is "'I still think you use an audience plant to tie the ropes loosely.'"  It is for Adag_problem2. It flips to Adag_hub. It is PreMagic.

Adag_problem_guess4 is a page.
"Adagio frowns. 'I hope you're not still upset about losing at poker the other night. No, [adag_problem desc]".
The cdesc is "'I still think you're just naturally slippery and you just ooze out of the ropes.'"  It is for Adag_problem2. It flips to Adag_hub. It is PreMagic.

AdagioProblemKnown is a truth state that varies. AdagioProblemKnown is false.

To say adag_problem desc:
	now AdagioProblemKnown is true;
	now the razor blade is known;
	say "I just cut the ropes until they fray and loosen up, so I can slip out. Then I end the show before anyone can look at the rope too closely. I have an old razor blade wedged in one of the pulleys. I can just about palm it and cut myself free.

'Well, I [i]had[/i] a blade. Somebody removed it just ahead of the show. I checked it was there before the show, as usual, but somebody must have snuck backstage during my other tricks and taken it. I had to abort the escape trick, of course. I had to tell the audience I was coming down with dysentery. And while I was being lowered again, I saw the Phantom - a person in a white mask at the back of the audience, holding that blade aloft.'

She pulls the deck of cards out again, and goes back to shuffling distractedly. 'So there you have it. I'm hoping this is all just a mistake. Maybe I just overlooked that blade last time. But I'm not hopeful. So if you have any ideas - some emergency way of doing the trick, say - it would help me out a lot.'[no line break]".

Section - Adag_blade - why Adagio can't replace the blade

Adag_blade is a page.
"Adagio shuffles uncomfortably while she shuffles. 'Well... I don't have any other blades. I know, I know, I should have kept a spare. But after all the laser removal, you know, I was so happy I didn't have to shave anymore that I threw all my shaving equipment out, apart from that blade. Now it's gone. They don't make that brand of blade anymore, and everyone else uses electric shavers. So that's that.' She flexes the cards. 'That blade is gone. I'll just have to think of another way of cutting that rope. With my hands tied.'"
The cdesc is "'Suppose you can't just put a new blade up in the Diabolical Contraption?'" It is for Adag_hub. It flips to Adag_hub. It is PreMagic.

Section - Adag_plant - why Adagio can't use a plant

Adag_plant is a page.
"'I could try it, but...' Adagio looks out the window. She seems really troubled. 'I have a really bad feeling about the Phantom, to be honest with you. They know how to get backstage, and they know how to sabotage our shows. They know how the circus works. Are they one of us? If I try to plant one of us in the audience, how do I know it's not the Phantom themself? Or how do I know the Phantom can't bribe them? And I have to let someone else in on the trick in the first place. I don't know. I want to keep this amongst ourselves, just you and me, if I can.'"
The cdesc is "'Could you try putting a plant in the audience for this escape trick?'" It is for Adag_hub. It is PreMagic.

Adag_plant_phantom is a page.
"'I'm afraid I do. Usually when an audience member sneaks backstage they get spotted quickly. We're all coming and going all the time. The Phantom, whoever they are... no one sees them until they want to be seen. Either they're really good at sneaking, or they know where they're going.'".
The cdesc is "'You really think the Phantom is a circus guy?'" It is for Adag_plant. It flips to Adag_hub. It is PreMagic.

Adag_plant_lola is a page.
"'I was thinking of asking you, but it wouldn't work for the trick. The idea of using the volunteers is that it's something I can't control. It tells the audience that the knot is real. If it was a colleague doing it, the audience wouldn't be so convinced.' Adagio smirks. 'We can't plant you in the audience, either. You refuse to take off the nose. I think people would notice you.'".
The cdesc is "'Well, it could just be me who ties you up. I could do it loosely.'" It is for Adag_plant. It flips to Adag_hub. It is PreMagic.

Adag_plant_joke is a page.
"'Quiet, Lola,' says Adagio. But she's smiling when she says it.".
The cdesc is "'No, I meant, like, a succulent or a peace lily.'" It is for Adag_plant. It flips to Adag_hub. It is PreMagic.



Section - Adag_hat - when Adag is wearing the purple hat

Adag_hat is a page.
"[adagio gives you the hat]".
The cdesc is "'Purple hat? That's unusual for you.'" It is for Adag_hub. It is a one-off. It is an end-page.

WasPurpleHatObtained is a truth state that varies.
WasPurpleHatObtained is false.

To say adagio gives you the hat:
	say "'Huh?' Adagio looks blank. She takes off her hat and looks at it. 'Ugh. I must have taken the wrong hat when I left the boss's camper earlier.'

Adagio hands the hat to you. 'Could you do me a favour and run this back to the Ringmaster? He must still have my hat.' She glances at the hutch. 'And my rabbit. I wondered why she was being so quiet today.'";
	now the player carries the purple top hat;
	now WasPurpleHatObtained is true;
	deactivate Adag_hat. [since the player has the hat. This ensures that it's cancelled when visiting via "ask Adagio about hat"]
	
[*TODO: see if you can't get rid of the extra line break that appears here (but not when asking about purple hat]

Section - Adag_show - trigger for Magic Show

Adag_show is a page.
"'Alright,' says Adagio. 'Let's try it again...'"
The cdesc is "'Should we put on your magic show and try this escape trick again? I can be the assistant.'" It is for Adag_hub. It flips to MagicShowStart. It is PreMagic.

Section - Adag_rope - allows fixing contraption rope if you broke it already

Adag_rope is a page.
The cdesc is "'[if the rope is broken]The rope's broken on your water tank contraption thing. Can you fix it[otherwise]Is the water tank contraption thing working correctly[end if]?'" It is for Adag_hub. It flips to Adag_hub. It is PreMagic.

A page-toggle rule for Adag_rope:
	if the rope is broken:
		say "'Broken, is it?' says Adagio. 'Wait here a second, I'll go replace it.'[paragraph break]A few minutes later, she comes back. 'Okay, the rope's replaced now[if the rope is lettuced].' She looks a little puzzled. 'There was some kind of vegetation on the old rope I just threw away. Strange. Algae, perhaps[end if].'";
		now the rope is unlettuced;
		now the rope is whole;
	otherwise:
		say "'Yes, last I checked,' says Adagio. 'It's working too well, perhaps, now that I don't have a way to cut the rope anymore.'".
		
Section - Adag_solved_x - conversation options after Magic Show solved

Adag_solved_congrats is a page.
"'Thank you, Lola,' Adagio smiles. 'I mean it. And thanks to this little one, too,' she adds, reaching under her hat to pet [the rabbit]. 'You've saved us a great deal of embarrassment. [if Unmasking is happening]And thank you for helping the others, too. I don't know what we'd do without you[otherwise]Freda and Lawn could do with your help, too, if you can spare it. I'm not sure what I can do for them, but maybe you've already got some ideas. Maybe you're already working on it[end if].'"
The cdesc is "'Glad you got your show running again, Dadge!'" It is for Adag_hub. It flips to Adag_hub. It is PostMagic.

Adag_solved_future is a page.
"'I think it'll have to be the rabbit for now. I know the Phantom's been giving Lawn and his goose trouble, but she's usually with me. I don't think our Phantom will be able to get at her[if Unmasking is happening]. Not if the police do their job, anyway,' she adds, glancing at the Phantom.[otherwise].'[end if] Adagio [if Unmasking is happening]glances pensively at Lawn[otherwise]sighs[end if]. 'I do hope Lawn doesn't mind that there are two animal acts now. I'd like to get back to normal soon.'"
The cdesc is "'Do you still need that razor blade finding, or are you going to keep having [the rabbit] chew you free?'" It is for Adag_hub. It flips to Adag_hub. It is PostMagic.

Section - Adag_bye - leaving conversation

Adag_bye is a page.
"'Goodbye, Lola.'"
The cdesc is "'See you around, Dadge.'" It is for Adag_hub. It is an end-page.

[
Chapter - Ask Adagio about topics

The topic-table of Adagio is the Table of Adagio Topics.

Table of Adagio Topics
topic	reply
"job"	"'I'm a magician,' says Adagio.[p]"
"joke"	"[adagio topic joke]"

To say adagio topic joke:
	say "'Alright, Lola. Tell me a joke.'";
	switch to cyoa at Adag_jokehub.
	
Adag_jokehub is a page.

Adag_joke1 is a page.
"'Go away, Lola.' But she's smiling when she says it."
The cdesc is "'What do you call a fish with no eyes? A fsh.'" It is for Adag_jokehub. It is an end-page.

Adag_joke2 is a page.
"'Shut up, Lola.' But she's smiling when she says it."
The cdesc is "'I dreamed I was eating a giant marshmallow, and when I woke up my pillow was gone.'" It is for Adag_jokehub. It is an end-page.
]

Chapter - Item-asking Adagio

The item unknown response of Adagio is "'I'm the wrong person to ask about that, I'm afraid, Lola,' shrugs Adagio."

The item-table of Adagio is the Table of Adagio Items.

Table of Adagio Items
item	reply
Adagio	"'Do you think I should change my name? I'm not sure about [']Adagio['] today. I've been looking at a list of musical terms... [one of]does [']Adantino['] sound any good[or]how about [']Fermata['][or]does [']Alla Marcia['] sound right? Too much of a mouthful[or][']L'istesso Tempo['][cycling]?'[p]"
bags of flour	"[adagio item phantom]"
black top hat	"[adagio item purple top hat]"
cloak	"[adagio item phantom]"
deck of cards	"'I can see how you're looking at them,' warns Adagio. 'Look, they're not marked. I'm a magician. If I was going to cheat at poker, I could just [i]force[/i] you to take a card. I wouldn't [i]need[/i] to use marked cards. You can keep looking if you want, but you're not going to find anything.' (Well, she would say that, wouldn't she.)[p]"
Diabolical Contraption	"'I've always felt calling it the Diabolical Contraption was a little much. It's just a tank of water and some pulleys, really. Well, that's the brand name, anyway. What do I know about brands?'[p]"
Freda	"'[if StrengthShowSolved is false]How's Freda doing?' asks Adagio. 'She really seemed upset when the Phantom spoiled her show. I know how much she loves, well, picking up things, lifting things, things of that nature. You will help her, won't you?[no line break][otherwise]'I've heard about Freda's show. Good work helping her out. We knew you'd pull through for her.[no line break][end if]'[p]"
Frankenstein	"[adagio frankenstein response]"
goose	"'Ugh, don't ask me about that thing,' mutters Adagio. 'I caught it trying to pull the windshield wipers off my camper the other day, and when I honked the horn to scare it, it just shrugged at me. I didn't even know birds could shrug.'[p]"
helium canister	"Adagio takes an experimental puff and patters '[i]Adagio, Adagio. Pick a card, sir, any card. ...no, that's [/i]too[i] high-pitched. Thanks anyway,[/i]' she adds, handing back the canister.[p]"
hired help	"'She seems very diligent, doesn't she? Diligent to a fault, perhaps.'[p]"
Lawn	"'Has Kentucky been brusque with you? He's been like that with me, too. He's been in this business a long time. We can't judge him too harshly; he's just older, and more strong-minded. I'm worried for him, honestly. This Phantom business must [if BeastShowSolved is false]be[otherwise]have been[end if] terrible for his blood pressure.'[p]"
lettuce leaf	"'Don't feed too many of those to my rabbit, will you? I know she'#s wild for them but they're not good for her in excess.'[p]"
Lola	"'Yes, that's you. Hullo, Lola.'[p]"
medication	"'Oh, I'm fully stocked up, thank you for asking,' says Adagio. 'How are you doing for yours?' (You're good, too.)[p]"
operator	"'He seems alright,' Adagio says guardedly. 'We don't really talk. I don't talk very easily to people I don't know, and all those rules make me nervous.'[p]"
rabbit	"[adagio rabbit response]"
razor blade	"'I think the blade is gone. [if MagicShowSolved is false]I don't think we should bother trying to find it at this point[otherwise]Not that we need it anymore[end if].'[p]"
red nose	"'Yes, it's very nice. Very bulbous today.'[p]"
Ringmaster	"'I feel quite sorry for him. He's very upset about this Phantom. I can only imagine. Hey, Lola, did he ever tell you he was a magician at some point? He's been trying to show me the tricks he used to do, trying to get me to perform them in my shows.' Adagio grimaces. 'He's a little out of practice, unfortunately. He doesn't remember half the details. He just wants to help, poor man.'"
Phantom	"[adagio item phantom]"
purple top hat	"[adagio item purple top hat]"



[cropping this out because there's something about it that I don't like]
[To say adagio item red nose:
	say "'Nice nose,' says Adagio. 'It's odd how the circus professions have their signature accessories, isn't it? I have my top hat and my moustache and my rabbit. Freda has her leotard and barbells. You clowns have your red noses. I wonder why that is?'";
	switch to cyoa at Adag_nosehub.
	
Adag_nosehub is a page.

Adag_nosedrunk is page.
"'Hmm. Clowning as a performance of drunkenness.' Adagio flexes her deck of cards. 'I suppose you'd have to be drunk to come up with the whitewash gag and the ladder gag. Sorry, I didn't mean that,' she adds."
The cdesc is "'Maybe we're supposed to look drunk?'" It is for Adag_nosehub. It is an end-page.

Adag_nosecute is a page.
"'No one ever says that about my moustache,' says Adagio. You're pretty sure she's only pretending to be bitter."
The cdesc is "'Because it's cute!'" It is for Adag_nosehub. It is an end-page.]

To say adagio frankenstein response:
	if the player's command includes "frankenstein's monster":
		say "'Thank you. Of course, I suppose many would argue that Victor Frankenstein is the real monster in that book.' Which is silly to you - you thought the real monster was the big green one - but it's not like you've read the book.";
	otherwise:
		say "'Actually, it's Frankenstein's [i]Monster[/i].'".
		
To say adagio item phantom:
	if Unmasking is happening:
		say "'Well, why not find out for yourself?' says Adagio, gesturing to the Phantom.";
	otherwise if MagicShowSolved is true:
		say "'Yes, the Phantom's been seen off now, I think. I don't think they'll try anything else on me.' Adagio looks thoughtful. 'I caught a glimpse of them when the show started, I think. Big, aren't they? They must be a very strong person, if even Freda's been having trouble with them. Hmm.'";
	otherwise:
		say "'It's... it's just so [i]upsetting[/i],' sighs Adagio. 'I know not everyone likes circuses, but... who would even do something like this to us? Why bother?'"

To say adagio item purple top hat:
	if Adagio wears the purple top hat:
		say "[adagio gives you the hat]";
	otherwise:
		say "'I should have noticed I was wearing the wrong hat, really. I was just in a hurry to get out of the Ringmaster's office this morning. He kept trying to show me a new card shuffle he's invented. I don't think he's got the hang of it, unless the idea is to drop the cards on the floor and pick them up one by one.'".
		
Section - Asking Adagio about the rabbit

To say adagio rabbit response:
	say "'What do you want to know about her?' asks Adagio.";
	switch to cyoa at Adag_rabbit_hub.
	
Adag_rabbit_hub is a page.

Adag_rabbit_name is a page.
"'Oh, you know very well what her name is. It's...' prompts Adagio."
The cdesc is "'What's your rabbit's name again?'" It is for Adag_rabbit_hub. It is a one-off.

Rabbit name toggle is a number that varies. Rabbit name toggle is 0.

Adag_rabbit_nameguess1 is a page.
The cdesc is "'Miss Bunnypenny?'" It is for Adag_rabbit_name. It flips to Adag_rabbit_name_ignored.
A page-toggle rule for Adag_rabbit_nameguess1:
	now the rabbit is proper-named;
	now the printed name of the rabbit is "Miss Bunnypenny";
	now rabbit name toggle is 1.
	
Understand "miss bunnypenny" and "miss" and "bunnypenny" and "bnuuypenny" and "bnuuypneey" as the rabbit when rabbit name toggle is 1.

Adag_rabbit_nameguess2 is a page.
The cdesc is "'The Last Harebender?'" It is for Adag_rabbit_name. It flips to Adag_rabbit_name_ignored.
A page-toggle rule for Adag_rabbit_nameguess2:
	now the rabbit is proper-named;
	now the printed name of the rabbit is "The Last Harebender";
	now rabbit name toggle is 2.
	
Understand "last harebender" and "last" and "harebender" and "havatar" as the rabbit when rabbit name toggle is 2.
	
Adag_rabbit_nameguess3 is a page.
The cdesc is "'Rabbott-and-Costello?'" It is for Adag_rabbit_name. It flips to Adag_rabbit_name_ignored.
A page-toggle rule for Adag_rabbit_nameguess3:
	now the rabbit is proper-named;
	now the printed name of the rabbit is "Rabbott-and-Costello";
	now rabbit name toggle is 3.
	
Understand "rabbott and costello" and "rabbott-and-costello" and "rabbott" and "rabbot" and "costello" as the rabbit when rabbit name toggle is 3.

Adag_rabbit_name_ignored is a page.
"'No, her name is-' starts Adagio, but you tune out the rest of what she says. It's [the rabbit] now."
It flips to Adag_rabbit_hub.

Adag_rabbit_tricks is a page.
"'None, really. I don't have Kentucky's magic touch. I can use her as a prop, pull her out of a hat, pull the hat out of a basket - all the classic nested containers, you know - but when it comes to training her I'm afraid she ignores anything that isn't food, bless her.'"
The cdesc is "'What tricks can she do?'" It is for Adag_rabbit_hub. It flips to Adag_rabbit_hub.

Adag_rabbit_food is a page.
"'Oh yes, don't I know it,' mutters Adagio a little peevishly. 'If there's any leafy greens around, she's on them. She's nearly chewed the clothes off me because I dropped a shred of lettuce on myself. She unmoored a yacht once because she thought the algae on the rope might be tasty.'"
The cdesc is "'Rabbits are very food-motivated, aren't they? Does she like treats?'" It is for Adag_rabbit_hub. It is needed by Adag_rabbit_food_yacht. It flips to Adag_rabbit_hub.

Adag_rabbit_food_yacht is a page.
"Adagio looks defensive. 'I thought she deserved a holiday. Leave me alone.'"
The cdesc is "'...Did you take your rabbit on a yacht ride?'" It is for Adag_rabbit_hub. It flips to Adag_rabbit_hub. It is a one-off.

Adag_redirect is a page.
"'Sure. What's on your mind?'"
The cdesc is "'I wanna ask you about something else...'"  It is for Adag_rabbit_hub. It flips to Adag_hub.

Adag_item_bye is a page.
"'Bye, Lola.'"
The cdesc is "'That's all, bye!'" It is for Adag_rabbit_hub. It is an end-page.
	
Part - other Adagio behaviours

Chapter - Adagio idle behaviours

Every turn when the location of the player is the location of Adagio (this is the Adagio idle daemon rule):
	unless Magic Show is happening or a climactic scene is happening:
		if a random chance of 1 in 7 succeeds:
			say "Adagio [one of]flexes the deck of cards absent-mindedly[or]casually disappears and reappears the [random card][or]tosses the deck in the air, catching with her other hand[or]practices her [random shuffle] with the cards[or]spots a [one of]tear[or]blemish[or]dog-ear[purely at random] on the [random card], sighs, disappears the deck and apparates a fresh one from her pockets[or]tosses the deck in the air, fumbles the catch, almost starts a game of 52-Card Pickup, and curses under her breath[as decreasingly likely outcomes].".
			
To say random card:
	say "[one of]Ace[or]Two[or]Three[or]Four[or]Five[or]Six[or]Seven[or]Eight[or]Nine[or]Ten[or]Jack[or]Queen[or]King[purely at random] of [one of]Spades[or]Clubs[or]Diamonds[or]Hearts[purely at random]".
	
To say random shuffle:
	say "[one of]Zarrow shuffle[or]Faro shuffle[or]riffle stacking[purely at random]".

Chapter - pie reaction

The pie reaction of Adagio is "'[one of]Okay, Lola, get it out of your system[or]Oh, you thought maybe it would be funnier a second time[or]Alright, that was the third time. If I know anything about comedy, that means that time was the funniest time, and it won't be as funny the next time[or]..[or]I don't think I like you very much today, Lola[stopping].'"

Chapter - persuasion refusal

The persuasion refusal of Adagio is "[if Magic Show is happening]Adagio's a little tied-up at the moment[otherwise if a climactic scene is happening][Lola wants to go it alone][otherwise]'Oh no, I still don't trust you, Lola. I still remember when you had me open that door you balanced those ten buckets of whitewash on,' says Adagio".

Chapter - gesture reaction

The gesture reaction of Adagio is "[if Magic Show is happening]The crowd waits for a joke; Adagio waits for you to try something else[otherwise if a climactic scene is happening]'Please, Lola, there'll be time for mimework later,' pleads Adagio[otherwise]Adagio mimics you[one of], smiling a little bit. You feel it's like when a dog tilts its head at you and you tilt yours to play along[or][or][or]. You're not getting anywhere with this, but it sure is fun[stopping].".


BOOK - Freda the Strongwoman

Freda is a woman.
Freda is known.

Understand "Siegfrieda" and "strongwoman" as Freda.

Freda is in RmFreda.

Description of Freda is "Siegfrieda, the Strongest Woman Around - Freda to her friends. A kitten in a lion's body. She looks like she should be singing long and violent operas, or carrying fallen Viking warriors to Valhalla, but she couldn't be gentler. [if Magic Show is happening]She's really struggling under the Phantom's weight here. You have to help her[otherwise]You adore her[end if]."

Initial appearance of Freda is "The [Freda-adjective] Freda[first time], the circus strongwoman and your strong girlfriend,[only] is [if Freda is in RmRing]doing her best to keep the Phantom aloft[otherwise]having a rest period here between shows[end if][first time]. She seems down, but she brightens up as soon as she sees you[only]."
[this doesn't break from Unmasking onwards because character is set to handled then. See Adagio initial appearance note]
[also, I'm not worried about that second first time token triggering in Strength Show because I think it's impossible to trigger the show without being in the same room as Freda beforehand]

To say Freda-adjective:
	say "[one of]lovely[or]beautiful[or]powerful[or]gorgeous[or]enchanting[or]charming[then at random]".
[this was going to be a list of the adjectives that Grey Prince Zote gets in Hollow Knight, but I had to remove too many of the inappropriate adjectives (e.g. terrifying, diligent (Freda is neither)) and the joke got lost]


[The dumbbell is carried by Freda.
Description of the dumbbell is "It's 50kg of dense iron, yet Freda can tote it like it's candyfloss."]


Part - Talking to Freda

Chapter - Freda main conversation

[define page types to let us swap out show-related conversation options once the Strength Show is solved]
A page can be NotStrength, PreStrength or PostStrength. A page is usually NotStrength.

The greeting of Freda is Freda_hello.

Section - Greetings

Freda_hello is a page.
"'Hello, love!' Freda gives you a quick peck on the [one of]cheek[or]cheek[or]nose[or]nose[or]nose (coming in a little too fast and honking it as she does)[as decreasingly likely outcomes]."
It flips to Freda_hub.

Freda_hello_unmask is a page.
"'We thought you should get to take their mask off, babe, since you did everything else for us,' smiles Freda[if the player is in RmRing]. She squeezes your hand[end if]."
It flips to Freda_hub.

Freda_hub is a page.

Section - Freda_problem - asking about Freda's problem

Freda_problem1 is a page.
"'Yeah! Last show was a nightmare!' Freda sighs. [Freda_problem description1][line break]'Well, when I did it last time, it went the worst it's ever gone!'".
The cdesc is "'I heard this Phantom's been causing you problems.'" It is for Freda_hub. It is a one-off. It is needed by Freda_show, Freda_problem2, Freda_needsLola, Freda_ignore and Freda_dense. It is PreStrength.

Freda_problem_last1 is a page.
"'Yeah, worse than that! And even worse than the other guy who got the straights!"
The cdesc is "'Worse than when you lifted that one guy so fast he got the bends?!'" It is for Freda_problem1. It flips to Freda_problem1b.

Freda_problem_last2 is a page.
"'Yeah, that was pretty bad. Still dunno where that referee came from. But even worse than that!"
The cdesc is "'Worse than when you deadlifted that pro wrestler and he instinctively countered you?!'" It is for Freda_problem1. It flips to Freda_problem1b.

Freda_problem_last3 is a page.
"'Yeah! I think so? Did we find that girl? Yeah, we did, she was being raised by hawks in that old clock tower. Yeah, worse than that!"
The cdesc is "'Worse than when you lifted that little girl and she got snatched by birds?!'" It is for Freda_problem1. It flips to Freda_problem1b.

Freda_problem1b is a page.
"'So, I do the call out to the audience, right? [Freda_problem description2]".
It flips to Freda_hub.

Freda_problem2 is a page.
"[Freda_problem description1][line break]'Well, I did that bit the other day, right? [Freda_problem description2]".
The cdesc is "'Remind me what the Phantom was doing to mess with your Strength show?'" It is for Freda_hub. It flips to Freda_hub. It is PreStrength.

To say Freda_problem description1:
	say "'So, like, you know I do the audience volunteer bit during the show? I'll lift anyone who wants to be lifted, and I hold them above my head for a while?".

To say Freda_problem description2:
	say "And this Phantom just books it out of the audience, runs into the ring, and just stands there. I can't ignore them, right, they volunteered. I have to lift them.

'But this guy was so heavy! Like, okay, they're a big guy, taller than me, but they're so [i]heavy[/i]! They must be so... what's the word, Mister Lawn said it about me once... 'dense'! Well, I just couldn't do it - my legs just gave out from under me. It was so humiliating.'

This is obviously getting to Freda. She rubs the back of her head. 'So, like, the boss seems to think the Phantom's gonna do it again. So next time I do the show... could you be there, Lola? To make sure nothing happens?'[run paragraph on]".

Section - Freda_needsLola - what should Loa look out for during show

Freda_needsLola is a page.
"'You just have to be there, love. I keep telling you. It helps a lot.

'And... and maybe you'll see what the trick is. The Phantom can't be that heavy, right? You're smarter than me. You'll think of something.' She strokes your cheek gently with her thumb. She's too hard on herself, but maybe she's missing something when she has to focus on her power-lifting. You'll be there."
The cdesc is "'[first time]Of course I'll be there, Freda. [only]What do you think I can do[one of][or] during the show[stopping]?'" It is for Freda_hub. It flips to Freda_hub. It is PreStrength.

Section - Freda_ignore - why can't Freda ignore Phantom

Freda_ignore is a page.
"Freda picks up a barbell and twiddles it between her fingers like a pen. 'But I can't, Lol[']. That's the thing. I gotta lift anyone that volunteers, or it looks like I'm dodging them, like I'm waiting for an audience plant or something. You can't help me lift them either. It's s'posed to be a solo show. I think I gotta lift the Phantom by myself if they show up.'"
The cdesc is "'Can't you just ignore the Phantom if they volunteer again?'" It is for Freda_hub. It flips to Freda_hub. It is a one-off. It is PreStrength.

Section - Freda_show - trigger for Strength Show

Freda_show is a page.
"'Yeah! Let's do it!'"
The cdesc is "'Let's put your show on and see if we can deal with the Phantom.'" It is for Freda_hub. It flips to StrengthShowStart. It is PreStrength.

Section - Freda_solved_x - conversation options after Strength Show solved

Freda_solved_congrats is a page.
"Freda pulls you in for another big rib-crushing bear hug. 'I'll heal. The show's great. Thank you, love.' [if Unmasking is happening]She nods towards Lawn and Adagio. 'They told me you helped them out, too. I'm proud of you. Now let's find out who our Phantom is! Then maybe we can shoot them again[otherwise] Then she looks gloomy again. 'I wish the ghost wasn't bullying the others too. I know it's a lot to ask, but can you help Ken and Adagio out too? I don't know what's going on with them, but you're smart[end if].'"
The cdesc is "'Thank goodness we saved your show! How are you feeling? You didn't hurt yourself back there, did you?'". It is for Freda_hub. It flips to Freda_hub. It is PostStrength.

Freda_solved_future is a page.
"'Nope! And it'll never happen again, [']cos now everyone knows you'll shoot them if they try it. Man, I wonder how the Phantom did it? They must be so strong if they can carry around all that stuff like it's nothing.'"
The cdesc is "'Has anything like that bag of flour trick happened before?'". It is for Freda_hub. It flips to Freda_hub. It is PostStrength.

Section - Freda_dense - little joke interaction between Freda and Lawn

[triggered by Freda_problem1]
Freda_dense is a page.
"'Yeah, but I don't know what he's on about. I'm in the range of normal weight and muscle mass for a professional powerlifter.'".
The cdesc is "'Did you say Ken called you [']dense[']?'" It is for Freda_hub. It flips to Freda_hub. It is needed by Lawn_callout. It is a one-off.

Choice-priority for Freda_dense:
	rule succeeds with result 99. [done so that this will appear at the end of convo list but before Freda_bye (default is 50)]

Section - Freda_bye

Freda_bye is a page.
"'Love you more!'"
The cdesc is "'Byeee! Love you!'" It is for Freda_hub. It is an end-page.

Choice-priority for Freda_bye:
	rule succeeds with result 100. [done so that this will appear at the end of convo list but after Freda_dense]

Chapter - Item-asking Freda

The item unknown response of Freda is "'Sorry, love, don't know a thing about any of that!' Freda shrugs cheerfully."

The item-table of Freda is the Table of Freda Items.

Table of Freda Items
item	reply
Adagio	"'Adagio's great! I don't know how she always guesses my card!' says Freda, who always flicks through the cards until she finds the Queen of Hearts. 'She's so smart. I bet she's laughing off the sabotage, really. [if MagicShowSolved is false]I bet she meant to not do her escape trick, and get dunked in the water tank a lot yesterday[otherwise]Now that you fixed her escape trick, I bet you guys are making the Phantom look so dumb[end if].'[p]"
bags of flour	"'What a sneak! Waste of ingredients! We should throw eggs at them and turn them into cake mixture.'[first time] You try to think of a pun about battering the Phantom, but can't quite get the wording right in your head.[only][p]"
barbells	"[freda barbells response]"
bendy balloons	"'[if the player carries the bendy balloons]Let me give it a try!' Freda takes a balloon and huffs and puffs with all her might. The balloon shows no signs of inflating. You gently take it off her before she passes out[otherwise]Those new balloons of yours don't blow up properly, huh? Maybe you can blow them up a different way? Or you can just do worms and snakes for balloon animals?' suggests Freda[end if]."
cloak	"'Big cloak. Big stupid cloak. Why does the Phantom even need a cloak? What are they even hiding[if the bags of flour are known] other than flour[end if]?'[p]"
clown car	"'Your car's so cute, Lola. I wish I didn't get such a crick in the neck riding with you.'[p]"
Diabolical Contraption	"'I help Adagio move that thing around sometimes! She says it's easier if I wait until it's not filled with water.'[p]"
Freda	"'I'm doing better than ever!' says Freda, [if StrengthShowSolved is false]lying[otherwise]earnestly[end if]. 'I could lift a horse! I could lift two horses[if StrengthShowSolved is true]! If the Phantom comes back to my show and they've become a horse, I could lift them wherever[end if]!'[p]"
goose	"'I don't know how they know that geese can break your arm. I tried to arm-wrestle that goose and it just bit me instead.'[p]"
helium canister	"Freda takes a puff and so do you, and the two of you do squeaky celebrity impressions for about ten minutes.[p]"
hired help	"[freda item hired help]"
Lawn	"'I know Mister Lawn's a bit grumpy, but I bet he's nice, really. [if BeastShowSolved is false]I bet he's just grumpy because of the Phantom, and because he keeps getting beaten up by his goose[otherwise]I want to be his friend more. Do you think he likes arm-wrestling? Do you think he likes throwing rocks? I'll keep asking him[end if].'[p]"
Lola	"'Yeah, I've heard of Lola. They're the best and cutest clown in the world!' Freda leans in and kisses you on the nose.[p]"
Monster Manor	"[freda item operator]"
operator	"[freda item operator]"
Phantom	"[freda item phantom]"
rabbit	"'Bunny!' says Freda automatically.[p]"
Ringmaster	"'Oh, the boss is great! Love working for him! I've been trying to get him to say yes to a new show idea I have! I'm going to bring in a big truck and pull it all over- all over the ring! And then I start pulling the wheels off! He says it's going to churn up the fields if I pull trucks all over them, though.'" [please read "all over the- all over the ring" in the cadence of Frank Reynolds as the Trash Man]
tyre	"[freda tyre response]"


To say freda barbells response:
	if Freda is in RmFreda:
		say "'Yeah! Wanna see a trick?' Freda picks up a huge barbell and [one of]spins it around like nunchuks[or]bends it like spaghetti[or]twists it into the shape of a giraffe[or]crushes it like an accordion[or]twirls it in the air like a bandleader's baton[or]folds it around her head like a bonnet[at random], then tosses it back into the pile.";
	otherwise:
		say "'My barbells roll around a lot when I'm driving and I have to steer. They nearly tipped my whole camper over last week when I took a wrong turn and I got lost on that go-kart track.'"
		
To say freda item hired help:
	now the printed name of the hired help is "Jenny";
	now the hired help is proper-named;
	say "'The new girl's great, isn't she? Her name's Jenny, right? I haven't talked to her much yet. She's always at the balloon stand when I see her. She works so hard!'"
	
To say freda item operator:
	say "'The Monster Manor guy won't let me pick up the buggy. He won't let even me pick him up. I thought carnivals were supposed to be fun!'"
	
To say freda item phantom:
	if Unmasking is happening:
		say "'They're right there! Get 'em, love!' says Freda, pointing at the Phantom.";
	otherwise if StrengthShowSolved is true:
		say "'We got them! Little sneak, hiding things under their cloak, but you got them! Now we won't have problems ever again!' cheers Freda. 'Oh yeah, the others said something about the Phantom, right? I think [if MagicShowSolved is true and BeastShowSolved is false]Mister Lawn was[otherwise if BeastShowSolved is true and MagicShowSolved is false]Adagio was[otherwise]Adagio and Mister Lawn were[end if] still having trouble. I hope you've got some ideas how to help, because I sure don't!'";[last 'otherwise' fires if both are false; if both true, then if StrengthShow is unsolved it's the below dialogue, and if it's also solved all three are done so it's the above dialogue]
	otherwise:
		say "'What a jerk. We're just here to have fun, and now the Phantom's ruining it for everyone! I don't go to... wherever they work, the Jerk Store, I don't go there and... and make them stop being a jerk, do I?'"
	

[this tyre stuff is a little complex but feeds into the tyre puzzle elsewhere defined in the tyre section and in the EndgameA section]
To say freda tyre response:
	if the tyre is undamaged or the tyre is changed:
		say the reply corresponding to an item of the clown car in the Table of Freda Items;
	otherwise if the tyre is slashed:
		if Freda is in the location of the clown car:
			have Freda remove the tyre; [defined in the EndgameA rules]
		otherwise:
			if TyreAwareness is false:
				say the reply corresponding to an item of the clown car in the Table of Freda Items;
			otherwise:
				say "'The tyre's been slashed? Babe, just lead the way and show me which tyre, and I'll take it off for you.'";
	otherwise:
		say "'I got the tyre off for you, but it's ruined, isn't it? I don't have a spare tyre. Can you, like, make a new tyre or something?'".
		

Part - other Freda behaviours

Chapter - idle behaviours

Every turn when the location of the player is the location of Freda (this is the Freda idle daemon rule):
	unless Strength Show is happening or a climactic scene is happening:
		if a random chance of 1 in 7 succeeds:
			say "Freda [one of]smiles and waggles her eyebrows at you[or]smiles and winks at you[or]smiles and makes kissy noises at you[or]cracks her knuckles recreationally[or]idly plays a little drum solo on her tummy[or]flexes her neck[or]passes the time by counting her fingernails[or]cracks her knuckles recreationally, but cracks one a little too hard. 'Owie,' she says[as decreasingly likely outcomes].".

Chapter - pie reaction

The pie reaction of Freda is "'[one of]Go on, Lola, come at me! I can take it[or]You didn't catch me out! I caught that pie with my head[or]Your pies simply break on me like waves on the shore[or]Your pies slide off me like water off a goose's back[or]Your pies pass by like a gentle breeze[or]Your pies bounce off me like bullets[then at random]!'"

Chapter - persuasion refusal

The persuasion refusal of Freda is "[if Strength Show is happening]'[Freda grunt],' she says. She is, of course, a little busy right now[otherwise if a climactic scene is happening][Lola wants to go it alone][otherwise]'I'm not in the mood to be pranked today, Lola. Sorry,' says Freda, with a weak little smile. 'Remember when you told me to sniff that joke flower?' You've tried to explain before that that wasn't a joke flower and you had no idea there was a bee in it, but Freda still thinks she's on to you".

Chapter - gesture reaction

The gesture reaction of Freda is "[if Strength Show is happening]The crowd waits for a joke; Freda says '[Freda grunt]'[otherwise if a climactic scene is happening]'Please, Lola, there'll be time for mimework later,' pleads Adagio[otherwise]'Oh! [one of]Is it Charades?[or]I love Charades![purely at random]' shouts Freda. 'Uh, [one of]film[or]book[or]play[or]person[purely at random]! [one of]One word! It's[or]Two words! First word,[or]Three words! First word,[purely at random] [one of]one sillyble[or]two sillybles[or]three sillybles[purely at random]! First bit, uh, [charade guess]! Uh, [charade guess], [charade guess]! Hey, why'd you stop?'".

To say charade guess:
	say "[one of]arm[or]hand[or]chest[or]floor[or]torso[or]body[or]clown[or]dance[or]circus[or]caravan[or]world[or]the Moon[as decreasingly likely outcomes]".

Chapter - touching Freda

Check touching Freda:
	if Strength Show is happening:
		say "This is possibly not the time." instead;
	otherwise:
		say "You give Freda a good scratch behind the ears." instead.
		
Chapter - pulling Freda

Before pulling Freda:
	say "Already did that months ago." instead.


BOOK - Lawn the Goose Tamer

Lawn is a man.
Description of Lawn is "Kentucky Lawn the Animal Tamer is deeply sensitive to animal rights, and refuses to work with lions, elephants and other large animals who would suffer from the travelling lifestyle. His animal of choice is the Canada goose. The peck-marks that cover 95% of his body speak to a lifetime of dedicated training."
Lawn is known.

Initial appearance of Lawn is "Ken Lawn, the carnival's resident Animal Tamer, is [if the location of Lawn is RmRing]desperately trying to keep his show on the rails from within the cage[otherwise]brooding here[end if]."
[again, see Adagio's IA for explanation of why this doesn't break from Unmasking onwards]

Understand "Ken/Kentucky" and "tamer/animal tamer/goose tamer" as Lawn.

Lawn is in RmLawn.

Part - Talking to Lawn

Chapter - Lawn main conversation

[define page types to let us swap out show-related conversation options once the Beast Show is solved]
A page can be NotBeast, PreBeast or PostBeast. A page is usually NotBeast.

Section - Greetings

The greeting of Lawn is Lawn_hello.

Lawn_hello is a page.
"'Oh. Hello, clown,' says Lawn.[first time] (It might sound like he's mad at you, but that's just how he is to everyone.)[only]".
It flips to Lawn_hub.

Lawn_hello_unmask is a page.
"'Adagio and Freda made me wait for you,' says Lawn, who's pacing impatiently. 'I can't wait to find out who this guy is.'".
It flips to Lawn_hub.

Lawn_hub is a page.

Section - Lawn_problem - asking about Lawn's problem

Lawn_problem1 is a page.
"[Lawn_problem descriptionA]".
The cdesc is "'I've heard this Phantom's been sabotaging your show?'" It is for Lawn_hub. It is a one-off. It is needed by Lawn_show, Lawn_problem2, Lawn_blindfold, Lawn_sound and Lawn_gesture. It is PreBeast.

To say Lawn_problem descriptionA:
	say "'Listen. I've been doing this for decades. I am in sync with the Goose, and the Goose is in sync with me and only me. But it all depends on the Goose's wellbeing. If the Goose ails, or if its senses are deprived in any way, it cannot perform at peak capacity. You understand this, of course?

'Well, yesterday I was preparing to perform as normal. And when I checked on the Goose before the show... do you know what the Phantom had done? Can you guess?'[no line break]".

Lawn_problem_guess1 is a page.
"'Not that. If you ever find a way to put a Goose to sleep on command, you'll be a giant amongst Goose-tamers, let me tell you."
The cdesc is "'Sedated it?'" It is for Lawn_problem1. It flips to Lawn_problem1b.

Lawn_problem_guess2 is a page.
"Lawn gives you a look. 'Yes, actually. How did you guess?'"
The cdesc is "'Blindfolded it?'" It is for Lawn_problem1.

Lawn_problem_guess_excuse1 is a page.
"'Oh yeah, [i]that[/i] guy,' says Lawn, as if he's disappointed not to have caught you in a lie."
The cdesc is "'The boss told me.'" It is for Lawn_problem_guess2. It flips to Lawn_problem1b.

Lawn_problem_guess_excuse2 is a page.
"'This isn't a joke, Lola! This is a Goose!"
The cdesc is "'I thought I was joking!'" It is for Lawn_problem_guess2. It flips to Lawn_problem1b.

Lawn_problem_guess_excuse3 is a page.
"'Oh, yes. You told me before how you and your brothers used to sneak onto the farm and blindfold the waterfowl."
The cdesc is "'I've played this game before.'" It is for Lawn_problem_guess2. It flips to Lawn_problem1b.

Lawn_problem_guess3 is a page.
"'Of course not! Heavens help the person who kidnaps a Goose who does not want to be kidnapped."
The cdesc is "'Kidnapped it?'" It is for Lawn_problem1. It flips to Lawn_problem1b.

Lawn_problem_guess4 is a page.
"'All of the above what? You know what, don't answer that. I don't care."
The cdesc is "'All of the above?'" It is for Lawn_problem1. It flips to Lawn_problem1b.

Lawn_problem1b is a page.
"[Lawn_problem descriptionB]".
It flips to Lawn_hub.

To say Lawn_problem descriptionB:
	say "'That dreadful Phantom... they'd blindfolded the Goose! Deprived the Goose of vision! Now, listen. To be a great Goose-tamer requires eye contact and full body gestures with every command. If the Goose can't see me, the show is ruined! I had to go out into the Ring locked in a cage with a blind Goose and do nothing!' Lawn is pacing back and forth now (which doesn't take long. It's a small caravan). 'How is the Goose to perform under these conditions?'[no line break]".
	
A page-toggle rule for Lawn_problem1b:
	now LolaKnowsGestures is true. [this controls a little text condition in the Gesturing action report rule]

Lawn_problem2 is a page.
"[Lawn_problem descriptionA]

[Lawn_problem descriptionB]".
The cdesc is "'Could you remind me what the Phantom was doing to ruin your show?'" It is for Lawn_hub. It flips to Lawn_hub. It is PreBeast.

Section - Lawn_blindfold - why can't he take off the blindfold

Lawn_blindfold is a page.
"'Don't you think I've tried?' snaps Lawn.[first time] (You [i]do[/i] think he's tried, which is why you asked 'why can't you' and not 'why didn't you'. But he's stressed. You'll let it slide.)[only] 'But that awful Phantom ties it so tight! I can't unpick the knot. I have to cut the Goose free after each show.'

Lawn glares at you like you just threatened his family. 'Don't you even [i]think[/i] about cutting the Goose free yourself! I'm the only person I trust with a knife anywhere near the Goose. And we're locked in a cage together each show, so you won't be able to touch the Goose anyway.'"
The cdesc is "'Why can't you take the goose's blindfold off during the show?'" It is for Lawn_hub and Lawn_goose_hub. It flips to Lawn_hub. It is PreBeast.

Section - Lawn_sound - can goose respond to sound

Lawn_sound is a page.
"'It's not how I work, Lola. I've been doing this for years. I know what works for me.' Lawn rubs his chin. 'Funny you should suggest it. Some of the youngbloods in the Goose-taming community have been propounding the phenomenological approach to the profession.' He catches your eye. 'That is, they use noises instead of gestures. Sounds, not words. They claim it's instinctive to Geese to respond in certain ways. But... no, it's not me. It might take me an age to find the right sounds, and this Phantom business will be over by the time we relearn the tricks.' He sighs. 'One way or another.'"
The cdesc is "'If the problem is that the goose can't see your gestures, can you train it to respond to words instead?'" It is for Lawn_hub and Lawn_goose_hub. It flips to Lawn_hub. It is PreBeast.

Section - Lawn_gesture - what are the tricks

Lawn_gesture is a page.
"'Well, okay, if you think it will help.'

Lawn heads to the caravan door and leans out. He brings both his hands to his chest. Seconds later, the goose appears, flapping in Lawn's face and beating him with powerful wings about the head. Lawn says a few unrepeatable words, but the goose soon settles. You're a little nervous being in such a confined space with the horrible bird, but it's Lawn who'll be doing the gestures, not you.

'Don't bother trying to copy any of these gestures, by the way. I have a sacred bond with the Goose. The Goose responds to my gestures and only my gestures,' cautions Lawn. [one of]He reads your mind, and snaps 'Don't even think of trying to wear my clothes or any kind of identity theft like that. It does not work that way. So... w[or]'W[stopping]hat did you want to see?'"
The cdesc is "'Show me the gestures you're using to get the goose to do tricks! Please.'" It is for Lawn_hub and Lawn_goose_hub. It flips to Lawn_gesture_hub. It is PreBeast.

Lawn_gesture_hub is a page.

Lawn_gesture_flyforward is a page.
"'That means [']come here['] - I'm asking the Goose to fly along the ground.' Lawn absent-mindedly repeats the gesture, and gets another face full of wings. 'I'm still working on keeping the Goose calm afterwards,' he says, spitting out a feather. 'Geese are tempestuous beings. Easily provoked by chest thumping, and noises. Eye contact. Strange faces,' he adds, tapping you on the red nose pointedly."
The cdesc is "'What was that you just did, putting your hands to your chest?'" It is for Lawn_gesture_hub. It is a dead-end.

Lawn_gesture_flyup is a page.
"'That is a request for the Goose to fly upwards, much like the gesture for flying towards me. I shan't demonstrate it in here, though. The Goose might hit the ceiling and get hurt.' Lawn allows himself a little smile. 'I'm rather proud of this one, in fact. It's incredibly hard to teach to a Goose. Easy enough to make a Goose fly parallel to the ground, but it takes a little more thought to go perpendicular!'"
The cdesc is "'I've seen you lift your hands up before. What does that mean again?'" It is for Lawn_gesture_hub. It is a dead-end.

Lawn_gesture_wings is a page.
"'Observe!' Lawn stretches his arms out and maintains eye contact with the goose. It mirrors him, stretching its own wings out. Lawn nods happily, and rewards the goose with a little tuft of grass he was keeping in his pocket. 'This little trick was inspired by watching the Goose stand proudly, wings spread proudly, honking back at a traffic jam on the motorway. I think it looks rather regal.'"
The cdesc is "'What does it mean when you spread your arms out?'" It is for Lawn_gesture_hub. It is a dead-end.

Lawn_gesture_playdead is a page.
"In response, Lawn points down and watches the goose. The goose spins and collapses backwards like it's been shot, with a death-rattle 'honk'. Lawn coos happily and digs around in his pocket for some treats to reward it. 'Our version of the [']play dead['] trick,' he explains to you while the actually-very-much-alive goose eats. 'I got the idea when the Goose kept fainting while we were featuring that brass band.' He scratches his head. 'I never solved that little mystery. Well, the Goose seems healthy enough now.'"
The cdesc is "'What does it mean when you point at the floor?'" It is for Lawn_gesture_hub. It is a dead-end.

Lawn_gesture_back is a page.
"'Alright, if you're sure.' The two of you watch the bored goose make its own way out of the caravan. 'Anything else?'"
The cdesc is "'Cheers, Ken, I've seen enough. Please dismiss the goose before it beats me up.'" It is for Lawn_gesture_hub. It flips to Lawn_hub.


Section - Lawn_show - trigger for Beast Show

Lawn_show is a page.
"'Well, I suppose you may, if you think you can make a difference,' muses Lawn. 'If the show goes poorly again, perhaps you can keep the audience entertained with your antics and capers.'"
The cdesc is "'Can I tag along and see you perform your show? Maybe I can help.'" It is for Lawn_hub. It flips to BeastShowStart. It is PreBeast.

Section - Lawn_solved_x - conversation options after Beast Show solved

Lawn_solved_congrats is a page.
"'Yes, well,' sniffs Lawn. 'I suppose it wasn't all me. You did good, clown. [if Unmasking is happening]And you helped the others. Not bad at all. Now go unmask that Phantom. They wouldn't let me do it before you got here, and I'm fed up of waiting[otherwise]Now go bother Adagio and your girlfriend. They're having their own Phantom problems, last I heard[end if].'"
The cdesc is "'Glad you got your show up and running again, Ken!'". It is for Lawn_hub. It flips to Lawn_hub. It is PostBeast.

Lawn_solved_future is a page.
"Lawn waves you away. 'No, no. I doubt the Phantom will be plaguing my show again.' He rubs his chin. 'I'm still surprised that using sound works. Maybe those young hotshot Goose-tamers with the audiovisual experiences have a point... No, this old dog can't learn any new tricks. I'll stick to what I'm best at: waving my arms around.'"
The cdesc is "'Do you want me to keep doing the honking for your show?'". It is for Lawn_hub. It flips to Lawn_hub. It is PostBeast.


Section - Lawn_callout - punchline to something set up in Freda's conversation

[this branch is activated from Freda's conversation tree by the page Freda_problem_dense]

Lawn_callout is a page.
"Ken looks hunted, which is funny to you, because you said that last thing [i]very[/i] conversationally. 'I never said that! When did I say that? It's been taken out of context! All I said was that... perhaps... Freda, [i]who I'll never hear a bad word against[/i]... maybe... understands things... a little later than other people?' He seems to have shrunk two feet under your gaze. 'Sorry.'

You do like Ken Lawn, really. He's good company when he's in a good mood. Tons of stories from his career, and he really won't hear a bad word about his colleagues. It's just that sometimes he says bad words and doesn't listen to himself. Well, you can deal with him some other time, after this Phantom bit is resolved."
The cdesc is "'So! Freda says you've been calling her [']dense['].'" It is for Lawn_hub. It flips to Lawn_hub. It is a one-off.

LawnCalloutSeen is a truth state that varies.
LawnCalloutSeen is false.

A page-toggle rule for Lawn_callout:
	now LawnCalloutSeen is true.

Choice-priority for Lawn_callout:
	rule succeeds with result 99.

Section - Lawn_bye

Lawn_bye is a page.
"'Farewell.'"
The cdesc is "'See you around, Ken!'" It is for Lawn_hub. It is an end-page.

Choice-priority for Lawn_bye:
	rule succeeds with result 100.

Chapter - Item-asking Lawn

The item unknown response of the Lawn is "'What am I, the [second noun] tamer? Don't ask me about that,' huffs Lawn."

The item-table of Lawn is the Table of Lawn Items.

Table of Lawn Items
item	reply
Adagio	"'She keeps telling me to [']calm down['] and [']look after my blood pressure.['] Look after your own blood, Adagio! That's what I keep telling her. She must [if MagicShowSolved is false]be[otherwise]have been[end if] upset about nearly drowning, and she's probably just taking it out on someone else,' adds Lawn with what may or may not be a note of concern in his voice.[p]"
cage	"'Do you like the cage? I got it for cheap from a professional wrestling company which went bust. The wrestlers were climbing up and all over it and doing all sorts of things to it, but a quick powerwash and it looks good as new. Ridiculous sport.'[p]"
clown car	"[lawn car horn response]"
car horn	"[lawn car horn response]"
goose	"[lawn goose response]"
Freda	"'Tell your girlfriend[if LawnCalloutSeen is true] - who I'd [i]never hear a word against[/i], by the way - tell your girlfriend[end if] to stop trying to arm-wrestle me. I'm old and my elbows creak. [if Unmasking is happening]I thought she was just upset about the Phantom, but she's still asking. Is she trying to make friends with me?? I don't get it[otherwise]I don't care if she's upset about the Phantom, she'll have to deal with it in some other way[end if].'[p]"
french horn	"'I hate brass instruments. They make the Goose faint, and they make my ears hurt.'[p]"
helium canister	"'My voice is [i]not[/i] to be laughed at.'[p]"
hired help	"'She seems fine. Too busy with the balloons to talk to me. I like that.'[p]"
Lawn	"'I've been better,' he mutters. 'My knees hurt. My jaw clicks when I eat. [if BeastShowSolved is false]I'm being sabotaged by someone in Phantom-of-the-Opera fancy dress. Things like this are always happening to me[otherwise]I have to buy a new car horn and a French horn and a clown nose now in case somebody ever blindfolds the Goose again. Everything is too expensive[end if].'[p]"
Lola	"'I know who you are,' he says irritably.[p]"
operator	"'I don't know him. I like his [']NO SCREAMING['] rule but I don't agree with his [']NO WATERFOWL['] rule.[p]"
Phantom	"'I don't want to talk about the Phantom,' says Lawn, who then says quite a lot about the Phantom, at length, using all the naughty words you know[first time] and a few that are new to you[only].[p]"
paddling pool	"'Yes, that's a pool. Notice there's no clowns in it. Please keep it that way.'[p]"
rabbit	"'Lagomorphs are not in my wheelhouse,' sniffs Lawn. 'Go ask Adagio about it.'[p]"
red nose	"'When my nose is red it's because I've got rosacea again. And it doesn't honk,' says Lawn, despite you not asking about that.[p]"
Ringmaster	"'I've known Henry for a long time. Trained him in animal handling when he was a lad. He couldn't hack it, but not many can. He was a good lad, though. Nervy, even then. [if Successful Performances is less than 3]He doesn't need any Phantoms running around. He's jumpy enough already[otherwise]Thank goodness we've nearly finished with the Phantom. Henry's going to need a month to calm down from all this[end if].'[p]"

To say lawn car horn response:
	if BeastShowSolved is false:
		say "'Did I tell you that car horn of yours makes the Goose go weird? I don't like that. Don't honk it any more.'";
	otherwise:
		say "'I suppose I could do with one of those car horns for the Goose. Do they come without the ridiculous car?'".




Section - Lawn_goose tree

To say lawn goose response:
	say "'Beautiful, beautiful creature,' sighs Lawn. 'What do you want to know?'";
	switch to cyoa at Lawn_goose_hub.
	
Lawn_goose_hub is a page.

Lawn_goose_name is a page.
"'You can't put human values like names on the Animal Kingdom, Lola,' he sniffs. 'Would you have animals pay taxes and remember their National Insurance numbers next? Let animals be wild and free.'"
The cdesc is "'Does it have a name?'" It is for Lawn_goose_hub. It is a one-off. It is needed by Lawn_goose_freedom. It flips to Lawn_goose_hub.

Lawn_goose_freedom is a page.
"'The Goose is free to leave any time the Goose wishes. But for all the grass you can eat from across the country and the chance to meet new people? You'd be a fool to leave.'"
The cdesc is "'If animals are supposed to be free, how come we make the goose do shows with us?'" It is for Lawn_goose_hub. It is a one-off. It flips to Lawn_goose_hub.

Lawn_goose_history is a page.
"'I've been working with Geese for forty years. I trained in animal handling under the lion-tamer [']Ironskin['] Hobbins. This would have been a couple of years before his fourth mauling. Even then, I wasn't happy with how the lions were being treated. You just can't give them the life they need in a circus. I wanted to work with an animal that's migratory, small, easy to feed, knows its own mind and can stand up to injustice. And so the humble Canada Goose chose me.' Lawn nods to the door leading outside. 'The Goose I work with these days is my third companion.'" 
The cdesc is "'How'd you start working with geese, anyway?'" It is for Lawn_goose_hub. It is a one-off. It is needed by Lawn_goose_hist_chose, Lawn_goose_hist_met and Lawn_goose_hist_ironskin. It flips to Lawn_goose_hub.

Lawn_goose_hist_chose is a page.
"'Oh well,' says Lawn, looking a little bashful, 'I fell into a lake and got chased out by a flock. Now, to be fair, I shouldn't have been in there. But even then, I couldn't help but admire those sleek and miraculous beasts, as they soared around me and broke my ribs. I knew I needed them to light my path.'"
The cdesc is "'What do you mean, the geese [']chose['] you?'" It is for Lawn_goose_hub. It is a one-off. It flips to Lawn_goose_hub.

Lawn_goose_hist_met is a page.
"'I hand-reared that poor orphaned Goose,' says Lawn proudly. 'And now that Goose never leaves my side, apart from frequently.'"
The cdesc is "'So how did you meet the current goose?'" It is for Lawn_goose_hub. It is a one-off. It flips to Lawn_goose_hub.

Lawn_goose_hist_ironskin is a page.
"'I believe he retired from the business a few years ago,' says Lawn, stroking his chin. 'I am not in touch with the man anymore, but I believe he runs a motorway café now[IronskinCafeActivate].'"
The cdesc is "'What happened to your lion-taming mentor Ironskin in the end?'" It is for Lawn_goose_hub. It is a one-off. It flips to Lawn_goose_hub.

IronskinCafeHeardOf is a truth state that varies.
IronskinCafeHeardOf is false.
To say IronskinCafeActivate:
	now IronskinCafeHeardOf is true.


Section - redirects and goodbyes

Lawn_redirect is a page.
The cdesc is "'I wanna ask about something else...'" It is for Lawn_goose_hub. It flips to Lawn_hub.

Lawn_item_bye is a page.
The cdesc is "'That's all for now. Bye, Ken!'" It is for Lawn_goose_hub. It is an end-page.


Part - other Lawn behaviours

Chapter - idle behaviours

Every turn when the location of the player is the location of Lawn (this is the Lawn idle daemon rule):
	unless Beast Show is happening or a climactic scene is happening:
		if a random chance of 1 in 7 succeeds:
			say "Lawn [one of]watches you, as if daring you to try any funny business[or]preens[or]harrumphs[or]tries to straighten a crease out of his clothing[or]makes a show of looking at his watch[or]thinks of a newspaper article he read earlier that day and scoffs[or]scrapes the floor with his foot[as decreasingly likely outcomes].".
			
The wristwatch is worn by Lawn. The wristwatch is known. Understand "watch" and "timepiece" and "face" as the wristwatch.

Description of the wristwatch is "You're sure Ken Lawn has a silly streak deep down inside him, and here's one way it surfaces. His watch has a cartoon of a goose on its face. Its head and neck is the second hand, one wing is the minute hand, and one leg shows the hour. The goose looks like it's had a horrible accident most of the day, but it looks good at about 5:45:00pm."

Instead of doing something other than examining with the wristwatch:
	say "[don't touch wristwatch]."
Instead of throwing something at the wristwatch:
	say "[don't touch wristwatch]."
Before doing something when the second noun is the wristwatch:
	unless the current action is item-asking something about something:
		say "[don't touch wristwatch]." instead.
To say don't touch wristwatch:
	say "You needn't do anything to Lawn's watch other than looking at it. It's precious to him, and he's very protective of it".

Chapter - pie reaction

The pie reaction of Lawn is "'[one of]Lola. We've talked about this[or]This is [i]not[/i] funny[or]Go on, then, keep throwing pies at me. For your information, I'm actually not mad about it[or]...Actually, no, stop doing it[or][i]Stop it[/i][stopping].'"

Chapter - persuasion refusal

The persuasion refusal of Lawn is "[if Beast Show is happening]'I don't have time, clown, I'm running a show here!' hisses Lawn. Anything that needs doing, you'll have to do yourself[otherwise if a climactic scene is happening][Lola wants to go it alone][otherwise]'Nope,' says Lawn. 'It'll just be another of your japes. Can't fool me a seventh time.' He folds his arms proudly".

Chapter - gesture reaction

The gesture reaction of Lawn is "'Is that supposed to be one of my famous Goose tricks?' frowns Lawn. 'I thought I told you, it's I who has the bond with the Goose! Those gestures will only work for me.'".



BOOK - The Goose

The goose is an animal.

Initial appearance of the goose is "[if the location of the goose is RmRing]The goose is in the cage with Lawn, blindfolded and unable to see Lawn's cues[otherwise][one of]Agh. Lawn's semi-trained goose is here[or]The goose. It's still here[stopping][end if]."

Description of the goose is "The Beastly Bird; the Terror of the Big Top. You don't think the goose has an actual name, unless it's called 'stay away from me' or 'aaaah nononono'[if the goose is wearing the blindfold]. The poor thing has been tightly blindfolded, though it doesn't seem too bothered[end if]." [one year after writing this, I'm realising I stole this joke from Terry Pratchett, just like most of my other jokes]

Understand "stay away from me" or "aaaah nononono" as the goose.

The goose is known.

The goose is in RmStaffE.

Part - Talking to the goose

Check talking to the goose (this is the goose talk response rule):
	say "[goose fails to respond]." instead.
Instead of item-asking the goose about (this is the goose item-asking response rule):
	say "[goose fails to respond].".
Instead of asking the goose about (this is the goose topic-asking response rule):
	say "[goose fails to respond].".
[using instead rules here to guarantee that we don't reach the check conversation rules]
[*IDEA: once the coding is done, maybe this can be cleaned up to be all check rules]

To say goose fails to respond:
	say "The goose [one of]does nothing[or]is unresponsive[or]doesn't seem to hear you[or]fails to play along[purely at random]".

Part - Attempting to instruct the goose

Persuasion rule for asking the goose to try doing something (this is the can't persuade goose rule):
	say "The goose does nothing[if the location of Lawn is the location of the player].[paragraph break]'Asking won't work, clown. The Goose doesn't listen to words,' chides Lawn[end if].";
	persuasion fails.
	
Before answering the goose that (this is the funnel goose instructions to persuasion rule):
	try asking the goose to try jumping instead.
	
Part - Goose behaviour

Chapter - Idle goosing

Every turn when the location of the player is the location of the goose (this is the idle goosing rule):
	if Beast Show is happening:
		if a random chance of 1 in 5 succeeds:
			say "The goose [one of]waddles around and bonks its head softly on the cage bars[or]tries to peck at the floor, but there's no grass to be found[or]cocks its head[or]shakes its head, but doesn't manage to dislodge the little blindfold[purely at random].";
	otherwise:
		if a random chance of 1 in 4 succeeds:
			say "The goose [one of]waddles around a little[or]stares at the sky wistfully[or]pecks at a likely-looking bit of grass[or]nudges a little bit of dirt around with its beak[purely at random].".

The idle goosing rule is listed after the Beast Show Operation rule in the every turn rulebook.

Chapter - Goose doesn't react to gestures

[This is handled in the report rule for gesturing. I'm sure I had my reasons when I decided to do it that way.]

Chapter - Goose reacts to honks

Section - Red nose honk

[when the red nose is honked in the presence of the goose, it chases the player to the last room]
After squeezing the red nose in the location of the goose (this is the goose reacts to red nose honk rule):
	say "'HOOONK!' The aggrieved goose flies at [run paragraph on]";
	if the player is in the clown car:
		say "the windshield, and ricochets off.";
	otherwise:
		say "your face! It beats its wings around your head and pecks at your nose, eliciting more honks which just make it angrier. You eventually fend off the goose and flee to...";
		send player to last location.
	
[*TODO: if we let the rabbit break the windows, this eventually should let the goose fly through the windshield]
	
Section - Car horn honk

After squeezing the car horn in the location of the goose (this is the goose reacts to car horn honk rule):
	say "[goose car horn response].".
	
To say goose car horn response:
	say "'Honk,' the goose responds pleasantly. It stretches its wings out for a second".
[separated out to use in Beast Show rules]

Section - French horn honk

After playing the French horn in the location of the goose (this is the goose reacts to French horn honk rule):
	say "[goose French horn response].".
	
To say goose French horn response:
	say "The goose spins around and collapses on its back with a sad trailing 'hoooonk'. A second later, it gets up again".
[separated out to use in Beast Show rules]

Chapter - Putting things on the goose

Check putting something on the goose:
	say "Better not. It'd be like playing Buckaroo if the mule could bite you." instead.
	
Chapter - Getting goose

Instead of rearrangement when the noun is the goose:
	say "Laying a finger on the goose is a very good way to get a broken finger. Better leave it alone." instead.
	
Chapter - Petting goose

Before touching the goose (this is the goose doesn't like being petted rule):
	if Beast Show is happening:
		say "[one of]You reach through the bars, give the goose a quick scratch behind where you imagine the ears are, and withdraw before it can try to bite you. Lawn is yelling at you to focus on the situation at hand, but you just had to do that once in your life[or]You said [i]once[/i] in your life. Twice would be pushing your luck[stopping]." instead;
	otherwise:
		say "You tentatively reach for the goose, but jerk back when it [one of]makes a sudden movement[or]mean-mugs you[or]snaps at your fingers[then at random]." instead.
		


BOOK - The Rabbit

The rabbit is an animal.
The rabbit is inside the black top hat.
The rabbit is known.
The rabbit is female.

Does the player mean item-asking about the rabbit: it is likely.

Understand "bunny rabbit" or "bunny" or "bnuuy" or "hare" as the rabbit.
[I know hares aren't rabbits, but if it's good enough for Bugs Bunny episode titles...]

Description of the rabbit is "A white rabbit with cute black markings around the eyes. She's curled up inside the hat. [if the player encloses the lettuce leaf]She seems to be eyeing up that bit of lettuce you're carrying, just waiting for you to leave it unattended[otherwise]Her nose is twitching but she doesn't seem to be stressed[end if]."

Check examining the rabbit when the black top hat is worn by Adagio (this is the make Adagio lift hat to see rabbit rule):
	say "[bracket]first getting Adagio to lift her hat so you can check [the rabbit] out[close bracket]".

Instead of taking the rabbit (this is the can't directly handle rabbit rule):
	if the black top hat is worn by Adagio:
		say "'Would you mind leaving her be, Lola? She doesn't like being handled much,' says Adagio.";
	otherwise:
		say "[The rabbit] rolls over and kicks your hand away as you reach for her. Perhaps she's happy enough where she is."
		

	
Part - Rabbit behaviour
	
Chapter - Rabbit seeks and destroys lettuce leaf

The rabbit can be rope-aware. The rabbit is not rope-aware.

Every turn when the location of the rabbit is the location of the player (this is the rabbit seeks and destroys lettuce rule):
	if the black top hat has not been carried by the player:
		make no decision;
	if the location of the rabbit is the location of the food stand:
		if Adagio is wearing the black top hat:
			say "[one of]Adagio's hat starts thudding around, and she instinctively holds it down to keep [the rabbit] from the lettuce in the burgers[or]Adagio keeps her hat held down[stopping].";
			make no decision;
		otherwise:
			say "[one of]You've made a mistake. All the lettuce in all those burgers is too much to resist, and [the rabbit] launches herself at them in a frenzy. Burger buns and patties fly everywhere. Wood splinters. The ropes supporting the entrance tent almost get chewed through in the devastation. After a lengthy scuffle and a lot of biting and scratching, you manage to drag the rabbit out and get her back in her hat[or]You've done it again. [The rabbit] races out to finish what she started. You drag her back into her hat and out of the area after another protracted struggle[stopping].";
			now the food stand is demolished;
			send player to last location;
	if the location of the rabbit is the location of the rope and the rope is lettuced:
		if the rabbit is not rope-aware:
			say "[one of]A little nose peeks out of the black top hat, pointed straight at the lettuce-wrapped rope. [The rabbit] launches herself out of the hat and tries to scramble up the side of the Diabolical Contraption. But the sides of the water tank are too slick and too tall; her little claws can't find any purchase. Dejected, she hops back into the hat, but keeps an eye on the rope[or][The rabbit] spies the lettuce-covered rope from her hat and launches herself again, making another attempt to scale the water tank. It's too slick and slippery, though, and soon enough the disappointed rabbit returns to her hat[stopping][if Adagio wears the black top hat]. 'Don't torment the poor thing, please. I don't want to do the escape trick again,' says Adagio[end if].";
			now the rabbit is rope-aware;
		otherwise:
			if a random chance of 1 in 2 succeeds:
				say "[The rabbit] [one of]pokes her head out of the hat briefly, just to check that the lettuced rope is still there[or]gazes wistfully at the lettuced rope[or]cranes her head to get a better look at the lettuced rope over the tall water tank[purely at random].";
	otherwise:
		now the rabbit is not rope-aware;
	if the location of the lettuce leaf is the location of the rabbit:
		if the player does not enclose the lettuce leaf:
			if the rabbit is rope-aware:
				say "[The rabbit] consoles herself by devouring the lettuce leaf left out in the vicinity[if the burger bun encloses the lettuce leaf] (and the bun it was in)[end if].";
			otherwise:
				say "A little nose peeks out of the black hat. [The rabbit] hops out and homes in on the lettuce leaf, eating it quickly[if the burger bun encloses the lettuce leaf] (and the rest of the burger, for that matter)[end if]. Sated for now, she bounces back into the hat[if Adagio wears the black top hat]. 'Please don't keep feeding her, Lola. It's my scalp she keeps jumping off, not yours,' sighs Adagio[end if].";
			if the burger bun encloses the lettuce leaf:
				let L be the list of things enclosed by the burger bun;
				repeat with item running through L:
					if item is not burgpart:
						move item to the location of the burger bun;
				move the burger bun to Burger Limbo;
			otherwise:
				move the lettuce leaf to Burger Limbo;
		

[DEBUG version of rule:]

[
Every turn when the location of the rabbit is the location of the player (this is the rabbit seeks and destroys lettuce rule):
	say "DEBUGDEBUGDEBUG because the rabbit and the player are in the same room, the rabbit lettuce-destroying behaviour is active.";
	if the black top hat has not been carried by the player:
		say "DEBUGDEBUGDEBUG the black hat has not been obtained by the player, meaning that Adagio cannot possibly have the black hat and that Lola hasn't met the rabbit yet. So the rule ends here so that the rabbit's existence is not spoiled by the rule (i.e. so that the rabbit doesn't appear while it's still hidden on the Ringmaster's head).";
		make no decision;
	say "DEBUGDEBUGDEBUG first, we look for the rope (which is part of the Diabolical Contraption), and we check that it has been wrapped in lettuce (which is part of the solution to the Magic Show puzzle).";
	if the location of the rabbit is the location of the rope and the rope is lettuced:
		if the rabbit is not rope-aware:
			say "DEBUGDEBUGDEBUG the rabbit can see the lettuced rope, but cannot reach it. This toggles a state of being rope-aware, a variable which influences the subsequent messages and which is checked when the player solves the puzzle.";
			say "[one of]A little nose peeks out of the black top hat, pointed straight at the lettuce-wrapped rope. The rabbit launches itself out of the hat and tries to scramble up the side of the Diabolical Contraption. But the sides of the water tank are too slick and too tall; its little claws can't find any purchase. Dejected, it hops back into the hat, but keeps an eye on the rope[or]The rabbit spies the lettuce-covered rope from its hat and launches itself again, making another attempt to scale the water tank. It's too slick and slippery, though, and soon enough the disappointed rabbit returns to its hat[stopping].";
			now the rabbit is rope-aware;
		otherwise:
			say "DEBUGDEBUGDEBUG because the rabbit is already rope-aware, the rabbit-lettuce rule now activates an environmental message with a random chance, to emphasise to the player that the rabbit want to chew the rope.";
			if a random chance of 1 in 2 succeeds:
				say "The rabbit [one of]pokes its head out of the hat briefly, just to check that the lettuced rope is still there[or]gazes wistfully at the lettuced rope[or]cranes its head to get a better look at the lettuced rope over the tall water tank[purely at random].";
	otherwise:
		say "DEBUGDEBUGDEBUG the rabbit cannot see the lettuced rope, so it is set to be not rope-aware. (Because this condition is checked every turn, it should be resilient to breaking, i.e. it should switch off automatically when the rabbit chews and therefore unlettuces the rope.)";
		now the rabbit is not rope-aware;
	say "DEBUGDEBUGDEBUG now we'll look for any instances of the lettuce leaf in the vicinity. This could (and probably should) be a separate rule to the rope-detection behaviour, but I want to piggy-back on the rope-aware toggle to change the eating message as appropriate.";
	if the location of the lettuce leaf is the location of the rabbit:
		say "DEBUGDEBUGDEBUG lettuce leaf noticed. Where is it?";
		if the player does not enclose the lettuce leaf:
			say "DEBUGDEBUGDEBUG it is out in the room. So the rabbit should eat it. The following message should change if the rabbit is rope-aware (i.e. it should acknowledge that the rabbit has already unsuccessfully tried to eat the rope).";
			if the rabbit is rope-aware:
				say "The rabbit consoles itself by devouring the lettuce leaf left out in the vicinity[if the burger bun encloses the lettuce leaf] (and the bun it was in)[end if].";
			otherwise:
				say "A little nose peeks out of the black hat. The rabbit hops out and homes in on the lettuce leaf, eating it quickly[if the burger bun encloses the lettuce leaf] (and the rest of the burger, for that matter)[end if]. Sated for now, it bounces back into the hat.";
			say "DEBUGDEBUGDEBUG having reported that  the rabbit eats the lettuce/burger, we now need to move the lettuce leaf out of play to Burger Limbo, along with any other burger parts if the lettuce was in the burger. I will do this using code that I know works rather than rewriting it, because doing it once was bad enough.";
			if the burger bun encloses the lettuce leaf:
				let L be the list of things enclosed by the burger bun;
				say "DEBUGDEBUGDEBUG The following things are in the burger bun: [L].";
				repeat with item running through L:
					if item is not burgpart:
						say "DEBUGDEBUGDEBUG: It looks like [item] shouldn't be edible, so we need to move this to wherever the burger bun is.";
						move item to the location of the burger bun;
				say "DEBUGDEBUGDEBUG It looks like all non-burger things are out of the burger now, so let's move it to Burger Limbo (which will also catch the burger patty if that's in, and the lettuce leaf which must be in the burger bun, otherwise we wouldn't be here).";
				move the burger bun to Burger Limbo;
			otherwise:
				say "DEBUGDEBUGDEBUG It looks like the lettuce is out by itself, so we'll just move that to Burger Limbo.";
				move the lettuce leaf to Burger Limbo;
		otherwise:
			say "DEBUGDEBUGDEBUG the lettuce is held by the player somehow. We'll take no further action here, but the rabbit's description should acknowledge that the rabbit is watching what you do with the lettuce.";
	otherwise:
		say "DEBUGDEBUGDEBUG there is no detectable lettuce in the vicinity. No action is taken.".
]



[*TODO: What happens if the player and rabbit are in the car?]

Chapter - Can give/show lettuce to rabbit

Instead of showing the lettuce leaf to the rabbit:
	try giving the lettuce leaf to the rabbit.
	
Check giving the lettuce leaf to the rabbit:
	move the lettuce leaf to Burger Limbo;
	say "As soon as the lettuce nears [the rabbit]'s mouth, it vanishes like it's been sucked up by a vacuum cleaner." instead.


Chapter - Rabbit first enters RmAdagio

[this is a one-shot event so we're just going to use a scene. This makes my Scenes Index more confusing but this works fine and I'm tired of writing rules for this dang rabbit]

RabbitEatsSalad is a scene.
RabbitEatsSalad begins when the location of the rabbit is RmAdagio.

When RabbitEatsSalad begins:
	say "A little nose peeks out of the black hat, swivelling like a periscope until it detects the little wicker bowl of salad. [The rabbit] launches herself out, and what happens next is a bit like those old cartoons, you know? Where two characters get in a fight and it's just a big spinning dust cloud with arms and legs popping out? Well, when the dust settles, even the wicker bowl has been devoured. The sated rabbit hops out of the hutch and into the hat again[if the player carries the black top hat].[paragraph break]Adagio smiles. 'Ah! There's my hat. Thank you, Lola.' You pass her the top hat and she puts it on, rabbit and all[end if].";
	now Adagio wears the black top hat;
	now the wicker bowl of salad is nowhere.
	
[*TODO: possible minor problem: rabbiteatssalad starts before magic show ends when both happen on the same turn - if magic show end has text, the text might look odd]

Chapter - Petting rabbit
		
Instead of touching the rabbit:
	if the black top hat is worn by Adagio:
		say "[bracket]first getting Adagio to lift her hat[close bracket][line break]";
	say "You give [the rabbit] a good scratch behind the ears."

BOOK - The Ringmaster

A man called the Ringmaster is in RmRingmaster.
Description of the Ringmaster is "The Ringmaster began his career as a tightrope walker, and to this day he's still high-strung. His nervous nature gets in his way sometimes, but he's the most senior troupe member, he has all sorts of contacts in the circus business, and he's the only one of you guys that can do maths, so he gets to be the boss."
The Ringmaster is known.

Understand "master" or "boss" or "Henry" as the Ringmaster.

Initial appearance of the Ringmaster is "Your boss the Ringmaster is pacing around nervously."

Part - Black top hat

[Item which starts worn by the Ringmaster. It contains the rabbit, whose code I have separated into a new NPC section]

The black top hat is a hat.
The black top hat is worn by the Ringmaster.
The black top hat is known.

The black top hat is closed. [becomes open after obtaining the black hat. This prevents the player interacting with the rabbit early]

Before taking the black top hat while the black top hat is closed:
	try searching the black top hat instead.
Before searching the black top hat when the black top hat is closed:
	say "You're getting curious what's under there, but the boss shies away as you approach, instinctively defensive after a lifetime of having his hat slapped off by rowdy teenagers. You'll find out soon enough, maybe." instead.

Description of the black top hat is "A smooth black hat[if the black top hat is worn by the Ringmaster]. It looks very sombre atop the rest of the Ringmaster's outfit[otherwise if the black top hat is worn by Adagio]. It suits Adagio[end if]. Occasionally, it twitches."

Chapter - Black top hat rules

Section - Every turn, the hat may twitch when the Ringmaster is wearing it

Every turn when the black top hat is worn by the Ringmaster (this is the rabbit kicks the crap out of the Ringmaster's scalp rule):
	if the player is in the location of the Ringmaster:
		if a random chance of 1 in 3 succeeds:
			say "The Ringmaster's hat seems to [one of]twitch[or]turn[or]jump[purely at random] a little[if a random chance of 1 in 2 succeeds]. He winces[end if].".

Section - Every turn, your head hurts when you're wearing the hat

Every turn when the black top hat is worn by the player (this is the rabbit kicks the crap out of your scalp rule):
	if a random chance of 1 in 2 succeeds:
		say "Feels like something is [one of]pulling on[or]chewing on[or]tugging at[or]digging in[or]nesting in[as decreasingly likely outcomes] your hair.";
	otherwise:
		say "Feels like something is [one of]kicking[or]punching[or]biting[or]gnawing[or]destroying[or]burrowing into[or]ground-pounding[as decreasingly likely outcomes] your scalp.".
			
Section - Don't put things in the black top hat

Check inserting into the black top hat (this is the don't put things into the black top hat rule):
	if the black top hat is worn by the Ringmaster:
		say "'What are you- don't do that, please, thanks,' says the Ringmaster, moving away as you reach for the hat." instead;
	otherwise:
		unless the noun is the lettuce leaf:
			if the black top hat is worn by Adagio:
				say "'Sorry, the hat's full,' says Adagio, gently pushing away [the noun]." instead;
			otherwise:
				say "[The rabbit] rolls over and kicks [the noun] out of the hat again." instead;
		otherwise:
			move the lettuce leaf to Burger Limbo;
			say "The lettuce disappears into the hat, with crunching sounds." instead.
	

Section - Don't throw the black top hat at anything

Check throwing the black top hat at something (this is the can't frisbee the black top hat rule):
	say "Although the hat and rabbit are pretty light, you don't trust yourself to frisbee the hat that far and you don't want to risk hurting the rabbit trying." instead.

Section - Report dropping the hat

Report dropping the black top hat:
	say "You gently set the hat and rabbit down." instead.

Part - Giving to the Ringmaster

Chapter - Giving the purple top hat to the Ringmaster

Instead of giving the purple top hat to the Ringmaster:
	say "The boss looks surprised as you hand him the purple hat. 'Oh! Th-that's my hat! Then...' He takes off the black hat and hands it to you, a little sheepishly. 'I was sure this was... Well, perhaps you could give this back? To... um, wh-whoever else wears hats? Does, um, does Freda like hats?'

As he [if the purple top hat encloses anything]empties the hat of all the junk that somebody put in it and puts it[otherwise]puts his rightful hat[end if] back on, you peek into the black hat. A little rabbit stares back at you!";
	now the black top hat is open;
	now the player carries the black top hat;
	let L be the list of things enclosed by the purple top hat;
	repeat with item running through L:
		move item to RmRingmaster;
	now the purple top hat is worn by the Ringmaster.

Part - Talking to the Ringmaster

Chapter - Ringmaster main conversation

The greeting of the Ringmaster is Mast_hello1.

Section - greetings

Mast_hello1 is a page.
"'Please help us, Lola,' the boss babbles. 'The Phantom, the ghost.' He's more beside himself than usual."
It flips to Mast_hub.

Mast_hello2 is a page.
"'Hello. Is the, uh, uh, how's the ghost problem going?' the Ringmaster asks hopefully."
It flips to Mast_hub.

Mast_hello_unmask is a page.
"'[if the player is in RmRing]Could you t-take their mask off for us, Lola? I don't want to get any closer than this,[otherwise]Um, Lola? The Phantom, in the Ring? Would you l-like to see who they are?[end if]' quavers your boss."
It flips to Mast_hub.

Mast_hub is a page.

Section - Mast_phantom - the Ringmaster explains it all

Intro_convo_had is a truth state that varies. Intro_convo_had is false.
[controls the end of the introduction scene - see that scene's comment for more]

Mast_phantom is a page.
"'It was your day off, you got back late, maybe you didn't hear from anyone yet,' says the Ringmaster. 'The circus is haunted now. A dreadful Phantom with a skull face appeared during yesterday's performances. Then Adagio complains that her magic act is being sabotaged in front of the whole circus! S-Siegfrieda gets challenged to a test of strength during her strongwoman show - and loses! And someone blindfolds the goose, so now Lawn's goose-taming act is ruined!' The Ringmaster wipes his brow. 'The whole show is ruined! And if it keeps happening, WE'RE ruined! We're out of business!'"
The cdesc is "'A [']phantom['] in the circus? What do you mean?'" It is for Mast_hub. It is a one-off. It is needed by Mast_dayoff and Mast_bye2.
A page-toggle rule for Mast_phantom:
	now Intro_convo_had is true;
	now the greeting of the Ringmaster is Mast_hello2;
	deactivate Mast_bye1.
	
Mast_phantom_adag is a page.
"'It's her escapology bit, the thing with the water tank. The Phantom is r-ruining it. I don't know, it's a magic trick, she gets cagey about sharing the secrets sometimes. You're in on it, you're her assistant sometimes, m-maybe she'll talk to you.[Mast_phantom join]".
The cdesc is "'Poor Adagio! What's this Phantom doing to her magic tricks?'" It is for Mast_phantom. It flips to Mast_hub.

Mast_phantom_freda is a page.
"'It's the volunteer bit, you know, where she picks up someone from the audience - I mean [i]lifts[/i], not [i]picks up[/i], I m-mean, you know, I know you're her partner, she's not, not -'

He stops digging, tries to compose himself, and continues. 'She was very upset about it. Maybe she'll talk to you.[Mast_phantom join]".
The cdesc is "'Poor Freda! I've never seen her lose a test of strength!'" It is for Mast_phantom. It flips to Mast_hub.

Mast_phantom_lawn is a page.
"'That's what he said to me. I don't- I don't know what to tell you. You go talk to him.[Mast_phantom join]".
The cdesc is "'Poor Ken! I'm sorry, someone [i]blindfolded[/i] the [i]goose[/i]??'"  It is for Mast_phantom. It flips to Mast_hub.

To say Mast_phantom join:
	say " Ow,' winces the Ringmaster as his black hat seems to lift an inch off his head briefly. 'In fact, you'd better talk to the r-rest of them too. They're all in their caravans, I think. Please help them stop the g-ghost, Lola. I don't know what to do.'[no line break]".
	
Section - Mast_letters - talking about the paperwork
	
Mast_letters is a page.
"[ringmaster item paperwork]??'".
The cdesc is "'Hey boss, what[if the Ringmaster is in RmRingmaster]'s this[otherwise] was that[end if] letter about the greenfield site?'" It is for Mast_hub. It flips to Mast_hub. It is inactive.

Section - Mast_dayoff - talking about Lola's day off

Mast_dayoff-explained is a truth state that varies.
Mast_dayoff-explained is false.

Mast_dayoff is a page.
"'I-it's fine, Lola, it's okay,' says the boss. 'It's, it's not like you could've known. Sorry about all this.' He gives you a sad little smile. 'Did you enjoy your day off, at least? What did you get up to?'"
The cdesc is "'Sorry I wasn't around to help yesterday, boss.'" It is for Mast_hub. It is a one-off. It flips to Mast_dayoff_hub.

Mast_dayoff_hub is a page.

Mast_dayoff_pagliacci is a page.
"'Ah, yes, you mentioned that, didn't you?' says the boss. 'A seminar from the great clown Pagliacci, inventor of the famous [']crying in front of the audience['] and [']my wife left me['] routines. Would that I could have been there,' he adds wistfully. 'I think we could all learn something about true happiness from him.'" [wrote this a year ago, and am just now realising I've stolen Snowdrake's dad's bit from Undertale. Ah well, it's staying now]
The cdesc is "'In the morning, I got to see a talk given by one of the all-time great clowns!'" It is for Mast_dayoff_hub. It is a one-off. It flips to Mast_dayoff_hub.
A page-toggle rule for Mast_dayoff_pagliacci:
	now Mast_dayoff-explained is true.

Mast_dayoff_brothers is a page.
"'Oh, I'm sorry, I forgot you had family around here!' says the Ringmaster. 'What were their names again, you mentioned them once, I'm so sorry I forgot - oh yes! Roflo and Lmaouie, wasn't it? It's good to see good clowning running in the family, Lola.'"
The cdesc is "'In the afternoon, I caught up with my brothers.'" It is for Mast_dayoff_hub. It is a one-off. It flips to Mast_dayoff_hub.
A page-toggle rule for Mast_dayoff_brothers:
	now Mast_dayoff-explained is true.

Mast_dayoff_bug is a page.
"'Again, Lola?' he sighs. 'Please come talk to me later, and I'll, I'll see if we can budget you a phone so you can call for help next time.' (You privately resolve not to do this. You didn't want help.)"
The cdesc is "'In the evening, I followed a bug for two hours and got lost in an underground cave system.'" It is for Mast_dayoff_hub. It is a one-off. It flips to Mast_dayoff_hub.
A page-toggle rule for Mast_dayoff_bug:
	now Mast_dayoff-explained is true.

Mast_dayoff_back is a page.
"'Oh well, [if Mast_dayoff-explained is true]it sounds like[otherwise]I expect[end if] you had a good time, anyway. S-sorry again, about all the, the ghost situation.'"
The cdesc is "'[if Mast_dayoff-explained is true]That's it, really[otherwise]Oh, nothing much[end if].'" It is for Mast_dayoff_hub. It flips to Mast_hub.





Section - Mast_bye - leaving conversation

Mast_bye1 is a page.
"'W-well...' The Ringmaster's beard-tugging intensifies. 'Okay, but please talk to me soon.'"
The cdesc is "'Actually, before we talk, can I just do something else real quick?'" It is for Mast_hub. It is an end-page.

Choice-priority for Mast_bye1:
	rule succeeds with result 100.

Mast_bye2 is a page.
"The Ringmaster forces a tired little smile. 'Thank you, Lola.'"
The cdesc is "'I'll sort the Phantom out. You deal with [if the location of the Ringmaster is RmRingmaster]the paperwork[otherwise]trying not to hyperventilate[end if].'" It is for Mast_hub. It is an end-page.

Choice-priority for Mast_bye2:
	rule succeeds with result 100.


	
Chapter - Item-asking the Ringmaster
	
The item unknown response of the Ringmaster is "'I'm, I'm afraid I wouldn't know about [the second noun], Lola,' the boss murmurs."

The item-table of the Ringmaster is the Table of Ringmaster Items.

Table of Ringmaster Items
item	reply
Adagio	"[ringmaster item adagio]"
balloon stand	"[ringmaster item hired help]"
barbells	"'Did I ever tell you I once trained to be a strongman? I, I started out lifting ball bearings and worked my way up. But I threw my back out one winter trying to, um, trying to deadlift a bag of pennies. And that was that. So it goes, hm?'[p]"
bendy balloons	"'Yes, yes, I'm sorry, Lola, I know about how stiff the new bendy balloons are. I'll, I'll put in an order for a different brand next time. Could you make do for now, please? Perhaps the balloon stand has something to help you?'"
Big Wheel	"[ringmaster item big wheel]"
black top hat	"[run paragraph on][ringmaster item hats]"
deck of cards	"'Ah, I, I know a few card tricks myself,' says the boss, a rare twinkle in his eye. '[one of]I still remember how to force a card. You simply have to tell the volunteer to pick a different card until they get the one you want[or]I've been practicing my shuffles. I, I can keep hold of all the cards up to 50% of the time[at random].'[p]"
Freda	"[ringmaster item freda]"
goose	"'I don't know how Ken handles his goose,' says the boss[if BeastShowSolved is true], apparently unaware that he doesn't[end if]. 'I've, I've dabbled in animal training myself. I've been bitten by my own flea circus, stung by my wasp circus, carried away by ants... the, um, I remember the butterfly circus fondly, but all those tornados in Manchester did for that... Animal training wasn't for me, really. I, I can't imagine handling a whole goose.'[p]"
helium canister	"'Oh... no thanks. I consider it a form of substance abuse.'[p]"
hired help	"[ringmaster item hired help]"
Lawn	"'Oh, yes, Kentucky and I go far back. Before I learned the tightrope, I-I practiced animal training with him. It, it wasn't for me, but that little flea circus gave me a taste for ringmaster-ing. When I started this carnival, Ken was my first hire.' The boss sighs wistfully. 'Wonderful, wonderful days. [If BeastShowSolved is false]It's, it's devastating that it'll all end like- like this[otherwise]And, and long may they continue. You've done a good thing for both of us, Lola[end if].'[p]"
lever	"[ringmaster item big wheel]"
Lola	"'You're, you're doing wonderfully, Lola. Keep going.'[p]"
love booth	"'I don't remember where I picked up that old gizmo. Sometimes I think it must have come with the circus tent.'[p]"
Monster Manor	"'I think, I think we did a rather good job with that ride. It certainly scares me.'[p]"
operator	"'Yes, he's a local hire. I can't talk to him much. He, he has a sign that says [']NO RENEGOTIATION OF CONTRACT['] whenever I see him. I don't, um, think we even signed a contract.'[p]"
paperwork	"[ringmaster item paperwork]??'[line break]"
Phantom	"[ringmaster item phantom]"
poster	"[ringmaster item poster]"
purple top hat	"[run paragraph on][ringmaster item hats]"
rabbit	"'Ah, that rabbit. How is that little scamp doing?[if the ringmaster wears the black top hat] Ow,' says the Ringmaster as the black hat swivels again on his head[otherwise] I, I hope it's not been getting into trouble!' jokes the Ringmaster, rubbing his sore scalp absent-mindedly[end if].[p]"
Ringmaster	"'Oh, I'm...' He pauses for a little too long. '...I'm hanging in there.'[p]"
rope	"'The rope in Adagio's Contraption is the rope I used to use in my tightrope act, you know. I, I had to retire in the end. There were newer, younger tightrope acts, who could do it without, um, crying. I thought at least we could put the rope to some other use. There's much more where that came from, so if you see it's broken, just, um, just talk to Adagio about it and she'll replace it.'"
stepladder	"[ringmaster item stepladder]"


To say ringmaster item adagio:
	say "'Oh, Adagio's a wonderful magician,' beams the Ringmaster. 'She's very diligent, and very intelligent. I, I actually dabbled in magic myself once. I've been showing her a few tricks that I, um, that I invented once. There's one where [one of]you, where the audience, no, an audience member picks a card, and then they, I mean, then you, then you guess what it is[or]you get a watch, you get one from the audience, or a phone, and you put the watch in a tissue, and then they, um, you, er, and something happens and the watch is alright[or]you're in a box, or a, uh, a big box, and you put swords in it, well, it doesn't have to be swords, just sticks or, uh, it's not dangerous, and you're okay at the end of it[at random].'[paragraph break]His face falls while you try to figure that one out. 'Well, she'll never get to do that trick if we can't get rid of this ghost. [if MagicShowSolved is false]You will help Adagio, won't you? She, she needs the help[otherwise]Thank you for helping Adagio, though. It must be a weight off her mind[end if].'"

To say ringmaster item big wheel:
	if the stepladder is known and the stepladder is not handled:
		say "[run paragraph on]";
		try item-asking the Ringmaster about the stepladder instead;
	otherwise:
		say "'I know, I know, I-I still need to, to get around to getting that Wheel, uh, fixed,' stammers the Ringmaster. 'It's just, you know, with everything else, you know... the ghost, Lola, the ghost...'".
[not bothering with any special dialogue after the Wheel is destroyed because by that point you're being funnelled towards the end-game and most conversation is locked]

To say ringmaster item freda:
	say "'Oh, Freda's been fantastic. She puts on a fantastic strength show. Certainly the b-best strongperson we've ever had. We were trying to negotiate a new show for her the other day. She's very set on this, um, this idea of pulling a vehicle across the ring, but I'm worried that if it's heavy, it might damage the fields we set the tent up on. That's the last thing we need[if the Ringmaster is in RmRingmaster].' The boss gestures to the paperwork piled up nearby. '[otherwise]. [end if]I'm trying to negotiate her down to, um, perhaps some sort of rickshaw[if StrengthShowSolved is false]. Of course,' he adds glumly, 'she won't get to pull anything around if the ghost won't go away. Please, please help Freda, Lola. If you can. Um, please[otherwise]. Um, I'm rather looking forward to it, now that Freda's show is back on the rails. You've done another sterling job, Lola[end if].'".

To say ringmaster item hats:
	if the player has the purple top hat:
		try giving the purple top hat to the Ringmaster instead;
	otherwise if the black top hat is closed:
		say "'Yes, it's, it's a nice hat, isn't it?' says the Ringmaster, fidgeting with the black hat. 'It's strange, though, it, it doesn't feel like it fits properly this morning. My head must have swollen again.'";
	otherwise:
		say "'My headache has been clearing up since you found my proper hat, Lola,' says the boss. 'I don't feel like my scalp is being kicked and bitten any more. That other hat must have been far too tight.'".
		
To say ringmaster item hired help:
	say "'The new girl at the balloon stand is wonderful, isn't she? She's been such a help. I've been meaning to get her onto ticket collection or ride operation, but she seems to be having such fun with the balloons.'"
		
To say ringmaster item paperwork:
	say "'The government is c-coming for my neck, Lola[if the ringmaster is in RmRingmaster]!' The boss waves a letter around frantically. '[otherwise]! [end if]They want us to pay for an outdoor p-performance permit. A grand! We've never had to do that in this town before[if the ringmaster is in RmRingmaster].'

He digs through the pile and shows you more letters. 'We got this[otherwise]. A-and we got a[end if] debt collection letter b-before we even got the council's letter! And this letter about a fast food tax, and this letter about noise complaints, and THIS letter telling us to move the whole show into a community centre two miles away! How are we going to set up the tent inside a community centre".
	
To say ringmaster item phantom:
	if Unmasking is happening:
		say "'They're, they're just in the ring now. We could unmask them, if you like,' the Ringmaster says meaningfully.";
	otherwise:
		say "'Please help us with our g-ghost problem, Lola. I'm at my wit's end. I don't know how to help the others. Can you talk to them and, and see if you can do anything?'".
		
To say ringmaster item stepladder:
	if the stepladder is known and the stepladder is not handled:
		say "'There's a stepladder caught in the Wheel? That's very odd. I'll, I'll go fiddle with the lever and get it down, if you like.' Do you want the Ringmaster to get the ladder out of the Big Wheel for you?";
		if the player consents:
			now the stepladder is handled;
			now StepladderHandled is true;
			now the stepladder is in RmStaffS;
			say "'Alright, I'll be back soon.' The boss leaves the camper. You hear a lot of clunking and grinding coming from the east. The boss comes back in, slightly out of breath. 'I left the ladder outside for you, Lola. I, um, I hope that's alright.'";
		otherwise:
			say "'Okay. Just let me know.'";
	otherwise:
		say "'I, I don't remember anyone working on the Wheel recently. I wonder why that stepladder was there?'".
[if stepladder is known and not handled: give player the option to have the boss solve the puzzle (since they're good at maths). If the player agrees: now the stepladder is handled, now StepladderHandled is true, put the stepladder outside the camper, have the boss leave the room and come back and say that he did it and put the ladder outside for you]

Poster joke setup is a truth state that varies. Poster joke setup is false.
To say ringmaster item poster:
	say "'Oh... that typo is so embarrassing,' sighs the Ringmaster. 'So many people coming in to complain that they can't find the big pig. We'll, we'll have to get the posters reprinted. I'll change the slogan, I'll change it to something the printers can't, um, um, misprint. I was thinking something like... something like [']WE CARE ABOUT MAN'S LAUGHTER.['] Yes, that'll do.'";
	now poster joke setup is true.
[poster joke setup flag adds a joke to the epilogue text]


	
Part - Other Ringmaster properties

Chapter - idle behaviours

Every turn when the location of the player is the location of the Ringmaster (this is the Ringmaster idle daemon rule):
	unless a climactic scene is happening:
		if a random chance of 1 in 8 succeeds:
			say "The boss [one of]tugs on his beard nervously as he paces[or]chews his lip[or]chews on his shirt collar[or]checks his own pulse[or]breaks out in a cold sweat, for no clear reason[or]tries to mindfully meditate, and lasts for about three seconds before going back to pacing[as decreasingly likely outcomes].".
			
The Ringmaster idle daemon rule is listed before the people follow the player rule in the every turn rules.
			
Chapter - Pie reaction

The pie reaction of the Ringmaster is "'Haha! [one of]You got me, Lola![or]Got me again![or]Please stop.[stopping]'".

Chapter - persuasion refusal

The persuasion refusal of the Ringmaster is "[if a climactic scene is happening][Lola wants to go it alone][otherwise]'Um... I'd, I'd rather not, Lola. It, it sounds like you're setting me up for a prank. I'm not in the mood. Sorry.' He avoids eye contact, as if you'd ever be mad at him for something like that".

Chapter - gesture reaction

The gesture reaction of the Ringmaster is "'Oh, are you, are you trying mimework, Lola?' the Ringmaster asks politely, forcing a smile. 'Perhaps, perhaps you could try the  [']glass box['] rotuine. I'm sure the children would find it quite [']swell['].'".


BOOK - The Phantom

A person called the Phantom is nowhere.
The Phantom is known.

[this description sets up Phantom's appearance in Strength Show and Unmasking. See Scenes > Strength Show > Scene-specific Rules > Phantom Behaviour > Phantom description for the SSPD text substitution below]
Description of the Phantom is "The Phantom wears a shapeless black hooded cloak, and their face is obscured by a featureless white mask[if Strength Show is happening][StrengthShowPhantomDesc][otherwise]. Their arms are tied behind their back[end if]."

Understand "ghost" or "ghoul" or "spectre" or "specter" as the Phantom.

[Use Gender Options to set Phantom to use they/them via the ambiguously plural property (a non-binary icon) (actually just to be ambiguous about gender and match descriptions until the reveal). Also allows he/him and she/her, since it looks like you can't have they/them without a singular pronoun - it's very unsatisfying that you can't have they/them without chaining it to another gender, and I don't like the way the Phantom takes over all the pronouns the player may want to use now. But it is what it is.]
The Phantom is male. The Phantom is female. [The Phantom is neuter.] The Phantom is ambiguously plural.

[The Phantom is not known at the start of play, because Lola first hears of it through the intro conversation with the Ringmaster. The known state is set in the Ringmaster's conversation tree.]


Initial appearance of the Phantom is "The Phantom is here[if Unmasking is happening], captive, silent, and awaiting an unmasking[otherwise if the player is in RmRing], masked, impassive, and crushing Freda underneath[otherwise if EndgameC is happening], waving papers around and ranting[otherwise], freeing himself from the wreckage[end if]!".

Part - Phantom's Attire

Chapter - Mask

The Phantom wears a mask.
Description of the mask is "Actually, now that you look more closely, it looks like a Mr Bean mask painted white. Even Phantoms have to work to a budget, you guess."

Instead of taking the mask when the Phantom wears the mask (this is the can't unmask Phantom rule):
	say "The Phantom twists this way and that, and you can't get your hands on the mask.".
	
Check wearing the mask:
	say "It won't fit over your big red nose." instead.
	
Check shooting the mask with the bow:
	if the Phantom wears the mask:
		try shooting the Phantom with the bow instead;
	otherwise:
		say "You shoot a couple extra holes in the mask, in case anyone with five eyes needs to wear it." instead.
	
	
Chapter - Cloak
	
The Phantom wears a cloak.
Understand "robes" and "hood/hooded" as the cloak.

Description of the cloak is "It's like one of those hooded cloaks that cultists wear in horror films. You know the ones[if Strength Show is happening][StrengthShowCloakDesc][end if]."

Instead of rearrangement when the noun is the cloak:
	say "You're not that worried about what's under the cloak right now[if Unmasking is happening]. The mask is a little more interesting[end if]."
		
Instead of opening the cloak:
	try pulling the cloak instead.
	
Check shooting the cloak with the bow:
	if the Phantom is clean:
		try shooting the Phantom with the bow instead;
	otherwise:
		try shooting the bags of flour with the bow instead.

[The Phantom conceals bags of flour under their cloak during the Strength Show. This item is handled in the code for that scene.]

	

Part - Marcus Pooting - Unmasking the Phantom

The Phantom can be masked or unmasked. The Phantom is masked.

To unmask the Phantom:
	now the Phantom is unmasked;
	now the printed name of the Phantom is "Pooting";
	now the Phantom is proper-named;
	now the Phantom is male;
	now the Phantom is not female;
	now the Phantom is not ambiguously plural;
	now the mask is nowhere;
	now the description of the Phantom is "[PootingDesc].".

To say PootingDesc:
	unless EndgameC is happening:
		say "So this is the true identity of the Phantom: Member for Parliament Marcus Pooting, the guy who's been sending all the threatening official letters to the boss, formerly known as Magnus the circus strongman. (The Phantom, not the boss.) Very big man, wearing what would be a sensible and professional shirt if it wasn't slightly too small for him";
	otherwise:
		say "Marcus Pooting MP, the Phantom, looks dazed and bedraggled after tumbling off the motorway at high speed. He's carrying important circus paperwork, and he looks ready to dump it in the lake at the first sign of trouble"
	
Understand "Magnus" or "strongman" or "Marcus Pooting" or "Marcus" or "Pooting" or "councillor/councilor/counciller/counciler/councilman/councilperson" as the Phantom when the Phantom is unmasked.


Part - Other Phantom Properties

Check taking the Phantom:
	say "Oh, you're trying." instead.

Chapter - Pie reaction

Report throwing the stack of pies at the Phantom (this is the no pie reaction for Phantom rule):
	say "The Phantom shakes the custard out. Other than that, they don't really react much. Maybe you should be worried about that?" instead.


Chapter - Phantom Announcement

[used in showtime scene intros]

To say PhantomAnnouncement:
	say "[one of]A hulking figure, swathed in black. A white mask, and two impassive eyes behind it. It can only be the Phantom.[paragraph break][or]It's the Phantom! [stopping]".

[
Part - Phantom tests - not for release

Chapter - Spawn Phantom in RmStaffS

When play begins (this is the test Phantom by spawning them early rule):
	now the Phantom is in RmStaffS.
	
Chapter - Test unmasking

Test-unmasking is an action applying to nothing. Understand "testunmask" as test-unmasking.

Carry out test-unmasking:
	say "Unmasking the Phantom...";
	unmask the Phantom.
]


VOLUME - WORLD

Book - RgBigTop (Big Top)

RgBigTop is a region. RmEntranceTent, RmStands, RmRing[, RmPlatformW, RmPlatformE] and RmBackstage are in RgBigTop.
Printed name of RgBigTop is "Big Top".




Part - RmEntranceTent (Entrance Tent)

RmEntranceTent is a room. Printed name of RmEntranceTent is "Entrance Tent". RmEntranceTent is short-interior.

Description of RmEntranceTent is "This smaller tent acts as the main entrance to the Big Top to the east. The carnival is outside to the west."

Check smelling in RmEntranceTent:
	say "Smells like any room with a bunch of pre-cooked burgers in it." instead.

Chapter - Food stand / burger display

The food stand is in RmEntranceTent. "There's also [if the food stand is demolished]the remains of [end if]a food stand here, selling cheap burgers."

The food stand can be demolished. The food stand is not demolished.

Understand "burger" or "burgers" or "display" or "burger display" as the food stand.

Does the player mean taking the food stand: it is likely.
[Does the player mean taking the food stand when the burger bun is in RmEntranceTent: it is unlikely.]

Description of the food stand is "[if the food stand is demolished]Debris is scattered everywhere, as if the food stand had detonated. Miraculously, some burgers still survive whole, if you want to take one[otherwise]The stand holds a pile of arguably-freshly-cooked burgers. There's nobody running the stand right now, but that's okay, nobody seems to want a burger anyway. You're a staff member with free burger perks, so you can just take one if you like[end if]."

Understand "debris" and "remains" as the food stand when the food stand is demolished.

Instead of eating the food stand (this is the allow eating burger from food stand rule):
	say "You pluck a burger from the display and eat it. Not bad. Not good either, admittedly."
	
Before wearing, pulling, pushing or turning the food stand (this is the stop actions that would require taking the stand rule):
	say "The food stand is too [if the food stand is demolished]chewed-to-smithereens[otherwise]big[end if] to do that kind of thing with." instead.
	
[To say can't lift food stand:
	say "The food stand is too [if the food stand is demolished]chewed-to-smithereens[otherwise]big[end if] to do that with."]

[grabbing (and keeping in inventory) a burger will be handled in the Burger chapter below]

Chapter - Burger

[a lot of the burger-handling code below is from example 378, "Pizza Prince", in the Inform documentation]

Section - Burgpart objects (the objects which are part of the standard burger)

A thing can be burgpart. A thing is usually not burgpart.

Section - Burger Limbo - where burger parts go when they die

Burger Limbo is a room.

Instead of eating a burgpart thing:
	if the noun is the burger bun:
		empty the burger bun of inedible things; [phrase defined under burger bun]
	say "You eat [the noun]. It's... fine.";
	move the noun to Burger Limbo.

Section - Burger bun

The burger bun is in Burger Limbo.

The burger bun is a container. The burger bun is transparent, open and unopenable.
The burger bun is burgpart.

Description of the burger bun is "A styrofoam-like bun encasing [burg-contents].".
To say burg-contents:
	let L be the list of things in the burger bun;
	if the number of entries in L is greater than 0:
		say "[L with indefinite articles]";
	otherwise:
		say "nothing".
		
The examine containers rule does nothing when examining the burger bun.

Rule for printing the name of the burger bun:
	let L be the list of things in the burger bun;
	if the number of entries in L is greater than 0:
		say "burger";
	otherwise:
		say "burger bun".

[this phrase removes important (non-burgpart) items from the burger. It is supposed to prevent players losing important items by putting them in the burger and eating the burger]
DidBurgHaveInedible is a truth state that varies.
DidBurgHaveInedible is false.

To empty the burger bun of inedible things:
	now DidBurgHaveInedible is false;
	let L be the list of things enclosed by the burger bun;
	[say "DEBUGDEBUGDEBUG The following things are in the burger bun: [L].";]
	repeat with item running through L:
		if item is not burgpart:
			now DidBurgHaveInedible is true;
			[say "DEBUGDEBUGDEBUG: It looks like [item] shouldn't be edible, so we need to move this to wherever the burger bun is (either inventory or floor).";]
			if the player encloses the burger bun:
				move item to the player;
			otherwise:
				move item to the location of the burger bun;
	if DidBurgHaveInedible is true:
		say "(first emptying the burger bun of ingredients it's probably not safe to eat and dumping them where you found it)[line break]".
		
Instead of inserting the stepladder into the burger bun:
	say "The LadderBurger! The World's Tallest Sandwich! Can you handle the LadderBurger Challenge??? Eat the whole thing in one hour and win another free LadderBurger- oh, never mind, it doesn't fit in the bun."
	
Instead of inserting the helium canister into the burger bun:
	say "The HeliumBurger! You've heard of light bites but this is ridiculous! Eat the whole HeliumBurger in one hour and win free surgical intervention- oh, never mind, the canister doesn't fit in the bun."
	
Instead of inserting the stack of pies into the burger bun:
	say "You tried inventing the PieBurger once before, remember? Last year? It seemed like such a good idea at the time, but it led to that horrible, horrible night. The doctors were baffled (you told them what you'd eaten and they said 'haha what'). No, let's let the past be the past."

Section - Patty

The patty is in the burger bun.
The patty is burgpart.

Description of the patty is "A grilled disc of meatlike substance."

Section - Lettuce leaf

The lettuce leaf is in the burger bun.
The lettuce leaf is burgpart.

Printed name of the lettuce leaf is "romaine lettuce leaf".
Understand "romaine" as the lettuce leaf.

Description of the lettuce leaf is "A very floppy and pliable piece of wilted romaine lettuce."

Section - Grabbing a burger from the food stand

[The can't take what's already taken rule does nothing if the noun is the burger bun and the location of the player is the location of the food stand.]

Before taking the burger bun when the burger bun is contained by the player:
	[say "DEBUGDEBUGDEBUG.";]
	if the location of the player is the location of the food stand:
		try taking the food stand instead.

IsBurgpartActive is a truth state that varies. IsBurgpartActive is false.
Instead of taking the food stand:
	now IsBurgpartActive is false;
	let B be the list of burgpart things;
	repeat with part running through B:
		unless the location of part is Burger Limbo:
			now IsBurgpartActive is true;
	if IsBurgpartActive is true:
		say "You already have your old burger (or some of it, anyway) lying around somewhere[first time]. If you grab a new burger from the food stand, all the parts of your old burger will be cleared away (we run a clean carnival around here, after all)[only]. Do you want to grab a new burger?";
		if the player consents:
			burg the player;
		otherwise:
			say "Okay then[first time]. By the way, you sometimes have this funny habit of referring to sandwiches by the bread, so that if you wanted to pick up a burger, you'd say you're picking up the bun. You've found it helps you disambiguate between the specific burger you're eating and any other piles of burgers in the same room. When you try to tell people this, they call you silly, but it sure helps you[only].";
	otherwise:
		burg the player.

[truth states track where the player has scattered the burgparts]
WasBurgpartInInv is a truth state that varies. WasBurgpartInInv is false.
WasBurgpartInTent is a truth state that varies. WasBurgpartInTent is false.
WasBurgpartElsewhere is a truth state that varies. WasBurgpartElsewhere is false.

To burg the player:
	[prepare truth states]
	now WasBurgpartInInv is false;
	now WasBurgpartInTent is false;
	now WasBurgpartElsewhere is false;
	[get important items safe - this phrase defined under Burger Bun above]
	empty the burger bun of inedible things;
	let B be the list of burgpart things;
	repeat with part running through B:
		[was a burgpart in inventory?]
		if the player encloses the part:
			[say "DEBUGDEBUGDEBUG [part] is in inventory[line break]";]
			now WasBurgpartInInv is true;
		[was a burgpart lying in the Entrance Tent room?]
		otherwise:
			[say "DEBUGDEBUGDEBUG [part] is in [location of the part][line break]";]
			if the location of part is RmEntranceTent:
				now WasBurgpartInTent is true;
			[was a burgpart lying elsewhere in the world?]
			otherwise:
				unless the location of part is Burger Limbo:
					now WasBurgpartElsewhere is true;
	[give the player the assembled burger]
	now the lettuce leaf is in the burger bun;
	now the patty is in the burger bun;
	now the player has the burger bun;
	[report giving player the burger, indicating that inventory is being cleared out]
	if WasBurgpartInInv is true:
		say "You discard the bits of burger you already have and grab a new one.";
	otherwise:
		say "You grab a burger from the stand.";
	[report that other burger parts are now gone, even if player can't see them]
	if WasBurgpartInInv is true or WasBurgpartInTent is true:
		say "Your dropped burger parts get squished by the crowd, and are lost to you.";
	if WasBurgpartElsewhere is true:
		say "(Elsewhere in this world, a passer-by sees some abandoned burger food and takes it for themself.)".
	
[*TODO: although this looks like it works, it needs some formal testing, and it needs a little polish (i.e. "get burger" should get a new burger from the stand if the player have an empty burger bun - the bun shouldn't be primarily identified as the burger in that case)]

[ tests to run:
	get burger when one already out
	get burger after eating one
	get burger after dismantling one
	get burger after putting something in burger
	get burger after putting something in and leaving it in another room
	get burger after eating some parts but not others
]		


Part - RmStands (Seats)

RmStands is a room. Printed name of RmStands is "Seats". RmStands is tall-interior.
RmStands is east of RmEntranceTent.

Description of RmStands is "You're always amazed at how huge the Big Top is. It must have been how the ancient Romans felt in the Coliseum, probably. Tiers of seats surround a central ring here, which is really just a big patch of empty ground if you're being cynical, but what was the Coliseum if not a load of seats around an empty patch of ground, huh?

Right now you're in the gangways between the [if AudienceSeated is true]audience[otherwise]empty seats[end if] and the ring. You can head into the central ring, south to a backstage area out of sight of the seats, or west to the entrance tent. [if a showtime scene is happening]There are flaps going outside to the east and north, too, but you're not going to abandon the show just like that[otherwise]You can also take a shortcut through a flap to the east into the staff area, or north into the carnival[end if]."


[*TODO: How do I want big top to be connected?
In Entrance Tent and Backstage: be able to overhear Ring, but not see objects - nothing in scope
In Ring, Stands and Tightrope: be able to see the other rooms (especially events in Ring) be able to talk to people in other rooms, but not be able to touch objects
]

Chapter - Circus seats (scenery)

The circus seats are scenery in RmStands. Understand "seats" and "seat" and "chairs" and "chair" as the circus seats.

The circus seats are a supporter. The circus seats are enterable.

Description of the circus seats is "Rows of tiered seats, like you'd get in a lecture theatre in a college."

[After deciding the scope of the player while the player is in RmRing:
	place the circus seats in scope.]
[this didn't work for whatever reason - oh well, not that important]
	
Before entering the circus seats when the player is in RmRing:
	say "It would be an incredible feat of your buttocks to sit in one of those seats out there while you're in the ring." instead.
[a bit dry for the narrative voice maybe, but "buttocks" is a funny word]

Report entering the circus seats:
	say "You sit in an empty seat. Comfy!" instead.


Chapter - BgRing (Ring)

BgRing is a backdrop. BgRing is in RmStands. BgRing is in RmRing. Printed name of BgRing is "ring". BgRing is proper-named.

Understand "ring" and "stage" and "space" as BgRing.

Description of BgRing is "The ring isn't really a thing in itself, it's just the empty space in the centre of the Big Top where you all perform. (Needs to be flat to the ground so you can get the big props into the ring more easily, of course.) Right now in the Ring, you can see [a list of visible things in RmRing]."

Instead of entering BgRing:
	if the location of the player is RmStands:
		try going inside;
	otherwise if the location of the player is RmRing:
		say "You're already in the ring!".

Instead of object-exiting BgRing:
	if the location of the player is RmRing:
		try going outside;
	otherwise if the location of the player is RmStands:
		say "You're not in the ring right now.".

Instead of examining BgRing while the location of the player is RmRing:
	try looking.


Section - Put RmRing objects in scope

[This rule lets the player see rooms in the Big Top that should be visible from each other, i.e. the player can see the ring from the tightrope platforms and vice versa]
[*TODO: can peep out from Backstage, which is good, but should disable talking from Backstage to Ring or elsewhere]

The Big Top Main Area is a list of rooms that varies.
The Big Top Main Area is {RmStands, RmRing[, RmPlatformW, RmPlatformE]}.

After deciding the scope of the player when the player is in RgBigTop (this is the let player see across Big Top rule):
	unless the player is in RmEntranceTent:
		repeat with room running through the Big Top Main Area:
			let T be the list of things in room;
			repeat with thing running through T:
				[say "DEBUGDEBUGDEBUG placing [thing] from [room] in scope[line break]";]
				place thing in scope.


Part - RmRing (Ring)

RmRing is a room. Printed name of RmRing is "Ring". RmRing is tall-interior.
RmRing is inside from RmStands.

Description of RmRing is "You're [if the player is on the cagetop]balancing on a cage [end if]in the heart of the Big Top, surrounded by [if Unmasking is happening]a curious and excitable audience, waiting for a big unmasking[otherwise if AudienceSeated is true]a probably-adoring audience. The circus is in full swing right now[otherwise]empty seats. It's awfully quiet when it isn't showtime[end if]. [if MagicShowActive is true or StrengthShowActive is true or BeastShowActive is true]If you headed out right now you'd be in the gangways between the seats, but it's showtime now - you aren't leaving this ring until this show ends, one way or another[otherwise]If you don't wanna stay, you can head out into the gangways between the seats and the ring[end if]."

[this next silly bit allows me to move the audience in and out of the big top]
A room can be audience-accommodating. A room is usually not audience-accommodating. RmStands is audience-accommodating. RmRing is audience-accommodating.

Chapter - Navigating from RmRing

Instead of going north in RmRing:
	try going outside.
Instead of going northeast in RmRing:
	try going outside.
Instead of going east in RmRing:
	try going outside.
Instead of going southeast in RmRing:
	try going outside.
Instead of going south in RmRing:
	try going outside.
Instead of going southwest in RmRing:
	try going outside.
Instead of going west in RmRing:
	try going outside.
Instead of going northwest in RmRing:
	try going outside.
[there has GOT to be a better way to do this.]

[Check going in RmRing:
	if the direction is north:
		say "rule succeeds".]

After exiting from the clown car while the location of the player is RmRing:
	say "You get out of the clown car[first time].[paragraph break][i]Note: if you were actually trying to leave the ring while still driving the car, try entering the car and specifying 'exit ring' instead[/i][only].";
	try looking.

Part - RmBackstage (Backstage)

RmBackstage is a room. Printed name of RmBackstage is "Backstage". RmBackstage is tall-interior.
RmBackstage is south of RmStands.

Description of RmBackstage is "This is a curtained-off area in the Big Top where the props are kept ready for each performer's routines, and where the performers can peek out at the crowd. You can step north through the curtains to enter the main area, or you can slip out the south exit to the staff area."


Book - RgStaffArea (Staff Area)

RgStaffArea is a region. RmStaffS, RmStaffSE and RmStaffE are in RgStaffArea.

Part - RmStaffS (Staff Area, by the boss's camper)

RmStaffS is a room. Printed name of RmStaffS is "Staff Area, by the boss's camper".
RmStaffS is south of RmBackstage.

Description of RmStaffS is "Part of the field around the back of the Big Top has been cordoned off as a private area for the performers and their caravans and campers. This bit of the field has direct access to the Big Top's backstage area through the flap to the north[if the BossCamper is in RmStaffS]. The Ringmaster has parked his camper as close as he can get to it - it's just to the south[end if].

There's more of the staff area to the east, as well as to the northeast if you take a shortcut underneath the tent ropes. You can see [if EndgameA is happening]an empty patch of sky where the Big Wheel used to be[otherwise]the Big Wheel[end if] to the west over the various trailers which you can cut through[first time].

Hm, if you want to start helping everyone with this Phantom problem, you'll want to talk to them first. Freda's parked up just to the east next to you, and Adagio and Lawn are both north of her (that is, northeast of here). Or you could put it off and wander north into the circus or west into the carnival. No rush, probably[only]."

Chapter - BossCamper

The BossCamper is scenery in RmStaffS. Printed name of the BossCamper is "Ringmaster's camper van". The BossCamper is proper-named.

Understand "camper" and "van" and "ringmaster" as the BossCamper.

Does the player mean doing something with the Ringmaster: it is likely. [disambiguates between RM and his camper during the motorway scene]

Description of the BossCamper is "It's a nice-looking camper, with the go-faster stripes on the side and everything. [if the BossCamper is in RmStaffS]It's parked up just to your south[otherwise if the BossCamper is in RmMotorway]Luckily, the stripes don't help - the Phantom can't be going any faster than 40mph[otherwise if the BossCamper is in RmLakeside]Well, it looked nice until it fell off the motorway. It looks more like a concertina now[end if]."

Check entering the BossCamper:
	if the BossCamper is in RmStaffS:
		try going south instead;
	otherwise if the BossCamper is in RmMotorway:
		say "It's a little too far away for you to make any daring leaps from car to car, unfortunately." instead;
	otherwise if the BossCamper is in RmLakeside:
		say "You know how you can crush a can of fizzy drink by stamping on the top? You can't enter the camper any more than you can reuse one of those cans." instead.
		
Chapter - Trailers

The trailers are scenery in RmStaffS. Understand "trailer" as the trailers. The trailers are plural-named.

Description of the trailers is "Just various trailers and storage containers, arranged as a makeshift privacy screen between this staff area and the public carnival. You can head west to weave through them if you want a shortcut to the carnival."

Check opening the trailers:
	say "There's nothing in there that you're supposed to touch." instead.
Check searching the trailers:
	try opening the trailers instead.
	
Check entering the trailers:
	try going west instead.
	
Before going west from RmStaffS:
	say "You squeeze between a couple of trailers and come out in the carnival."
	
Before going east from RmCarnivalSW:
	say "You head east a little and wiggle through a wall of trailers to get back to the staff area."


Part - RmStaffSE (Staff Area, by Freda and you)

RmStaffSE is a room. Printed name of RmStaffSE is "Staff Area, by Freda and you".
RmStaffSE is east of RmStaffS.

Description of RmStaffSE is "Part of the field around the back of the Big Top has been cordoned off as a private area for the performers and their caravans and campers. This bit of the field is right in the corner. You and Freda have tucked yourselves away here. Your own caravan is to the south; Freda's camper is east.

There's more of the staff area to the north and to the west."

Chapter - Lola's caravan

The LolaCaravan is scenery in RmStaffSE. Printed name of the LolaCaravan is "caravan". Indefinite article of the caravan is "your".

Understand "caravan" and "my caravan" and "Lola's caravan" as the LolaCaravan.

Description of the LolaCaravan is "It's not much bigger than your car, but it's just a place to sleep, really. It's painted with multicoloured polka dots, just like any other clown's living space."

Check entering the LolaCaravan:
	try going south instead.

Chapter - Freda's camper

The FredaCamper is scenery in RmStaffSE. Printed name of the FredaCamper is "Freda's camper". The FredaCamper is proper-named.

Understand "camper" and "Freda" and "Freda's camper" as the FredaCamper.

Does the player mean doing something with Freda: it is likely.

Description of the FredaCamper is "Freda's camper is a big, rugged beast that you could drive up Everest in."

Check entering the FredaCamper:
	try going east instead.

Chapter - Clown car

The clown car is in RmStaffSE.
The clown car is a vehicle.
The clown car is known.

Understand "car" as the clown car. The indefinite article of the clown car is "your".

Initial appearance of the clown car is "Your lovely little car is parked up here, still attached to your caravan."

Does the player mean item-asking the noun about the clown car: it is very likely.

[Rule for printing the name of the clown car:
	if the clown car contains nothing:
		omit contents in listing.]

Description of the clown car is "Your car, one cubic metre of pure horsepower. It's drivable, but the innards are stripped down to the bare essentials (the fewer seats there are, the more passengers you can fit in). There is a car horn, though.[tyre hint]"

To say tyre hint:
	if the tyre is slashed:
		if TyreAwareness is false:
			say "[paragraph break][one of]Hmm. Your car looks strangely lopsided right now. Is there a problem with the tyres?[no line break][or]You car is lopsided, probably because of a problem with the tyres.[no line break][stopping]";
		otherwise:
			say "[paragraph break]Your car is lopsided, since one of the tyres has been slashed.[no line break]";
	otherwise if the tyre is removed:
		say "[paragraph break]Your car is lopsided, since one of the wheels has been removed.[no line break]".
		
Check shooting the clown car with the bow:
	if the player is in the clown car:
		say "Firing the bow inside the car is a little unwieldly, so you settle for poking the daskboard with an arrow instead." instead;
	otherwise:
		try shooting the tyre with the bow instead.
		
Section - Redirect responses to hint at entering car
		
Check taking the clown car:
	if the player is in the clown car:
		say "It's too big to carry around, and anyway it turns out you can't pocket something you're inside. There's some maths reason behind it, probably." instead;
	otherwise:
		say "It may be small, but it's still too big to carry around." instead.
		
Check pushing the clown car to:
	try pushing the clown car instead.
Check pushing the clown car:
	if the player is in the clown car:
		say "You are in the car. You could just go somewhere while in the car." instead;
	otherwise:
		say "You get behind the car and push and heave with all your might before you remember that it's your car and you could just get in it and drive it." instead.


Section - Entering the car - first time unhooking + tutorial

Report entering the car:
	now the car is handled; [to suppress initial appearance]
	say "You [first time]unhook your caravan and [only]squeeze into your little car[first time].[paragraph break][i]Note: if you type a direction while in the car, you'll automatically drive it between places[/i][no line break][only]." instead.
	
Section - quick little "unhook" action in case someone gets clever and tries unhooking the car first

Unhooking is an action applying to one thing.
Understand "unhook [something]" or "detach [something]" as unhooking.

Unhooking it from is an action applying to two things.
Understand "unhook [something] from [something]" or "detach [something] from [something]" as unhooking it from.

Check unhooking it from:
	try unhooking the noun instead.

Check unhooking:
	say "[regarding the noun][They're] not hooked[one of][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or][or]. Look, unhooking things isn't really going to be a thing you have to do here. Try not to think about it anymore[or][stopping]." instead.
	
Instead of unhooking the clown car:
	if the clown car is handled:
		say "Already unhooked.";
	otherwise:
		say "Don't worry about that, you'll unhook the car if you drive it anywhere.".
		
Instead of untying the clown car:
	try unhooking the clown car.


Section - Keep the car in sensible places

Before going by the clown car to RmLola (this is the can't drive the car into Lola's caravan rule):
	say "The tragedy of having a little caravan is that it has an even littler door, and you can't quite squeeze the car through. What a shame! You used to love driving your car around your own home and the others' caravans, but they don't let you do it anymore. Arguably, they didn't want you doing it in the first place." instead.

Instead of going by the clown car to RgCaravans (this is the can't ramraid people's homes with your car rule):
	say "People got genuinely mad at you the last time you drove your car into their homes, so you'd better get out of your car before you go in."
	
[Instead of going by the clown car to RmPlatformW:
	say "Your car is a mean machine, but not even it is capable of driving vertically."]
	
Section - redirect opening and closing car

Instead of opening the clown car:
	if the player is in the clown car:
		say "[bracket]opening the door to get out[close bracket]";
		try exiting;
	otherwise:
		say "[bracket]opening the door to enter[close bracket]";
		try entering the clown car.
		
Instead of closing the clown car:
	say "The door is already closed[if the player is in the clown car] (you closed the door when you got in, as you usually do when you drive)[end if]."
	

Section - Tyre

The tyre is part of the clown car. Understand "tire" or "tyres/tires" or "wheel/wheels" or "rim/rims" as the tyre.
The tyre is known.

The tyre can be undamaged, slashed, removed or changed. The tyre is undamaged.
TyreAwareness is a truth state that varies.
TyreAwareness is false.

Description of the tyre is "[tyre desc].".
To say tyre desc:
	if the tyre is undamaged:
		say "All four wheels still present and correct";
	otherwise if the tyre is slashed:
		say "[one of]Oh no. One of the tyres has been completely shredded. And you have a pretty good idea of who did it too. [if EndgameA is happening]There's no hope of catching the Phantom with your car in this state[otherwise]Well, you'll have to change it later. Right now you've got a Phantom to unmask[end if][or]One of the tyres has been slashed, and needs changing [if EndgameA is happening]ASAP[otherwise]when you get a chance[end if][stopping]";
		now TyreAwareness is true;
	otherwise if the tyre is removed:
		say "One of the wheels is missing a tyre. It'll need replacing before you can take the car anywhere";
	otherwise:
		say "One of the tyres is now a[if EndgameC is happening]n extremely [otherwise] hopefully-[end if]durable circular balloon animal stretched over the wheel[if EndgameC is happening]. You've changed your mind. Those balloons are [i]good[/i][no line break][end if]".
		
Does the player mean item-asking about the tyre: it is unlikely. [this is to disambiguate between the tyre ("wheel") and the Big Wheel in conversation]

Check shooting the tyre with the bow:
	if TyreAwareness is false:
		say "Seems liable to cause a puncture. One of the things you like about your car is that the tyres aren't punctured." instead;
	otherwise if the tyre is slashed:
		say "Since the tyre is already punctured, you see no issue with shooting it some more. Everyone silently watches you unload five or six arrows into the tyre." instead;
	otherwise if the tyre is removed:
		say "You fire an arrow or two into the bare wheel of the car. Not productive, but good target practice!" instead;
	otherwise:
		say "The arrow ricochets off the car tyre harmlessly. Those balloons really are sturdy!" instead.
		
[
Description of the tyre is "[tyre desc].".
To say tyre desc:
	if the tyre is undamaged:
		say "All four wheels still present and correct";
	otherwise if the tyre is slashed:
		if TyreAwareness is true:
			say "One of the tyres has been slashed, and needs changing [if EndgameA is happening]ASAP[otherwise]when you get a chance[end if]";
		otherwise:
			say "Oh no. One of the tyres has been completely shredded. And you have a pretty good idea of who did it too. [if EndgameA is happening]There's no hope of catching the Phantom with your car in this state[otherwise]Well, you'll have to change it later. Right now you've got a Phantom to unmask[end if]";
			now TyreAwareness is true;
	otherwise if the tyre is removed:
		say "One of the wheels is missing a tyre. It'll need replacing before you can take the car anywhere";
	otherwise:
		say "One of the tyres is now a[if EndgameC is happening]n extremely [otherwise] hopefully-[end if]durable circular balloon animal stretched over the wheel[if EndgameC is happening]. You've changed your mind. Those balloons are [i]good[/i][no line break][end if]".
]
		
To say toggle tyrea:
	now TyreAwareness is true.
		
[logic to deal with trying to take tyre is under EndgameA where it's relevant]

Section - testtyrea - not for release

Testing tyre awareness is an action applying to nothing. Understand "testtyrea" as testing tyre awareness.

Carry out testing tyre awareness:
	say "Tyre Awareness is [if TyreAwareness is true]true[otherwise]false[end if]."

Section - Car horn

The car horn is part of the clown car.
The car horn is known.

Description of the car horn is "It's not the original car horn, of course - it's one of those classic squeezy horns which you glued to the dashboard. It's no use for getting the attention of other drivers on the road, but it's a lot funnier."

Check taking the car horn:
	say "You glued it to the car ages ago. Where the horn goes, the car goes too." instead.
	
Check playing the car horn:
	try squeezing the car horn instead.
	
Check squeezing the clown car:
	try squeezing the car horn instead.
	
Check squeezing the car horn:
	if the player is not inside the clown car:
		say "(reaching through the window)".

Carry out squeezing the car horn (this is the honk car horn rule):
	say "Honk!".
Report squeezing the car horn: do nothing instead.

Check shooting the car horn with the bow:
	say "That would only puncture and ruin the car horn, and it wouldn't even make a funny sound." instead.


Part - RmStaffE (Staff Area, by Adagio and Lawn)

RmStaffE is a room. Printed name of RmStaffE is "Staff Area, by Adagio and Lawn".
RmStaffE is north of RmStaffSE. RmStaffE is northeast of RmStaffS. RmStaffE is east of RmStands.

Description of RmStaffE is "Part of the field around the back of the Big Top has been cordoned off as a private area for the performers and their caravans and campers. This bit of the field is directly behind the Top, although you can use one of the tent's fire exits to head inside to the west. Adagio's camper is parked to the north, and Lawn's caravan is to the east.

There's more of the staff area to the south, as well as to the southwest if you take a shortcut underneath the tent ropes."

[the goose is here - see the goose's character section for more on that]

Chapter - Adagio's camper 

The AdagioCamper is scenery in RmStaffE. Printed name of the AdagioCamper is "Adagio's camper". The AdagioCamper is proper-named.

Understand "camper" and "Adagio" and "Adagio's camper" as the AdagioCamper.

Does the player mean doing something with Adagio: it is likely.

Description of the AdagioCamper is "Adagio's camper is just very normal. Disappointingly normal, really. You reckon a real magician's camper ought to be made out of mirrors or sawn in half, or something like that."

Check entering the AdagioCamper:
	try going north instead.


Chapter - Lawn's caravan 

The LawnCaravan is scenery in RmStaffE. Printed name of the LawnCaravan is "Lawn's caravan". The LawnCaravan is proper-named.

Understand "caravan" and "Lawn" and "Lawn's caravan" as the LawnCaravan.

Does the player mean doing something with Lawn: it is likely.

Description of the LawnCaravan is "Lawn keeps his caravan spotlessly clean, but it's an old old caravan. It's starting to turn the colour an apple slice turns when you leave it out on the counter for a few days."

Check entering the LawnCaravan:
	try going east instead.


Book - RgCaravans (Caravans)

RgCaravans is a region. RmRingmaster, RmLola, RmFreda, RmAdagio and RmLawn are in RgCaravans.

Part - RmRingmaster (Ringmaster's Camper)

RmRingmaster is a room. Printed name of RmRingmaster is "Ringmaster's Camper". RmRingmaster is short-interior.
RmRingmaster is south of RmStaffS.

Instead of going outside in RmRingmaster:
	try going north.
Instead of exiting in RmRingmaster:
	try going north.

Description of RmRingmaster is "The Ringmaster's got one of those super-nice campers with the wood panelling and everything. Since he does most of the actual running of the place, the chairs are piled high with legal paperwork and accounts and bills and correspondence. You can clamber out north to the staff area[if Introduction is happening] once you've tried to calm down the Ringmaster[end if]."

Chapter - Paperwork

The paperwork is in RmRingmaster.
The paperwork is scenery.

Understand "legal" and "account/accounts" and "bill/bills" and "letter/letters/letterhead/correspondence" and "document/documents/documentation" and "paper/papers" as the paperwork.

Description of the paperwork is "All the boring legal and financial stuff: where you're allowed to pitch the big top in each city, ownership details and licenses, staff wages, and so on[paperwork context desc].".

To say paperwork context desc:
	unless EndgameC is happening:
		say ". Glad it's not your job to deal with this stuff!

There's a letter on the top of the pile which catches your eye. The letterhead's from a local politician - 'the Right Honourable Marcus Pooting MP', nice name. But the text itself is kinda not very nice. It's about how the greenfield site, where you are now, needs to be developed into businesses, and how the circus is in the way, and how they're going to take 'action' if you don't pack up and leave. You're a travelling circus, you're going to leave anyway at some point, but this is one of your best seasonal sites. It'll be a shame if you lose it. Maybe the boss knows something about it";
	otherwise:
		say ". All the stuff that, to be clear, should not be thrown into a lake".

[this next block is logic for the Ringmaster main conversation tree]
After examining the paperwork:
	now the paperwork is known;
	now PhantomPlanKnown is true; [defined and used in the epilogue text]
	activate Mast_letters.

Instead of rearrangement when the noun is the paperwork, say "'No no, please leave that where it is, please,' says the Ringmaster. 'I have a system.'"
	
Chapter - Panelling (scenery)

The wood panelling is scenery in RmRingmaster. Understand "wood/wooden" and "paneling/panelling" as the wood panelling.

Description of the wood panelling is "It's probably just varnished plywood or something, but it's still nice."

Chapter - Chairs (scenery)

The chairs are scenery in RmRingmaster. Understand "chair" or "seats" or "seat" as the chairs.

Description of the chairs is "They've been buried under paperwork for years. They weren't bow-legged when the boss bought them."

Check entering the chairs:
	say "All the chairs here are occupied by papers." instead.
	
Instead of rearrangement when the noun is the chairs, say "The thick layers of paperwork practically cement the chairs in place."


Part - RmLola (Lola's Caravan)

RmLola is a room. Printed name of RmLola is "[Our] Caravan". RmLola is short-interior.
RmLola is south of RmStaffSE.

Description of RmLola is "It's not much, but it's yours. Really, it's just a place for sleeping (and you do most of that in Freda's caravan these days) and for keeping your props and medication. You can exit north to the staff area."

Instead of going outside in RmLola:
	try going north.
Instead of exiting in RmLola:
	try going north.

Chapter - Props (scenery)

The props are scenery in RmLola.
The props are known.

Description of the props is "You don't touch most of this stuff anymore. A lot of it ought to be donated to a clown college, really. The only things you regularly use are the pies and the balloons."

Check taking the props:
	if the stack of pies is handled:
		if the bendy balloons are handled:
			say "There's nothing else here that looks useful." instead;
		otherwise:
			say "The only useful thing here is the balloons." instead;
	otherwise:
		if the bendy balloons are handled:
			say "The only useful thing here is the stack of pies." instead;
		otherwise:
			say "Only the stack of pies and the balloons look useful here." instead.
			
Chapter - Medication (scenery)

The medication is scenery in RmLola.
The medication is known.

Description of the medication is "You know, hormones, boy-pills. Well, you're not going that far with them. Less-girl-pills."

Understand "medicine" and "hormone/hormones" and "pill/pills" and "boy-pill/boy-pills" and "less-girl-pill/less-girl-pills" as the medication.

Check taking the medication (this is the don't take the medicine rule):
	say "You're actually going to leave your pills well alone. You don't want to lose them again." instead.
	
Check shooting the medication with the bow (this is the don't shoot the medicine rule):
	say "Actually, you know what, maybe your medication is too important to be destroyed." instead.
	
Check throwing the stack of pies at the medication (this is the do pie the medicine rule):
	say "You splatter a pie over the medication, making them custard-flavoured." instead.
	
The medication is edible.
Check eating the medication (this is the don't eat the medicine rule):
	say "You took your dose before meeting the boss today." instead.

Chapter - Stack of pies

The stack of pies is in RmLola. "Your trusty stack of custard pies is here."

Understand "pie" and "custard" as the stack of pies.
The stack of pies is ambiguously plural.

Description of the stack of pies is "A stack of light, custardy, throwable pies. They are to your trade what a shuriken is to a ninja. How many pies? More than enough to splat anything that moves."

The stack of pies is edible.
Check eating the stack of pies:
	say "You take a nibble, but only a nibble, because these things don't actually taste that good. It's throwing custard, not cooking custard." instead.
	
Report taking the stack of pies:
	say "You grab the whole stack. Why stop at one?" instead.

Section - Throwing pies

[Code in this section is mashed up from Inform 7 documentation examples 404 "Kyoto" and 127 "Technological Terror"]

The futile to throw things at inanimate objects rule is not listed in the check throwing it at rules.
The block throwing at rule is not listed in the check throwing it at rules.

Check throwing something at something (this is the check if throwing pie or other object rule):
	if the noun is the lettuce leaf:
		say "The wet romaine leaf fwips pretty far, sticks to [the second noun] for a second, then slips off and falls to the ground[if the second noun is a person]. [The second noun] looks at you reproachfully[end if].";
		silently try dropping the lettuce leaf instead;
	otherwise if the noun is the red nose:
		say "No! The nose stays on!" instead;
	otherwise if the noun is the bow:
		say "You chuck an arrow like a dart, and it works about as well as when you play darts. Shooting the bow at things might be more effective." instead;
	otherwise if the noun is not the stack of pies:
		say "Sad to say, when it comes to throwing anything heavier than a matchstick, your throwing arm is trained for one kind of missile only. [The noun] [drop] pathetically to the ground one foot away from you. You scoop [regarding the noun][them] up again and hope nobody noticed." instead.
	
Carry out throwing something at something (this is the pie throw responses rule):
	if the second noun is the stack of pies:
		say "You clap two pies together, splattering them in a way that doesn't solve any puzzles but is still very satisfying.";
	otherwise if the player is carrying the second noun:
		say "You splatter a pie over [the second noun]. Messy!";
	otherwise if the second noun is the player:
		say "The self-pieing is a cheap laugh, but a laugh nonetheless. Splat!";
	otherwise:
		say "Splat!".
	
Section - Throwing pies at NPCs

A person has some text called the pie reaction.
The pie reaction of a person is usually "[regarding the second noun][They] glower at you and return to what [regarding the second noun][they] were doing."

To wipe is a verb. [no gameplay attached, but defined for the purpose of adaptive text below]

Report throwing something at a person (this is the pie reaction rule):
	say "[The second noun] instinctively [wipe] custard from [regarding the second noun][their] eyes with both hands. [pie reaction of the second noun][paragraph break]".
	
[this section applies to animals as well as humans, but the prevent animal pieings rule below stops the throwing it at action getting as far as the report stage for animals]

Section - Stop throwing pies at animals

Check throwing something at an animal (this is the prevent animal pieings rule):
	say "You think animals maybe don't get the joke of pie throwing, and they would think you were just attacking them instead, and that would make you very sad. You hold your fire." instead.
	
The prevent animal pieings rule is listed after the check if throwing pie or other object rule in the check throwing it at rules.

[*IDEA: No environmental changes at all after pieing - maybe characters and objects are listed as "custardy" for ten turns until the custard drips off?]



Chapter - Bendy Balloons

The bendy balloons are in RmLola. The bendy balloons are inflatable. The bendy balloons are plural-named. Understand "balloon" and "bendy balloon" and "sculpture balloon/sculpture balloons" and "long/long balloon/long balloons" as the bendy balloons.

Description of the bendy balloons is "[first time]These things are why you wanted to talk to the boss in the first place. [only]You couldn't get your usual brand of balloons for making animals last time you ordered, so you got these 'Special Vulcanised Sculptural Balloons' instead. Big mistake - the rubber is so tough you can't even blow them up with your own lungs."

Does the player mean doing something to the bendy balloons: it is very likely.

Section - Balloon sculptures

A thing can be floating. A thing is usually not floating.

Balloon Limbo is a room. [room which stores unused balloon sculpture objects - not necessary (I could just say they're nowhere, or reuse the Burger Limbo room), but this is easier for me to read]

Instead of untying a floating thing:
	say "Was Michelangelo able to uncarve David? No. You can't unsculpt a balloon sculpture."
	
Check shooting a floating thing with the bow:
	say "The arrow bounces harmlessly off the thick rubber of [the noun]." instead.

Section - Dropping sculptures (floating things which float away)

Carry out dropping a floating thing (this is the balloon sculptures float away rule):
	unless the location of the player is short-interior:
		say "You let go of [the noun] and watch it escape into the [if the location of the player is exterior]sky[otherwise]recesses of the ceiling[end if], out of your sight[if the noun contains something]. On its way up, an air current catches the unstable [noun] and tips [the list of things contained by the noun] into your arms[end if].";
		now the noun is in Balloon Limbo;
		let L be the list of things contained by the noun;
		repeat with item running through L:
			move item to the player;
		rule fails.
		
Check throwing a floating thing at something (this is the can't throw balloon sculptures rule):
	try dropping the noun instead.
		
Report dropping a floating thing when the noun is in Balloon Limbo (this is the don't say 'dropped' after letting a balloon go rule):
	do nothing instead.

Report dropping a floating thing when the location of the player is short-interior (this is the balloon sculptures don't float away in small rooms rule):
	say "[The noun] bumps gently against the ceiling, still within reach." instead.

Check dropping a floating thing when the player is in the clown car (this is the prevent dropping balloons in car rule):
	say "[The noun] drifts around the ceiling of the car and gets between you and the windshield. You're forced to hold onto it again, for safety." instead.

Section - Making balloon sculptures

Carry out inflating the bendy balloons:
	say "You grab a balloon and blow it up with the helium. What sculpture do you wanna make?";
	switch to cyoa at Balloon_hub.
	
Balloon_hub is a page.

Balloon_dog is a page.
"You quickly twist the balloon into a dog-like shape."
The cdesc is "Dog". It is for Balloon_hub. It is an end-page.

A page-toggle rule for Balloon_dog:
	pop and replace the dog sculpture.

Balloon_basket is a page.
"You quickly weave the balloon into a basket-like shape."
The cdesc is "Basket". It is for Balloon_hub. It is an end-page.

A page-toggle rule for Balloon_basket:
	pop and replace the basket sculpture.
	
Balloon_circle is a page.
"You quickly bend the balloon into a perfectly circular shape."
The cdesc is "Perfect circle". It is for Balloon_hub. It is an end-page.

A page-toggle rule for Balloon_circle:
	pop and replace the circle sculpture.
	
Balloon_frost is a page.
"You quickly tangle the balloon into your best attempt at a Robert Frostian-shape."
The cdesc is "Celebrated American poet Robert Frost". It is for Balloon_hub. It is an end-page.

A page-toggle rule for Balloon_frost:
	pop and replace the Robert Frost sculpture.

To pop and replace (sculpture - an object):
	let L be the list of things contained by the sculpture;
	unless the sculpture is in Balloon Limbo:
		if the player carries the sculpture or the location of the player is the location of the sculpture:
			say "(As you work on this, the [sculpture] [if the player carries the sculpture]you already have[otherwise]nearby[end if] mysteriously springs a leak and forces you to toss it away...)";
			repeat with item running through L:
				move item to the player;
		otherwise:
			say "(Somewhere, a superfluous [sculpture] [one of]bursts unexpectedly[or]gets found and stolen by a delinquent child[or]is blown by a gust of wind into the ether[purely at random]...)";
			repeat with item running through L:
				move item to the location of the sculpture;
	now the player carries the sculpture.

Section - Dog sculpture

The dog sculpture is floating. The dog sculpture is in Balloon Limbo.

Description of the dog sculpture is "A helium balloon twisted to look like a dog with bulbous ears, four legs as fat as its body, and a little knotted balloon neck dangling off its snout. You knew a dog like this once."

Check eating the dog sculpture:
	say "No need, you haven't eaten any cats recently." instead.

Section - Basket sculpture

The basket sculpture is floating. The basket sculpture is in Balloon Limbo.

Description of the basket sculpture is "A helium balloon which has been knotted and woven to make a little basket about the size of a human head. Useful for storing juggling balls and other props. Heck, this balloon rubber is so thick you could probably keep chainsaws in here. The basket is pumped full of enough helium that it'll float away as soon as you let go."

The basket sculpture is a container. The basket sculpture is transparent, open, unopenable, unlocked, not enterable and not lockable.

Check inserting the stepladder into the basket sculpture (this is the prevent obviously silly ladder-in-balloon scenario rule):
	say "The ladder's way too big for that." instead.
	
Check wearing the basket sculpture:
	if the basket contains nothing:
		say "You can't keep it on since it threatens to float straight off your head, but you try it on anyway. It feels just slightly bigger than a normal hat." instead;
	otherwise:
		say "It won't fit, because there's something that isn't your head that's already in the basket." instead.
	
Report inserting a hat into the basket sculpture:
	say "The hat fits just about perfectly!" instead.


Section - Circle sculpture

The circle sculpture is floating. The circle sculpture is in Balloon Limbo.

Description of the circle sculpture is "A helium balloon which has been bent and knotted freehand (with great effort, thanks to the extreme thickness of the rubber) into a perfect circle, about a foot-and-a-bit across. This might be your greatest talent, but you almost never get to show it off. Kids don't want perfect geometry, they want balloon dogs. Which is fine! You love making dogs too. But still."

Check throwing the circle sculpture at something (this is the hoop throwing joke rule):
	say "[bracket]attempting to use the circle as a throwing hoop to win [the second noun] as a prize[close bracket]".
	
Before putting the circle sculpture on the goose (this is the use circle sculpture as necklace joke rule):
	if Beast Show is happening:
		say "'Focus!' hisses Lawn as you try to thread the circle through the bars." instead; [this doesn't fire if I don't do this as a before rule - hacky and not funny enough to be worth it, but we all strive]
	otherwise:
		say "You try very hard to dress up the goose in the circle like a necklace. The circle is too big for the goose's body, never minds its neck. The goose rebels and bites the circle, but the rubber is too tough to destroy. [if EndgameA is happening]Lawn, Freda and Adagio start betting on who'll win, and you get self-conscious and stop trying[otherwise]Nobody is happy with this[end if]." instead.

Section - Robert Frost sculpture

The Robert Frost sculpture is floating. The Robert Frost sculpture is in Balloon Limbo.

Description of the Robert Frost sculpture is "A helium balloon which has been twisted into a balloon portrait of the celebrated American poet Robert Frost. You're pretty sure it looks like him, anyway. Nobody else recognises him, but you're... you're pretty sure."


Part - RmFreda (Freda's Camper)

RmFreda is a room. Printed name of RmFreda is "Freda's Camper". RmFreda is short-interior.
RmFreda is east of RmStaffSE.

Instead of going outside in RmFreda:
	try going west.
Instead of exiting in RmFreda:
	try going west.

Description of RmFreda is "You spend more time here than in your own caravan. Freda fills the poky camper like how custard fills a pie dish, and most of the rest of the space is taken up by barbells, but that's fine by you, that just makes the place cosier. If you have to leave, the door out to the staff area is west."



Chapter - Barbells (scenery)

The barbells are scenery in RmFreda. Understand "barbell/dumbbells/dumbbell" as the barbells. The barbells are known.

Description of the barbells is "A huge mess of huge barbells, somehow tangled together like one of those packing puzzles. There's a slight tilt to Freda's camper where they're weighing down that end."

Check taking the barbells:
	say "Hah. You can't even lift the bars, let alone the bells." instead.
	
Check pulling the barbells:
	try pushing the barbells instead.
Check turning the barbells:
	try pushing the barbells instead.
Check pushing the barbells:
	say "You manage to roll a barbell back and forth[if Freda is in RmFreda] while Freda cheers you on[end if]. You're never going to fit it through the door, though[one of][or][or]. Just to be clear about this, you're pretty sure you don't need the barbell for anything[or][stopping]." instead.
	
Check pushing the barbells to:
	say "None of the barbells fit through the exit, unless you turn one around and try to push it through the door lengthwise instead of rolling it, which, to be clear, is not going to happen without ten years of powerlifting and protein. There's nothing you need a barbell for, anyway." instead.
	
Chapter - Dashboard (scenery)

The dashboard is scenery in RmFreda. Understand "speedometer" as the dashboard.

Description of the dashboard is "The speedometer maxes out at 30mph. Well, it's a comfort camper, not a racing camper."

[this is only here because the speedometer is mentioned in the car puzzle sequence if you go to RmFreda]


Part - RmAdagio (Adagio's Camper)

RmAdagio is a room. Printed name of RmAdagio is "Adagio's Camper". RmAdagio is short-interior.
RmAdagio is north of RmStaffE.

Instead of going outside in RmAdagio:
	try going south.
Instead of exiting in RmAdagio:
	try going south.

Description of RmAdagio is "Adagio keeps her camper van neat as a pin - it's almost like she doesn't live here. The inside is lined with shelves of reference books on magic and academic things she's into. She's also converted the, you know, the bit that hangs over the driver's cab where you keep your children? She's converted that into a hutch. You can go south to head outside."

Chapter - Rabbit hutch

The hutch is a container in RmAdagio. The hutch is fixed in place and transparent.

Description of the hutch is "[if the location of the rabbit is RmAdagio]An empty rabbit hutch. [The rabbit] seems to prefer the cosiness of Adagio's hat[otherwise]Probably a rabbit hutch, though you're not sure since there's no rabbit around[end if]."

Check inserting something into the hutch:
	if the noun is the lettuce leaf:
		if the location of the rabbit is RmAdagio:
			say "You pop the lettuce into the hutch. Adagio's hat moves, you see a white blur streak through the hutch and hear a noise like a chainsaw passing by, and suddenly the lettuce is gone, the hat rocking back into place.";
			move the lettuce leaf to Burger Limbo instead;
		otherwise:
			say "In it goes. That's be a treat when [the rabbit] spots it.";
			move the lettuce leaf to the hutch instead;
	otherwise:
		say "Anything that goes in there is fated to be destroyed by a rabbit. You can probably find a better use for [the noun]." instead.
		
Check opening the hutch:
	say "It's actually the bit of the camper above the driver's cab, so it's always an open-faced hutch." instead.
Check closing the hutch:
	try opening the hutch instead.
	
Instead of entering the hutch:
	say "You respect Adagio and her rabbit too much to climb in and trash the hutch, and also you don't want Adagio to snap at you like last time.".

Section - Wicker bowl of salad

The wicker bowl of salad is in the hutch.

Description of the wicker bowl of salad is "A sort of hay salad - mostly hay with some shreds of romaine lettuce and a few carrot shavings, served in a wicker bowl."

Check taking the wicker bowl of salad:
	say "'That's for the rabbit,' scolds Adagio. 'You can get food any time you like from the burger stall, you know.'" instead.
	
Check eating the wicker bowl of salad:
	try taking the wicker bowl of salad instead.
	

Chapter - Bookshelf

The bookshelf is in RmAdagio. Understand "book" and "books" and "shelf" and "shelves" and "bookshelves" as the bookshelf. The bookshelf is scenery.

Description of the bookshelf is "There are all sorts of biographies of magicians and collections of card tricks here - Adagio's the kind of person who studies her classics. Most of the other books are books for very smart people: French philosophy and Italian sociology and stuff like that. It makes your head spin, but Adagio likes that sort of thing."

Understand the command "read" as something new. Reading is an action applying to one thing. Understand "read [something]" as reading.
Check reading:
	try examining the noun instead.

Check reading the bookshelf (this is the response to reading Adagio's books rule):
	say "You open a random book at a random page, see the phrase '[one of]a priori[or]problematisation[or]quid pro quo[or]Foucaultian énoncé[or]phenomenology[or]doctrine of univocity[at random]', and quietly put the book back." instead.

Check taking the bookshelf (this is the response to taking Adagio's books rule):
	if Adagio is in RmAdagio:
		say "'You want to borrow that one, do you?' says Adagio as you slide a random book out. 'Do let me know what you think of the [one of]chapter[or]author's views[or]meditation[at random] on [one of]metaphysics[or]experiential landscape[or]post-structural analysis[or]hauntology[at random], will you? I've been itching to talk about it.'[paragraph break]You don't need that kind of pressure. You put the book back." instead;
	otherwise:
		say "You never got any of Adagio's books before and you don't need to start now." instead.


Part - RmLawn (Lawn's Caravan)

RmLawn is a room. Printed name of RmLawn is "Lawn's Caravan". RmLawn is short-interior.
RmLawn is east of RmStaffE.

Instead of going outside in RmLawn:
	try going west.
Instead of exiting in RmLawn:
	try going west.

Description of RmLawn is "Lawn's caravan smells surprisingly good, given that he shares it with a goose. The bed has been ripped out and replaced with a paddling pool. Not for the first time, you wonder if it's actually the goose's caravan and Lawn sleeps on the roof or something. The exit is west."

Check smelling in RmLawn:
	say "Smells good in here! Surprising!" instead.

Chapter - Pool (scenery)

The paddling pool is scenery in RmLawn. Understand "bed" as the paddling pool.

The paddling pool is known.

The paddling pool is a container. The paddling pool is not enterable. The paddling pool is transparent. The paddling pool is open. The paddling pool is unopenable.

The paddling pool can be intact, afloat or punctured. The paddling pool is intact.

Description of the paddling pool is "A little inflatable children's paddling pool, you know, the kind that lasts for one week in the summer before one of your brothers explodes it trying to do a triple somersault into it from the upstairs window. This pool [if the paddling pool is intact]is remarkably intact, and even more remarkably clean and empty. You think Lawn fills it every night and empties it in the morning[otherwise if the paddling pool is afloat]is currently gently bumping along the ceiling[otherwise]has mysteriously met such a fate[end if]."

Check taking the paddling pool: say "You probably won't need it, and you don't have the patience to deflate it so you could get it out the door anyway." instead.

Check entering the paddling pool:
	if the pool is afloat:
		say "Not unless gravity inverts, you can't." instead;
	otherwise if Lawn is in RmLawn:
		say "'Hey, no!' barks Lawn. 'Goose only!'" instead;
	otherwise:
		say "[one of]With Lawn gone, you tentatively set foot inside the pool. You hear an unsettling squelching sound from within the pool. You remove your foot[or]The less you investigate, the better, perhaps[stopping]." instead.
		
Check inflating the paddling pool (this is the use helium on pool rule):
	if the paddling pool is punctured:
		say "Nothing's inflating this pool ever again." instead;
	otherwise if the paddling pool is afloat:
		say "It can't really get any more inflated than it already is." instead;
	otherwise if Lawn is in RmLawn:
		say "'Leave it alone!' snaps Lawn." instead;
	otherwise:
		if the player carries the helium canister:
			now the paddling pool is afloat;
			say "You quickly pump some helium into the pool. Now it's floating along the ceiling. This is a great prank to play on a goose." instead;
		otherwise:
			say "You might be able to get more air in there, but not with your lungs alone." instead.
			
Check shooting the paddling pool with the bow:
	if Lawn is in RmLawn:
		say "'No, no, no!' yells Lawn, pushing your bow off-target as you take aim." instead;
	otherwise:
		unless the paddling pool is punctured:
			now the paddling pool is punctured;
			say "You shoot the pool and puncture it. It slowly sinks to the floor and sags into a puddle of plastic. [if the Ringmaster is in RmLawn]'I, I hope you're going to pay for another one for Ken, b-because I haven't budgeted for this,' says the boss[otherwise]This is a rude prank to play on a goose[end if]." instead.

Book - RgCarnival

RgCarnival is a region. RmCarnivalW, RmCarnivalSW, RmCarnivalNW and RmCarnivalN are in RgCarnival.

Part - Crowd backdrop, which is also audience backdrop

[I want to have this up under Characters but things break when I move this (I think because I need to define a region before placing backdrops in it), and at this stage the project is big enough that I may forget something while I move things around and introduce a new bug]

The crowd is a backdrop in RgCarnival. The crowd is ambiguously plural. The crowd is personlike.
Understand "person/people" and "man/men" and "woman/women" and "boy/boys" and "girl/girls" and "child/children" and "couple/couples" and "audience" and "spectator/spectators" as the crowd.

Description of the crowd is "[crowd desc]."

To say crowd desc:
	if the player is in RgCarnival:
		say "The carnival is full of children and couples and families today, all [if the Phantom is unmasked]bristling nervously[otherwise]enjoying the warm weather and the carnival atmosphere[end if]";
	otherwise:
		say "The circus is packed with young and old, all watching you and the ring intently".
		

Chapter - Moving crowd into and out of Big Top for shows

[I define a truth state because I want to have more control over how the game acknowledges the state of the audience. Otherwise I have to do this with scenes (which is tricky because of my structure and because scenes aren't usually updated until the ends of turns which is a problem if I need to show the audience on the same turn) or locations (which is tricky because, as "showme crowd" suggests, the crowd object itself is always out of play and is just placed in scope of wherever you want the backdrop to be)]
AudienceSeated is a truth state that varies.
AudienceSeated is false.

To seat the audience:
	move the crowd backdrop to all audience-accommodating rooms; [that is, just RmRing and RmStands. I think the crowd disappears from the carnival, but that's okay because when this happens the player shouldn't be able to go outside anyway]
	now AudienceSeated is true.
	
To unseat the audience:
	move the crowd to RgCarnival;
	now AudienceSeated is false.
[okay I need to talk about this. the fact that "move the ___ backdrop" is correct syntax in one case but not the other is maddening. There must be some deep-seated reason baked into the Inform code why it has to be like this, because it's clearly not a very helpful or intuitive way to do it. I like Inform 7 and all, but, like, I get why people don't.]


Chapter - Random behaviours of crowd

Every turn when the crowd is in the location of the player (this is the crowd bustling rule):
	if the player is in the clown car:
		do nothing;
	if AudienceSeated is true:
		do nothing;
	otherwise:
		if a random chance of 1 in 3 succeeds:
			unless EndgameA is happening:
				choose a random row in the Table of Regular Crowd Bustling;
				say "[event entry][paragraph break]";
			otherwise:
				choose a random row in the Table of Nervous Crowd Bustling;
				say "[event entry][paragraph break]".

Table of Regular Crowd Bustling
event
"A [crowdchild] [if the player is on the love booth]flits past the booth[otherwise]weaves through your legs[end if] and melts into the crowd[one of][or], chased by a parent[purely at random]."
"Some children scream somewhere nearby. (Good screams! The kind kids do when they just wanna be loud.)"
"You see [crowdparents] [one of]arguing over a schedule[or]making phonecalls[or]eating sandwiches[purely at random] while some children [one of]loiter[or]play[or]wait impatiently[purely at random] nearby."
"A[one of][or] young[or]n elderly[purely at random] couple pass by, [one of]their hands clasped together[or]sharing a quick kiss[or]talking excitedly[purely at random]."
"A sub-crowd of children pass by, herded like sheep by [crowdparents]."
"[if the player is on the love booth]The booth wobbles a little as a passer-by bumps into it[otherwise]You get nudged around a little in the press of people[end if]."
"You overhear one [crowdchild] tell another excitedly about [past-events]."

Table of Nervous Crowd Bustling
event
"You pass [crowdparents] counting children to make sure they're all safe."
"Nearby, a [crowdchild] looks up from a phone and asks where the ferris wheel went."
"You see [crowdparents] carefully herding their charges to the exit."
"You overhear one [crowdchild] tell another excitedly about [past-events]."
"[if the player is on the love booth]The booth is[otherwise]You're[end if] bumped into by a nervous-looking [one of]man[or]woman[or]person[purely at random] looking for the exit."

To say crowdparents:
	say "[one of]a mum and dad[or]some adults[or]two dads[or]two mums[or]a couple of teachers[purely at random]".

To say crowdchild:
	say "[one of][or]little [purely at random][one of]boy[or]girl[or]child[purely at random]".

To say past-events:
	let N be a random number from 1 to the number of entries in the list of past events;
	let T be entry N in the list of past events;
	say T.
	
The list of past events is a list of texts that varies. The list of past events is { "the rumours of a ghost that haunts the Big Top" }.

[this function is called when a show is solved, and adds a slightly misremembered description of that show to the list of past events]
To memorialise (T - a text):
	 add T to the list of past events.

Chapter - Talking

Check item-asking the crowd about something (this is the item-ask crowd rule):
	say "You ask around about [the second noun], but you don't hear much that's useful." instead.
	
Chapter - Other fun crowd interactions

Check throwing the stack of pies at the crowd (this is the pie the crowd rule):
	say "You hurl a few pies at randomly-chosen people. The victims [unless the player is in RgBigTop]stop to [end if]scoop custard out of their eyes with both hands. Those who weren't targeted laugh and applaud, and then some of them avoid eye contact with you and [unless the player is in RgBigTop]powerwalk to a different part of the carnival[otherwise]move to a seat further back from the ring[end if]." instead.
	
Check giving a floating thing to the crowd:
	now the noun is in Balloon Limbo;
	say "You hand [the noun] to a [crowdchild], who says thank you and [one of]trots away with it happily[or]immediately drops it into the sky[purely at random]." instead.
	
[*TODO:
	don't allow direct interaction while in ring
	add more "something personlike" actions]


Part - RmCarnivalW (Carnival, by the Entrance)

RmCarnivalW is a room. Printed name of RmCarnivalW is "Carnival, by the Entrance".
RmCarnivalW is west of RmEntranceTent.

Description of RmCarnivalW is "You're right outside the entrance to the Big Top, in the carnival. There's a balloon stand here, but it's not getting much traction, probably because none of the balloons float. You can enter the Big Top by heading east.

There's more carnival to the south and north (and the northeast, if you take a shortcut through the tent ropes)."

Chapter - Entrance

The entrance is scenery in RmCarnivalW.

Description of the entrance is "To your east, there's a little tent attached to the main tent which acts as the entrance. There's a poster stuck here, one of the ones the others have been sticking all over town to promote the circus."
Understand "tent" and "entrance tent" as the entrance.

Check examining the entrance:
	now the poster is known.

Instead of entering the entrance (this is the redirect entering entrance to direction rule):
	try going east.
	
Section - Poster

The poster is scenery in RmCarnivalW.

Description of the poster is "[first time]Oh, you haven't seen the new poster yet! [only]This poster has a lovely photo of Adagio and her rabbit, Freda, and Lawn and the goose. Well, Ken seems to be struggling but the rest of them are looking happy. You don't remember where you were when they did this photoshoot - you think this must have been one of the days you were stuck down that old well.

Shame about the misprint. They've put 'THE GREATEST SOW ON EARTH !!' instead of 'SHOW'. Looks like the boss had to correct it himself. Well... maybe people will think it's charming?"
Understand "advert" and "advertisement" and "photo" and "photograph" as the poster.
[what I should do here is have all the people in the photo as synonyms. I know, I know. But it's late, I'm tired, and I can see bugs being introduced when trying to ask about other people. Better to have "Freda" unambiguously mean Freda, I think.]

Instead of rearrangement when the noun is the poster:
	say "Not that you care to admit this, but the paper these things are printed on is pretty flimsy. There's no moving this poster now unless you want to make papier-mache out of it.". 

Chapter - Balloon stand

The balloon stand is in RmCarnivalW. The balloon stand is scenery. Understand "balloons" and "counter" as the balloon stand.

Description of the balloon stand is "It's a rickety little stall giving out free balloons. No one seems to want them, probably because they're useless and they don't float. There's a little ban on helium balloons at the moment, because the kids kept losing their balloons, and they kept bumping into drones and getting sucked into jet engines. The balloons, not the kids[unless the helium canister is handled].

There's a canister of helium from before the little ban here, lying unused[end if]."

Check taking the balloon stand: say "You've got your own balloons in your caravan." instead.

Chapter - Helium Canister

[the helium canister doesn't do much by itself, but having it is necessary for inflating the bendy balloons]

The helium canister is in RmCarnivalW.

Initial appearance of the helium canister is "You can spot an unused helium canister behind the counter of the balloon stand."

Description of the helium canister is "A pressurised canister which can be used to inflate balloons with helium. The carnival isn't actually using this right now. Kids were letting too many balloons fly into the sky. The air traffic control authorities were starting to send you some nasty letters."

Instead of eating the helium canister (this is the breathing helium rule):
	say "You treat yourself to a cheeky puff of helium[first time]. You wish it still changed your voice, but you've accidentally built up a tolerance over the years[only]."
	
Instead of giving the helium canister to someone:
	try item-asking the second noun about the helium canister.
	
Check shooting the helium canister with the bow:
	say "Helium is one of a clown's most precious resources - let's not waste it by puncturing the canister." instead.

Chapter - Jenny (Hired help)

A woman called the hired help is in RmCarnivalW. Understand "local/hire/hired/help/worker" as the hired help.
The hired help is known.

Initial appearance of the hired help is "The stall is being run by some local hired help, who's preoccupied with manually blowing up more balloons.".

[following adapted from Inform docs example 32 "Gopher-wood"]
Check examining the hired help for the first time:
	rename the hired help. [factored out to use in Freda convo]
	
To rename the hired help:
	now the printed name of the hired help is "Jenny";
	now the hired help is proper-named.
	
Understand "Jenny" as the hired help when the hired help is proper-named.

Description of the hired help is "Her nametag says she's Jenny. Jenny is occupied blowing up [if the tyre is removed]a shredded car tyre, fruitlessly[otherwise]hundreds and hundreds of balloons with her own lungs just in case there's a rush for balloons[end if]. She gets paid £10 an hour, and by gosh she's earning it."

Section - Talking to the hired help

Instead of asking the hired help about something: try talking to the hired help. Instead of item-asking the hired help about something: try talking to the hired help.

Check talking to the hired help:
	say "[The hired help] [one of]wheezes incomprehensibly[or]huffs and puffs[purely at random] and gives you a thumbs-up. Best leave her be, she's doing her best." instead.
	
Section - idle behaviours

Every turn when the location of the player is the location of the hired help (this is the hired help idle daemon rule):
	unless a climactic scene is happening:
		if a random chance of 1 in 8 succeeds:
			say "[The hired help] [one of]spots you and gives you a big thumbs-up without pausing for breath[or]ties up an inflated balloon and immediately starts blowing up another without any pause for breath[or]accidentally breathes in instead of out and deflates the balloon she's working on[as decreasingly likely outcomes].".

Section - gesture reaction

The gesture reaction of the hired help is "[The hired help] tries to mimic you without letting go of the [if the tyre is undamaged or the tyre is slashed]balloon[otherwise]tyre[end if] she's holding, and wobbles a little bit."

Section - persuasion refusal

The persuasion refusal of the hired help is "She seems busy".

Section - pie reaction of the hired help, plus rule for trying to pie her earlier

Instead of throwing the stack of pies at the hired help when the tyre is undamaged or the tyre is slashed:
	[tying it to the tyre state ensures that this only fires until she takes the changed tyre from Freda]
	say "The pie rebounds off the balloon in front of [the hired help]'s face and into your own face! Splat! Everyone around you laughs and applauds[one of]. It's one of the best slapstick routines you've ever done, and only mildly embarrassing[or][stopping]."
	
Pie reaction of the hired help is "Then she goes right back to trying to blow up the tyre with steely determination. Attagirl[if the hired help is proper-named], Jenny[end if]."


Section - giving bendy balloons to the hired help

To say hired help can't inflate bendy balloons:
	if the tyre is undamaged or the tyre is slashed:
		say "[The hired help] takes one of your balloons and tentatively gives it a few blows. Her lungs aren't having any more luck than yours, though. She hands it back with an apologetic shrug and goes back to her own balloons";
	otherwise:
		say "[The hired help]'s very busy trying and failing to blow up a punctured tyre right now".

Check giving the bendy balloons to the hired help:
	say "[hired help can't inflate bendy balloons]." instead.

Persuasion rule for asking the hired help to try inflating the bendy balloons:
	persuasion succeeds.
	
Carry out the hired help trying inflating the bendy balloons:
	say "[hired help can't inflate bendy balloons]." instead.

Part - RmCarnivalSW (Carnival, under the Big Wheel)

RmCarnivalSW is a room. Printed name of RmCarnivalSW is "Carnival, under the Big Wheel".
RmCarnivalSW is south of RmCarnivalW. RmCarnivalSW is west of RmStaffS.

Description of RmCarnivalSW is "You're mingling with the crowd in the carnival. Here, you're [if Unmasking has happened]under a conspicuous open spot where a ferris wheel used to be, next to an orphaned lever[otherwise]at the foot of the Big Wheel, which looms over everything. Shame it's not working today. The lever that operates it is here if you want to try spinning it yourself[end if].

The rest of the carnival is to the north. If you need a break, you can duck through the trailers to your east to get to the private staff area and the caravans."

Chapter - Big Wheel (scenery)

The Big Wheel is scenery in RmCarnivalSW. Understand "ferris" and "really" and "wheely" and "sign" as the Big Wheel.

The Big Wheel is known.

Description of the Big Wheel is "A tall and wide ferris wheel. The sign mounted on the central hub calls it 'the Wheely Big Wheel'. (That's a typo. It should say 'Really'.) Another sign says 'Closed for Repairs', because the lever next to you that operates it has been going a bit funny recently.

There are 21 cabs attached to the wheel. Only the bottom one, Cab [cab number], is reachable[if the stepladder is not handled]. A stepladder is dangling from Cab 14[end if]."

Check entering the Big Wheel:
	say "You peek inside Cab [cab number], but there's nothing inside[if the stepladder is not handled and the cab number is 14] (the stepladder isn't in the cab, it's dangling below in takeable range)[end if], so you hop out again. The Wheel isn't working right and your fear of heights is running at full capacity, so riding it isn't an option today." instead.
	
Check climbing the Big Wheel:
	say "You get about 12 feet up the wheel before panic sets in and you scramble back down. It's not that you're scared of heights. It's just that you're scared of falling from them." instead.
	
Check turning the Big Wheel:
	say "You give it a big heave, but the Wheel fails to budge. You think maybe there's ratchets and stuff to stop people doing that. You could, however, try to spin the Big Wheel by pushing and pulling the lever over there." instead.

Section - Cabs

The cabs are part of the Big Wheel. Understand "cab" and "cabs" and "cab 1" and "cab 2" and "cab 3" and "cab 4" and "cab 5" and "cab 6" and "cab 7" and "cab 8" and "cab 9" and "cab 10" and "cab 11" and "cab 12" and "cab 13" and "cab 14" and "cab 15" and "cab 16" and "cab 17" and "cab 18" and "cab 19" and "cab 20" and "cab 21" as the cabs.

[Yeah, I know. I'm adding this late in the dev process and I simply cannot be bothered to look up how to have it accept any number from 1 to 21 but no other numbers. This is good enough.]

Description of the cabs is "Little cabs around the outside of the Big Wheel. You can only get on them when they're at the bottom of the Wheel, so only one cab at a time can be reached. Right now, that's Cab [cab number][if the stepladder is not handled]. There's a stepladder caught up on Cab 14[end if].".

Before doing something other than examining to the cabs:
	now the noun is the Big Wheel;
	try the current action instead.

Section - Only one cab available at a time

Cab number is a number that varies. Cab number is 1.

Previous cab number is a number that varies. Previous cab number is 1.

Chapter - Lever

The lever is scenery in RmCarnivalSW. Understand "control" and "controls" as the lever.

Description of the lever is "This lever rotate[if Unmasking has happened]d the Big Wheel until very recently[otherwise]s the Big Wheel. Push it to turn the Wheel forwards, from Cab 1 to Cab 2 to Cab 3 and so on. Pull it to spin the other way, from Cab 2 to Cab 1 to Cab 21 to Cab 20 and so on. It's supposed to go one cab at a time, but the lever has been sticking recently. Now when you push it it goes three cabs forwards, and when you pull it it goes seven cabs back[end if]."

Instead of pushing the lever (this is the push lever to add 3 to wheel rule):
	if the player's command includes "move":
		say "Since the lever goes two ways, you gotta be more specific - you need to either push the lever or pull the lever[if Unmasking has happened]. Not that it matters anymore[end if].";
	otherwise if Unmasking has happened:
		say "The lever clunks forlornly.";
	otherwise:
		now the previous cab number is the cab number;
		let the sum be the cab number + 3;
		if the sum is greater than 21:
			now the sum is the sum - 21;
		now the cab number is the sum;
		say "The Big Wheel [one of]ticks forward one cab, and then another two[or]judders forward three cabs before you can stop it[at random]. Now only Cab [cab number] is reachable[if the cab number is 14 and the stepladder is not handled]. The stepladder scrapes around the ground under the Wheel, now in easy reach[otherwise][report wheel puzzle progress][end if].".
		
Instead of pulling the lever (this is the pull lever to take 7 from wheel rule):
	now the previous cab number is the cab number;
	let the sum be the cab number - 7;
	if the sum is less than 1:
		now the sum is the sum + 21;
	now the cab number is the sum;
	if Unmasking has happened:
		say "The lever clunks forlornly.";
	otherwise:
		say "The Big Wheel [one of]ticks backwards seven full cabs before stopping, despite your best efforts[or]judders six cabs backwards - and then one more for good measure[at random]. Now only Cab [cab number] is reachable[if the cab number is 14 and the stepladder is not handled]. The stepladder scrapes around the ground under the Wheel, now in easy reach[otherwise][report wheel puzzle progress][end if].".
		
Wheel frustration is a number that varies.
Wheel frustration is 0.
	
To say report wheel puzzle progress:
	if the stepladder is not handled:
		if the previous cab number is 14:
			say ". [one of]Wait, did you remember to get the ladder off Cab 14? Nuts, you didn't. Better spin it around again[or]Ah, you've done it again. The ladder's still on there. Spin it around again[or]The stepladder remains hooked to the ascendant Cab 14[or]You wonder if you can spin the wheel fast enough for the ladder to just fly off somewhere[or]No, no luck, the ladder didn't fly off anywhere. It's still up there[or]The stepladder is still on Cab 14. You should try taking it one of these days[stopping]";
		otherwise:
			now wheel frustration is wheel frustration + 1;
			if wheel frustration is 6:
				say ". This ladder is beginning to annoy you";
			otherwise if wheel frustration is 12:
				say ". This ladder is continuing to annoy you";
			otherwise if wheel frustration is 18:
				say ". Wait a minute. Is this maths? You don't care for maths";
			otherwise if wheel frustration is 24:
				say ". Part of your brain suggests getting a pencil and paper and working this out. The rest of your brain calls that part boring".
		

Chapter - Stepladder

The stepladder is in RmCarnivalSW. "Oh, look at that. A stepladder must've got caught up while someone was trying to fix the controls. It's dangling from the Big Wheel's Cab 14."

Understand "ladder" and "step-ladder" as the stepladder.

Description of the stepladder is "Fairly short as stepladders go, but still plenty high enough for you. About six feet tall? Two in clown feet[if the stepladder is not handled]. Right now it's just hanging around from Cab 14 of the Big Wheel[end if]."

Every turn when the location of the player is RmCarnivalSW and the stepladder is unknown: [this makes sure stepladder is known as soon as player enters CarnivalSW]
	[say "DEBUGDEBUGDEBUG Ladder now known.";]
	now the stepladder is known.

[*TODO:
	Prevent putting stepladder onto supporters
]

Section - Can't take stepladder until wheel puzzle solved

Before taking the stepladder when the stepladder is not handled (this is the enforce wheel puzzle before taking ladder rule):
	unless the cab number is 14:
		if the cab number is 13 or the cab number is 15:
			say "It's just one cab away from being reachable, but one cab is too many - it still dangles above the ground just out of your reach." instead;
		otherwise:
			say "The stepladder is caught up in Cab 14, high above the ground. You'll need to bring it down to Earth first." instead.
			
StepladderHandled is a truth state that varies. StepladderHandled is false.
After taking the stepladder when StepladderHandled is false (this is the first time taking stepladder report rule):
	say "You carefully unhook the stepladder from the bits and bobs of the cab. It's yours now!";
	now StepladderHandled is true.
[I'm using a truth state here instead of the handled property because otherwise this doesn't work. I think the handled property must get flipped during the carry out phase of taking a thing, which makes sense and is generally what I want, but it means a little wrangling here]

Check unhooking the stepladder:
	try taking the stepladder instead.
	
Check untying the stepladder:
	try taking the stepladder instead. [untying is a deeply unnatural way of describing it but it's fine, few players will discover this]
	
Section - Invalid solutions to getting stepladder

Check throwing the stack of pies at the stepladder when the stepladder is not handled:
	say "You hurl a pie at the stepladder[if the cab number is greater than 12 and the cab number is less than 16] and manage to splat it. But it just sways a little, stubbornly tangled up in Cab 14's workings[otherwise], but it's just too high off the ground to reach[end if]." instead.


	

Section - Climbing the stepladder

The block climbing rule does nothing when the noun is the stepladder.

Check climbing the stepladder when the stepladder is not handled (this is the stop climbing ladder when wheel unsolved rule):
	say "You can't, it's still hooked up in the Wheel." instead.

Check climbing the stepladder (this is the drop stepladder first rule):
	if the player carries the stepladder:
		say "(first dropping the stepladder)";
		silently try dropping the stepladder.

Carry out climbing the stepladder (this is the climbing stepladder response rule):
	say "You climb up the ladder. There's not much to see up here, and you're wobbling a lot more than you like to wobble usually, especially this far off the ground. So you climb back down quickly."
	
[See cage for some special rules re: carry out climbing stepladder next to the cage]
	
Section - Dropping stepladder

Report taking the stepladder:
	say "You close the stepladder and pick it up." instead.

Report dropping the stepladder:
	say "You open up the stepladder and place it on the [if the location of the player is exterior]ground[otherwise]floor[end if]." instead.
	
Check opening the stepladder:
	try dropping the stepladder instead.
Check closing the stepladder:
	try taking the stepladder instead.
	
Section - Ladder is big - prevents going some places and adds joke with crowd

Before going to RgCaravans while the player carries the stepladder (this is the stepladder can't go into caravans rule):
	say "You try to step inside, but the stepladder clangs off the entrance and knocks you back, like when a dog tries to bring a big stick through a doggy door. Maybe drop the ladder outside first." instead.
	
Before going to RgRides while the player carries the stepladder (this is the stepladder can't go into rides rule):
	say "The operator gives you a stern look and points at a sign behind them: 'NO STEPLADDERS.'" instead.

Before going in RgCarnival while the player carries the stepladder (this is the stepladder routine joke rule):
	say "Circus-goers have to duck and dodge the swinging ladder as you weave through the crowd."
The stepladder routine joke rule is listed last in the before rules. [prevents this rule firing at same time as other ladder rules]

Before entering the clown car while the player carries the stepladder (this is the stepladder can't be carried into car rule):
	say "[ladder bigger than car]. Maybe drop the ladder first." instead.
	
Before inserting the stepladder into the clown car (this is the stepladder can't be placed in car rule):
	say "[ladder bigger than car]." instead.
	
To say ladder bigger than car:
	say "The ladder bonks against the sides of the car door, and in fact there's a small problem with the whole idea here, which is that the ladder is longer than the car".

Section - Prevent taking ladder while on supporter

Check taking the stepladder while the player is on a supporter:
	say "Not possible. You just don't have the strength to lift the ladder from below while you're up here." instead.

Part - RmCarnivalNW (Carnival, outside Monster Manor)

RmCarnivalNW is a room. Printed name of RmCarnivalNW is "Carnival, outside Monster Manor".
RmCarnivalNW is north of RmCarnivalW.

Description of RmCarnivalNW is "You're mingling with the crowd in the carnival. People turn to you expectantly as you wander about. You're right outside the carnival's signature ghost train ride, Monster Manor, situated to the north.

The rest of the carnival is to the south and the east."

[*TODO: Manor scenery, NPC]

Chapter - Monster Manor - scenery

Monster Manor is scenery in RmCarnivalNW. Monster Manor is proper-named. Understand "ghost/train/ghost train" and "haunted/house/haunted house" and "castle" and "parapets" as Monster Manor.
Monster Manor is known.

Description of Monster Manor is "A little something for the thrill-seekers, Monster Manor is a dark ghost train ride. The outside is airbrush-painted like a decrepit castle, and out of the parapets lunge some of fiction's greatest monsters: Frankenstein, Dracula, Mickey Mouse and the Creature from the Black Lagoon. A little buggy on a track takes tiders through the doors to the north.".

Check entering Monster Manor:
	try going north instead.

Section - Monsters - paintings

A painting is a kind of thing.

Check taking a painting: say "No, it looks real, but it's not really [the noun]. It's just a painting." instead.

Frankenstein is a painting. Frankenstein is part of Monster Manor. Frankenstein is proper-named. Understand "frankenstein's monster" and "monster" as Frankenstein.
Description of Frankenstein is "Adagio always corrects you - says it's actually Frankenstein's Monster. But it's not like she says Jacuzzi's Hot Tub or Hoover's Vacuum Cleaner, so whatever."

Dracula is a painting. Dracula is part of Monster Manor. Dracula is proper-named. Understand "vampire/count" as Dracula.
Description of Dracula is "Dracula's a little singed here, thanks to a mishap with a fire-breathing act a few years ago. You just tell people he's having trouble with the sunlight.".

Mickey Mouse is a painting. Mickey Mouse is part of Monster Manor. Mickey Mouse is proper-named. Understand "disney" as Mickey Mouse.
Description of Mickey Mouse is "You're not sure this is legal, but the lawyers haven't come knocking yet.".

the Creature from the Black Lagoon is a painting. the Creature from the Black Lagoon is part of Monster Manor. Understand "creature/black/lagoon" and "swamp/thing/swamp thing" as the Creature from the Black Lagoon. ["swamp thing?!"]
Description of the Creature from the Black Lagoon is "Where is the Black Lagoon, anyway? Germany?".

Chapter - Buggy

The buggy is a container in RmCarnivalNW. The buggy is enterable, transparent, open, unopenable and unlocked. The buggy is scenery.

Description of the buggy is "A little car with a skull painted on it. The powered car follows a track through the rooms of Monster Manor. There's no roof or anything, so your hands are free when you're in it, but a sturdy lap bar keeps you in your seat."

Understand "ghost/train/ghost train" and "car" and "lap bar" and "lapbar" and "track" as the buggy.

Check entering the buggy while the location of the player is RmCarnivalNW:
	try going north instead.
	
Check exiting while the player is in the buggy:
	say "You're pinned down by a lap bar, but your arms are free so you can probably still touch anything you want to touch as you pass by." instead.
	
Section - Player is put into the buggy when entering Monster Manor

Before going north from RmCarnivalNW (this is the prevent entering ghost train sometimes plus endgame joke rule):
	if EndgameA is happening:
		have the operator say "NO MORE THAN TWO PEOPLE IN ONE CAR";
		say "[one of]You all get in a huddle. Freda's adamant that you and her should get to ride together, and the Ringmaster is happy to recuse himself. But then Lawn feels left out and demands a go on the ride, and the three of you enter intense negotiations[if the hired help is in the location of the player], while [the hired help] puffs harder to get noticed[end if]. Eventually, Adagio gently suggests that catching the Phantom might be a priority, and you sheepishly break off the argument[or]Immediately, you, Freda[if the hired help is in the location of the player], [the hired help][end if] and Lawn re-enter heated negotiations, until Adagio steps in and firmly leads you away from the buggy[stopping]." instead;
	otherwise if the player is in the clown car:
		have the operator say "NO RAMRAIDING" instead;
	otherwise if the player carries the stepladder:
		have the operator say "NO STEPLADDERS" instead.

Carry out going north from RmCarnivalNW (this is the put player into buggy in Monster Manor rule):
	say "You [if Unmasking is happening]and the Ringmaster [end if]get into the buggy, the lap bar clicks into place, and you judder through the doors of Monster Manor...";
	move the buggy to RmGhost;
	if Unmasking is happening: [i.e. if the Ringmaster follows Lola]
		move the Ringmaster to the buggy;
	move the player to the buggy, without printing a room description;
	rule succeeds.
	
Chapter - The operator

The operator is a man in RmCarnivalNW.
The operator is known.

Initial appearance of the operator is "The Monster Manor ride operator, an older surly-looking gentleman[if the operator is proper-named] called Arthur[end if], sits in front of a wall of rules.".

[following adapted from Inform docs example 32 "Gopher-wood"]
Check examining the operator for the first time:
	now the printed name of the operator is "Arthur";
	now the operator is proper-named.
	
Understand "Arthur" as the operator when the operator is proper-named.

Description of the operator is "This man - Arthur, his nametag says - helps the carnival operate Monster Manor whenever it's in town. You never really made friends with him. He's not much of a talker. Good at his job, though."

Section - The operator points mutely to rules

To have the operator say (rule - a text):
	say "[The operator] gives you a stern look[if the operator is in RmCarnivalNW] and points at a rule behind him[otherwise], pulls out a stack of flashcards and thumbs through it until he finds the rule he wants to show you[end if]: '[rule].'" instead.
	
Instead of asking the operator about something: try talking to the operator. Instead of item-asking the operator about something: try talking to the operator.

Check talking to the operator:
	have the operator say "NO DISTRACTING THE RIDE OPERATOR" instead.

Instead of item-asking the operator about the French horn when the player carries the French horn:
	if the operator is in RmCarnivalNW:
		say "[The operator] gives you a stern look and turns to scan the rules behind him. There's nothing there about taking props out of Monster Manor. He shrugs and waves you away.";
	otherwise:
		say "[The operator] shrugs and waves you away, clearly having decided that robbing Monster Manor isn't any of his concern while he's off-duty.".
		
After playing the French horn in the location of the operator:
	have the operator say "NO ENTRANCE OF THE GLADIATORS".
	
Section - idle behaviours

Every turn when the location of the player is the location of the operator (this is the operator idle daemon rule):
	unless a climactic scene is happening:
		if a random chance of 1 in 8 succeeds:
			say "[The operator] [one of]glowers[or]glares[purely at random] at [one of]you[or]a passer-by[or]the world at large[at random].".

Section - gesture reaction

Gesture reaction of the operator is "[The operator] gives you a stern look[if the operator is in RmCarnivalNW] and points at a rule behind him[otherwise], pulls out a stack of flashcards and thumbs through it until he finds the rule he wants to show you[end if]: 'NO GESTICULATION.'".
[yeah I know this should just use the have the operator say rule, but there was a rogue line break which I can't be bothered to hunt down]

Section - persuasion refusal

Persuasion refusal of the operator is "The operator [if the operator is in RmCarnivalNW]points lazily to a rule behind him[otherwise]shows you a flashcard he keeps up his sleeve for easy access[end if]: 'NO.' A bit blunt, but you suppose you're not the boss of him".

Section - pie reaction

Pie reaction of the operator is "He [if the operator is in RmCarnivalNW]points angrily to a rule behind him[otherwise]angrily shows you a flashcard[end if]: '[one of]NO PIE-THROWING[or]NO IGNORING THE [']NO PIE-THROWING['] RULE[or]SERIOUSLY, NO PIE-THROWING. NO FOOLIN['][or]REALLY NO PIE-THROWING (THIS MEANS YOU, LOLA THE CLOWN)[or]COME ON, NOW. JEEZ[stopping].'".

	
Chapter - Wall of rules

The wall of rules is scenery in RmCarnivalNW.

Description of the wall of rules is "Many, many rules and instructions for riding Monster Manor. They're all intended to keep children and adults safe, of course. Still, you wonder what happened that made [the operator] put up the rule '[one of]NO SWORD-SWALLOWING[or]NO CANOODLING[or]NO EGGS TO BE TAKEN ON THE RIDE[or]NO KNIFE-FIGHTS[or]NO RELEASING WILDLIFE ONTO THE RIDE[purely at random].'"




Part - RmCarnivalN (Carnival, by the Love Booth)

RmCarnivalN is a room. Printed name of RmCarnivalN is "Carnival, by the Love Booth".
RmCarnivalN is east of RmCarnivalNW. RmCarnivalN is northeast of RmCarnivalW. RmCarnivalN is north of RmStands.

Description of RmCarnivalN is "You're in the main carnival area, north of the Big Top. People turn to you expectantly as you wander through the crowd. You can sneak into the Big Top through a fire exit flap to the south.

The rest of the carnival is to the west (and the southwest, if you take a shortcut through the tent ropes)."

Chapter - Love booth

The love booth is a supporter in RmCarnivalN. "The love booth is here, adorned with its little sculpture of Cupid."

The love booth is fixed in place.

Description of the love booth is "This thing is older than anything else in the carnival, and probably older than dirt. It's an old Victorian toy. Press the button on the front, and a little window in the booth will eventually predict your future lover, giving a different result each time. It's decorated with a statue of Cupid perched on top, aiming [if the bow is on the Cupid]a bow-and-arrow[otherwise]nothing in particular[end if] at nothing in particular."

Understand "button" as the love booth.

Check entering the love booth:
	say "It's too tall to get on. No handholds or anything like that." instead.

Check climbing the love booth:
	try entering the love booth instead.
	
Report getting off the love booth:
	say "You tentatively climb over the edge, hang off the booth by your fingertips, say your prayers, and drop the eight-inches-or-so to ground level. You survived!";
	try looking instead.
	
[fake directions to make moving on and off the love booth easier, but without spoiling the mild ladder puzzle]
Check going down in RmCarnivalN:
	if the player is on the love booth:
		try getting off the love booth instead.
Check going up in RmCarnivalN:
	if the location of the stepladder is the location of the love booth:
		unless the player is on the love booth:
			try climbing the stepladder instead;
		otherwise:
			say "Oh no, this is plenty high enough." instead.

Check pushing the love booth:
	if the player is on the love booth:
		say "You can't reach the button from up here, or see the window for that matter." instead;
	otherwise:
		if a random chance of 1 in 1000 succeeds:
			say "Little pieces of paper flit in the booth: 'TRAPPED IN LOVE MACHINE FORTUNE FACTORY SEND HELP.'";
		otherwise:
			say "Little pieces of paper flit in the booth: 'YOUR FUTURE [one of]HUSBAND[or]WIFE[or]SPOUSE[or]PARTNER[or]LOVER[or]BOYFRIEND[or]GIRLFRIEND[or]SIDEPIECE[or]SPECIAL FRIEND[purely at random] WILL BE: [if a random chance of 1 in 4 succeeds][one of]EXTREMELY[or]QUITE[or]RATHER[or]VERY[or]DELIGHTFULLY[or]DEEPLY[purely at random] [end if][one of]BEAUTIFUL[or]CONSIDERATE[or]CUTE[or]DELICIOUS[or]DEPENDABLE[or]DEVIOUS[or]DIVINE[or]ELDERLY[or]EMACIATED[or]ENTERTAINING[or]ENTHUSIASTIC[or]EXCITING[or]FASTIDIOUS[or]GORGEOUS[or]INTERESTING[or]HANDSOME[or]HOMELY (DEROGATORY)[or]HOMELY (COMPLIMENTARY)[or]MATURE[or]MISERLY[or]MUSCULAR[or]PHILANTHROPIC[or]POVERTY-STRICKEN[or]PRETTYBOY[or]PROHIBITIONIST[or]ROTUND[or]SHORT[or]SLOVENLY[or]SWEET[or]TAINTED[or]TALL[or]THOUGHTFUL[or]UNDERHANDED[or]WEALTHY[or]YOUTHFUL[purely at random] [one of]ANIMAL HANDLER[or]BANK ROBBER[or]BOBBIN BOY[or]BOXER[or]BUFFER GIRL[or]BUG[or]CARICATURIST[or]CARTWRIGHT[or]CENSOR[or]CHIMNEY-SWEEP[or]COACHMAN[or]COMPUTER[or]CONFECTIONER[or]FABULIST[or]FAIRY[or]FORTUNE-TELLER[or]GAMEKEEPER[or]GARDEN HERMIT[or]GENERAL[or]GLASS-BLOWER[or]GREGORY[or]HANGMAN[or]ILLUSIONIST[or]INDUSTRY TYCOON[or]INTERACTIVE FICTION AUTHOR[or]JESTER[or]JOURNALIST[or]JUDGE[or]KING[or]LANDLORD[or]LANDSCAPE ARTIST[or]LEECH COLLECTOR[or]LIBRARIAN[or]MARKET STALL OPERATOR[or]MATAGI[or]MERCHANT[or]MILLIONAIRE[or]MINISTER[or]NURSEMAID[or]OUTLAW[or]PIRATE[or]POACHER[or]POISON TASTER[or]POLICE OFFICER[or]POLITICIAN[or]POUNDMASTER[or]PRINTER'S DEVIL[or]QUARTERMASTER[or]QUEEN[or]RAILROAD WORKER[or]RUFFIAN[or]SCRIVENER[or]SERGEANT-AT-ARMS[or]SNAKE OIL SELLER[or]STENOGRAPHER[or]STRATEGIST[or]SWORD-SWALLOWER[or]TOWN CRIER[or]URBAN PLANNER[or]WAINWRIGHT[or]WEIGHTLIFTER[or]WORLD-TRAVELLER[or]WRESTLER[or]XYLOPHONIST[purely at random].'" instead.
	
Section - Climb ladder to get onto love booth

The climbing stepladder by booth rule does nothing unless the location of the stepladder is the location of the love booth.
The climbing stepladder response rule does nothing if the location of the stepladder is the location of the love booth.

Carry out climbing the stepladder (this is the climbing stepladder by booth rule):
	unless the player is on the love booth:
		say "You climb the wobbly stepladder and scramble for the relative stability of the top of the booth.";
		now the player is on the love booth;
	otherwise:
		say "You manage to get both feet on the ladder and quickly climb down to ground-level.";
		now the player is in the location of the love booth.
	
Chapter - Cupid (including definition of mannequin)
	
A mannequin is a kind of supporter.

The Cupid is a mannequin on the love booth. The Cupid is scenery.

Understand "statue" and "sculpture" and "god" and "eros" as the Cupid.

Description of the Cupid is "Not the original sculpture - this Cupid is plastic, and [unless the bow is on the Cupid]no longer[end if] carries a bow and a bundle of arrows with heart-shaped heads. You and the rest of the staff know that it's a functioning bow, and take care to keep Cupid pointed away from the crowd, after that one time."

Instead of rearrangement when the noun is the Cupid:
	say "Leave him where he is, otherwise people won't know this is the love booth[unless the player is on the love booth]. Anyway, you can't reach him from down here[end if]." instead.
	
Check shooting the Cupid with the bow:
	say "You shoot Cupid straight through the heart! Hoist by your own petard, you big weird baby. Enjoy feeling love and compassion." instead.
	
Check throwing the stack of pies at the Cupid:
	say "Splat! You wonder if custard in the eyes will interfere with Cupid's aim, and what kind of effect that will have on the course of true love[unless the bow is on the Cupid]. Mind you, you [i]have[/i] taken his bow, which might have a bigger effect[end if]." instead.

Chapter - Bow

The bow is on the Cupid. "The statue of Cupid is holding a bow and a bundle of arrows."

Understand "bow/longbow/crossbow" or "arrow/arrows/bundle/quiver/heart/hearts" or "bow-and-arrow" as the bow.

Description of the bow is "A little bow, and a bundle of arrows with sharp heart-shaped heads. How many arrows? Don't worry about it. Enough."

Check taking the bow:
	if the bow is on the Cupid:
		unless the player is on the love booth:
			say "Cupid and his bow are high up on the love booth, and you can't reach that bow from down here." instead.

Report taking the bow:
	say "[one of]You lift the bow out of Cupid's little hands. You grab his arrows while you're at it[or]You scoop up the bow and arrows[stopping]." instead.
	

Section - Shooting the bow

[Cribbed heavily from the Inform 7 documentation, example 127 "Technological Terror"]

Shooting it with is an action applying to two things.

Check shooting something with something (this is the check shooting bow rule):
	if the player is not carrying the bow, say "You're unarmed!" instead;
	if the second noun is not the bow, say "[The second noun] isn't a great weapon." instead;
	if the noun is the bow, say "You fire an incredible trick shot which curves an arrow back into the upper limb of the bow! Everyone is impressed!" instead;
	if the noun is the player or the noun is the torso, say "No no no! You're doing great! Keep going!" instead;
	if the noun is the arms, say "No no no! 'A shot in the arm' is just an expression!" instead.
	
Understand "shoot [bow] at [something unbowlike]" as shooting it with (with nouns reversed). 

Definition: a thing is unbowlike if it is not the bow. 

Understand "shoot [something unbowlike] with [bow]" as shooting it with. Understand "shoot [something] with [something]" as shooting it with. 

Understand "shoot [something] at [something]" as shooting it with (with nouns reversed). Understand "fire [bow] at [something unbowlike]" as shooting it with (with nouns reversed). Understand "fire at [something unbowlike] with [bow]" as shooting it with. Understand "fire at [something] with [something]" as shooting it with.

Carry out shooting something with something (this is the standard shooting response rule):
	say "Thunk! An arrow judders in [the noun]. You hope [regarding the noun][they] [find] true love[if the noun is touchable]. You pluck the arrow out again[end if]."
	
[*TODO: make sure this works with the objects you expect it to work with. Needs to work on audience backdrops as if you were trying to shoot people. Also needs to bounce off things it shouldn't pierce, e.g. cage]

Section - Can't shoot animals or people

Carry out shooting an animal with something (this is the prevent animal cruelty rule):
	say "That wouldn't be funny at all." instead.
	
Carry out shooting a person with something (this is the I used to be an adventurer etc etc rule):
	say "Really shoot [the noun]?";
	if the player consents:
		say "Alright. You fire an arrow into [the noun] in the leg at point-blank range. It doesn't help [regarding the noun][them] find true love, but [regarding the noun][they] [do] have to go to hospital, and you have to go to jail.";
		end the story saying "It was funnier in your head";
	otherwise:
		say "Probably for the best." instead.
	
Section - Interesting exceptions to shooting objects

Carry out shooting the cage with something (this is the special response for shooting cage rule):
	say "The arrow sails between the bars harmlessly." instead.
	
[*TODO: Special rule for shooting contraption rope with bow: don't allow it during show, allow it but hint that breaking the rope now isn't the right move outside of show]



Book - RgRides

RgRides is a region. RmGhost is in RgRides.

Part - RmGhost (Monster Manor)

RmGhost is a room. Printed name of RmGhost is "In Monster Manor". RmGhost is tall-interior.
RmGhost is north of RmCarnivalNW. South of RmGhost is nowhere.

Description of RmGhost is "You're in a little buggy juddering through dark rooms."

Check smelling in RmGhost:
	say "Smells of sawdust in here. Is sawdust scary?" instead.

Chapter - Ghost train events

Ghost Train Counter is a number that varies.
Ghost Train Counter is 0.

Every turn while the location of the player is RmGhost (this is the ghost train operation rule):
	if there is an event corresponding to a number of Ghost Train Counter in the Table of Ghost Train Events:
		let E be the event corresponding to a number of Ghost Train Counter in the Table of Ghost Train Events;
		say "[E]";
	increment Ghost Train Counter.
		
Table of Ghost Train Events
number	event
0	"[mummy appears]"
2	"[zombie appears]"
4	"[hornist appears]"
6	"[end ghost train]"

To say mummy appears:
	now the mummy is in RmGhost;
	say "Suddenly, out of the gloom, a mummy appears[exclam][ringmaster cowers][paragraph break]".
	
To say zombie appears:
	now the mummy is nowhere;
	now the zombie is in RmGhost;
	say "The ghost train stutters around a corner and the mummy disappears behind you. Suddenly, a zombie lunges out from the dark at you[exclam][ringmaster cowers][paragraph break]".
	
To say hornist appears:
	now the zombie is nowhere;
	now the hornist is in RmGhost;
	say "The ghost train crawls down a corridor and the zombie disappears from sight. You turn a corner - and suddenly, [the hornist] is before you[exclam][ringmaster cowers][paragraph break]".
	
To say ringmaster cowers:
	if the location of the Ringmaster is RmGhost:
		say " The boss [one of]screams[or]yelps[or]cries out[purely at random] and [one of]pulls his hat over his eyes[or]grips the lap bar[purely at random].[no line break]"
	
To say end ghost train:
	now the hornist is nowhere;
	say "The ghost train leaves the hornist behind, and rolls out into the daylight again. You disembark.";
	now Ghost Train Counter is -1;
	move the buggy to RmCarnivalNW;
	if Unmasking is happening: [i.e. if the Ringmaster follows Lola]
		move the Ringmaster to RmCarnivalNW;
		say "'I wish we hadn't made that ride so s-scary,' says the Ringmaster. 'M-maybe we could buy a nice funhouse instead.'";
	move the player to RmCarnivalNW.
	
	
Chapter - Ghost train mannequins

["Mannequin" as a type of supporter is defined under Cupid code in RmCarnivalN. Would prefer to define it here, but since Cupid is a mannequin, it has to be defined there first]

[this doesn't work and I'm too tired to figure out why and I can't think of any good jokes to make it worth it]
[Before chitchat when the noun is a mannequin:
	if the noun is the Cupid:
		say "Hello Cupid.";
	otherwise if the noun is the mummy:
		say "Hello, mummy.";
	otherwise if the noun is the zombie:
		say "Hello, zombie.";
	otherwise if the noun is the hornist:
		say "Hello, Mad Hornist of Valencia.";
	otherwise:
		say "Hello, dummy.".]

Section - Mummy

The mummy is a mannequin.
The mummy is nowhere.

Description of the mummy is "One of ancient Egypt's great pharaohs, blessed and cursed with eternal life; his organs preserved, his tomb raided, he stalks the Manor and curses the unwary! (The bandages hide that this is a clothes mannequin that the boss bought from a closing-down department store.)"

Understand "pharaoh" and "bandage" and "bandages" as the mummy.

Check shooting the mummy with the bow:
	say "You get him straight through where the heart would be if it wasn't sitting in a jar somewhere in Egypt. You're not sure whether the little heart shape on the arrow would be a replacement or an insult." instead.
	
Check throwing the stack of pies at the mummy:
	say "You splat the mummy with a perfect pie throw. Shame he can't eat it, on account of his guts being in a jar on a shelf somewhere. Maybe that's why he's angry at everything." instead.
	
Check opening the mummy:
	say "No, no! The shrivelled flesh that lies beneath the bandages is fearsome to gaze upon! (That is, the blank flesh of the clothes mannequin underneath the mummy is boring to gaze upon.)" instead.

Section - Zombie

The zombie is a mannequin.
The zombie is nowhere.

Description of the zombie is "A putrid-looking zombie, its flesh a rotten green, its limbs dropping off with decay! (One of the arms broke off when you and the boss were carrying this one out of the department store.)"

Check shooting the zombie with the bow:
	say "You think heavier artillery is more traditional in zombie stories - you don't watch those kinds of films, they're a bit much for you - but nevertheless, you stick an arrow straight through the head of the zombie. Hope it finds love for something other than brains." instead.
	
Check throwing the stack of pies at the zombie:
	say "You splat the zombie with a perfect pie throw. You probably wouldn't be much use if zombies were real, but at least everyone could have a bit of a laugh at their expense." instead.

Section - Hornist

The hornist is a mannequin. Printed name of the hornist is "Mad Hornist of Valencia". The indefinite article of the hornist is "the".
The hornist is nowhere.

Description of the hornist is "Europe's most mysterious criminal. No one knows where he came from. No one knows where he went. But some say that the Mad Hornist still stalks the streets of Ruzafa, driving the innocent to despair with his otherworldly, polyrhythmic melodies... (The boss got outbid on a werewolf animatronic, so you've had to make do with an unidentifiable celebrity waxwork and an old French horn he found in a skip[first time]. By the way, that's supposed to be 'mad' as in 'angry'. You tried your best to make that clear. You drew the angry eyebrows on the Hornist and everything[only].)"

Understand "player" and "criminal" and "mad" and "angry" and "valencia" and "mad hornist of valencia" and "hornist of valencia" as the hornist.

Check shooting the hornist with the bow:
	say "You shoot him where you think the lungs are, putting an end to his ability to toot his furious harmonies!" instead.
	
Check throwing the stack of pies at the hornist:
	say "You splat the hornist with a perfect pie throw, getting custard all down his shirt. If he was mad before, he'll be positively irate now." instead.

Section - French horn

On the hornist is a French horn. The French horn is an instrument.

Description of the French horn is "Rusty, but not so rusty that you couldn't play it if you wanted."

Check blowing the French horn:
	try playing the French horn instead.
	
Carry out playing the French horn:
	say "You play your best rendition of Entrance of the Gladiators. Honk honk honk!"
	
Check shooting the French horn with the bow:
	say "The arrow flies into the bell of the horn, travels around the valves, and flies out of the mouthpiece[if the French horn is on the hornist], straight into the Mad Hornist of Valencia's kisser. Ouch[end if]." instead.



Book - RgEndgame (endgame rooms)

RgEndgame is a region. RmMotorway and RmLakeside are in RgEndgame.

Part - RmMotorway (Motorway)

RmMotorway is a room. Printed name of RmMotorway is "Motorway".

Description of RmMotorway is "Marcus Pooting, in the Ringmaster's camper van, is pootling down the motorway just a few dozen metres ahead. You weave in and out of traffic, trying to keep up."

Report listening when the location of the player is RmMotorway:
	say "Lots of horns being honked at you, for some reason. Thank goodness you didn't bring the goose." instead.

Chapter - Traffic (backdrop)

The traffic is a backdrop. The traffic is in RmMotorway and RmLakeside.

Understand "cars" and "van/vans" and "motorbike/motorbikes/motorcycle/motorcycles/bike/bikes" and "truck/trucks/lorry/lorries" as the traffic.

Description of the traffic is "[if the location of the player is RmMotorway]So many trucks and lorries and vans. It's like they don't know there's a medium-speed car chase going on[otherwise]The traffic is some way behind you now[end if]."

Check listening to the traffic:
	try listening instead.
	
Instead of doing something other than examining or listening with the traffic:
	say "[if the location of the player is RmMotorway]Things will probably get unfunny very quickly if you try to play with the passing traffic at this speed. Leave it alone[otherwise]It's way behind you, and you'd better not leave the Phantom unguarded right now[end if]."

Part - RmLakeside (Lakeside)

RmLakeside is a room. Printed name of RmLakeside is "Lakeside".

Description of RmLakeside is "You've ended up near some reed-choked lake. The Ringmaster's camper has rolled over here, crushed up like a soda can. You've parked up next to it. The motorway rumbles on far behind you."

Report listening when the location of the player is RmLakeside:
	say "The lapping of water in the breeze, and the rumble of distant traffic. It would be soothing without the disgraced politician yelling at you." instead.
	
Check smelling in RmLakeside:
	say "Smells grassy and sharp here." instead.

Chapter - Lake (scenery)

The lake is scenery in RmLakeside.
Understand "pond/water" and "reed/reeds" as the lake.

Description of the lake is "Wild, stagnant, forgotten, but kinda pretty. The motorway must cut this place off from any foot traffic."


Book - Backdrops

[dumping the backgrounds in their own book, so that all the regions are defined already and I don't break anything]

Part - BgRing

[I've actually specified BgRing in the RmStands section since it's most relevant there and helps to control how the player can enter/interact with the ring while outside it. I know this is confusing! Difficult to sensibly lay out an interconnected object-oriented world in what's essentially one long text document!]

Part - BgCaravan

[this bg object is inside caravan-like rooms, and helps to allow "exit caravan" as a way out]

BgCaravan is a backdrop. BgCaravan is in RmRingmaster. BgCaravan is in RmLola. BgCaravan is in RmFreda. BgCaravan is in RmLawn. BgCaravan is in RmAdagio. 

Understand "caravan" and "camper" and "van" and "camper van" and "vehicle" as BgCaravan.

Check examining BgCaravan:
	try looking instead.
	
Check entering BgCaravan:
	say "You're already inside." instead.
	
Check object-exiting BgCaravan:
	try going outside instead.

Part - BgBigTop

BgBigTop is a backdrop. BgBigTop is in RgCarnival, RgStaffArea and RgBigTop. Printed name of BgBigTop is "Big Top".

Description of BgBigTop is "They're not lying, it's a Big Top. There are flaps around the side of the tent to let audiences, performers and intruders in."

Understand "tent" and "circus tent" and "bigtop" and "big top" and "flap" and "fire exit" as BgBigTop.

Check entering BgBigTop (this is the allow entering big top backdrop rule):
	if the player is in RgBigTop:
		say "You're already inside the Big Top!" instead;
	otherwise:
		if the player is in RmCarnivalN:
			try going south instead;
		otherwise if the player is in RmCarnivalW:
			try going east instead;
		otherwise if the player is in RmStaffS:
			try going north instead;
		otherwise if the player is in RmStaffE:
			try going west instead;
		otherwise:
			say "There isn't an entrance to the tent here." instead.
			
Part - BgWheel

BgWheel is a backdrop. BgWheel is in RmStaffS and RmCarnivalW. Printed name of BgWheel is "Big Wheel".

Description of BgWheel is "The Big Wheel, your non-operational ferris wheel, looms over there."

Understand "ferris" and "really" and "wheely" and "sign" and "big wheel" and "big" and "wheel" as BgWheel.

Does the player mean item-asking about BgWheel: it is very unlikely.

[this backdrop is moved to nowhere when the Phantom blows the Wheel up]

			
Part - BgSky
			
BgSky is a backdrop. BgSky is in RgCarnival, RgStaffArea and RgEndgame. Printed name of BgSky is "sky". The indefinite article of BgSky is "the".

Understand "sky" and "sun" and "clouds" and "cloud" and "weather" as BgSky.

Description of BgSky is "Overcast this week. Perfect weather for sitting inside a big tent to watch magic tricks, animal handling and powerlifting."

Instead of throwing the stack of pies at BgSky (this is the skyward pie rule):
	say "You throw a pie skyward to see if you can punch a hole in the clouds. A couple of seconds later, it [if a random chance of 4 in 5 succeeds]lands harmlessly on the ground[bad sky pie joke][otherwise]splats you in the face[end if]."
	
To say bad sky pie joke:
	say "[first time]. You were hoping that pie would be anticlimatic but it was merely anticlimactic.[paragraph break]Hmm. Is that pun worth remembering? It's too wordy for the kids but you bet the crossword compilers in the audience would love it[only][no line break]".
	
Book - Items which are never in play

[These only exist as a quick way of allowing certain conversation topics]

The razor blade is nowhere.
Understand "razor" and "blade" as the razor blade.


VOLUME - SCENES

Book - Scene classification

[Showtime scenes are the main Shows (Magic Show, Strength Show, Beast Show)] 
A scene can be showtime. A scene is usually not showtime.

[Climatic scenes designate the Endgame scenes]
A scene can be climactic. A scene is usually not climactic.

Part - Rule for all showtime scenes which forbids item-asking

[the following rule tries to prevent the player, e.g., engaging Adagio in a long conversation about the rabbit while she's about to drown]
Before item-asking someone about something (this is the block item-asking during showtime rule):
	if the noun is Lawn or the noun is Adagio or the noun is Freda:
		if a showtime scene is happening:
			say "You'd love to chat about [the second noun], but this is not going to be a good time. If it's urgent - if you want to end the show, say - you should just talk to [if Magic Show is happening]Adagio[otherwise if Strength Show is happening]Freda[otherwise]Lawn[end if] directly. Otherwise, better save it until you're between shows." instead.
			
Part - Phrase used when leaving ring during showtime scenes

To keep player in ring with (performer - a person):
	say "You mustn't abandon the ring during a show! If you need the performance to end, it would be kinder to let [performer] know."
[each showtime scene has a rule to forbid the player leaving RmRing during it. It's individualised for each scene so that I can use this phrase to name the specific NPC. There's definitely a better way to do this but once again I am crushed under the weight of 18 months of bad coding decisions]

Book - Intro

Part - Scene control

Chapter - Start intro (when play begins)

Introduction is a scene.
Introduction begins when play begins.

When play begins (this is the set up pages and play intro rule):
	[take this opportunity to deactivate post-puzzle conversation options (defined in convo sections for their respective characters]
	deactivate all PostMagic pages;
	deactivate all PostStrength pages;
	deactivate all PostBeast pages;
	[now play the intro text]
	say "'Thank goodness you're here! We're ruined, Lola!' cries the Ringmaster the moment you enter his camper van. 'The council are trying to put us out of business, my headache's getting worse, and now there's a ghost haunting the circus! Th-they're, they're all coming for our necks, Lola!' The boss falls to pacing around in a tight circle, gnawing on his shirt collar and whimpering.[paragraph break]You were going to ask if there was room in the budget to buy more bendy balloons, but this seems more important."

Chapter - end intro

[Controlled by a truth state which is toggled by the page Mast_phantom in the ringmaster convo tree. This used to be controlled much more elegantly by "when the Phantom is known..." But this caused a problem because it meant the Phantom had to start as unknown, which meant that "ask ringmaster about phantom" didn't work because of the way item-asking works based on known/unknown items, even though it obviously should work and it's nonsense if it doesn't work. The way I've done asking about items and known/unknown items seriously sucks and needs redoing completely in the next game I write, but I can't rewrite here because I'll never be done refactoring and debugging the game. I've got to press ahead and finish this absolute shambles.]

Introduction ends when Intro_convo_had is true.

[When Introduction ends:
	say "DEBUGDEBUGDEBUG INTRO ENDS."]


	
Part - Scene rules

Chapter - prevent leaving
	
Instead of going from RmRingmaster during Introduction (this is the force Ringmaster conversation by forbidding leaving Introduction rule):
	say "The Ringmaster's in a real tizzy. You'd better talk to him first, and find out what this ghost business is about."
	
Chapter -  Don't let the player item-ask, to force conversation first

Before item-asking the Ringmaster about when Introduction is happening:
	if the second noun is the Phantom:
		switch to cyoa at Mast_phantom instead;
	otherwise:
		say "Actually, you probably need to talk to him about this Phantom thing first." instead.

Book - Magic Show - Adagio's puzzle

Magic Show is a recurring showtime scene.

Part - Scene control

Chapter - MagicShowStart - initialise Magic Show

[define a truth state to switch scene on and off]
MagicShowActive is a truth state that varies. MagicShowActive is false.
Magic Show begins when MagicShowActive is true.

[since Magic Show is begun via Adagio's conversation options (see Adag_show), we can use a page and a page-toggle rule to provide intro text, shuffle objects and characters into the right place, and switch MagicShowActive on]
MagicShowStart is a page.
"[MagicShowStart desc]".
It is an end-page.

[prepare an ActiveHat variable to track what hat is out and about]
ActiveHat is an object that varies.
ActiveHat is nothing.

AdagioFixesRopes is a truth state that varies.
AdagioFixesRopes is false.

A page-toggle rule for MagicShowStart:
	set up the Magic Show.
	
To set up the Magic Show:
	now MagicShowActive is true;
	pause the game;
	seat the audience;
	cyoa teleport to RmRing;
	now Adagio is in RmRing;
	now the deck of cards is nowhere;
	now the greeting of Adagio is Adag_show_hello;
	if Adagio wears a hat (called the active hat):
		now ActiveHat is the active hat;
		now the active hat is in RmRing;
	otherwise:
		now ActiveHat is nothing;
	[now the Phantom is in RmRing;]
	now the Diabolical Contraption is in RmRing;
	if the rope is broken:
		now the rope is whole;
		now the rope is unlettuced;
		now AdagioFixesRopes is true;
	otherwise:
		now AdagioFixesRopes is false;
	now Magic Show Counter is 0.
	
To say MagicShowStart desc:
	if AdagioFixesRopes is true:
		say "(Before the show, Adagio gives her equipment the once-over. She spots [the rope] on the Diabolical Contraption. Her escapology routine needs that rope - as she tells you, it's not much of an escape trick if she can't even be tied up in it - so she's forced to replace it with a fresh, unbroken rope[if the rope is lettuced]. The old rope with the lettuce bits on it gets chucked away[end if].)[paragraph break]";
	say "It's near the end of Adagio's magic show. Time for the big finish: the Escape From the Diabolical Contraption. You select a few random[one of][or], un-Phantom-like[stopping] audience members. They truss up Adagio's hands and feet behind her back with the rope, and hoist her up and over the water tank so that her tummy points down. The gears through which the rope winds will slowly unspool it, lowering Adagio into the water and drowning her - unless, of course, she can miraculously untie herself.

The gears click into place, and Adagio starts her descent. You step back to watch, and there, at the back of the stands, you see...

[PhantomAnnouncement]Something glints in their hands. They turn and leave through the emergency exit.

'And now, the great escape!' announces Adagio. And then a pause. And then she mutters '[one of]Uh oh[or]Alright, help me out, Lola[stopping].'".
	

[
When Magic Show begins:
	if the rope is lettuced and the location of the rabbit is RmRing:
		solve the Magic Show.]
	[otherwise:
		say "DEBUGDEBUGDEBUG can't detect rabbit and/or lettuced ropes here - Magic Show not solvable yet."]
	
To solve the Magic Show:
	say "You let go of the basket. It floats up, wobbling a little, drifting past the ropes and pulleys...

Like water from a flower, [the rabbit] shoots out of the hat, straight at the lettuce-coated rope. It latches onto the rope with its teeth and spins around and around like a pair of pants from a washing line in a windy day, somehow chewing frantically at the same time. You'd swear you can hear a buzzsaw sound.

The rope snaps and Adagio plummets into the water, catching and holding [the rabbit] aloft as she goes. The crowd erupts in rapturous applause! It's not the neatest escape, maybe, but they seem impressed, and Adagio managed to avoid drowning. You have foiled the Phantom!";
	now MagicShowSolved is true;
	[swap dialogue options (PreMagic and PostMagic defined in Adagio conversation section)]
	deactivate PreMagic pages;
	activate PostMagic pages;
	[if the player has managed to solve this without giving the black hat to Adagio, the next two lines ensure that she'll take it with her when the show is solved]
	now ActiveHat is the black top hat;
	now the black top hat is in RmRing;
	dismantle the Magic Show.


Chapter - MagicShowEnd - restore ring and characters when scene ends

Magic Show ends when MagicShowActive is false.

MagicShowEnd is a page.
It is an end-page.

A page-toggle rule for MagicShowEnd:
	dismantle the Magic Show.
	
Magic Show report state is a number that varies.
Magic Show report state is 0.
	
To dismantle the Magic Show:
	now MagicShowActive is false;
	pause the game;
	if the location of the rabbit is RmRing:
		if the rope is lettuced:
			now Magic Show report state is 2; [doesn't account for rope breaking during show, but if that happens show is solved anyway]
		otherwise:
			now Magic Show report state is 1;
	otherwise:
		now Magic Show report state is 0;
	unseat the audience;
	cyoa teleport to RmAdagio;
	now the deck of cards is carried by Adagio;
	[let Adagio have her hat back if the player has solved the show]
	if MagicShowSolved is true:
		now Adagio wears the black top hat;
	otherwise if ActiveHat is a hat:
		now Adagio wears ActiveHat;
	now Adagio is in RmAdagio;
	now the greeting of Adagio is Adag_hello;
	[now the Phantom is nowhere;]
	now the Diabolical Contraption is in RmBackstage;
	have Adagio make her report; [i.e. post-show quip; see below]
	if not in CYOA mode:
		try looking.
		
To have Adagio make her report:
	if MagicShowSolved is true:
		say "Back in her camper, Adagio's found a chunk of carrot from somewhere. Beaming, she presents it to [the rabbit], who performs her very own magic trick and disappears it. 'And thanks to you too, Lola,' she says. 'With tricks like that, you'd make a great magician if you wanted. That should stymie our Phantom for a while.'[paragraph break]She straightens up, putting the hat-and-rabbit back on, and catches your expectant look. 'Oh... sorry, Lola. That was my last carrot treat. I'll buy you a whole one next time I'm shopping.'";
	otherwise:
		say "'Well, [one of]that could have gone better[or]that one wasn't so good either[stopping],' says Adagio, now in dry clothes but still looking bedraggled in spirit. 'Sorry to drag you into this, Lola.' She sighs and stares into space for a while. '[if Magic Show report state is 0][one of]I need to untie that rope,' she mutters. 'Can't do it myself. Can't cut it myself. You could do it, except you're not supposed to be part of the act. Nobody else can help. Can they? Hmm...[no line break][or]If you can't cut the ropes and I can't, something else needs to. Right? Can we use anything else in my act?' She frowns. 'Was something missing?[no line break][stopping][no line break][otherwise if Magic Show report state is 1]I need to untie that rope. I can't do it because I'm tied up. You can't do it because you're not supposed to be part of the act, really. It's not an escapology act if you help me that directly.' She reaches under her hat and pets [the rabbit] absent-mindedly. '[one of]What else is there?[no line break][or]Shame I don't have Kentucky's way with animals. Would be nice to have some extra help from this little one.[no line break][stopping][no line break][otherwise if Magic Show report state is 2][one of]I saw my rabbit trying to climb the Contraption. Did you do something, Lola? Whatever it was, I think you're on the right track. I think she could chew through the rope. She just needs a little more help to get high enough.[no line break][or]I still think we're nearly there with your rabbit idea. I don't think you can quite pass the rabbit's hat up to me, can you? And I don't want you throwing the poor thing. Shame rabbits can't fly, isn't it?[no line break][stopping][no line break][otherwise]I need to untie that rope,' she mutters. 'Can't do it myself. Can't cut it myself. You could do it, except you're not supposed to be part of the act. Nobody else can help. Can they? Hmm...[no line break][end if]'[paragraph break]".
		
[
if rabbit is present and ropes are lettuced (i.e. rabbit can't reach rope) - hint at balloon part - state 2?
if rabbit is present, but ropes are not lettuced - hint at needing to tempt rabbit, hint that wet ropes are clingy - state 1?
if no advancement, hint that rabbit needs to be there - state 0?
]

	
When Magic Show ends:
	[say "DEBUGDEBUGDEBUG MAGIC SHOW END.";]
	if MagicShowSolved is true:
		[say "DEBUGDEBUGDEBUG MAGIC SHOW PUZZLE WAS SOLVED.";]
		deactivate Adag_show;
		increment Successful Performances;
		memorialise "the cool magic trick they saw with the floating bunny rabbit". [add this to crowd banter]

Section - Solving the Magic Show

MagicShowSolved is a truth state that varies. MagicShowSolved is false.


[if rabbit is rope-aware (which means ropes must be lettuced), black hat is in basket balloon and basket balloon is dropped:
	solve the Magic Show]
	
Check dropping the basket sculpture when the location of the player is the location of the rope:
	if the basket sculpture encloses the black top hat:
		if the rabbit is rope-aware:
			now the rope is unlettuced;
			now the rope is broken;
			now the rabbit is not rope-aware;
			move the black top hat to the player;
			move the basket sculpture to Balloon Limbo;
			if Magic Show is happening:
				solve the Magic Show instead;
			otherwise:
				say "You set the basket free. As it rises level with the rope above the water tank, [the rabbit] climbs out of the hat, teeters on the brim... and leaps across to the rope, tipping the hat out of the balloon into your hands. The rabbit gnaws the lettuce-covered rope to pieces in a frenzy, and leaps back into the hat as the balloon drifts away out of sight.[paragraph break][if AdagioProblemKnown is false]You're not sure why you did all that yet. Perhaps you just had a premonition that this is the sort of thing you'll be doing later today? Maybe you should remember what you did, and go get more lettuce just in case you have to redo it[otherwise if MagicShowSolved is false]Okay. Fine. This should work. Now to set it all up again and do the actual rope-chewing during Adagio's show. You'll need to get more lettuce and tell Adagio to fix the rope, of course[otherwise]There's no need to do that anymore, but it sure is fun to watch that little bunny go[end if]." instead.

[
[temp solution]
Instead of attacking the Phantom during Magic Show:
	now MagicShowSolved is true;
	switch to cyoa at MagicShowSuccess.
	
MagicShowSuccess is a page.
"You bludgeon the Phantom! You win!"

MagicShowSuccessTestChoice is a page.
The cdesc is "Nice." It is for MagicShowSuccess. It flips to MagicShowEnd.
]


Chapter - Events during Magic Show

Magic Show Counter is a number that varies.
Magic Show Counter is 0.

Every turn during Magic Show (this is the Magic Show operation rule):
	if the player is in RgBigTop: [prevents event playing in turn between player exiting show and show scene ending]
		if there is an event corresponding to a number of Magic Show Counter in the Table of Magic Show Events:
			let E be the event corresponding to a number of Magic Show Counter in the Table of Magic Show Events;
			say "[E][if MagicShowActive is true][p][end if]"; [if condition prevents extra paragraph break in timeout event]
	increment Magic Show Counter.
		
Table of Magic Show Events
number	event
2	"Adagio tugs at the knot with her fingertips, to no avail."
5	"Adagio swings herself around a little like a pendulum, but no luck. 'Oh boy,' she says."
8	"Adagio looks deep in thought, and you hope she's figured something out- oops, never mind, she's back to wiggling in the ropes."
10	"Adagio's about halfway down now. Her tummy grazes the water, which soaks into her clothes. 'Yeesh,' she says."
13	"The water's starting to claim Adagio. The audience is getting worried. 'Help her, clown!' shouts one. Their seatmate turns to them and explains in great detail about escapology and how the idea is that the escapologist traditionally unties themselves."
16	"Oh, she doesn't look happy up there. The water line is coming up to her shoulders. She's squirming, but the volunteers did a tragically good job of tying her up."
18	"It's getting dangerous for Adagio. Her face only just peeks above the water line. 'Oh geez,' she says. If you have anything you can do, you need to do it now!"
20	"[Magic Show timeout]"

To say Magic Show timeout:
	say "Adagio's nose dips under the water - and you've seen enough. [Adagio pulled out desc].";
	dismantle the Magic Show.
	
To say Adagio pulled out desc:
	say "You run to the rope and hoist her up before she drowns. The audience murmurs as a bedraggled Adagio [unless ActiveHat is nothing]grabs her hat and [end if]lopes off. You try to cover with a few skits, but it's no good, really. The vibes are wrong. You'll catch up with Adagio as soon as you can and make sure she's okay".

Part - Scene-specific Rules

Chapter - Forbid player departure during Magic Show

Instead of going from RmRing during Magic Show (this is the forbid leaving Magic Show rule): keep player in ring with Adagio.

[Instead of going from RgBigTop to a room which is not in RgBigTop during Magic Show (this is the forbid leaving Magic Show rule): say "You mustn't abandon the Big Top during a show! If you need the performance to end, it would be kinder to let Adagio know."]

Chapter - Special pie reaction for Magic Show

Instead of throwing the stack of pies at Adagio during Magic Show (this is the special reaction to pieing Adagio during Magic Show rule):
	say "You throw a pie in a beautiful arc and splat Adagio at her most vulnerable. The crowd cheers wildly. Adagio hisses a couple of elaborate swear words at you. Sorry, Adagio. [one of]It seemed really funny[or]It's still funny[stopping].".

Chapter - Pulling rope during Magic Show

Instead of pulling the rope during Magic Show:
	say "Pulling the rope will save Adagio from the water tank, but it will abort the show and won't be considered a successful performance by anybody. Do you want to go ahead and pull Adagio out?";
	if the player consents:
		say "[Adagio pulled out desc].";
		dismantle the Magic Show;
	otherwise:
		say "You let the rope keep on unspooling."
		
Chapter - Untying Adagio

Instead of untying Adagio during Magic Show:
	say "The knot would be too tight, and it's not an escape trick if someone else walks up and unties the escapologist. If you're panicking and you want to save Adagio right now, either talk to her or pull the rope - otherwise, you'll have to think of a less obvious way."
	
Instead of untying the rope during Magic Show:
	try untying Adagio.
	
Chapter - Crowd cries foul if you climb high during Magic Show

Instead of climbing the stepladder during Magic Show:
	say "[anti-climbing text in Magic Show]."
	
Instead of climbing the clown car during Magic Show:
	say "[anti-climbing text in Magic Show]."

Instead of climbing the Diabolical Contraption during Magic Show:
	say "[anti-climbing text in Magic Show]."
	
To say anti-climbing text in Magic Show:
	say "You start climbing [the noun], but the audience starts getting restless! '[one of]Hey! That clown's climbing up to untie the magician!' 'How disappointing! How anticlimactic!' 'Let's throw missiles at them[or]Look! The clown is once again trying to sneak up to untie the magician themself!' 'Pathetic[or]Look, everybody! The clown believes the third time is the charm with regards to climbing higher and untying the magician themself!' 'How cringe[or]Look! The clown persists in pursuing an unviable and unsatisfying solution to this unenviable scenario!' 'Boo to that[stopping]!' [one of][or][or]Wow, tough crowd. [or][stopping]You'll just have to stay on the ground and find a way to free Adagio remotely".


Part - Talking to Adagio during Magic Show

Chapter - Main tree

Adag_show_hello is a page.
"'I think I'm in trouble,' mutters Adagio, feigning a smile at the audience."
It flips to Adag_show_hub.

Adag_show_hub is a page.

Adag_show_problem is a page.
"'Still no blade up there[first time]. I didn't miss it. It has been stolen after all. Pity[only].' Adagio wriggles uselessly. 'Can't cut myself free. Can't untie myself. Not sure how I'm going to get out of this one.'"
The cdesc is "'What's the matter, Adagio?'" It is for Adag_show_hub. It flips to Adag_show_hub.

Adag_show_end is a page.
"Adagio sighs. You give her a stern look. She sighs again. 'Fine.'

[Adagio pulled out desc]."
The cdesc is "'This is getting dangerous. We need to stop the show.'" It is for Adag_show_hub. It flips to MagicShowEnd.

Adag_show_bye is a page.
The cdesc is "'Let's keep going.'" It is for Adag_show_hub. It is an end-page.

Chapter - Giving things to Adagio

Instead of giving the black top hat to Adagio during Magic Show:
	say "'Yes, okay, Lola,' says Adagio, dangling from the apparatus. 'I'm busy right now. Just set the hat down there. I'll pick it up if I leave here alive.' You set the hat down.";
	now ActiveHat is the black top hat;
	now the black top hat is in RmRing.


Part - Objects

Chapter - Diabolical Contraption

The Diabolical Contraption is in RmBackstage. It is fixed in place.
The Diabolical Contraption is known.

Understand "water" and "tank" and "water tank" and "big mess" and "mess" and "gear" and "gears" and "pulley" and "pulleys" as the Diabolical Contraption.

Description of the Diabolical Contraption is "It's essentially a water tank with a big mess of pulleys and gears suspended over it. [if Magic Show is happening]Adagio is tied up in them, and she's being slowly lowered into the water[otherwise]It's part of Adagio's act. The idea is that Adagio gets tied up in the gears and stuff and she gets lowered into the water, and she has to free herself before she drowns[end if]. A thin wet rope [if Magic Show is happening]trusses up Adagio's hands and feet[otherwise]dangles over the side[end if][if the rope is lettuced], and is wrapped in floppy lettuce[otherwise if the rope is broken], cut short[end if]."

Initial appearance of the Diabolical Contraption is "[if the Diabolical Contraption is in RmBackstage]Looming from the shadows is the Diabolical Contraption, the centrepiece of Adagio's escapology routine."

Before listing nondescript items when the Diabolical Contraption is in RmRing:
	if the Diabolical Contraption is marked for listing:
		now the Diabolical Contraption is not marked for listing.

Section - Rope

The rope is part of the Diabolical Contraption.

Understand "ropes" and "tightrope" as the rope.

Description of the rope is "It's a thin frayed rope - you think it's the one which ties up Adagio's hands and feet when she's in the Contraption. It's wet from being dunked in the water tank[if the rope is lettuced], which is helping the romaine lettuce you wrapped around it earlier to stay on[end if][if the rope is broken], and it's been gnawed apart[end if]."

The rope can be lettuced or unlettuced. The rope is unlettuced.
The rope can be broken or whole. The rope is whole.
The rope is known.

Rule for printing the name of the rope:
	say "[if the rope is broken]chewed-through [end if][if the rope is lettuced]lettuce-wrapped [end if]rope".

Check taking the rope:
	say "You give it a little tug and watch it weave through the machine. It's threaded all over through there, so you won't be able to pull the rope out. This is the rope Adagio is tied to during her Magic Show, so you could pull it during the act if it goes wrong and you need to rescue her." instead.
Check pulling the rope:
	try taking the rope instead.
	
Check cutting the rope:
	say "Sure, but how[if Magic Show is happening] can you do that and still make it look like Adagio's trick[end if]?" instead.
	
Check untying the rope:
	if the rope is lettuced:
		say "Wow, the lettuce is really stuck in there now, like it's become part of the rope. That lettuce is staying there for the time being." instead;
	otherwise:
		say "It's slippery and impossible to unpick. Adagio ties a mean knot." instead.
	
Section - Can attach lettuce leaf to rope by tying or throwing
	
Instead of tying the lettuce leaf to the rope:
	say "[if the rope is not lettuced]The limp lettuce sticks easily to the wet rope! You wind the lettuce around the [rope][otherwise]The rope has already been lettuced, but you stick a bit more on there for good measure[end if].";
	now the rope is lettuced;
	now the lettuce leaf is in Burger Limbo.
	
Check tying the lettuce leaf to the Diabolical Contraption:
	try tying the lettuce leaf to the rope instead.
Check putting the lettuce leaf on the rope:
	try tying the lettuce leaf to the rope instead.
Check putting the lettuce leaf on the Diabolical Contraption:
	try tying the lettuce leaf to the rope instead.
	
Check tying the rope to something (this is the save yourself the headache of allowing rope tying rule):
	if the second noun is the lettuce leaf:
		try tying the lettuce leaf to the rope instead;
	otherwise:
		if Magic Show is happening:
			say "You shouldn't try tying the rope to anything, or else Adagio and the audience will think you're pulling her out. Anyway, you were always terrible with knots." instead;
		otherwise:
			say "You fumble with the rope and [the second noun], but you were always terrible at knots. No luck." instead.
	
Understand "romaine" or "lettuce" or "leaf" or "romaine lettuce leaf" as the rope when the rope is lettuced.

Does the player mean doing something to the lettuce leaf: it is very likely.

Instead of throwing the lettuce leaf at the rope:
	say "[if the rope is not lettuced]The limp lettuce sticks easily to the wet rope! The momentum of your throw wraps the lettuce nice and tight around the [rope][otherwise]The rope has already been lettuced, but you fling a bit more on there for good measure[end if].";
	now the rope is lettuced;
	now the lettuce leaf is in Burger Limbo.

Check taking the rope when the rope is lettuced:
	say "The sodden and fragile lettuce disintegrates in your hand as you handle the rope.";
	now the rope is unlettuced.

[*TODO:
	what else might you try tying the lettuce to?
]

Section - Can't touch Contraption during Magic Show

Instead of tying the lettuce leaf to the rope during Magic Show:
	say "Now that Adagio's show is underway, you can't get to the rope right now to tie the lettuce to it... but maybe you don't have to. You throw the lettuce with all your might.";
	try throwing the lettuce leaf at the rope.
	
Instead of doing something other than examining with the Diabolical Contraption during Magic Show:
	say "[one of]'Hey! That clown's going to untie that magician!' yells one audience member. 'No escapology act this!' cries another. You're forced to step away from the Diabolical Contraption to settle them down. If it looks like Adagio isn't getting loose with her own magic abilities or props, the show will be ruined anyway, Phantom or not[or]Again, the audience gets audibly disappointed as you approach the Diabolical Contraption. You can't touch the Contraption without ruining her act for everyone - you'll have to help her in a less direct way[stopping]!".
	
Instead of doing something other than examining with the rope during Magic Show:
	try taking the Diabolical Contraption.
	
Section - Can't shoot the rope during Magic Show

Instead of shooting the rope with the bow during Magic Show (this is the prevent bow and arrow solution for Magic Show rule):
	say "That should cut the rope and release Adagio, yeah. But it'll be obvious that it's you doing it, and not something that it looks like Adagio set up. Also, you're going to be firing an arrow into a crowd of people when it passes through the rope. Wanna try it anyway?";
	if the player consents:
		say "You try it anyway. The expected result happens.";
		end the story saying "Arrested for shooting an audience member with an arrow";
	otherwise:
		say "Okay, let's look for something safer and more magic-related.".
		
Check shooting the rope with the bow:
	if the rope is whole:
		now the rope is broken;
		say "Your aim is good! You shoot the rope and sever it. Of course, Adagio will have to replace that when the next show starts, so there wasn't much point cutting the rope now. Also, if you did that during Adagio's show, the arrow would go through the rope and into the audience, which is the sort of thing that the cops frown upon, so this way of cutting the rope is not going to be helpful to anyone. Still, though. You can totally do it." instead;
	otherwise:
		say "The rope is already severed." instead.


Book - Strength Show - Freda's puzzle

Strength Show is a recurring showtime scene.

Part - Scene control

Chapter - StrengthShowStart - initialise Strength Show

[define a truth state to switch scene on and off]
StrengthShowActive is a truth state that varies. StrengthShowActive is false.
Strength Show begins when StrengthShowActive is true.

[since Strength Show is begun via Freda's conversation options (see Freda_show), we can use a page and a page-toggle rule to provide intro text, shuffle objects and characters into the right place, and switch StrengthShowActive on]
StrengthShowStart is a page.
"[StrengthShowStart desc]".
It is an end-page.

A page-toggle rule for StrengthShowStart:
	now StrengthShowActive is true;
	pause the game;
	seat the audience;
	cyoa teleport to RmRing;
	now Freda is in RmRing;
	now the greeting of Freda is Freda_show_hello;
	now the Phantom carries the bags of flour;
	now the Phantom is in RmRing;
	now Strength Show Counter is 0.
	
To say StrengthShowStart desc:
	say "Freda's powerlifting show has gone well so far. She's lifted all sorts of things. A barbell... then two barbells.[no line break][if the clown car is in RmRing] (And your car, since you left it parked in the ring.)[no line break][end if] She's lifted it all. The crowd is beside itself with glee.

All her shows end with her carrying around an audience volunteer like another barbell. It's not the most impressive thing she does, but it's just a bit of fun. She puts out the call for volunteers. Immediately, a figure charges down to the ring...

[PhantomAnnouncement]They stand in front of Freda and stare her down. [one of]You want to tell her it's okay, she can choose another volunteer. But you know she wouldn't listen. And there she goes, grabbing the Phantom, hoisting them up. Something is wrong. She's trembling, her knees are shaking. The Phantom looks very bulky and shapeless under that cloak they're holding closed, but can he really be that heavy[or]Again, Freda scoops them up and holds them aloft; again, she starts trembling dangerously. Is the Phantom really that dense under that cloak[stopping]? You need to help Freda, fast."
	
[When Strength Show begins:
	say "[bracket]DEBUG NOTE: sorry, the writing is not done here yet! Messages like 'Event 2' are where I want to put environmental messages about Freda losing strength as the show goes on.[close bracket][paragraph break]".]
	

Chapter - StrengthShowEnd - restore ring and characters when scene ends

Strength Show ends when StrengthShowActive is false.

When Strength Show ends:
	[say "DEBUGDEBUGDEBUG Strength SHOW END.";]
	if StrengthShowSolved is true:
		[say "DEBUGDEBUGDEBUG Strength SHOW PUZZLE WAS SOLVED.";]
		deactivate Freda_show;
		increment Successful Performances;
		memorialise "the cool strongwoman show where she lifted a ghost and the ghost got shot". [add this to crowd banter]

StrengthShowEnd is a page.
It is an end-page.

A page-toggle rule for StrengthShowEnd:
	dismantle the Strength Show.
	
To dismantle the Strength Show:
	now StrengthShowActive is false;
	pause the game;
	unseat the audience;
	cyoa teleport to RmFreda;
	now Freda is in RmFreda;
	now the greeting of Freda is Freda_hello;
	now the bags of flour are nowhere;
	now the Phantom is nowhere;
	have Freda make her report; [i.e. post-show quip; see below]
	if not in CYOA mode:
		try looking.
		
To have Freda make her report:
	if StrengthShowSolved is true:
		say "Right after the show, Freda carries you all the way back to her caravan in the biggest bear hug she's ever given you (weeks later you will learn that you've been walking around with a cracked rib). 'Thank you thank you thank you thank you love you so much love you love you thank you thank you,' she burbles, ragdolling you around. 'You got them good! Sorry I let go of them when I put them down. They got away fast without all that flour weighing them down. But we'll get them again!'[paragraph break]She puts you down and beams at you. 'Love you[if Successful Performances is less than 3]! Now go help the others[no line break][end if]!'"; [the successful performances counter doesn't work because it's incremented after this text is printed, but, like, whatever]
	otherwise:
		say "'Oh man, that was bad[one of][or] too[stopping],' moans Freda, nervously bending and unbending a barbell. It took a bit of cuddling but you've managed to calm her down enough to think straight, or at least as straight as either of you can. She twirls one of the ending weight plates like a fidget spinner. '[unless the bags of flour are known][one of]How is that guy so heavy? How can they be so hard to lift?' She frowns. 'And where did they get that huge coat, anyway? I want a coat like that.[no line break][or]They don't look like they should be that heavy. [i]I'm[/i] not that heavy. I'm not [i]that[/i] heavy. Are they hiding something?[no line break][or]Still. I'm not jealous of that coat anymore, at least. It doesn't even fit them. It looks like they have to keep it held closed. I need to keep my hands free for lifting things.[no line break][stopping][no line break][otherwise][one of]Did you say they've got flour bags under that coat, love? What a cheat! It'd be easy to lift the Phantom without those![no line break][or]Wish we knew where the Phantom lived! We should pour all that flour out. All over their kitchen. I guess we just have to deal with it during the show?[no line break][or]Hate those flour bags. Lola, I know it's cheating, but they cheated first - can we, like get rid of those bags? Rip them, or puncture them... or something?[no line break][stopping][no line break][end if][no line break]'[paragraph break]".
	
[
basic "he's so heavy" thing
if flour is known, hint gradually that bow is needed
]

Section - Solving the Strength Show

StrengthShowSolved is a truth state that varies. StrengthShowSolved is false.

To solve the Strength Show:
	[no text is printed here - it's printed by the Instead rule for shooting the bags of flour, which then calls this phrase. It's inconsistent with how the Magic Show and Beast Show are handled, I know, but it works just fine, and if it ain't broke...]
	[say "DEBUGDEBUGDEBUG Strength Show solved!";]
	now StrengthShowSolved is true;
	[swap dialogue options (PreStrength and PostStrength defined in Freda conversation section)]
	deactivate PreStrength pages;
	activate PostStrength pages;
	dismantle the Strength Show.


Section - quick solve for Strength Show - not for release

Strength Show quicksolving is an action applying to nothing. Understand "teststr" as Strength Show quicksolving.

Check Strength Show quicksolving:
	unless Strength Show is happening:
		say "Not now, dummy." instead.
		
Carry out Strength Show quicksolving:
	solve the Strength Show.


Chapter - Events during Strength Show

Strength Show Counter is a number that varies.
Strength Show Counter is 0.

Every turn during Strength Show (this is the Strength Show operation rule):
	if the player is in RgBigTop: [prevents event playing in turn between player exiting show and show scene ending]
		if there is an event corresponding to a number of Strength Show Counter in the Table of Strength Show Events:
			let E be the event corresponding to a number of Strength Show Counter in the Table of Strength Show Events;
			say "[E][if StrengthShowActive is true][p][end if]"; [if condition prevents extra paragraph break in timeout event]
	increment Strength Show Counter.
		
Table of Strength Show Events
number	event
2	"She's shaking, but Freda looks like she's doing okay so far."
5	"Freda is starting to sweat. She's taking slow and deep breaths."
8	"The trembling is a little more violent now. Freda seems to catch herself as if she was falling asleep, and she raises the Phantom back as high as she can."
10	"Freda stumbles. The crowd gasps as she sinks to one knee. She grunts and manages to hoist the Phantom up again, but she's running out of stamina. Hang in there, Freda."
13	"Freda's not holding the Phantom as high as she was. Her shoulders are sinking a little."
16	"Freda staggers again, and grunts. She's getting really tired."
18	"The trembling has become unbearable to watch. If you can help Freda, you have to do it now."
20	"[Strength Show timeout]"

To say Strength Show timeout:
	say "You're out of time. Freda folds up underneath the Phantom.

[Phantom escapes Strength Show].";
	dismantle the Strength Show.
	
To say Phantom escapes Strength Show:
	say "The audience gasps. You run to Freda and shout for help. She's alright, though, thank goodness. She's hardy. Nothing but bruises.

Later, you'll realise you could have tried to catch the Phantom as they rolled off Freda and ran into the stands, but you weren't paying attention to them at the time. Neither was anybody else".


Part - Scene-specific Rules

Chapter - Forbid player departure during Strength Show

Instead of going from RmRing during Strength Show (this is the forbid leaving Strength Show rule): keep player in ring with Freda.

[Instead of going from RgBigTop to a room which is not in RgBigTop during Strength Show (this is the forbid leaving Strength Show rule): say "You mustn't abandon the Big Top during a show! If you need the performance to end, it would be kinder to let Freda know."]

Chapter - Throwing a pie at Freda is the wrong choice

Instead of throwing the stack of pies at Freda during Strength Show (this is the special reaction to pieing Freda during Strength Show rule):
	say "That... would be a very mean thing to do to Freda right now. Are you sure it will be funny?";
	if the player consents:
		say "You hurl a pie straight at Freda's face and she instantly folds up like a deckchair, crushed under the weight of the Phantom, who makes their escape before anybody can reach the ring to help. Ohhh... that wasn't funny at all.";
		dismantle the Strength Show;
	otherwise:
		say "Seems wise. There's probably a funnier target in here.".
		
Chapter - Climbing either person will unbalance the Phantom and Freda

Instead of climbing Freda during Strength Show:
	try climbing the Phantom.

Instead of climbing the Phantom during Strength Show:
	say "You could try climbing up there and wrestling the Phantom off. But Freda's struggling enough with the Phantom's weight as it is. Are you sure this is a good idea?";
	if the player consents:
		do the Phantom overbalance bad ending;
	otherwise:
		say "Probably for the best. Maybe you can help Freda without having to put any extra strain on her.".
		
To do the Phantom overbalance bad ending:
	say "The second you add your weight to the Phantom's, Freda collapses as if someone had stolen her bones. You fall to the floor, dragging the Phantom down on top of you. The Phantom is very, [i]very[/i] heavy. Ouch.";
	end the story saying "The doctor says you have 'pulverised bones'";
	
Chapter - Pulling/opening Phantom's cloak will unbalance them

Instead of rearrangement when the noun is the cloak during Strength Show:
	if the Phantom is custarded:
		say "No need, the cloak is already open.";
	otherwise:
		say "You reach for the cloak and pull, but Freda and the Phantom wobble dangerously. It looks like trying to open the Phantom's cloak yourself might overbalance everyone, with you underneath them. Are you sure this is a good idea?";
		if the player consents:
			do the Phantom overbalance bad ending;
		otherwise:
			say "Probably for the best. There must be a reason why the Phantom's keeping that cloak closed, though. Maybe there's a less direct way to open it, or make the Phantom let go.".
		
Instead of opening the cloak during Strength Show:
	try pulling the cloak instead.


Chapter - Phantom behaviour

Section - Phantom descriptions

[the below text substitutions are invoked in the Phantom's descriptions in the Phantom book]

To say StrengthShowPhantomDesc:
	say ". They're currently being held aloft by Freda, with their [if the Phantom is clean]arms crossed tightly in front of themselves, clutching onto their cloak[otherwise]hands rubbing custard out of their eyeholes, leaving their flour-lined cloak dangling free[end if]".
	
To say StrengthShowCloakDesc:
	say ". [if the Phantom is clean]The Phantom is clutching the cloak in their hands, keeping it wrapped around their body tightly[otherwise]The cloak dangles in the air under the Phantom and to the side of Freda, and you can see bags of flour stuck to its inside[end if]".

Section - Phantom knocks you away if you try to climb ladder

Instead of climbing the stepladder in the location of the Phantom during Strength Show (this is the stepladder ain't gonna work as a solution to Strength Show rule):
	say "You start climbing the ladder, but the Phantom quickly slaps you away with one hand, the other keeping the cloak tightly closed. You won't be able to climb up to the Phantom to do anything to them."
	
Section - Shooting the Phantom loses the game

Instead of shooting the Phantom with the bow during Strength Show (this is the shooting Phantom during Strength Show kills them rule):
	say "Are you sure you want to shoot at the Phantom[if the Phantom is custarded]? Rather than the flour, that is[end if]?";
	if the player consents:
		say "Okay. You shoot an arrow at the Phantom, catching them square in the tummy[if the Phantom is clean]. Something white and powdery spills out from under the cloak, followed immediately by something worse[end if].[paragraph break]This solves the circus's problem with Phantom invasions. Unfortunately, it's now known as The Circus Where Audience Volunteers Get Drastically Injured By Evil Clowns. This rebrand does not help anybody. The circus stops operating soon afterwards, although you're not around to see its final show, by reason of serving a life sentence for Grievous Bodily Harm conducted in front of hundreds of witnesses.";
		end the story saying "Whoopsy daisy";
	otherwise:
		say "Good choice. Let's try to find a solution that doesn't involve slaughtering the Phantom.".
		
Section - Forbid talking to Phantom

Instead of talking to the Phantom during Strength Show:
	say "[one of]The Phantom says nothing[or]The Phantom still says nothing[or]The Phantom maintains their silence[or]Not a word from the Phantom[or]Not even a peep from the Phantom[or]You try telling the Phantom a joke, to no response[or]You try spooking the Phantom, to no response[or]You try telling the Phantom that you know this really sick little girl, oh, she's so ill, you don't know if she's gonna make it, and her last wish is that the Phantom says something, and it would make her so so sad if she didn't get her last wish. The Phantom is unmoved[or]Still nothing. You wonder if you got sidetracked[or]You don't think the Phantom's gonna say anything for now[stopping].".
Instead of asking the Phantom about something during Strength Show:
	try talking to the Phantom.
Instead of item-asking the Phantom about something during Strength Show:
	try talking to the Phantom.


Part - Objects

Chapter - Bags of flour

The bags of flour are nowhere.

Description of the bags of flour is "The Phantom has bags and bags of flour strapped to the inside of their cloak! Must be a couple hundred kilograms there, and that's in addition to the Phantom's weight - and they're not exactly a small ghost. No wonder Freda is struggling. You wonder how tough the Phantom must be to lug all that flour on them."

Section - The bags of flour are concealed

Rule for deciding the concealed possessions of the Phantom (this is the hide bags of flour rule):
	if the particular possession is the bags of flour:
		if the Phantom is clean:
			yes;
		otherwise:
			no;
	otherwise:
		no.

Section - The bags of flour are revealed when the Phantom is pied

The Phantom can be custarded or clean. The Phantom is clean. [move this to a general rule in case you want to use it for more general pie shenanigans]

Instead of throwing the stack of pies at the Phantom during Strength Show (this is the reveal bags of flour upon pieing Phantom rule):
	if the Phantom is clean:
		now the Phantom is custarded;
		the Phantom cleans themselves in three turns from now;
		now the bags of flour are known;
		say "[one of]It is a perfect throw. The pie arcs through the air and lands squarely in the Phantom's masked face. Custard, straight through the eyeholes.[paragraph break]Maybe instinctively, the Phantom raises their hands to clean the gunk out of their eyes. The cloak falls open, dangling under the Phantom, to the side of Freda. You can see bags of flour strapped to the inside of the cloak![or]It's not as beautiful a throw as the first time - it's a little leptosomic, not the perfect circular arc you got before - but the pie still finds its target. Again, the Phantom drops their cloak to clear their eyes; again, the cloak hangs open by Freda and reveals the bags of flour attached to the insides.[stopping]";
	otherwise:
		say "The Phantom is already pretty well pied-up. Perhaps there's something more useful you could be doing while they're distracted?".
	
Section - The bags of flour are concealed again when the Phantom recovers from a pieing

At the time when the Phantom cleans themselves:
	if the Phantom is custarded:
		now the Phantom is clean;
		if the player is in the location of the Phantom:
			say "The Phantom finishes cleaning their face, and hurriedly hoists their cloak back around them. The bags of flour disappear from your view.".
			


Section - Shooting the bags of flour with the bow-and-arrow solves the Strength Show puzzle 

Instead of shooting the bags of flour with the bow (this is the shooting bags of flour solves Strength Show rule):
	say "An arrow sails into one of the bags with a resounding THUNK. Flour trickles out.

The Phantom seems to realise what you're trying to do. They start yanking their cloak up, but you just manage to get another arrow in before they finish. They poke themselves with an arrow nock when they wrap the cloak around themselves; they yank the arrow out, and you're glad they did, because that rips the bag more and the flour falls out faster.

And all the while, Freda's finding her footing. As more flour falls out, she manages to hoist the Phantom higher. They try to wiggle out of her grasp, but she's got them.

The audience erupts in rapturous applause. It is the best guy-lifting they've ever seen.";
	solve the Strength Show.
	
Section - Taking the bags of flour will unbalance the Phantom and Freda

Instead of rearrangement when the noun is the bags of flour:
	say "They're a little too high to grab easily. Wanna try it anyway?";
	if the player consents:
		say "With a running leap, you grab onto a bag of flour and hang off it, trying to rip it out of the cloak. This adds your weight to the Phantom's for a second.

That's all it takes. Freda gives way. Strongwoman and Phantom and clown all come crashing down in a puff of flour. The stunt has failed!";
		dismantle the Strength Show;
	otherwise:
		say "Okay. Hopefully there's another way to get rid of the flour.".
		
Instead of opening the bags of flour:
	try taking the bags of flour instead.
		

[*TODO: Concerns:
	Why can't the player use the lettuce/rabbit to open the bags?
		Maybe they can! Just say the lettuce won't stick to the bags for now, but earmark this for an alt solution]


Part - Talking to Freda during Strength Show

Chapter - Main tree

Freda_show_hello is a page.
"'[Freda grunt],' grunts Freda. She's fighting the weight too hard to talk, poor thing."
It flips to Freda_show_hub.

Freda_show_hub is a page.

Freda_show_checkin is a page.
"'[Freda grunt].'"
The cdesc is "'How are you holding up?'" It is for Freda_show_hub. It flips to Freda_show_hub.

Freda_show_end is a page.
"'[Freda grunt],' says Freda, and her legs give out from under her.[paragraph break][Phantom escapes Strength Show]."
The cdesc is "'This is too dangerous. We're ending the show now.'" It is for Freda_show_hub. It flips to StrengthShowEnd.

Freda_show_bye is a page.
"'[Freda grunt].'"
The cdesc is "'Stay strong! I'll think of something!'" It is for Freda_show_hub. It is an end-page.

To say Freda grunt:
	say "[one of]Hrngh[or]Rngh[or]Rnhghh[or]Ggghh[or]Nrhgnh[or]Hhhhhg[then at random]".


Book - Beast Show - Lawn's puzzle

Beast Show is a recurring showtime scene.

Part - Scene control

Chapter - BeastShowStart - initialise Beast Show

[define a truth state to switch scene on and off]
BeastShowActive is a truth state that varies. BeastShowActive is false.
Beast Show begins when BeastShowActive is true.

[since Beast Show is begun via Lawn's conversation options (see Lawn_show), we can use a page and a page-toggle rule to provide intro text, shuffle objects and characters into the right place, and switch BeastShowActive on]
BeastShowStart is a page.
"[BeastShowStart desc]".
It is an end-page.

[truth state for checking if the cage has been emptied before show]
LawnClearsCage is a truth state that varies. LawnClearsCage is false.

A page-toggle rule for BeastShowStart:
	now BeastShowActive is true;
	pause the game;
	seat the audience;
	cyoa teleport to RmRing;
	[clear out the cage, and set a truth state to report it when the show opens. "non-cagetoplike" (!) defined under Cagetop in Cage. (the cagetop seems to be a Schrodinger's thing which is considered to be both inside and outside the cage, and this is one of the scenarios where it's inside]
	let L be the list of non-cagetoplike things enclosed by the cage;
	if the number of entries in L is 0:
		now LawnClearsCage is false;
	otherwise:
		now LawnClearsCage is true;
		repeat with item running through L:
			now item is in RmBackstage;
	[now bring the cage to the ring and put Lawn and goose in it]
	now the cage is in RmRing;
	now the cage is closed;
	now the cage is locked;
	now the goose is in the cage;
	now the goose wears the blindfold;
	[now the goose is handled; [supporessing its IA for now]]
	now Lawn is in the cage;
	[prepare correct dialogue and list of events]
	now the greeting of Lawn is Lawn_show_hello;
	now Beast Show Counter is 0;
	now the Beast Show state number is 0; [this controls which table is being looked at - see the Events during Beast Show section]
	iterate the Beast Show.

To say BeastShowStart desc:
	if LawnClearsCage is true:
		say "(Ahead of the show, Lawn checks that the cage is empty before it's moved out to the circus ring. He hauls your junk out of the cage onto the backstage floor, glaring at you.)[paragraph break]A few minutes later, [run paragraph on]";
	otherwise:
		say "Just before the show starts, [run paragraph on]";
	say "you hear a groan from Lawn, and hurry over to him. [one of]S[or]Again, s[or]Once again, s[stopping]omeone has managed to blindfold the goose[one of]???[no line break][or]![no line break][stopping] Lawn tries to untie the blindfold, but while he's being battered by wings, something moves in the corner of your eye. You look up just in time to see...

[PhantomAnnouncement]They disappear through the backstage exit. You want to give chase, but it's too late now, it's showtime. The audience is waiting. The morose Lawn enters the cage with the blindfolded goose, the cage is locked, Freda and the others haul the cage out into the ring, and then it's just you, Lawn, the goose, and the audience.".

[When Beast Show begins:
	say "[bracket]DEBUG NOTE: sorry, the writing is not done here yet! Messages like 'Event A2' are where I want to put environmental messages about Lawn getting more desperate as the goose fails to react.[close bracket][paragraph break]"]
	

Chapter - BeastShowEnd - restore ring and characters when scene ends

[use the truth state defined above to switch scene off]
Beast Show ends when BeastShowActive is false.

When Beast Show ends:
	[say "DEBUGDEBUGDEBUG Beast SHOW END.";]
	if BeastShowSolved is true:
		[say "DEBUGDEBUGDEBUG Beast SHOW PUZZLE WAS SOLVED.";]
		deactivate Lawn_show;
		increment Successful Performances;
		memorialise "the cool goose show they saw that taught them not to get hit by a car". [add this to crowd banter]

[end-page defined to end Beast Show within CYOA]
BeastShowEnd is a page.
It is an end-page.

A page-toggle rule for BeastShowEnd:
	dismantle the Beast Show.
	
[dismantle phrase to restore Beast Show props]
To dismantle the Beast Show:
	now BeastShowActive is false;
	pause the game;
	unseat the audience;
	cyoa teleport to RmLawn;
	now the cage is in RmBackstage;
	now the cage is closed;
	now the cage is unlocked;
	now Lawn is in RmLawn;
	now the goose is in RmStaffE;
	[now the goose is not handled; [reinstating its IA]]
	now the blindfold is nowhere;
	now the greeting of Lawn is Lawn_hello;
	have Lawn make his report; [i.e. post-show quip; see below]
	if not in CYOA mode:
		try looking.
		
To have Lawn make his report:
	if BeastShowSolved is true:
		say "It's later on, the goose has been freed from its blindfold with much biting and cursing, and now you and Lawn are back in his caravan. He turns to you stiffly. 'Look, clown... Lola. I know we're not the closest... I know I can be somewhat abrasive, I don't play along, I talk behind your back, but... that was a good thing you did for the Goose and I, helping us there. You've saved our show, and by extension, the circus. Thank you, Lola.'[paragraph break]This is the first time Ken Lawn has ever sincerely thanked you. You're so moved, you're not even gonna ask about that 'talk behind your back' bit.";
	otherwise:
		say "After a lot of fuss, the goose is eventually freed from its blindfold[one of][or] again[stopping]. You both return to Lawn's caravan. He slams the door behind him.[paragraph break]'This is embarassing! [one of]I'm going to be the laughing stock of the Goose And Waterfowl Tamer's Association Christmas luncheon[or]I can't keep being humiliated like this[stopping]!' he roars. 'Look, clown, I know you're doing your best, but... [if Beast Show state number is 1]isn't there anything you can [i]do[/i]? If the Goose can't [i]see[/i] me, what else can the Goose even react to? I'm sure you must have something on you that can help![no line break][otherwise if Beast Show state number is 2]look, was the Goose reacting to you honking your nose there? Is there anything else you can honk? Don't answer that, I don't want jokes. Just find something else that honks.[no line break][otherwise if Beast Show state number is 3]that last one we couldn't do, that one about flying into traffic, that's the same as the first bit. I thought you got the hang of that one![no line break][otherwise if Beast Show state number is 4]don't you have another kind of honk in you? What else is there? You've got your nose, you've got your car horn... what else is there that honks, some other kind of horn? Bullhorn? Whatever. Figure it out.[no line break][otherwise if Beast Show state number is 5]I know you can do the angel wings bit, you did it before. It's the same as the earlier bit, with the [']who, me?['] bit. You know the bit, that bit. Whatever. Let's try it again.[no line break][otherwise if Beast Show state number is 6]I suppose it's too much to ask that you've got one more kind in you. We must be nearly there. Flying up, that's just the same as the other flying bits, but... but upwards. Straight upwards. We must have it, surely.[no line break][otherwise]isn't there anything you can [i]do[/i]? If the Goose can't [i]see[/i] me, what else can the Goose even react to?[no line break][end if]'[paragraph break]".
		
[phew, that's a long otherwise-if statement. That last "otherwise" should never be triggered - pretty sure the Beast Show state number (which is what controls progress through the various Beast Show mini-puzzles - see below) is tight enough to always be 1-6 while show is unsolved - but I've added a little boilerplate message just in case I'm wrong]
	

Section - Solving the Beast Show

BeastShowSolved is a truth state that varies. BeastShowSolved is false.

To solve the Beast Show:
	say "[line break]The audience explodes! They can't contain themselves! People run down to the ring to high-five Lawn through the bars! Lawn picks up the goose and holds it up for people to pet it, and everyone only gets wing-beaten a little bit!

You watch the frenzy from on top of the cage. Looks like this show went pretty well. The Phantom has been vanquished this time!";
	now BeastShowSolved is true;
	[swap dialogue options (PreBeast and PostBeast defined in Lawn conversation section)]
	deactivate PreBeast pages;
	activate PostBeast pages;
	dismantle the Beast Show.

[
[temp solution]
Instead of attacking the Phantom during Beast Show:
	now BeastShowSolved is true;
	switch to cyoa at BeastShowSuccess.
	
BeastShowSuccess is a page.
"You bludgeon the Phantom! You win!"

BeastShowSuccessTestChoice is a page.
The cdesc is "Nice." It is for BeastShowSuccess. It flips to BeastShowEnd.
]

Chapter - Events during Beast Show

Section - Running down the current mini-table

The current Beast Show state is a table name that varies. The current Beast Show state is the Table of Beast Show Events A.

Beast Show Counter is a number that varies.
Beast Show Counter is 0.

Every turn during Beast Show (this is the Beast Show operation rule):
	if the player is in RgBigTop: [prevents event playing in turn between player exiting show and show scene ending]
		if there is an event corresponding to a number of Beast Show Counter in the current Beast Show State:
			let E be the event corresponding to a number of Beast Show Counter in the current Beast Show state;
			say "[E][if BeastShowActive is true][p][end if]"; [if condition prevents extra paragraph break in timeout event]
	increment Beast Show Counter.
	
Section - Listing and changing the current mini-table
	
The Beast Show state list is a list of table names that varies. The Beast Show state list is {Table of Beast Show Events A, Table of Beast Show Events B, Table of Beast Show Events C, Table of Beast Show Events D, Table of Beast Show Events E, Table of Beast Show Events F}.

The Beast Show state number is a number that varies. The Beast Show state number is 0.

To iterate the Beast Show:
	[tick the Beast Show state number forward while assigning it to N for readability]
	increment the Beast Show state number;
	let N be the Beast Show state number;
	[sanity check: is N too high? if so, lock to Table A. note: this shouldn't be possible during the finished game.]
	if N is greater than the number of entries in the Beast Show state list:
		say "DEBUGDEBUGDEBUG the Beast Show state number is higher than the number of tables. This should never actually happen, since the puzzle should have timed out in a failure state by this point and every new puzzle attempt should reset the timer. Please send a bug report if you see this during play. Setting to the first table instead...";
		now N is 1;
	[update to the correct table]
	now the current Beast Show state is entry N in the Beast Show state list;
	[reset the Beast Show Counter to go back to Entry 0]
	now the Beast Show Counter is 0.

Section - Testing the Beast Show Tables - not for release

Testing the Beast Show tables is an action applying to nothing. Understand "testbeast" as testing the Beast Show tables.

Carry out testing the Beast Show tables:
	iterate the Beast Show.

Section - Beast Show tables

Table of Beast Show Events A
number	event
0	"'Alright, settle down, settle down!' It looks like Lawn is going to press ahead with the show as he usually performs it. 'You kids better listen up! This is important! My name is Mister Lawn, and this is my incredible storytelling goose! Settle down! We're going to tell you a story with a moral. It's called [i]The Goose Who Ran Into Traffic And Got Hit By A Car[/i].[paragraph break]'[']Once upon a time, there was a goose. A goose who crossed the road by charging into traffic... like so![']' Lawn raises both hands to his chest, like he's beckoning. The goose sits still."
2	"Lawn raises both hands to his chest again, more desperately this time. 'Yes, she [i]charged[/i]... into traffic!' Then again, and again."
5	"[Beast Show warning]."
8	"Lawn tries again and again. 'Come on, fly forward, you dumb wonderful beast!' he mutters, not as quietly as he thinks. [Beast Show final warning]."
10	"[Beast Show timeout]"

Table of Beast Show Events B
number	event
0	"The audience politely applauds[first time]. Lawn gives you an impressed nod[only].[paragraph break]'Yes, she always loved to run into traffic,' Lawn continues. 'And we would all admonish her! We would all say [']Goose, you must wait for the traffic to stop before you cross the road, or you will get hit!['][paragraph break]'But the goose would always say... [']Who, me?[']' At this, Lawn spreads his arms out wait, and looks at the goose hopefully. The goose just stands there."
2	"Lawn clears his throat. 'Yes, she would spread her wings like [i]this![/i]' He spreads his arms again, to no extra effect."
5	"[Beast Show warning]."
8	"'She would SPREAD! Her WINGS!' Lawn spreads his arms again and again desperately like he's doing exercises. [Beast Show final warning]."
10	"[Beast Show timeout]"

Table of Beast Show Events C
number	event
0	"The audience murmurs - they're impressed[first time]. So is Lawn, who gives you a rare thumbs-up[only].[paragraph break]'And so it was that one fateful day, our goose pushed her luck yet again. She just couldn't wait for the light to turn red. She flew into traffic...' Lawn brings his hands up to his chest again. No response from the goose."
2	"Lawn gestures again, a little hopelessly. 'She [i]flew[/i] into that traffic! Any moment now!'"
5	"[Beast Show warning]."
8	"Lawn raises his hands to his chest a couple more times, then glances at you. 'Lola, do the thing again, please,' he whispers. [Beast Show final warning]."
10	"[Beast Show timeout]"

Table of Beast Show Events D
number	event
0	"The audience claps again, and one or two audience members whoop appreciatively. Lawn is looking a little happier. You're about halfway done with the goose-taming show, you think.[paragraph break]'Yes, she played with traffic again - and met a Land Rover speeding around the corner. And that, I'm afraid, was the end of our goose.'[paragraph break]Lawn now points down at the floor. The goose, of course, doesn't react."
2	"'Yes, I'm afraid it was the end! She was done for.' Lawn points at the ground again, more empathetically. 'Someone's it takes a little while for a goose's body to realise it's done for,' he adds. The audience doesn't look that convinced."
5	"[Beast Show warning]."
8	"Lawn points down as hard as possible, his index finger waving around. 'Yes, she didn't just [i]PLAY DEAD[/i]' - that last bit directed at the goose, very loudly - 'she [i]was[/i] dead! On the ground. Please.' [Beast Show final warning]."
10	"[Beast Show timeout]"

Table of Beast Show Events E
number	event
0	"The audience starts cheering[first time]. Lawn gives you another thumbs up, then returns to working the crowd[only].[paragraph break]'Okay, settle down, settle down! It's not the end of the story yet! Our goose had been reckless, and now it was time to go to Goose Heaven. So she gained her angel wings...'[paragraph break]Lawn throws his arms wide again, to the usual reaction from the blindfolded goose."
2	"'She gained her angel wings, which are a pair of wings that come out wide from the body of the goose,' says Lawn impatiently, spreading his arms again."
5	"[Beast Show warning]."
8	"'Lola, honk the car horn again, would you?' whispers Lawn, sounding defeated with his arms still outstretched. [Beast Show final warning]."
10	"[Beast Show timeout]"

Table of Beast Show Events F
number	event
0	"Now the audience is going buck wild, chanting Lawn's name and throwing chairs around. Lawn's lapping it up.[paragraph break]'Alright, folks, settle down! Almost there! This is the good part! Yes, our goose got her wings... and she ascended to Goose Heaven!'[paragraph break]This time, Lawn raises both hands to the sky, like he's throwing something upwards. The goose doesn't stir."
2	"'Yes, she [i]ascended![/i]' shouts Lawn, throwing his hands up again towards the top of the cage. 'She flew up!'"
5	"[Beast Show warning]."
8	"Lawn raises his hands once more, desperately. 'She flew [i]upwards![/i] In an [i]upwards[/i] direction, which is [i]above us![/i] Come on, you stupid beautiful animal, if you can fly at our face you know how to do this!' [Beast Show final warning], which seems awful unfair considering how well it's gone so far, but that's show business."
10	"[Beast Show timeout]"


To say Beast Show warning:
	say "'[one of]Mister Lawn, I think your goose is sick,[or]That goose isn't trained at all![no line break][or]Is that goose even reacting to anything?[no line break][or]Dumb goose trainer can't even train a goose,[or]I can't believe I missed my son's graduation for this,[or]We should have gone to the carnival back at home. They had a trained swan,[then at random]' shouts an audience member.

'[one of]Hey[or]Hey, you[or]Hey, kid[purely at random]! [one of]Settle down[or]Be quiet[or]Shush[or]Quit distracting me[purely at random]!' shouts Lawn back. But the rest of the audience is looking uncomfortable too. If Lawn (or, let's face it, more likely you) can't find a way to make the blindfolded goose respond soon, the performance might have to be cancelled".

To say Beast Show final warning:
	say "The audience looks like they're about to [one of]walk out[or]riot[purely at random][run paragraph on]".

To say Beast Show timeout:
	say "You're out of time! And the audience is out of patience. They start booing and yelling and throwing things at you and at Lawn through the bars.

'Ow! Quit it! Ow! I should have called this [i]The Story Of The Ungrateful Audience Who Can't Even Wait Twenty Minutes For A Goose To Tell A Story[/i]! Ow! Stop it!'

You flee backstage. Lawn has to just huddle into a ball until you can round up everyone to move the cage back. The goose stands on Lawn's back and honks at the darkness.";
	dismantle the Beast Show.


Part - Scene-specific Rules

Chapter - Forbid player departure during Beast Show

Instead of going from RmRing during Beast Show (this is the forbid leaving Beast Show rule): keep player in ring with Lawn.

[Instead of going from RgBigTop to a room which is not in RgBigTop during Beast Show (this is the forbid leaving Beast Show rule): say "You mustn't abandon the Big Top during a show! If you need the performance to end, it would be kinder to let Lawn know."]

Chapter - New goose rules for honking (featuring checks to iterate the Beast Show table)

After squeezing the red nose in the location of the goose during Beast Show (this is the goose reacts to red nose honk while caged rule):
	if the player is on the cagetop:
		say "'HOOONK!' The aggrieved goose flies skyward and pecks at your feet through the ceiling of the cage.";
		if the current Beast Show State is Table of Beast Show Events F:
			[say "DEBUGDEBUGDEBUG correct answer.";]
			solve the Beast Show;
		otherwise:
			[say "DEBUGDEBUGDEBUG wrong answer.";]
			say "[Beast Show incorrect]";
	otherwise:
		say "'HOOONK!' The aggrieved goose flies at the wall of the cage and beats its wings against the bars.";
		if the current Beast Show State is Table of Beast Show Events A or the current Beast Show State is Table of Beast Show Events C:
			[say "DEBUGDEBUGDEBUG correct answer.";]
			iterate the Beast Show;
		otherwise if the current Beast Show State is Table of Beast Show Events F:
			[say "DEBUGDEBUGDEBUG almost-correct answer.";]
			say "'Almost, almost!' cries Lawn. 'She flew [i]upwards[/i]!'";
		otherwise:
			[say "DEBUGDEBUGDEBUG wrong answer.";]
			say "[Beast Show incorrect]".
			
After squeezing the car horn in the location of the goose during Beast Show (this is the goose reacts to car horn honk while caged rule):
	say "[goose car horn response].";
	if the current Beast Show State is Table of Beast Show Events B or the current Beast Show State is Table of Beast Show Events E:
		[say "DEBUGDEBUGDEBUG correct answer.";]
		iterate the Beast Show;
	otherwise:
		[say "DEBUGDEBUGDEBUG wrong answer.";]
		say "[Beast Show incorrect]".
		
After playing the French horn in the location of the goose during Beast Show (this is the goose reacts to French horn honk while caged rule):
	say "[goose French horn response].";
	if the current Beast Show State is Table of Beast Show Events D:
		[say "DEBUGDEBUGDEBUG correct answer.";]
		iterate the Beast Show;
	otherwise:
		[say "DEBUGDEBUGDEBUG wrong answer.";]
		say "[Beast Show incorrect]".
	
To say Beast Show incorrect:
	say "'No, no, no!' complains Lawn. 'The goose didn't do that!'".


Chapter - Lawn kicks objects out of cage

[This is actually implemented under the cage's response to dropping something while on the cagetop.]


Part - Talking to Lawn during Strength Show

Chapter - Main tree

Lawn_show_hello is a page.
"'What? What do you want?'"
It flips to Lawn_show_hub.

Lawn_show_hub is a page.

Lawn_show_gestures is a page.
"'It's very simple! This' - Lawn raises his hands to his chest - 'means I want the goose to fly forward, up to the bars. This' - he raises his hands skywards - 'means the goose needs to fly up! This' - Lawn throws his arms wide - 'is supposed to make the goose spread his wings out. And [i]this[/i]' - Lawn points down at the floor - 'means [']play dead[']! I don't have time to explain all of this to you! Ask me after the show, if we live that long!'"
The cdesc is "'What do all your hand gestures mean?'" It is for Lawn_show_hub. It flips to Lawn_show_hub.

Lawn_show_end is a page.
"'I thought you'd never ask.' Lawn raises his voice at the audience. 'Alright, show's over folks! That was the tale of [i]The Goose Who Sat There And Didn't Do Anything[/i]! That was fully the story I intended to tell! Settle down! Quit throwing things! Go back to your places of residence!'"
The cdesc is "'This isn't going well. Do you want to end the performance?'" It is for Lawn_show_hub. It flips to BeastShowEnd.

Lawn_show_bye is a page.
The cdesc is "'Nothing. Let's keep going.'" It is for Lawn_show_hub. It is an end-page.


Part - Objects

Chapter - Cage

The cage is a container in RmBackstage. It is transparent, closed, openable, unlocked, enterable and lockable.

Initial appearance of the cage is "[if the cage is in RmBackstage]There's a huge cage in storage here, the cage in which Lawn and his goose perform their show[otherwise]A huge cage has been set up within the Ring. You're outside it, and inside are Lawn and the goose[end if]."

Description of the cage is "During his Beast Show, Lawn locks himself and the goose in this immense cage. Each of the cage's four sides is a lattice of iron bars, criss-crossing vertically and horizontally, spaced about six inches apart. The top of the cage is covered by the same kind of lattice, preventing the goose from flying out to harass the audience (and preventing Lawn from climbing out to argue with children in the audience)."

The cage is fixed in place.
The cage is known.

To say cage-is-fixed:
	say "Even with Freda's help, the cage takes a team of people to move around. Best leave it be."
Check taking the cage (this is the can't take the cage rule):
	say cage-is-fixed instead.
Check pushing the cage (this is the can't push the cage rule):
	say cage-is-fixed instead.
Check pushing the cage to (this is the can't push the cage to rule):
	say cage-is-fixed instead.
	
The can't insert into closed containers rule does nothing when inserting something into the cage.
Report inserting something into the cage when the cage is closed:
	say "You slip [the noun] between the bars." instead.
[*TODO: write the reverse as well!]

[Rule for printing the name of the cage during Beast Show:
	say "cage (in which Lawn is trying valiantly to perform his routine with the blindfolded goose)";
	omit contents in listing.]
[this doesn't work, for reasons I don't care to troubleshoot today, so it looks worse and more wordy than just listing the contents normally. Must take another crack at this]
	
Section - Cagetop - part of cage which lets it act as climbable

[much of this code cribbed from the Inform 7 docs, example 58 "U-Stor-It"]

The cagetop is part of the cage. The cagetop is a supporter. The cagetop is enterable.

A thing can be cagetoplike or non-cagetoplike. A thing is usually non-cagetoplike. The cagetop is cagetoplike.

The cagetop is privately-named. Printed name of the cagetop is "cage's top".

Before opening the cagetop:
	try opening the cage instead.
Before closing the cagetop:
	try closing the cage instead.
Before unlocking the cagetop with:
	try unlocking the cage with the second noun instead.
Before locking the cagetop with:
	try locking the cage with the second noun instead.
	
Before inserting something into the cagetop: 
	try inserting the noun into the cage instead. 


[the following is a workaround for a bug where the player is listed as "in the cage" even though they are on the cagetop. It copies and adapts the "room description heading rule" in the Standard Rules. This happens (I think) because the cagetop is part of the cage, so the regular room description heading rule considers the whole cage to be the intermediary between the player and the rest of the room - the rule can see that the player has entered the cage in some fashion, can see that the cage is a container, and makes the wrong assumption.]

Carry out looking when the player is on the cagetop (this is the room description heading for cagetop rule):
	say bold type;
	if the visibility level count is 0:
		begin the printing the name of a dark room activity;
		if handling the printing the name of a dark room activity:
			say "Darkness" (A);
		end the printing the name of a dark room activity;
	otherwise if the visibility ceiling is the location:
		say "[visibility ceiling]";
	otherwise:
		say "[The visibility ceiling]";
	say roman type;
	say " (on [the cage])";
	[let intermediate level be the visibility-holder of the actor;
	repeat with intermediate level count running from 2 to the visibility level count:
		if the intermediate level is a supporter or the intermediate level is an animal:
			say " (on [the intermediate level])" (B);
		otherwise:
			say " (in [the intermediate level])" (C);
		let the intermediate level be the visibility-holder of the intermediate level;]
	say line break;
	say run paragraph on with special look spacing.
	
The room description heading rule does nothing when the player is on the cagetop.


Section - putting things on the cage (they fall through the bars)

Before putting something on the cage:
	try putting the noun on the cagetop instead.

Check putting something on the cagetop:
	if the player is on the cagetop:
		try dropping the noun instead;
	otherwise:
		say "You can't reach the top of the cage from down here." instead.

Instead of dropping something when the player is on the cagetop:
	say "[drop from cagetop response][p]";
	if Beast Show is happening:
		now the noun is in RmRing;
	otherwise:
		now the noun is inside the cage.
		
To decide what text is drop from cagetop response:
	decide on "[The noun] falls between the bars and lands inside the cage.[if Beast Show is happening] Lawn kicks [regarding the noun][them] out into the ring again. 'Hey, watch where you drop your inventory items, clown!'[end if]".
	
Section - Climbing the cage (ie entering the cagetop)
	
Before climbing the cage (this is the redirect climbing cage to entering cagetop rule):
	if the player is inside the cage:
		say "You clamber around inside the cage for a second." instead;
	otherwise if the player is on the cagetop:
		try getting off the cagetop instead;
	otherwise:
		try entering the cagetop instead.
		
Before entering the cagetop (this is the don't let player climb cage with stepladder rule):
	if the player carries the stepladder:
		say "You're finding it very difficult to climb the cage while carrying the stepladder." instead.
		
After entering the cagetop (this is the report entering cagetop and show room desc rule):
	say "The horizontal bars of the cage are spaced just right for you to scramble up on top[if Beast Show is happening], with the goose show happening right below you[end if]. Thankfully your big feet keep you stable up here and stop your legs falling between the bars.";
	try looking.
	
Before getting off the cage (this is the redirect getting off cage to cagetop rule):
	try getting off the cagetop instead.
	
After getting off the cagetop (this is the report exiting cagetop and show room desc rule):
	say "You quickly clamber down the cage.";
	try looking.

[	
Every turn:
	if the player is on the cagetop:
		say "DEBUGDEBUGDEBUG Player on top of cage.";
	if the player is in the cage:
		say "DEBUGDEBUGDEBUG Player inside cage.".
]

Section - Climbing the stepladder next to the cage

[using the stepladder to access the cage's top is unnecessary - you can just climb the cage instead. But some players may want to try it anyway]

The climbing stepladder by cage rule does nothing unless the location of the stepladder is the location of the cage.
The climbing stepladder response rule does nothing if the location of the stepladder is the location of the cage.

Carry out climbing the stepladder (this is the climbing stepladder by cage rule):
	if the stepladder is inside the cage:
		if the player is inside the cage:
			say "You scurry up the ladder, bonk your head on the bars of the cage's ceiling and fall off again.";
		otherwise:
			say "The stepladder is inside the cage right now.";
	otherwise:
		unless the player is on the cagetop:
			say "You climb the ladder. It wobbles upsettingly, but from here you make a daring leap and scramble onto the top of the cage!"; 
			now the player is on the cagetop;
		otherwise:
			say "You carefully clamber back onto the ladder and down to the floor.";
			now the player is in RmRing;


Chapter - Blindfold

The blindfold is nowhere. The blindfold is wearable.

Description of the blindfold is "The blindfold seems to just be a chocolate biscuit wrapper that's been tied around the goose's eyes. But the knot is very small and tight - not a chance that you or Lawn can get it untied any time soon.".

[To randomise the blindfold:
	now the description of the blindfold is "The blindfold seems to actually be [one of]a chocolate biscuit wrapper[or][or][or][sticky random]".]


Book - Unmasking

Unmasking is a scene.

Part - Scene control

Chapter - Unmasking start

Successful Performances is a number that varies. Successful Performances is 0.
Unmasking begins when Successful Performances is 3.

When Unmasking begins:
	now the tyre is slashed;
	seat the audience;
	[now the Phantom is handled;]
	now the Phantom is in RmRing;
	now Adagio is handled;
	now Adagio is in RmRing;
	now the greeting of Adagio is Adag_hello_unmask;
	now Freda is handled;
	now Freda is in RmRing;
	now the greeting of Freda is Freda_hello_unmask;
	now Lawn is handled;
	now Lawn is in RmRing;
	now the greeting of Lawn is Lawn_hello_unmask;
	now the initial appearance of the Ringmaster is "The boss [one of]waits[or]hovers[purely at random] [one of]nervously[or]patiently[purely at random] nearby.";
	now the Ringmaster is in the location of the player;
	now the greeting of the Ringmaster is Mast_hello_unmask;
	have the Ringmaster make his report;
	add the Ringmaster to the list of followers. 

To have the Ringmaster make his report:
	let the accompanier be Lawn;
	let the interjection be "[UnmIntLawn]";
	if the player is in RmFreda:
		now the accompanier is Freda;
		now the interjection is "[UnmIntFreda]";
	otherwise if the player is in RmAdagio:
		now the accompanier is Adagio;
		now the interjection is "[UnmIntAdagio]";
	say "'Hello? H-Hello!'

The Ringmaster runs in, waving his arms like those tall inflatable boys you get outside of used car warehouses. 'We got them! We got them!' He stops to catch his breath for several minutes while you and [the accompanier] wait. 'We just caught the Ph-Phantom! We've got them tied up in the circus!'

[the interjection][line break]'You too, L-Lola,' says the boss. 'Th-thank you for helping everyone. I want you to be there when we find out who this ghost really is.'".

To say UnmIntAdagio:
	say "'Ah, wonderful,' says Adagio. 'Let's see what's going on.' She leaves the camper and heads towards the circus.".
To say UnmIntFreda:
	say "'I'm there!' shouts Freda, and she clambers out of the caravan and runs to the circus.".
To say UnmIntLawn:
	say "'Finally!' says Lawn. 'Time to give them a piece of my mind!' He heads out of the caravan and towards the circus.".
	
Chapter - Unmasking prompt

UnmaskingPrompted is a truth state that varies. UnmaskingPrompted is false.

Report going to RmStands during Unmasking (this is the prompt Phantom unmasking rule):
	if UnmaskingPrompted is false:
		now UnmaskingPrompted is true;
		say "As you enter the big top, you see them. The Phantom's been tied up in the ring, and they're sitting very quietly. The others are there too. Adagio catches your eye and beckons you over. 'We spotted the Phantom lurking about the Wheel,' she says. 'Would you care to do the honours and unmask our spectre?'".


Chapter - Unmasking end

Section - The unmasking action

[I'm calling it verb-unmasking because I was silly and called the scene Unmasking, and I don't want to risk any confusion]
Verb-unmasking is an action applying to one thing.
Understand "unmask [something]" as verb-unmasking.

Check verb-unmasking (this is the check unmasking rule):
	if the noun is not a person:
		say "That can't be unmasked" instead;
	otherwise:
		if the noun is Lola:
			say "It's not a mask, it's facepaint. And no, it stays on." instead;
		otherwise if the noun is not the Phantom:
			say "[regarding the noun][They're] not wearing a mask. Not a literal one, anyway." instead.
			
Carry out verb-unmasking (this is the unmask during Unmasking but not elsewhere rule):
	if Unmasking is happening:
		try taking the mask;
	otherwise:
		if Strength Show is happening:
			say "You give it a good go, but the Phantom's head is just a little out of your reach. Another time, perhaps.";
		otherwise if Unmasking has happened:
			say "He's pretty well unmasked already.".

Section - taking the mask off

Instead of taking the mask during Unmasking (this is the unmask Phantom during Unmasking rule):
	if the player is in the clown car:
		say "You can't reach them from here. You will, unfortunately, have to get out of your comfortable car to dramatically unmask the Phantom.";
	otherwise:
		unmask the Phantom; [phrase defined in the Phantom Book]
		now the player has the mask;
		say "You grab the mask, revealing-"

[list rules explicitly, otherwise the can't unmask Phantom rule overrides this scene logic]
The unmask Phantom during Unmasking rule is listed before the can't unmask Phantom rule in the instead rules.
	
Unmasking ends when the phantom is unmasked.

When Unmasking ends:
	[say "DEBUGDEBUGDEBUG UNMASKING SCENE ENDS.";]
	pause the game.
	
Part - Scene rules

Chapter - Ringmaster follows Lola

[I dummied this out because the behaviour is covered by the rule "people follow the player" which also controls everyone following Lola after the Phantom escapes]
[Every turn during Unmasking (this is the Ringmaster follows player during Unmasking scene rule):
	if the location of the Ringmaster is not the location of the player:
		let the way be the best route from the location of the Ringmaster to the location of the player, using doors; 
		try the Ringmaster going the way.]
		
Chapter - Can't talk to Phantom

Check talking to the Phantom during Unmasking (this is the can't talk to Phantom before unmasked rule):
	say "The Phantom maintains their silence." instead.
	
Check item-asking the Phantom about something during Unmasking (this is the redirect item-asking during Unmasking rule):
	say "The Phantom maintains their silence." instead.
		
Check asking the Phantom about something during Unmasking (this is the redirect asking during Unmasking rule):
	say "The Phantom maintains their silence." instead.
	
[god there's a lot of techncal debt in this project. I wanna condense these rules but I can't remember how things break and which verbs I'm using exactly!]
	
Chapter - Climbing Phantom

Check climbing the Phantom during Unmasking:
	say "'I don't think they're going to give you a very good piggyback ride, Lola,' says Adagio, as everyone watches you clamber around the Phantom's neck and shoulders for half a minute." instead.
	
Chapter - Don't untie Phantom

Instead of untying the Phantom during Unmasking:
	say "You're sure you didn't even move a muscle, but nevertheless everyone screams at you to leave the Phantom be and take the mask first."
	


[
Chapter - Redirect talking during Unmasking

[Originally was going to ban talking during Unmasking in order to focus player, but it meant you wouldn't get to see a lot of the post-show dialogue (i.e. whoever is solved last immediately kicks off Unmasking). Kept this code in just in case, but some of the dialogue has been moved to new greetings)]

Check talking to someone during Unmasking (this is the redirect convo during Unmasking rule):
	if there is a response corresponding to a person of the noun in the Table of Unmasking Conversation:
		say "[the response corresponding to a person of the noun in the Table of Unmasking Conversation][paragraph break]" instead.
		
Table of Unmasking Conversation
person	response
Adagio	"'We spotted the Phantom lurking about the Wheel,' says Adagio. 'Would you care to do the honours and unmask our spectre?'"
Lawn	"'Adagio and Freda made me wait for you,' says Lawn, who's pacing impatiently. 'I can't wait to find out who this guy is.'"
Freda	"'We thought you should get to take their mask off, babe, since you did everything else for us,' smiles Freda[if the player is in RmRing]. She squeezes your hand[end if]."
the Ringmaster	"'[if the player is in RmRing]Could you t-take their mask off for us, Lola? I don't want to get any closer than this,[otherwise]Um, Lola? The Phantom, in the Ring? Would you l-like to see who they are?[end if]' quavers your boss."
the Phantom	"The Phantom maintains their silence."

Check item-asking someone about something during Unmasking (this is the redirect item-asking during Unmasking rule):
	if there is a response corresponding to a person of the noun in the Table of Unmasking Asks:
		say "[the response corresponding to a person of the noun in the Table of Unmasking Asks][paragraph break]" instead.
		
Check asking someone about something during Unmasking (this is the redirect asking during Unmasking rule):
	if there is a response corresponding to a person of the noun in the Table of Unmasking Asks:
		say "[the response corresponding to a person of the noun in the Table of Unmasking Asks][paragraph break]" instead.
		
Table of Unmasking Asks
person	response
Adagio	"Adagio waves that away. 'I think we need to focus. Let's unmask the Phantom first, then maybe we can talk more.'"
Lawn	"'Can we get this guy's mask off first?' Lawn retorts impatiently."
Freda	"'We can talk about it later, hon,' says Freda. 'Everyone's waiting for you to take the ghost down.'"
the Ringmaster	"'Um, I don't think we should talk much now,' the boss says nervously. 'Could you unmask them and we can get them out of the circus first?'"
the Phantom	"The Phantom maintains their silence."
]
		
Book - Endgame

Part - EndgameA (from circus to car)

EndgameA is a climactic scene.

Chapter - Scene control

Section - EndgameA start

EndgameA begins when Unmasking ends.

When EndgameA begins:
	[say "DEBUGDEBUGDEBUG ENDGAME A SCENE (CIRCUS) STARTS.";]
	switch to cyoa at Reveal_intro.
	
Section - EndgameA end

EndgameA ends when the player is in the clown car and the tyre is changed.

[When EndgameA ends:
	say "DEBUGDEBUGDEBUG ENDGAME A SCENE ENDS.".]
	

Chapter - The reveal conversation

Section - Introduction

Reveal_intro is a page.
"He launches himself upwards, knocking you backwards. The ropes fall in coils around him, and he pockets the razor blade he'd been holding. He stands up, a chiselled, clean-shaven man.

'Well, here we are again,' he says to the Ringmaster. 'Remember me... [']boss[']?'

It's... it's..."

Reveal_intro_who-c1 is a page.
The cdesc is "'... who are you?'" It is for Reveal_intro. It flips to Reveal_intro_who.
Reveal_intro_who-c2 is a page.
The cdesc is "'Sorry, who are you again?'" It is for Reveal_intro. It flips to Reveal_intro_who.
Reveal_intro_who-c3 is a page.
The cdesc is "'??????'" It is for Reveal_intro. It flips to Reveal_intro_who.
Reveal_intro_who-c4 is a page.
The cdesc is "'?'" It is for Reveal_intro. It flips to Reveal_intro_who. [we salute you, Ryan Pequin]

Reveal_intro_who is a page.
"The unmasked Phantom turns to you. 'Why, clown, surely a local citizen would recognise their local Member of Parliament, Marcus Pooting MP. And surely one with respect for the history of the circus would recognise its former troupe member...'

Something dawns on the Ringmaster. 'You! Y-You're Magnus, our old strongman!'

'That was another life,' smirks Mister Pooting, 'and one I deeply regret. Please, call me Marcus Pooting MP.'"
It flips to Reveal_hub.

Reveal_hub is a page.

Section - Reveal_magnus - who the heck is the Phantom

Reveal_magnus is a page.
"'You wouldn't have done,' murmurs Adagio. 'He was gone before you and Freda joined us. Not our favourite person.'

'N-now, M-Magnus,' the Ringmaster quavers, while the Phantom - Mister Pooting - stares him down. 'I'm v-very sorry we had to let you go, but you have to realise-'

'Well [i]I'm[/i] not sorry!' interjects Lawn."
The cdesc is "'Who's Magnus? I don't think I've heard anyone talk about him.'" It is for Reveal_hub. It is a one-off.

Reveal_magnus_1 is a page.
"'Yes, that's the one,' says Adagio. 'Always with very little notice, too. We had to cancel more than a few shows thanks to dead grandmothers.'

'N-now, let's be fair, everyone,' stammers the boss. 'Some of us h-have very large families, and-'

'He doesn't work here anymore, Henry! You don't have to see both sides!' interrupts Lawn. 'Anyway, don't you remember those photographs of him in Vegas during funeral number 6?'

'I have no recollection of that time,' declares the Phantom.".
The cdesc is "'Wait, wasn't he the one who who took time off for his grandma's funeral, like, eight times?'". It is for Reveal_magnus. It flips to Reveal_hub.

Reveal_magnus_2 is a page.
"'W-we never actually proved that,' begins the boss.

'No, we didn't,' says Adagio. 'But we know [i]someone[/i] stole your wallet and planted it in Kentucky's caravan. It's a good thing he had that alibi, getting into that argument with that seven-year-old in front of that school trip.'

'And who could have tried that, huh?' shouts Lawn, squaring up to Mister Pooting. 'Could it perhaps be the man who borrowed money from the victim and didn't want to pay it back? And still hasn't, by the way!'

'A calumny,' says the Phantom. 'Anybody could have stolen from the Ringmaster, with the weak and breakable lock his old caravan had.'".
The cdesc is "'Wait, wasn't he the one who tried to get Ken fired?'" It is for Reveal_magnus. It flips to Reveal_hub.

Reveal_magnus_3 is a page.
"'W-w-well, I wouldn't have said t-that,' says the boss. 'It was just that, that s-ome of the expenses Magnus was claiming were, were, were difficult to justify...'

'Henry, stand up for yourself,' snaps Lawn. 'You fired him and you were right to do it. What was it, £5000 for [']supplements[']?'

'A necessary expense,' says Magnus or Marcus or whoever, in clipped tones. 'Dietary supplements are an important part of any strength-building regime.'

'My protein powder costs me, like, £30 for about three weeks,' says Freda carefully. 'So £5000 must be... wow, a lot of protein?'

'That simply proves my dedication to strength-building.'".
The cdesc is "'Wait, wasn't he the one who you guys think was embezzling?'" It is for Reveal_magnus. It flips to Reveal_hub.

Section - Reveal_why1 - the motive

Reveal_why1 is a page.
"The Phantom turns away from you. He addresses the audience instead.

'It is my belief that this city, and this country, rests on a simple bedrock.

'The bedrock of economy.

'Of the free market, and of free choice.

'I believe in development - in improving our urban and suburban areas to offer you the best economy in the world.

'Areas like this very field.

'Building a brand-new, fully modernised supermarket in this field would offer an unprecedented supply of goods and services to the people of this city.

'But my colleagues in the circus don't want you to have this choice.

'They believe in frivolity over the free market; in silliness, not security.'".
The cdesc is "'Why are you trying to sabotage the circus?'" It is for Reveal_hub. It is a one-off. It is needed by Reveal_updog1.

Reveal_why1a is a page.
"".
The cdesc is "'But there's already a supermarket nearby. You can see it from the entrance.'". It is for Reveal_why1. It flips to Reveal_why2.

Reveal_why1b is a page.
"".
The cdesc is "'But this is a playing field. It's not just us who use this field. Kids need it to play sport.'". It is for Reveal_why1. It flips to Reveal_why2.

Reveal_why1c is a page.
"".
The cdesc is "'But people need to go somewhere to have fun too. We're only here for a few weeks a year.'". It is for Reveal_why1. It flips to Reveal_why2.

Reveal_why1d is a page.
"".
The cdesc is "'Pardon me, is everything you say going to be its own paragraph?'". It is for Reveal_why1. It flips to Reveal_why2.

Reveal_why2 is a page.
"The Phantom ignores this. 'I ask you this,' he says, still facing the crowd. 'What would you rather have?

'Would you rather be kept in the dark, in this tent, rewarded with nothing but spectacle?

'Or will you join me in building a better future on this very field?'

The crowd starts calling out, a thousand voices talking over each other. But something wonderful is happening. You can't hear a single voice in favour of Pooting. Some are calling him names. Others are telling him to get lost and let the show go on. One person's trying to explain gentrification to him; another is trying to start a chant for 'the goose guy'. Your heart swells.

The Phantom's voice doesn't change, but his face has hardened. 'I will be proud to create a more stable and secure future,' he continues. He's trying to ignore it. He still thinks he's right. But he's lost the crowd. Thank goodness, he's already lost.".
It flips to Reveal_hub.

A page-toggle rule for Reveal_why2:
	now PhantomPlanKnown is true. [defined and used in the epilogue text]

Section - Reveal_how - tying up a few loose ends

Reveal_how is a page.
"'I will be happy to address your very real concerns,' says Pooting.".
The cdesc is "'I have some questions about your methods, Mister Pooting.'" It is for Reveal_hub. It flips to Reveal_how_hub.

Reveal_how_hub is a page.

Reveal_how_freda is a page.
"The Phantom looks blank for a moment, and he glances at Freda, and realisation seems to dawn. 'I regret that you are unsatisfied with my appearance during your friend's show. Let me be clear that this was an event in which she was responsible for selecting volunteers, so she could have chosen anybody else-'

'That's not true, you made her! You pushed me out of the way to get into the ring first!' That voice belongs to someone in the audience, you can't see who. Mister Pooting ignores it.

You risk a look at Freda, but she doesn't look upset at all. She looks curious. 'You must still be pretty strong to carry all that flour around yourself. What's your workout like?'

'He's not going to be your friend, Siegfrieda,' says Lawn gently. 'Adagio and I knew him. He won't be nice. I'm sorry.'

You think it's best to change the subject. Freda may be trying to forgive, bless her, but you're having some angry, angry thoughts right now.".
The cdesc is "'Why did you try to hurt my girlfriend?'" It is for Reveal_how_hub. It flips to Reveal_how_hub.

[
You saw the glance and the look on his face, and you feel a way you haven't felt in a long time, since before Freda and the circus. But Freda is here and she's squeezing your hand and making things a little better, and you can see the contempt on Adagio and Lawn's faces, staring daggers at him, and you can see it on the rest of the crowd too. It's going to be okay. It's going to be even better when this guy's gone.

(i like the above passage a lot better than what I wrote, but i think it's too tonally different from the rest of the game)]

Reveal_how_adag is a page.
"'One quality that this circus is celebrated for is its dedication to preserving traditional forms of entertainment,' says the Phantom. 'I regret to announce that this traditionalism extends to the layout of its tents. I have learned to navigate these as, regrettably, a former member of this establishment which I have worked tirelessly to learn from and distance myself from.'

Alright, you think you got that. He's saying that he just remembers where everything usually is from when he worked here. You suppose he must have remembered how to sabotage Adagio's props, or figured it out or something, not that you can ask him about it in front of the audience.".
The cdesc is "'How'd you keep sneaking backstage?'" It is for Reveal_how_hub. It flips to Reveal_how_hub.

Reveal_how_lawn is a page.
"Mister Pooting digs around in his pocket for something. 'A discovery I made during previous years at this establishment. I shall be happy to share my research to improve the workings of this place.'

His hand comes out holding a small tape recorder, like the kind which journalists use in films to record interviews. He plays back... it sounds like an elephant blowing its trunk?

'Go find your goose,' he says to Lawn. Lawn jogs east out of the top. A minute later, he returns with the goose limp in his arms.

'Completely asleep!' marvels Lawn. 'I don't believe it! How did yaargh fnaaargh,' he continues as the goose wakes up and bites his nose. The goose flies out of the tent again.

'The low, brassy melodies of the African elephant cause this goose to fall asleep for long enough to dress or modify as you please,' adds the Phantom. 'I learned this while watching nature documentaries with the windows to my caravan wide open several years ago. Does this explanation satisfy you? Perhaps this circus could take heed of my discoveries?'

'No thanks,' says Freda. 'I hate when the animals fight in those programmes.'".
The cdesc is "'How'd you manage to blindfold a goose??'" It is for Reveal_how_hub. It flips to Reveal_how_hub.

Reveal_how_back is a page.
The cdesc is "'Actually, never mind.'" It is for Reveal_how_hub. It flips to Reveal_hub.

Section - Reveal_updog

Reveal_updog1 is a page.
"Pooting sniffs. 'I am sorry to hear that you are not fully satisfied with our development plans.'"
The cdesc is "'I think it's embarrassing that your plan for this field doesn't account for updog.'" It is for Reveal_hub. It flips to Reveal_hub. It is a one-off. It is needed by Reveal_updog2.

Reveal_updog2 is a page.
"'I will have my people look into it, and prepare a response in due course,' says Pooting."
The cdesc is "'I mean, do you even have a stance on updog?'" It is for Reveal_hub. It flips to Reveal_hub. It is a one-off. It is needed by Reveal_updog3.

Reveal_updog3 is a page.
"Pooting shuffles a little uneasily. 'My friends on both sides of the debate have valid points. Perhaps this is a question better directed at your local councillors.' The crowd is starting to get restless."
The cdesc is "'You can't ignore this so easily, Mister Pooting. Quite frankly, if you're not for updog, you're against it.'" It is for Reveal_hub. It flips to Reveal_hub. It is a one-off. It is needed by Reveal_updog4.

Reveal_updog4 is a page.
"'Alright!' Pooting snaps. 'I have had it with this incessant buffoonery, and so has the rest of the country! We are all trying to discuss serious matters for adults, and yet here you are! Well, clown, you have the stage you crave so much! Perhaps you can enlighten us all, and mince no words: what is [']updog[']??'

Everyone waits with bated breath.".
The cdesc is "'Surely everybody in government knows what updog is! What kind of politician are you?'" It is for Reveal_hub. It is a one-off. It is needed by Reveal_updog_blowoff.

Reveal_updog_blowoff is a page.
"The audience erupts in rapturous cheers! You do a victory lap around the stands high-fiving the audience. People are crying with joy. Freda lifts you up for everyone to see, and Adagio and Lawn run around hyping up the crowd to a standing ovation. The Ringmaster leads a chant of your name. Boys rip off their shirts and beat their chests. New mothers name their children after you; old mothers write you into their will.

Marcus Pooting MP stands still and stony-faced. When the celebrations die down after about thirty minutes, he says 'It pleases you to laugh, clown. But now, more than ever, we must return to the sensible discourse that this country deserves.'".
The cdesc is "'NOT MUCH DOG WHAT'S UP WITH YOU'". It is for Reveal_updog4. It flips to Reveal_hub. It is a one-off.



Section - Reveal_end - Ending the reveal scene

Reveal_end is a page.
"". [because the text here needs Basic Screen Effects, we'll abuse a page-toggle rule for it instead]
The cdesc is "'I don't wanna talk to you anymore. Let's tie you up again.'" It is for Reveal_hub. It is an end-page.

A page-toggle rule for Reveal_end:
	[a lot happens when the Phantom says his piece, so we set it up now while the player is still trapped in cutscene limbo]
	[move the characters]
	unseat the audience;
	now Lola is in RmStaffS;
	now Adagio is in RmStaffS;
	now Freda is in RmStaffS;
	now Lawn is in RmStaffS;
	now the Ringmaster is handled;
	now the Ringmaster is in RmStaffS;
	remove the Ringmaster from the list of followers;
	add {Adagio, Freda, Lawn, the Ringmaster} to the list of followers;[* see below for footnote]
	now the Phantom is in RmLakeside; [prepare for EndgameC]
	[move the world around a bit]
	now the BossCamper is in RmMotorway; [prepare for EndgameB] 
	now nothing is mapped south of RmStaffS;
	now the printed name of RmStaffS is "Staff Area, by an empty camper-sized patch of land";
	now the Big Wheel is nowhere;
	now BgWheel is nowhere;
	update backdrop positions;
	memorialise "the cool ferris wheel explosion";
	now the printed name of RmCarnivalSW is "Carnival, in the tragically open air";
	[and here comes the text]
	say "'Oh, I don't think there'll be any need for that,' says the Phantom. And suddenly he's not there anymore. He's running past you, and disappearing through the backstage curtain. You and the troupe run after him.

As you spill out of the emergency exit, you see the Phantom standing on top of the Ringmaster's van. He's holding some kind of TV remote.

'It's disappointing,' he says. 'It's a disappointment that certain migrating parties are unwilling to engage with local economy. You leave me no choice but to engage in a programme... of destructuring.'

He points the gadget towards the looming Big Wheel. 'Your [']Big Top['] is about to be crushed... under the [']wheel of economy['].' He presses a button...";
	SPACE-pause;
	say "[line break]Something explodes at the hub of the Big Wheel. The whole thing judders...";
	SPACE-pause;
	say "[line break]The hub bends, breaks. The Big Wheel falls off its supports...";
	SPACE-pause;
	say "[line break]The Big Wheel rolls harmlessly backwards into the woods and out of sight.";
	SPACE-pause;
	say "[line break]'Nuts,' says the Phantom.";
	SPACE-pause;
	say "[line break]And he jumps, points his feet down, smashes through the windshield of the Ringmaster's van. He turns the keys in the ignition, and he's off, and you all dive out of the way as he ploughs through the trailers and drives out towards the road.

'M-my camper!' yells the Ringmaster. 'I n-n-need that to camp!'

Oh no. The paperwork. That MP has all the legal paperwork for the circus! If he knows what to do with that, you don't have a circus anymore! You have to get to your car and chase him down!".

[* we remove the Ringmaster from the list, only to add him back immediately. This is because, if the Ringmaster is the first entry in the list of followers, then when my following rule reports the character movement it fails to capitalise the "the". I have a strong suspicion that fixing this properly would involve delving into some arcane rules about printing text. This hack is easier.]
	

Chapter - Clown car puzzle

Section - Make the player notice the tyre

Check entering the clown car during Unmasking (this is the anticipate noticing the tyre early rule):
	unless the tyre is changed:
		notice the slashed tyre instead.

Check entering the clown car during EndgameA (this is the enforce tyre puzzle rule):
	unless the tyre is changed:
		notice the slashed tyre instead.
	
To notice the slashed tyre:
	if TyreAwareness is false:
		say "You rush to enter, and bang your head on the top of the door instead. Is your car lower than usual? And more wobbly? You check the tyres.";
		try examining the tyre;
	otherwise:
		say "No point getting in - you can't drive it anywhere until you change the tyre.[paragraph break]";
	have Freda remove the tyre.
	
Section - Can't take the tyre, but Freda removes it

[Freda should take it upon herself to remove the tyre when the player notices or tries to enter the car]

Check taking the tyre:
	if the tyre is undamaged:
		say "No need to change the tyres." instead;
	otherwise if the tyre is slashed:
		if EndgameA is happening:
			have Freda remove the tyre instead;
		otherwise:
			say "If the tyre needs changing, you'll want Freda around to help you." instead;
	otherwise if the tyre is removed:
		say "Already taken care of. You need to find a new tyre now." instead;
	otherwise:
		say "You start pulling off the circle balloon, and everyone groans at your antics. Maybe leave it alone now." instead.
		
Check pulling the tyre: try taking the tyre instead.
			
To have Freda remove the tyre:
	if EndgameA is happening:
		if the tyre is slashed:
			say "'Aw, babe, look what the ghost did!' Freda sounds angrier about your car than she did about the Phantom nearly killing her. She peels the shredded tyre straight off the wheel. 'Can we pump this up? No, it's all in bits, look. There's no chance-' 

'LEAVE IT TO ME!!' [The hired help] from the balloon stand sprints towards you all, vaults over the Ringmaster, snatches the tyre from Freda's hands and starts huffing and puffing into the shredded rubber.

You don't think that's gonna do it. You decide to leave it to her while you look for an alternative.";
			now the hired help is in the location of the player;
			now the hired help is handled;
			add the hired help to the list of followers;
			now the tyre is removed.
			
Section - Extracting some common text for balloon sculpture replacement attempts

[The solution to the tyre puzzle is to swap it with the circle balloon sculpture. However, the basket is a reasonable attempt, and the dog and Robert Frost lend themselves to stupid jokes. So we'll implement responses and one or two jokes for all sculptures. This section extracts some text that can be common to multiple sculptures.]

To say balloon tyre already replaced:
	say "You've already stretched one perfect circle over the wheel rim. The car's fixed enough to drive".

To say balloon TyreAwareness false:
	say "You're not sure why you'd want to do that, although you have a bad feeling about the state of the car from the way it's tilting".
	
To say balloon remove shredded first:
	say "This could be a good makeshift tyre, but first, you need to get the shredded tyre off the car. Better yet, ask Freda to do it".
	
To say balloon wait for tyres to be shredded first:
	say "This could be a good makeshift tyre, but the actual tyres that are already on the car would be even better tyres".

	
Section - Putting the circle sculpture on the car as a substitute tyre (correct solution)

Instead of putting the circle sculpture on the clown car (this is the use circle sculpture as makeshift tyre rule):
	if the tyre is removed:
		now the tyre is changed; [this is the property that allows the player to enter the car and progress to EndgameB]
		now the circle sculpture is in Balloon Limbo;
		say "Yes... this might work. With a great deal of effort, and a little help from Freda, you stretch the circle over the rim. The car looks level again, and the rubber and the helium seem to be taking the weight of the car. Yeah, this will work! It better had, anyway. You've got a Phantom to catch now." instead;
	otherwise if the tyre is changed:
		say "[balloon tyre already replaced]." instead;
	otherwise if the tyre is slashed:
		if TyreAwareness is false:
			say "[balloon TyreAwareness false]." instead;
		otherwise:
			say "[balloon remove shredded first]." instead;
	otherwise:
		say "[balloon wait for tyres to be shredded first]." instead.
		
Check putting the circle sculpture on the tyre:
	try putting the circle sculpture on the clown car instead.
Check tying the circle sculpture to the clown car:
	try putting the circle sculpture on the clown car instead.
Check tying the circle sculpture to the tyre:
	try putting the circle sculpture on the clown car instead.

Section - Putting the basket sculpture on the car (good-but-wrong attempt)

Instead of putting the basket sculpture on the clown car (this is the can't quite use basket sculpture as makeshift tyre rule):
	if the tyre is removed:
		say "[one of]This looks like it ought to work. It's so close to working. But the basket is just slightly the wrong shape, or just slightly too small, or something like that. You can't quite get it right. Something in the back of your head is telling you there are other sculptures you could try instead[or]Something in the back of your head is telling you there are other sculptures you should try, but you ignore it and keep wrestling with the basket and tyre until Adagio takes pity and stops you[stopping]." instead;
	otherwise if the tyre is changed:
		say "[balloon tyre already replaced]." instead;
	otherwise if the tyre is slashed:
		if TyreAwareness is false:
			say "[balloon TyreAwareness false]." instead;
		otherwise:
			say "[balloon remove shredded first]." instead;
	otherwise:
		say "[balloon wait for tyres to be shredded first]." instead.
		
Check putting the basket sculpture on the tyre:
	try putting the basket sculpture on the clown car instead.
Check tying the basket sculpture to the clown car:
	try putting the basket sculpture on the clown car instead.
Check tying the basket sculpture to the tyre:
	try putting the basket sculpture on the clown car instead.


Section - Putting the dog sculpture on the car (secret good funny cutscene) (very funny)
	
To say don't repeat dog balloon joke:
	say "Better not. Lawn's getting cranky".

JokeFailDog is a truth state that varies.
JokeFailDog is false.

Instead of putting the dog sculpture on the clown car (this is the dog as tyre joke rule):
	if the tyre is removed:
		if JokeFailDog is false:
			switch to cyoa at Tyre_dog_start instead;
		otherwise:
			say "[don't repeat dog balloon joke]." instead;
	otherwise if the tyre is changed:
		if JokeFailDog is false:
			say "Ah, nuts, you should've done that before you changed the tyre and made a joke about being dog-tyred or something. Oh well. Maybe next time your tyres get slashed." instead;
		otherwise:
			say "[don't repeat dog balloon joke]." instead;
	otherwise if the tyre is slashed:
		if TyreAwareness is false:
			say "[balloon TyreAwareness false]." instead;
		otherwise:	
			say "Ooh, you've got a good joke in mind. Get Freda to remove the tyre first, then you can do it." instead;
	otherwise:
		say "Can't really see a good reason to do that, although you're sure these balloons are made out of tyre rubber, with how stiff they are." instead.
		
Check putting the dog sculpture on the tyre:
	try putting the dog sculpture on the clown car instead.
Check tying the dog sculpture to the clown car:
	try putting the dog sculpture on the clown car instead.
Check tying the dog sculpture to the tyre:
	try putting the dog sculpture on the clown car instead.

Tyre_dog_start is a page.
"You just about manage to wrestle the dog around the tyreless wheel, tying its nose to its tail to keep it in place. It's obviously not gonna work as a makeshift tyre. You turn to the others and say..."

Tyre_dog_joke is a page.
"Everyone is quiet for a long, long ten seconds.

Lawn puts his arm around your shoulders and leads you away from the others. After a suitable distance, he turns to you and speaks with a very flat voice.

'Clown. Lola. Hello. Welcome to Earth. Maybe you didn't notice this. But. We have a situation right now.

'There was a man. Do you remember him? You just met him. He tried to ruin us. He has stolen our property. He has gotten away. He is currently getting further away. We are trying to catch him.

'This is a sensitive situation. We do not have time. We were led to believe that you had a plan. However, in fact, you have taken this time to make. Just. The [if JokeFailRF is true]second-[end if]worst joke I have [i]ever[/i] heard. With prop comedy.

'Do you, in fact, think that this is an appropriate time for prop comedy?'"
The cdesc is "'I've heard of being dog-tired, but this is ridiculous!'" It is for Tyre_dog_start.

A page-toggle rule for Tyre_dog_joke:
	now JokeFailDog is true.

Tyre_dog_gottalaugh is a page.
"'NO. Clown. You do not, in fact, [']gotta laugh[']. You [']gotta['] help us catch Magnus. Otherwise. You will lose your job. I will lose my job. Your friends will lose their jobs. Henry will lose his circus and his home. It is not a [']gotta laugh['] matter. Figure it out.'

Lawn takes his arm off your shoulders. You quietly remove the dog from the wheel."
The cdesc is "'Well, you gotta laugh.'" It is for Tyre_dog_joke. It is an end-page.

Tyre_dog_cancel is a page.
"Discretion is the better part of humour. You take the dog sculpture off the wheel again."
The cdesc is "(No, that's awful. Don't do it.)" It is for Tyre_dog_start. It is an end-page.

	
Section - Putting the Robert Frost sculpture on the car (secret good funny cutscene) (extremely good) (you will laff)

To say don't repeat RF balloon joke:
	say "No. You're still cross with everyone".

JokeFailRF is a truth state that varies.
JokeFailRF is false.

Instead of putting the Robert Frost sculpture on the clown car (this is the Robert Frost as tyre joke rule):
	if the tyre is removed:
		if JokeFailRF is false:
			switch to cyoa at Tyre_RF_start instead;
		otherwise:
			say "[don't repeat RF balloon joke]." instead;
	otherwise if the tyre is changed:
		if JokeFailRF is false:
			say "Ah, nuts, you should've done that before you changed the tyre and made a joke about the road less traveled by or something. Oh well. Maybe next time your tyres get slashed." instead;
		otherwise:
			say "[don't repeat RF balloon joke]." instead;
	otherwise if the tyre is slashed:
		if TyreAwareness is false:
			say "[balloon TyreAwareness false]." instead;
		otherwise:	
			say "Ooh, you've got a good joke in mind. Get Freda to remove the tyre first, then you can do it." instead;
	otherwise:
		say "Can't really see a good reason to do that, although you're sure these balloons are made out of tyre rubber, with how stiff they are." instead.
		
Check putting the Robert Frost sculpture on the tyre:
	try putting the Robert Frost sculpture on the clown car instead.
Check tying the Robert Frost sculpture to the clown car:
	try putting the Robert Frost sculpture on the clown car instead.
Check tying the Robert Frost sculpture to the tyre:
	try putting the Robert Frost sculpture on the clown car instead.

Tyre_RF_start is a page.
"After lots of wrangling, you manage to pull Robert Frost over the wheel rim. His silhouette is now horribly stretched, and the wheel obviously isn't fit to drive on. You turn to the others and say..."

Tyre_RF_joke is a page.
"Everyone is quiet for a long, long ten seconds.

Finally, Adagio breaks the silence. 'Oh! Was that a balloon of Robert Frost? I'm so sorry, I thought it was Walt Whitman.'

'It's never Walt Whitman,' says Lawn[if JokeFailDog is true], who seems too bewildered to be cranky about it[end if]. 'Look at the jowls, it's clearly T. S. Eliot.'

'Yeah, why would it be Walt Whitman, Dadge?' pipes up Freda. 'Why would Lola want to make a balloon of a drug dealer?'

'I, I thought it might be R-Ralph Waldo Emerson-' tries the Ringmaster in a moment of lucidity.

While they argue, you tug Robert Frost off the rim again, and try not to sulk."
The cdesc is "'I guess we'd better take the road less traveled by, huh?'" It is for Tyre_RF_start. It is an end-page.

A page-toggle rule for Tyre_RF_joke:
	now JokeFailRF is true.

Tyre_RF_cancel is a page.
"You bottle it at the critical moment, and take Mister Frost off the wheel again."
The cdesc is "(No, that's terrible. Abort.)" It is for Tyre_RF_start. It is an end-page.

[*TODO: dog-tyred joke]


Section - Other vehicles won't work

[This section fills the "vehicle check" say phrase with dialogue to explain why other vehicles won't work. "Vehicle check" is called in the rule for NPCs following you.]

To say vehicle check:
	if the location of the player is RmAdagio:
		say "[first time].[paragraph break]'This'll do,' announces Lawn. 'Alright, Adagio, start this thing and let's catch that Phantom!'[paragraph break]'Oh,' says Adagio.[paragraph break]'What do you mean, [']oh[']?'[paragraph break]Adagio squirms. 'I, um, forgot to take my keys out of my pocket the other day. When it went wrong and I ended up in the water. They're electronic. They don't work anymore. I haven't had time to get them replaced.'[paragraph break]Lawn stares at her. 'Magician, we're going to the next town soon. Were you expecting me to tow your camper? Along with my own caravan? And all my things?'[paragraph break]'Would you?'[paragraph break]Oh well, too bad. Adagio's camper is nice and all, but you're going to have to use a different vehicle[only]";
	otherwise if the location of the player is RmLawn:
		say "[first time].[paragraph break]'Alright, everyone, stay here!' orders Lawn. 'I'll bring my car around, hook it up, and we'll have Magnus caught in no time!' He dashes out of the door.[paragraph break]After a while, you realise you can hear a distant screaming. You all poke your heads around the door and silently watch Lawn wrestling with the goose in a patch of muddy ground.[paragraph break]'Hey, where is Ken's car, anyway?' asks Freda. 'I don't see it anywhere.'[paragraph break]'He likes to park it ten minutes off-site because he thinks it deters [']carnival thieves['],' says Adagio.[paragraph break]'Oh. Should we use a different car?'[paragraph break]Adagio shrugs resignedly. 'You know how it is, arguing with Ken. He- oops, here he comes.'[paragraph break]You all duck back into the caravan and act innocent. Lawn slopes in, and claps his hands. 'Come on, what are you all doing, waiting around? We've got a Phantom to catch! Move on, move on[exclam][unless the paddling pool is intact] And what the heck did you guys do to the pool[questi][exclam][end if]' Okay, guess you do need a different car, then[only]";
	otherwise if the location of the player is RmFreda:
		say "[first time].[paragraph break]'Freda, could you drive this? Do you think you can catch up with Magnus in this?' asks Adagio.[paragraph break]'Absolutely!' barks Freda. 'Hey, boss! How fast does your van go, anyway?'[paragraph break]The Ringmaster snaps out of it briefly. 'Um, about, about 120mph.'[paragraph break]Freda inspects the speedometer, which maxes out at 30mph. She looks at the ceiling, then at her feet. She counts silently on her fingers. 'No,' she says. 'Sorry.'[paragraph break]Shame, you like this camper. Oh well, better find another vehicle[only]";
	otherwise if the location of the player is RmLola:
		say "[first time].[paragraph break]'Alright, clown,' declares Lawn, 'we'll all wait here. Go [if TyreAwareness is true]fix[otherwise]find[end if] your car, hook it up, and we'll catch Magnus!'[paragraph break]'Don't worry, Ken, no need to wait here!' says Freda cheerily. 'Lola's car is big enough for everyone! We don't have to use the caravan!'[paragraph break]'I suppose it would be quicker to just use the car than to bother with hooking it up here,' adds Adagio.[paragraph break]'Oh,' says Lawn. He sounds disappointed, but too bad for him, everyone else is right. Your car will be plenty big enough[only]".


Section - Report successful car entry

Report entering the clown car during EndgameA (this is the everyone piles into the clown car rule):
	say "You rush into your car, you and the Ringmaster and Freda and Adagio and Lawn and [the hired help] and [the operator] and a little boy in a sailor suit licking a big swirly lollipop who got caught in the tide. You slam on the accelerator.

You catch up with Pooting on the motorway." instead.



Chapter - Redirect talking during EndgameA

Check talking to someone during EndgameA (this is the redirect convo during EndgameA rule):
	if there is a response corresponding to a person of the noun in the Table of EndgameA Conversation:
		say "[the response corresponding to a person of the noun in the Table of EndgameA Conversation][paragraph break]" instead.
		
Table of EndgameA Conversation
person	response
Adagio	"'Can we talk later, Lola? We ought to get to a vehicle and catch our Phantom right now,' says Adagio pointedly."
Lawn	"[one of]'Oh yeah, clown, I'd LOVE to talk right now!' Lawn yells. 'Everything's been stolen by a wild politician in a stupid mask and we'll all be ruined if we don't catch up with him now, but sure, clown, let's have a CHAT about it!' You decide to leave him alone[or]Better not talk to Ken again. He seems cranky[stopping]."
Freda	"'No time to talk! Let's get that Phantom!' yells Freda, pointing [if the location of the clown car is the location of the player]at your car[otherwise]in the direction she thinks your car probably is[end if]."
the Ringmaster	"The boss isn't listening to you. He's caught up muttering to himself. '[one of]My paperwork... my camper... w-what am I going to do? All my stuff is in there[or]H-how am I going to pay everyone? I don't know what to tell the troupe[or]I can't afford another c-camper... All my money is in that camper... I don't trust the banks[or]What am I going to tell all the fields we already booked? My phonebook is in that camper... and I don't have a phone[cycling]...'"


Check item-asking someone about something during EndgameA (this is the redirect item-asking during EndgameA rule):
	if there is a response corresponding to a person of the noun in the Table of EndgameA Asks:
		say "[the response corresponding to a person of the noun in the Table of EndgameA Asks][if the second noun is the bendy balloons or the second noun is the circle sculpture] (Despite the unhelpful response, though, you have a feeling you're on the right track...)[no line break][end if][paragraph break]" instead.
		
Check asking someone about something during EndgameA (this is the redirect asking during EndgameA rule):
	if there is a response corresponding to a person of the noun in the Table of EndgameA Asks:
		say "[the response corresponding to a person of the noun in the Table of EndgameA Asks][if the second noun is the bendy balloons or the second noun is the circle sculpture] (Despite the unhelpful response, though, you have a feeling you're on the right track...)[no line break][end if][paragraph break]" instead.
		
EndgameAAskedforHelp is a truth state that varies.
EndgameAAskedforHelp is false.

To say EndgameA guidance:
	if EndgameAAskedforHelp is false:
		say "[paragraph break]Hmm, it looks like everyone's too distracted to give you any good advice. You may have to work out how to catch up with the Phantom yourself.";
		now EndgameAAskedforHelp is true;
	otherwise:
		say paragraph break.

Table of EndgameA Asks
person	response
Adagio	"'Can we discuss that some other time, Lola? We ought to get to a vehicle and catch our Phantom right now,' says Adagio pointedly."
Lawn	"'Who cares about that?! We need to catch that politician now!' cries Lawn, unhelpfully."
Freda	"'No time to discuss objects or people! Let's get that Phantom!' yells Freda, pointing [if the location of the clown car is the location of the player]at your car[otherwise]in the direction she thinks your car probably is[end if]."
the Ringmaster	"The poor old Ringmaster is too wrapped up in his worries to talk with you about that."

Part - EndgameB (on motorway)

EndgameB is a climactic scene.

Chapter - Scene control

Section - EndgameB start

EndgameB begins when EndgameA ends.

When EndgameB begins:
	[say "DEBUGDEBUGDEBUG ENDGAME B SCENE (MOTORWAY) STARTS.";]
	pause the game;
	now the little lad is in the clown car;
	now the operator is handled;
	now the operator is in the clown car;
	now the hired help is in the clown car;
	now the Ringmaster is in the clown car;
	now Lawn is in the clown car;
	now Freda is in the clown car;
	now Adagio is in the clown car;
	now the clown car is in RmMotorway;
	if IronskinCafeHeardOf is true:
		the cafe should be passed in five turns from now;
	say "As it turns out, it wasn't that hard. The Phantom is trundling down the motorway at a stately 40mph. The wind's probably getting in his eyes after he smashed the window. The tricky part was weaving around the queue of cars backed up behind him.[paragraph break]You manage to get behind the camper, keeping your distance. You consider your options.";
	try looking.
	
Section - Secret cafe joke

At the time when the cafe should be passed:
	say "You zip past a roadside cafe called LION BACON BUTTIES: THE PRIDE OF THE COUNTRY, but it's gone in the rear-view mirror before you register it."
	
Section - EndgameB end 1 (by wheel)

EndgameB ends by wheel when the clown car is in RmMotorway for the tenth turn. [more like seventh turn after the endgameB start rules have run]

When EndgameB ends by wheel:
	say "You all feel a rumbling coming up through the road. You glance in your rear-view mirror. A loose ferris wheel is rolling down the motorway after you! You swerve to the inside lane and let the wheel pass.

The Phantom is not so alert. The Wheel rolls over the Ringmaster's camper, scooping it up and flinging it 200 feet into the air. It lands somewhere in the forest beside you. [EndgameBJoin]...";
	prepare the finale.
	
Section - EndgameB end 2 (by pie)

EndgameBPie is a truth state that varies.
EndgameBPie is false.

Instead of throwing something at the BossCamper during EndgameB:
	if the noun is not the stack of pies:
		say "Your throwing arm is useless for anything other than pies. [The noun] will just tumble onto the motorway and you'll lose it.";
	otherwise:
		say "You lean out the window. That might have been the best pie you ever threw before, but [i]this[/i] is the most [i]powerful[/i]. This is the fastest and furthest you've ever thrown a pie. It lands just ahead of the camper's front tyre...";
		now EndgameBPie is true.
		
[*TODO: perhaps this should be a carry out rule so I can use the earlier check rules?]

EndgameB ends by pie when EndgameBPie is true.

When EndgameB ends by pie:
	say "The camper hits the pie. It wobbles, then it skids, then it drifts like a rally car. It crashes through the barrier and careers into the nearby forest. [EndgameBJoin]...";
	now Lakeside Counter is -1;
	prepare the finale.
	

Section - EndgameB end 3 (by bow)

EndgameBBow is a truth state that varies.
EndgameBBow is false.

Instead of shooting the BossCamper with something during EndgameB:
	if the second noun is not the bow:
		say "That's not very shootable.";
	otherwise:
		say "You lean out the window and take aim (steering with your knees). You shoot...";
		now EndgameBBow is true.

EndgameB ends by bow when EndgameBBow is true.

When EndgameB ends by bow:
	say "It's a direct hit. The front tyre bursts. The camper careens across the lanes, and sparks fly. The Phantom can't keep control; the camper crashes through the barrier and tumbles into the nearby forest. [EndgameBJoin]...";
	now Lakeside Counter is -1;
	prepare the finale.


Section - EndgameB join

To say EndgameBJoin:
	say "[paragraph break]'Oh, my car,' moans the boss.

At the next exit, you carefully pull off the road and drive back through the overgrowth to the landing zone".

Section - Prepare the finale

To prepare the finale:
	[say "DEBUGDEBUGDEBUG ENDGAME B SCENE ENDS.";]
	pause the game;
	now the Phantom is in RmLakeside;
	now the BossCamper is in RmLakeside;
	now the Phantom carries the paperwork;
	now the clown car is in RmLakeside;
	now Lola is in RmLakeside.
	
Chapter - Little lad

The little lad is a man. The little lad is nowhere. [added to the car when EndgameB begins]

Description of the little lad is "A curly-haired rosy-cheeked boy in a sailor suit who looks to be about five years old, licking a big swirly lollipop. Whose child is this? He must have just gotten dragged in from the audience while you were all rushing in."

Understand "curly/curly-haired" and "rosy/rosy-cheeked" and "boy" and "sailor" and "german" and "Junge" as the little lad.

Section - talking to the Little Lad

Instead of asking the little lad about something: try talking to the little lad. Instead of item-asking the little lad about something: try talking to the little lad.

Check talking to the little lad:
	say "The boy [one of]looks around curiously[or]peeps out of the window[or]licks his lollipop[purely at random]. '[one of]Wo sind meine Eltern?[no line break][or]Woohoo! Ich mag diese Achterbahn![no line break][or]Wo ist das Gänschen? Ich möchte das Gänschen treffen, bitte![no line break][at random]'[paragraph break]" instead.
	
Pie reaction of the little lad is "'Oh! Mensch Meier! Meine Nasenlöcher sind voll mit Sahnetorte!'".
	
Section - Lollipop

The lollipop is held by the little lad. Understand "big" and "swirly" as the lollipop. The lollipop is edible.

Description of the lollipop is "Where did he get that? You don't sell lollipops."

Check eating the lollipop: say "You want to. No, you can't you can't, it belongs to that boy. Gosh, you want to, though." instead.
Check taking the lollipop: say "A famously difficult task, and one you've got no time for. You need to focus on dealing with the Phantom right now." instead.

	
Chapter - Scene rules

Section - Redirect talking during EndgameB

Check talking to someone during EndgameB (this is the redirect convo during EndgameB rule):
	if there is a response corresponding to a person of the noun in the Table of EndgameB Conversation:
		say "[the response corresponding to a person of the noun in the Table of EndgameB Conversation][paragraph break]" instead.
		
Table of EndgameB Conversation
person	response
Adagio	"'Please, focus on the road, please, Lola,' says Adagio."
Lawn	"'No talking! Can't this thing go any faster?' yells Lawn."
Freda	"'Go faster, Lola!' yells Freda. 'You shoulda done what I said and cut out the floor so I could run us on the road like in that documentary.'"
the Ringmaster	"'My c-camper... Oh, all the paint's g-going to be scratched and everything,' moans the boss."

Check item-asking someone about something during EndgameB (this is the redirect item-asking during EndgameB rule):
	if there is a response corresponding to a person of the noun in the Table of EndgameB Asks:
		say "[the response corresponding to a person of the noun in the Table of EndgameB Asks][paragraph break]" instead.
		
Check asking someone about something during EndgameB (this is the redirect asking during EndgameB rule):
	if there is a response corresponding to a person of the noun in the Table of EndgameB Asks:
		say "[the response corresponding to a person of the noun in the Table of EndgameB Asks][paragraph break]" instead.
		
Table of EndgameB Asks
person	response
Adagio	"'Please, stop holding that and please put both hands on the steering wheel, please,' says Adagio."
Lawn	"'I don't care about that!' yells Lawn. 'Watch the road!'"
Freda	"'Wow,' says Freda, and the two of you share a moment chatting about [the second noun] while Adagio screams and takes the wheel to swerve you around a [one of]car[or]truck[or]van[or]lorry[or]motorbike[purely at random]."
the Ringmaster	"The boss is too busy wincing at every bump his camper takes to notice anything else."

Section - Admonish for examining

EndgameBXCount is a number that varies. EndgameBXCount is 0.

After examining during EndgameB (this is the keep your eyes on the road rule):
	increment EndgameBXCount;
	if EndgameBXCount is 3:
		say "A little voice in your head says you should keep your eyes on the road. You ignore it. You've seen roads before and they don't get any more interesting."

Section - Forbid leaving clown car with funny failure

Instead of exiting during EndgameB (this is the let player bail out of the car at 110mph like in GTA if they really want to rule):
	say "In the middle of a car chase?? Are you sure?";
	if the player consents:
		say "Alright. You open the door and bail out, bouncing helplessly down the road for a good 100 metres. The driverless car with all its passengers veers off the road and flips over the barrier and crashes into a petting zoo.";
		end the story saying "You booched it";
	otherwise:
		say "Probably wise.".

Section - Funny failure for sleeping

Instead of sleeping during EndgameB (this is the tiredness kills rule):
	say "At the wheel of your car on the motorway, huh? You, uh, you sure about this one?";
	if the player consents:
		say "Okay. You're out like a light, your forehead pressed on the car horn making it go hoooooonk. The car veers off the motorway and smashes through a TIREDNESS KILLS sign and into a furniture store, where you're all flung through the windshield and you all land peacefully in a king-size bed.";
		end the story saying "Goodnight";
	otherwise:
		say "You shake yourself awake and keep your eyes on the road.".

Section - Response to going

Instead of going during EndgameB (this is the can't try to leave motorway rule):
	say "Only one way to go on the motorway. You keep your foot on the accelerator."
	

Part - EndgameC (lakeside)

EndgameC is a climactic scene.

Chapter - Scene control

Section - EndgameC start

EndgameC begins when EndgameB ends.

When EndgameC begins:
	[say "DEBUGDEBUGDEBUG ENDGAME C SCENE (LAKESIDE) STARTS.";]
	say "Pooting's clutching something as he wriggles free. Oh, no. He found the paperwork. He staggers halfway towards the lake with an armful of documents before he notices you. 'Stay away from me! Clown!'[paragraph break]You motion the others to stay in the car. Better not go in mob-handed and provoke him. You assess the situation.".

[no need for EndgameC end condition, since this is the final scene]

Chapter - Scene events

Section - Pooting taunts Lola

Lakeside Counter is a number that varies.
Lakeside Counter is 0.

Every turn during EndgameC (this is the EndgameC Operator rule):
	if there is an event corresponding to a number of Lakeside Counter in the Table of Lakeside Events:
		let E be the event corresponding to a number of Lakeside Counter in the Table of Lakeside Events;
		say "[E][p]";
	if Lakeside Counter is 2:
		now the flock is in RmLakeside;
	if Lakeside Counter is 6:
		now the chart is in RmLakeside;
	if Lakeside Counter is 10:
		now the chart is nowhere;
	increment Lakeside Counter.
		
Table of Lakeside Events
number	event
0	"'You listen to me now!' screams the Phantom. 'You circus people don't understand anything about politics!'"
1	"'This is about good business sense!' continues the Phantom. 'This is about economy! This is about value for money!' Behind him, you can see something approaching from the sky."
2	"The Phantom is saying something about how commerce is the bedrock of economy. Behind him, a flock of geese flies in and settles on the lake."
3	"Pooting is still ranting and raving, but you've stopped listening now. You watch the geese drift across the lake."
4	"The Phantom's getting worked up and making all sorts of arm gestures now."
5	"You tune back in. '...inject £1,000,000 into the local economy! House prices could well...' You tune out again and watch the geese some more."
6	"The Phantom pulls out a chart from somewhere, with axes 'ECONOMY' and 'GOOD'. You're no economist but you're beginning to suspect he isn't, either. He's still going, by the way."
7	"It's a lot of fun watching the Phantom struggle to flip a chart and keep hold of a wad of circus paperwork, but you should figure out how to incapacitate him before he does something silly with the papers."
8	"The Phantom pulls out a USB stick and looks around fruitlessly for a laptop and projector to show you a Powerpoint. The geese peck idly at the grass on the shoreline."
9	"'In conclusion, the circus can't be allowed to...' Uh oh. Sounds like the Phantom is wrapping up. Better do something to incapacitate him soon!"
10	"The Phantom packs up his flip chart and other materials. The geese watch him with interest."
11	"'Say goodbye to your circus deeds!' The Phantom is walking towards the lake! It's now or never!"
12	"[lakeside timeout]"

To say lakeside timeout:
	say "Too late! The Phantom dunks the paperwork into the lake! The circus and carnival's legal and property rights - and your salaries - drift away with the current.";
	end the story saying "Dang".

Section - The flock

The flock is nowhere.
The flock is fixed in place.

Understand "flock of geese" and "geese" as the flock.

Initial appearance of the flock is "Behind the Phantom, there's a flock of geese paddling quietly in the lake."

Description of the flock is "A flock of about thirty Canadian geese on the lake, minding their own business."
[originally "fifty or thirty Canadian geese" in tribute to my favourite Strong Bad Email "2 emails". But it confused testers who thought it was a typo, and yeah, when you remove it from Homestar Runner's very specific ways of torturing language, it does look too much like a typo to stay. I just want you all to watch "2 emails" though.]

Check shooting the flock with the bow:
	say "You're here to stop the Phantom, not to hunt geese!" instead.
	
Check throwing the stack of pies at the flock:
	say "The flock scatters, and the pie flops harmlessly in the water. The flock reforms around the ripples." instead.

Section - The chart

The chart is nowhere. The chart is scenery.

Understand "flipchart" and "flip chart" and "graph" as the chart.

Description of the chart is "A graph labelled with the axes 'ECONOMY' and 'GOOD'. A wiggly arrow is drawn on the chart, trending upwards. The arrow is labelled 'YES'."

Chapter - Scene rules

Section - Redirect talking during EndgameC

Check talking to someone during EndgameC (this is the redirect convo during EndgameC rule):
	if there is a response corresponding to a person of the noun in the Table of EndgameC Conversation:
		say "[the response corresponding to a person of the noun in the Table of EndgameC Conversation][paragraph break]" instead.
		
Table of EndgameC Conversation
person	response
Adagio	"'This is a nightmare,' mutters Adagio. 'We can't approach him, or he'll just destroy the papers. Can we get him away from the lake, or chase him away? You must have something that can help, Lola. You've been so resourceful.' She smiles weakly - still a little shaken from the car ride, probably."
Lawn	"[Lawn EndgameC advice]."
Freda	"[Freda vehicular manslaughter joke]."
the Ringmaster	"Staring at his stricken camper, the boss has gone beyond coherent sentences. '[Ough],' he says."
the Phantom	"You can't get a word in edgeways, but there's not much left to say anyway."

To say Lawn EndgameC advice:
	if the flock is in RmLakeside:
		say "Ken's not paying attention to you. He's staring past you at the flock of geese behind the Phantom. '[one of]Beautiful beasts[or]Wonderful[or]What a privilege[then at random],' he murmurs";
	otherwise:
		say "'Why are you asking me? I thought you had it under control!' Then Ken calms down a little and considers the Phantom. 'Mark was always like this. Very intense when he has a bad idea. Won't pay attention to anything around him. But what can I do about it? He's looking right at us. We can't sneak up to him.' He slumps back petulantly".

To say Freda vehicular manslaughter joke:
	say "[one of]'Go get him Lola!' says Freda. 'Want me to hit him with the car?'

'What??' says Lawn. 'No, don't drive the car into him! I can't do another assault charge!'

'No no, not driving it,' says Freda. 'Throwing it.'

'Better not. You'll just knock him backwards into the water, and then the papers will be ruined anyway,' murmurs Adagio, after a little thought[or]'I still like my idea,' mutters Freda[stopping]".

To say Ough:
	say "O[one of]u[or]o[or]a[purely at random][one of][or]g[or]gg[purely at random][one of]h[or]hh[or]he[purely at random]".

Check item-asking someone about something during EndgameC (this is the redirect item-asking during EndgameC rule):
	if there is a response corresponding to a person of the noun in the Table of EndgameC Asks:
		say "[the response corresponding to a person of the noun in the Table of EndgameC Asks][if the second noun is the red nose] (Despite the unhelpful response, though, you have a feeling you're on the right track...)[no line break][end if][paragraph break]" instead.
		
Check asking someone about something during EndgameC (this is the redirect asking during EndgameC rule):
	if there is a response corresponding to a person of the noun in the Table of EndgameC Asks:
		say "[the response corresponding to a person of the noun in the Table of EndgameC Asks][if the second noun is the red nose] (Despite the unhelpful response, though, you have a feeling you're on the right track...)[no line break][end if][paragraph break]" instead.
		
Table of EndgameC Asks
person	response
Adagio	"'I think we've run out of time to chat,' says Adagio politely-yet-firmly."
Lawn	"'No time to chat about things! Stop that Phantom!' says Lawn impolitely-and-firmly."
Freda	"'Wow,' says Freda, and the two of you share a moment chatting about [the second noun] until Adagio gently reminds you (and Lawn not-so-gently) that the Phantom is about to ruin the circus."
the Ringmaster	"Staring at his stricken camper, the boss has gone beyond coherent sentences. '[Ough],' he says."
the Phantom	"You can't get a word in edgeways, but there's not much left to say anyway."

Section - Can't approach Pooting

[talking to now handled above]

Section - The flock reacts to other honks

[Honking the red nose is handled by part "The end!" below]

Instead of squeezing the car horn in the location of the flock (this is the flock reacts to car horn rule):
	say "Honk![paragraph break]'Honk,' says the flock of geese on the lake in chorus, all stretching their wings for a second. The Phantom looks [one of]behind him quizzically, but turns back before you can do anything[or]around at them again. 'Shush,' he says[stopping]."
	
Instead of playing the French horn in the location of the flock (this is the flock reacts to French horn rule):
	say "You toot one note on the French horn. Honk![paragraph break]'Hoooonk,' cries the flock of geese in unison. They all twirl, belly-flop into the water, and sink with little gurgling sounds. Then they all bob up again like corks, as if nothing had happened. The Phantom looks around at the geese, but all he sees are geese swimming normally[one of][or]. 'Do you mind?' he says[stopping]. He turns back before you can do anything to him."
	
Section - Forbid entering car

Instead of entering the clown car during EndgameC:
	say "Can't drive away. Need to end this now."


Part - The end!

Chapter - The winning honk

Instead of squeezing the red nose in the location of the flock (this is the winning honk rule):
	clear the screen;
	say "[line break]Honk!";
	SPACE-pause;
	say "[line break]A great chorus of screams. A great beating of wings[if the player is not in the clown car]. Just enough time to run back into your car with everyone else and close the door and roll up the windows[end if].

Marcus Pooting turns around just in time to see an army of geese bearing down on him like Valkyries charging into battle. He runs away towards your car, but the geese are faster. They're trying to get to you, but he's in the way. Angry geese ricochet off him and bowl him over, scattering the documents over the grass. Freda, Adagio and Lawn slip out the other door and sneak around to recover the papers while you, the Ringmaster and the rest shelter in the car, geese bouncing off the windows like hailstones. The Phantom lies bruised and unconscious by the lake.

[The hired help] stops blowing into the shredded tyre. 'Sorry, guys. I think this thing has a puncture.'

The circus is saved.";
	SPACE-pause;
	say "[line break]...

In fact, now things are better than ever! Everyone's talking about the shows you put on. They clamour to see Adagio and her flying rabbit. They applaud Lawn and his narrative goose. They all really wanna see Freda lift a big guy. Wherever the circus travels, tickets sell out instantly[if Poster joke setup is true]. You even got some new posters printed, which, yes, say 'WE CARE ABOUT MANSLAUGHTER.' You've got to talk to that printing company[end if].

[if PhantomPlanKnown is true]You still get to use that field. That field redevelopment thing never came to pass[otherwise]You'll later learn from the boss that Pooting was sending him threatening letters about redeveloping that field you always use for the carnival. He was gonna turn it into a supermarket or something. That was why he was sabotaging the circus - he wanted to drive you out of one of your most popular sites.

Well, it didn't work out so well for him[end if]. Word got around about Marcus Pooting MP trying to crush a full circus tent with a runaway ferris wheel. That sort of thing gets people mad at you. (Most people, anyway.) Marcus held a few town hall meetings and surgeries to explain himself - Freda went to one of the surgeries and came back very confused, saying he just ranted at her the whole time and he didn't even have a scalpel - but he's having trouble since his office got demolished by a rogue ferris wheel. Empty at the time, thankfully. (Both the office and the wheel.) There's an election coming up soon, apparently. You're not sure if he's getting kicked out, but here's hoping.

Sometimes you wonder how he'd've got to you, if you'd been running your own shows that day. Would anyone have helped you? Yeah, of course they would - the others would have your back. Would anyone outside the circus have helped, though? You think they would, actually. The crowds like you. Most people are nice to you! They laugh at your jokes and cheer for your successes and some of them even come back for more. It's just a shame that the ones who hate you are the ones with the money and the power, isn't it.

But they're not the only people who matter. You still have the audience, and you still have your friends and they have you, and you still have this space and this job, and you still have a stack of pies and a mean throwing arm. And if you ever get one of those fake squirty flowers, you'll be unstoppable.";
	end the story finally saying "Thank you for playing Honk!".
	
PhantomPlanKnown is a truth state that varies. PhantomPlanKnown is false.
[this is used in the epilogue text above, and it is activated by looking at the letters or by asking the Phantom about his motive. I think it's possible to go through the game without actually learning what the Phantom is up to, so this checks that Lola knows what's up and changes the ending text accordingly]
[another truth state used above is Poster joke setup, which is set if the player finds the poster and then asks the Ringmaster about it. The best jokes are the ones which are hidden in the most recondite manner possible]
	
Chapter - Amusing a victorious player

Rule for amusing a victorious player:
	say "[b]Have you tried...[roman type]

Throwing pies at everyone? Multiple times?[line break]Throwing pies at the Monster Manor inhabitants? Shooting them with the bow?[line break]Bringing the rabbit to the burger stand (before Adagio starts wearing the black hat)?[line break]Shooting Adagio's cards with the bow (before unmasking the Phantom)?[line break]Bringing the Ringmaster into Monster Manor? Bringing everyone else there at once?[line break]Trying the dog balloon as a fresh tyre instead of the circle? Trying the Robert Frost balloon?[line break]Exiting the car while on the motorway?[line break][i]Ghost Trick: Phantom Detective[/i]? Ahh dude you gotta play [i]Ghost Trick[/i]. You gotta let me watch you play it[line break]Falling asleep at the wheel on the motorway?[line break]Playing the French horn next to the flock of geese?[line break]Finding ways to end the game by going to hospital or going to jail?"


VOLUME - OUT OF WORLD ACTIONS

Book - Help Menu

Helping the player is an action out of world. Understand "help" and "about" and "credits" and "menu" and "main menu" as helping the player.

Carry out helping the player:
	now the current menu is the Table of Options;
	carry out the displaying activity;
	clear the screen;
	try looking.
	
Table of Options
title	subtable	description	toggle
"How to play text adventures"	--	"[how to play]"	--
"How to talk to people in Honk!"	--	"[honk talk help]"	--
"About performing shows in Honk!"	--	"[honk show help]"	--
"Verbs that Honk! recognises"	--	"[verb list]"	--
"Hints"	Table of Hints	--	--
"About/Credits"	--	"[credits]"	--

Chapter - How to play

To say how to play:
	say "[Honk] is a work of interactive fiction. Type commands to direct the player character around the world, pick up and use objects, and talk to people.

If this is your first text adventure, you should know that it helps to be curt. You don't need to type 'pick up the egg on the ground'. 'GET EGG' will do. Don't be afraid to experiment - it will never be possible to make [Honk] unwinnable. If you get a game over, you will always be able to type UNDO and continue the game.

If you need more help than this, check the 'Verbs that [Honk] recognises' option in the menu for a list of things you could try typing. If there's a verb you want to try but the game isn't recognising it, try a synonym of the verb, or try rephrasing your command (the built-in Inform 7 engine knows a lot of words and I've added some more with the help of testers, but we can't catch everything!). There's some more [Honk]-specific guidance under the 'About performing shows in [Honk]' option in the menu. And there's no shame in using the 'Hints' option, whether you're completely stuck or just impatient.

All adventurers should be aware that [Honk] uses TALK TO as the main verb for conversation, although ASK ABOUT is recognised too. Look at the 'How to talk to people in [Honk]' option in the help menu if you want more guidance."

Chapter - How to talk

To say honk talk help:
	say "In [Honk], you will need to talk to other characters in order to activate certain events and get a few hints. There are two ways to talk to people:

The main way of talking is to just type TALK TO RINGMASTER (or whoever you want to talk to). You will have to TALK TO people in order to activate certain scenes and complete the game. Doing this may open up a conversation menu where you can choose from a list of questions and quips. Conversation menus are operated by entering the number by the line of dialogue you want to say. (For example, to choose option 2, just type '2' and press enter.) Some conversation options may unlock new options. Don't worry if an option disappears before you can select it; any dialogue that's really important will stick around so you can read it as much as you need to. (And you can always UNDO mid-conversation if you really want to read the options you missed.)

You can also ASK people ABOUT objects or other people. This might get a small response from the character you're talking to, or it might open a new conversation menu (or the character might not have anything to tell you). You never have to ASK anyone about anything, but doing so may progress the game as if you'd used the relevant option in the conversation menus, or get you some puzzle hints, or just a few extra jokes. (Second-time players, please note that sometimes you (the player) won't get a response to asking about an object until you (the player character Lola) have seen that it exists in the game world.)

After a certain point in the story, characters will become distracted by other events, and you won't get much of a response from TALKing or ASKing anymore. Don't worry when this happens. No critical information will be locked away from you.

Notes for experienced text adventurers: TELLing people about objects and SHOWing objects to them are treated the same as ASKing them about the objects (but GIVE is still a separate action). ASKing about general topics is less likely to work, but it might take you to part of the TALK TO conversation tree. Direct instructions to other characters (e.g. RINGMASTER, GO NORTH) won't ever work, though you're welcome to try."

Chapter - About shows

To say honk show help:
	say "As you explore [Honk], you will discover that certain circus performances need to happen correctly in order to save the circus.

Each of three performers in [Honk] has their own show associated with them. Talk to them, and (after they've explained the problem to you) you can choose a dialogue option that begins the show. You'll need to bring each show to a successful conclusion to reach the endgame. If a show ends in failure, you can retry it as many times as you like by talking to that performer again until you get it right.

Once you've started a show, you're stuck in the circus ring while that show is ongoing. You can't leave the ring to get anything (it's just not right to abandon your co-star mid-performance!), so try to have everything you'll need either on your person or already in the ring before you start.

If you think you can't complete a show you've started, you can talk to your co-star and choose a dialogue option to end the show early. A show can also end in failure if you take too long resolving it (but don't worry, you'll always have plenty of time to complete a show once you've got everything you need).

Good luck!"

Chapter - Verb list

To say verb list:
	say "Here are some of the main commands that will work in [Honk]. Every verb you need to complete the game is listed on this page somewhere.

To go somewhere:[line break]GO direction[line break](The eight compass directions are recognised (GO NORTH, GO SOUTHEAST, etc). You can also GO IN or OUT, or GO UP or DOWN. That's only if the direction leads anywhere, of course. You can also just type the direction by itself - instead of GO NORTHWEST, you can say NORTHWEST, or even just NW.)

To enter something (e.g. a car, a box):[line break]GET IN container[line break](and then EXIT or GET OUT to leave when you're done)

To look around at your surroundings:[line break]LOOK (or just L)

To look at an object or a person more closely:[line break]EXAMINE something (or just X something)

To interact with people:[line break]TALK TO someone (or just T someone)[line break]ASK someone ABOUT something[line break]GIVE something TO someone[line break](check the 'How to talk to people in [Honk]' option in the menu for a little more guidance)

To take an object:[line break]TAKE something

To drop an object that you're carrying:[line break]DROP something

To check what objects you've got:[line break]INVENTORY (or just I (that's a capital i))

To use an object:[line break]It depends on what you're trying to use! Different verbs work for different objects. You can HONK your red nose, for instance. You could try to BLOW something UP, CLIMB something, CLOSE something, EAT something, OPEN something, PLAY something, PUSH something, PULL something, SHOOT something AT something else, SQUEEZE something, THROW something AT something else, WRAP something AROUND something else...

To do nothing for a turn:[line break]WAIT (or just Z (as in 'zzz...'))

To do the same thing you did last turn:[line break]AGAIN (or just G)[line break](and on some interpreters, you can press the up and down arrow keys to flip through and autofill your last few commands)

To manage your game:[line break]UNDO to undo the last move you made[line break]SAVE to save your game so far[line break]RESTORE to load an older game[line break]RESTART to start a new game[line break]QUIT to end the game (and possibly close whatever app or program you're playing [Honk] in, depending on the program)[line break]SCRIPT ON/OFF to record your play session (this will usually save a text file somewhere on your computer (if playing locally) or in your web browser's files (if playing online), but it depends on the program you're playing [Honk] in)."

Chapter - Credits

To say credits:
	say "[Honk] was written by Alex Harby, or rabbit or wisprabbit, whatever you want to call me. This is the first public version, submitted to the Interactive Fiction Competition 2023. It was exported from Inform on 23rd September 2023.

[Honk] was programmed in Inform 9.3 (aka Inform 7 6M62), developed by Graham Nelson, and adapts some code from the Inform 7 documentation examples by Graham Nelson and Emily Short.

It also uses the following extensions:[line break]Hybrid Choices by AW Freyr[line break]Gender Options by Nathanael Nerode[line break]Nathanael's Cookbook by Nathanael Nerode (not actually included in the game code, but helped me sort out a few whitespace bugs)[line break]Basic Screen Effects by Emily Short[line break]Menus by Emily Short

In addition to the documentation and the extensions, I've stolen bits of code from all over the IntFiction forums like a magpie. This project uses code written by climbingstars, Dannii Willis, Felix Larsson, StJohnLimbo and zarf. Proper citations are in the source code, which should have been included alongside the game file if you downloaded a .zip to play this.

Thanks to StJohnLimbo and Mike Russo for providing help with using Hybrid Choices.

Huge thanks to alpha testers Garry Francis, Mike Russo, Andrew Schultz, and Jkj Yuio, and to beta testers Lance Cirone and Reiko Yukawa, for all their bug reports, feedback and advice. Any remaining bugs and imperfections are, of course, the work of the wizard who cursed my game to make me look bad.

Andrew 'Drizzle' Bedno and Susan 'Sweetie' Hooper's ebook [i]Clowning 101[/i] was the starting point for writing the main character. I deviated from it a lot, but it's interesting reading: http://tritontrouperscircus.com/clowning

I do not give consent for any of the source text of this game to be used in AI/machine-learning databases. I don't actually believe this is going to stop anything, but I just want it written down somewhere.".

[
Chapter - Hints

To say hints message:
	say "This is still an early testing build. This is where the hints will go if/when I get around to writing them. Send me a message if you need help now, though."
]

Chapter - Tester Hints

Table of Hints
title	subtable	description	toggle
"What am I supposed to be doing?"	--	"[objective message]"	--
"How do I save Freda's show?"	Table of Freda Hints	""	hint toggle rule
"How do I save Adagio's show?"	Table of Adagio Hints	""	hint toggle rule
"How do I save Lawn's show?"	Table of Lawn Hints	""	hint toggle rule
"What do I do after saving all three shows?"	--	"[unmask hint]"	--
"Hints for the endgame"	Table of Endgame Hints	--	--


To say objective message:
	say "The Phantom is sabotaging the shows of Adagio, Freda and Lawn. Visit them, talk to them and have them perform their shows via the conversation option you should find for each. Then figure out how to counteract the Phantom's sabotage during the show. You will need to explore the circus and find items which will help you within each show. If you don't think you can solve a show, you can either wait for it to end or talk to the performer to end it early.".

Table of Freda Hints
hint	used
"The Phantom is impossibly heavy. Your job is to work out how they're doing it, and make them lighter for Freda."	
"A significant detail: the Phantom is holding their cloak shut. What are they hiding? How can you reveal it?"	
"Have you got anything to make somebody do something with their hands?"	
"Have you experimented with the stack of pies in Lola's caravan?"	
"THROW PIE AT PHANTOM."	
"You now know that the Phantom is packing bags of flour, but you can't grab them without unbalancing everyone."	
"Can you rip or puncture the bags of flour to spill the flour?"	
"'Puncture' is the right idea."	
"Have you found the bow and arrow yet?"	
"The bow and arrow is held by the Cupid model on the love booth in the carnival area. It's too high to reach, though."	
"You'll need something to help you climb up, but it should be pretty obvious what you need when you spot it."	
"You will need the ladder elsewhere in the carnival."	
"Can't get the stepladder? You'll need to fiddle with the ferris wheel lever."	
"You want the accessible cab number to be 14 by pushing and pulling the lever. Yes, it's maths, but it's not that nasty..."	
"Push the lever until the cab number you can reach is either 7, 14 or 21..."	
"...then, if it's not 14, pull the lever until it is. You can now get the stepladder and put the whole Freda puzzle together!"	
"Get the stepladder from the ferris wheel, drop it by the love booth, CLIMB LADDER and GET BOW."	
"Then activate Freda's show, THROW PIE AT PHANTOM as before, and quickly SHOOT FLOUR WITH BOW."	

Table of Adagio Hints
hint	used
"Adagio cannot cut the rope to escape. You need to cut the rope without touching it or being anywhere near it."	
"A lot of things you can do won't work, either because they're dangerous or because it's too obvious Lola is doing it."	
"Ideally, you'll use something that Adagio could be using, without having to use it yourself."	
"Is Adagio missing anything that she could bring into the Magic Show?"	
"What about her hat? Doesn't it look odd?"	
"ASK ADAGIO ABOUT HAT and she'll hand it to you and ask you to find her actual hat. Where could it be?"	
"Who else wears a top hat? Wasn't there something wrong with that one, too?"	
"GIVE HAT TO RINGMASTER to exchange it with Adagio's hat, complete with rabbit! The visit Adagio to give it to her."	
"Now Adagio will have the rabbit in the Magic Show (tucked inside her hat). How can that help?"	
"Has the rabbit been brought back to Adagio's camper yet? What happened when the rabbit was brought into the room?"	
"It was so frenzied by the salad in the hutch, it chewed through the wicker basket."	
"That rabbit has extremely strong teeth when it's hungry!"	
"Can you make the rabbit chew through the rope of the Contraption?"	
"Maybe if the rope had some salad on it."	
"Have you helped yourself to a burger yet?"	
"Go to the burger stand, get a burger, then get the lettuce out of the burger."	
"Find the Contraption backstage and TIE LETTUCE TO ROPE. Or you can THROW LETTUCE AT ROPE if you're in the Show."	
"You are almost there, but you may now find that the rabbit can't reach the ropes. Perhaps it needs an extra lift."	
"'Lift' is the important word there. Can you carry the black top hat upwards somehow?"	
"You'll need a couple more items to help you. Have a look around the carnival and in the caravans."	
"You'll need the helium from the balloon stand..."	
"... and the pack of bendy balloons from Lola's Caravan. Try to INFLATE BALLOON - can you make anything useful?"	
"Try making the basket. You'll find it's the right size for a hat..."	
"During Adagio's show, tie lettuce to the rope, make a basket, put the black hat inside it, then drop the basket."	

Table of Lawn Hints
hint	used
"Lawn's goose is blindfolded and won't respond to his body gestures. You need to make the goose perform its tricks anyway."	
"Lawn will unknowingly give you a ton of hints in conversation. Ask him all about his goose training and pay attention."	
"First, you need to get the goose to react to anything at all. Taking off the blindfold isn't an option, but you won't need to."	
"Lawn suggests that goose-tamers are learning to use other senses. If the goose can't react to sight, then..."	
"You'll need to find sounds that the goose will react to. Again, Lawn gives a lot of hints when he describes the tricks."	
"First off, the 'fly around the ground' trick. What does Lawn do when he describes it to you?"	
"He taps you on the nose as a warning. Have you tried to HONK NOSE yet?"	
"Do it in the presence of the goose and it will fly along the ground (to attack you). That's good enough for this trick."	
"The 'spread wings' trick - Lawn mentioned that he saw the goose doing this at a traffic jam. Can you recreate that?"	
"Have you tried looking at or driving Lola's car yet?"	
"Lola's car has a horn. Honk it near the goose to make it spread its wings. [lawn car warning]!"	
"The 'play dead' trick - Lawn mentioned the goose doing this at a brass band feature. Can you recreate that?"	
"There's an instrument somewhere in the carnival you need to find."	
"Enter the haunted house ride and wait until the Mad Hornist appears. Then steal his horn and play it near the goose."	
"With the red nose, the car and the horn, you have everything you need to complete Lawn's show. [lawn fly up warning]."	
"Activate Lawn's show and match up the right sounds with Lawn's gestures to get the goose to behave."	
"You'll need to HONK NOSE, HONK CAR HORN, HONK NOSE, PLAY FRENCH HORN and HONK CAR HORN in that order."	
"The final step is to recreate the 'fly up' trick. This will require more lateral thinking."	
"You will not find another item that honks at this point. You'll need to improvise with what you already have."	
"'Fly up' is just 'fly forward' in a different direction, right?"	
"Can you get above the goose?"	
"CLIMB CAGE, then HONK NOSE to finish off the show."

To say lawn car warning:
	say "Make sure to drive the car to the stands or the circus ring and leave it there, so that you have it when you do Lawn's show".
To say lawn fly up warning:
	say "You still might not know how to recreate the 'fly up' gesture but don't worry about that yet".
	
To say unmask hint:
	say "After all three shows are saved, people will gather in the circus ring, and the Ringmaster should be following you. Head into the ring where the Phantom is tied up, then GET MASK to reveal their true identity."
	
Table of Endgame Hints
title	subtable	description	toggle
"The Phantom has escaped - how can I catch up with them?"	Table of Escape Hints	""	hint toggle rule
"How can I slow the Phantom down?"	Table of Motorway Hints	""	hint toggle rule
"How can I stop the Phantom holding something hostage?"	Table of Lakeside Hints	""	hint toggle rule


Table of Escape Hints
hint	used
"The Phantom has taken off in a vehicle. You won't catch them by staying here."	
"Don't you have your own car?"	
"Find where you left the clown car and use it to chase the Phantom."	
"You might find there's a problem with a slashed tyre, and Freda should remove it for you (if she hasn't, try looking at the tyre again or asking her about it while you're next to the car). You'll need to find a replacement tyre."	
"You won't find another actual tyre anywhere in the carnival, so you'll have to improvise."	
"Are you carrying anything that could be durable enough? Have a careful look at the items you've used so far."	
"You should have access to something made of stiff, vulcanised rubber."	
"Look at the bendy balloons. What can you make with them?"	
"Blow up a balloon, make the circle sculpture, and put the circle on the car. Now you can enter the car to progress to the next scene."	

Table of Motorway Hints
hint	used
"There are three ways to end this chase, but the easiest is just to wait - the chase will end in its own time."	
"If you want to end it faster, you could try shooting out the Phantom's tyres..."	
"... which will require you to SHOOT CAMPER WITH BOW."	
"Or you could try making the Phantom spin out off the road..."	
"... which can be done with THROW PIE AT CAMPER."

Table of Lakeside Hints
hint	used
"At first, you can't do anything (safely) to the Phantom. You will have to bide your time."	
"After waiting for a few moves, something will change in the environment without the Phantom noticing."	
"Have you spotted the flock of geese who land behind the Phantom?"	
"You know a few tricks you can pull with geese now..."	
"HONK NOSE."	



VOLUME - Scraps and notes

Book - Dummied-out

Chapter - Ask about topics

[you were supposed to be able to ask about abstract topics as well as objects. I cut it out to reduce the conversation I had to write, but this still works fine and could come back in a post-comp release. probably not, though]

[
[Redirect tell to ask]
Before telling someone about something:
	try asking the noun about it instead.
	
[Define topic-tables]
Every person has a table name called the topic-table. The topic-table of a person is usually the Table of Placeholder Topics.

Check asking someone about a topic listed in the topic-table of the noun:
	say "[reply entry]" instead.

Table of Placeholder Topics
topic	reply
"AAA"	"DEBUGDEBUGDEBUG placeholder topic table used for AAA.[p]"
"BBB"	"[bbb debug response]"

To say bbb debug response:
	say "DEBUGDEBUGDEBUG placeholder topic table used for BBB.";
	switch to cyoa at Placeholder.

Section - Expand reachability for ask about

[If a person is in scope, but in a different room, I allow asking about to work. This will allow the player to have conversations with NPCs from across open spaces, i.e. the Big Top. This already works for talking to and item-asking without a reaching rule (probably because I built those verbs myself and I haven't hooked them into existing before-stage reachability rules?), but asking about needs the following:]

A rule for reaching inside:
	if asking about:
		if the noun is a person:
			say ask reach inside room preface;
			allow access.

To say ask reach inside room preface:
	say "(first raising your voice to be heard across [map region of location of player])".
	
]


Chapter - Intervisibility

[futzing with seeings rooms from other rooms]

[

[this bit from Inform 7 docs example 366]

Intervisibility relates rooms to each other in groups. The verb to be connected with means the intervisibility relation. 

Definition: a room is inter-visible if it is connected with more than one room. 

After deciding the scope of the player when the location is an inter-visible room: 
	repeat with other place running through rooms which are connected with the location: 
		unless the other place is the location, place the other place in scope. 

Rule for reaching inside a room (called target) which is connected with the location: 
	let way be the best route from the location to the target; 
	if the way is not a direction: 
		say "You can't get over to [the target] from here."; 
		deny access; 
	say "(first heading [way])[command clarification break]"; 
	try going way; 
	if the player is in the target, allow access; 
	otherwise deny access. 

After looking when the location is an inter-visible room: 
	repeat with other place running through rooms which are connected with the location: 
		if the other place is not the location, describe locale for other place. 

RmStands is connected with RmRing.

]

Chapter - Tightrope platforms

[
Part - RmPlatformW (West Tightrope Platform)

RmPlatformW is a room. Printed name of RmPlatformW is "West Tightrope Platform".
RmPlatformW is up from RmRing.

Description of RmPlatformW is "You are perched on a platform ten metres above the circus ring, which doesn't sound like a lot but it's high enough to trouble you. A tightrope stretches east above the ring (and a safety net, thankfully) to another platform. Or you can climb down to the ring."

Part - RmPlatformE (East Tightrope Platform)

RmPlatformE is a room. Printed name of RmPlatformE is "East Tightrope Platform".
RmPlatformE is east from RmPlatformW.
RmRing is down from RmPlatformE.

Description of RmPlatformE is "You are perched on a platform ten metres above the circus ring, which doesn't sound like a lot but it's high enough to trouble you. A tightrope stretches west above the ring (and a safety net, thankfully) to another platform. Or if you're feeling daring, you can jump down onto the safety net to get back to the ring."

Check going to RmPlatformE from RmPlatformW:
	say tightrope walking.
Check going to RmPlatformW from RmPlatformE:
	say tightrope walking.

To say tightrope walking:
	say "You stretch your arms and walk out onto the rope. One step at a time. Don't tread on your own toes. Soon enough, you've reached the other side."

Check going to RmRing from RmPlatformE:
	say "You carefully drop into the safety net, bounce straight out helplessly, and fall nose-first into the ring. Honk!"
]

Chapter - Adagio's trick

[the first bit of conversation I wrote, while the game was still a little directionless. I want to focus the main conversation a litle more so this stuff had to go, but I still like it and it may make a comeback in the future]

[
Adag_how1 is a page.
"'I've been worse.' Her tone suggests she's been a lot better, too. 'I'm practicing a new card trick. I haven't got the hang of it yet, but I won't let it get on top of me.'"
The cdesc is "'You seem gloomy. What'sa matter?'" It is for Adag_hub. It is needed by Adag_how2 and Adag_trick1. It is a one-off. It flips to Adag_hub.

Adag_how2 is a page.
"Adagio frowns. 'It's this card trick, I just can't get the hang of it. It's simple sleight-of-hand, but something odd keeps happening. My head's just not in the right place, that's what it is.'"
The cdesc is "'How are ya? Still feeling down?'" It is for Adag_hub. It flips to Adag_hub.

Adag_trick1 is a page.
"[adag_trick description]".
The cdesc is "'Show me this card trick! I'm sure it's fine.'" It is for Adag_hub. It is needed by Adag_trick2 and Adag_death. It is a one-off. It flips to Adag_hub.
A page-toggle rule for Adag_trick1:
	now the player carries the Death card.

Adag_trick2 is a page.
"[adag_trick description]".
The cdesc is "'Show me that card trick again. You'll nail it this time, I bet.'" It is for Adag_hub. It flips to Adag_hub.

To say adag_trick description:
	say "'Okay... pick a card.' Adagio fans the deck out. You pluck a card out, memorise it - the [random card] - and return it to the deck.

Adagio cuts and shuffles the deck with the precision of a Marine dismantling a firearm. She tosses the cards behind her back and over her shoulder, grabs it so that the deck is cut into four stacks between the five fingers of her left hand, and flicks her hand [i]just so[/i] so that all but one card falls into her right hand. She hands you the remaining card with a flourish.

It's [one of]the Death card from a tarot deck. Adagio catches your expression and peers at the card. 'Curses!' she cries. 'It happened again.' You applaud anyway, and pocket the tarot card[or]another Death card. 'Curses!' Adagio snatches the extra Death card, crumples it up and disappears it[stopping].[run paragraph on]".

Adag_death is a page.
"Adagio crosses her arms. 'Yes, Death after Death. I've got boxes full of Deaths. I don't know why they keep showing up instead of the card I'm trying to force.' She starts to get lost in thought. 'Maybe if I tried the Partario Double-Flick instead of the Baumkuchen's Incredible Four-Way Cut...'"
The cdesc is "'That trick is amazing! Is it always a Death card that shows up?'" It is for Adag_hub. It flips to Adag_hub.

Chapter - Printing the name of a random card

To say random card:
	say "[one of]Ace[or]Two[or]Three[or]Four[or]Five[or]Six[or]Seven[or]Eight[or]Nine[or]Ten[or]Jack[or]Queen[or]King[purely at random] of [one of]Spades[or]Clubs[or]Diamonds[or]Hearts[purely at random]".
	
Part - Death card

[The Death card is given to the player by the Adag_trick1 page in Adagio's talk-to conversation.]

The Death card is nowhere.
Description of the Death card is "A tarot card depicting the Grim Reaper. Now that you look at it more closely, the Reaper seems to be stamping on a top hat, bending a barbell like spaghetti with one hand and plucking a goose with the other. And there's a circus bigtop on fire in the background. But who can say what the cards signify, really?"

]

Chapter - Magic Show Objects

[the original idea for the Magic Show was the saw-the-assistant-in-half trick, where you'd get sawn in half and use your torso and your legs to do things in two separate places. It's funny and I like it, but it had to go, really - it's a lot more fantastical than the rest of the game (which is at least semi-grounded in reality), I never had a strong idea what the actual puzzle/scenario would be, and there are enough nightmarish design decisions in this code base without adding NPC persuasion to the mix.]

[
Chapter - The Saw Box

The saw box is a container. It is in RmBackstage. It is fixed in place. It is enterable, transparent, open and openable.

Description of the saw box is "A long box - the word 'coffin' enters your mind but that's not nice, Adagio and you have done this trick a hundred times before - a long box with a hole at one end for your head, and a large split halfway down the box, about where your waist will go."

Lola can be whole or halved. Lola is whole.

After entering the saw box during Magic Show:
	if Lola is whole:
		say "You climb in, and Adagio shuts the lid. She takes out her Magic Chainsaw, and slices the box in half down the split! She wheels your lower half away. Then she pops open the lid of that half, and out come your legs!";
		now the saw box is closed;
		now Lola is halved;
		now the legs are in the location of the saw box.
		
Check exiting from the saw box:
	if Lola is halved:
		say "You and what legs?" instead.
		
Instead of asking the legs to try entering the saw box:
	if Lola is in the saw box:
		rejoin Lola.
		
To rejoin Lola:
	say "The legs jump into their half of the box. Adagio shuts the lid, unsaws the box, and you leap out to the floor. You're whole again!";
	now Lola is whole;
	now the saw box is open;
	now the legs are nowhere;
	now Lola is in RmRing.
	
[
Instead of entering the saw box:
	if Lola is whole:
		say "You climb in, and Adagio shuts the lid. She takes out her Magic Chainsaw, and slices the box in half down the split! She wheels your lower half away. Then she pops open the lid of that half, and out come your legs!";
		now Lola is halved;
		now the legs are in the location of the saw box;
	else:
		say "You're already half the clown you used to be!"
]
		
Chapter - Legs

The legs are a person. The legs are plural-named.
The legs are nowhere.

Description of the legs is "Your legs are free as the wind, but without a brain to direct them all they want to do is stand around. Perhaps you can still control them?"

Persuasion rule for asking the legs to try doing something: persuasion succeeds.
]

Chapter - Phantom's car

[this object got cut when I had the idea of using the camper instead, but it's a shame to lose the bumper sticker joke]

[
Chapter - Pooting's car (scenery)

Pooting's car is in RmMotorway.
Pooting's car is scenery.

Description of Pooting's car is "A sensible little green city car, [if the noun is in RmMotorway]currently going flat out at 110mph[otherwise]overturned and crumpled. This close, you can see a bumper sticker on the back: THIS MACHINE ENGAGES FASCISTS IN REASONED DEBATE[end if]."

Understand "pooting" as Pooting's car.
]

Section - Suppress listing contents if the player doesn't have the hat

[The examine containers rule does nothing when examining the black top hat while the black top hat is worn by the Ringmaster.]

[This was a stopgap for hiding the rabbit while the Ringmaster was still wearing the hat, but abusing the closed-container thing seems to be working more elegantly]



Book - Help menu

[early version of help menu which used Hybrid Choices instead of Menus. Although it seemed more streamlined to only use Hybrid Choices for all menus, in practice I felt that I wanted a more clear difference between the help menu and the conversation - that is, the help menu using Menus is more clearly "out of world" than the help menu using the same underlying code as the conversation trees]

[Opening the menu is an action out of world. Understand "help" and "about" and "menu" as opening the menu.

Carry out opening the menu (this is the open menu rule):
	switch to cyoa at Menu_main.
	
Menu_main is a page.
"This is the main menu for [Honk]. Please select an option from the menu below."

Menu_helpIF is a page.
"[Honk] is a work of interactive fiction. Type commands to direct the player character around the world, pick up and use objects, and talk to people.

If this is your first text adventure, you should know that it helps to be curt. You don't need to type 'pick up the egg on the ground'. 'GET EGG' will do. Look at the 'Verbs that [Honk] recognises' option in the help menu if you want a list of things you can type. Don't be afraid to experiment - it will never be possible to make [Honk] unwinnable. If you get a game over, you will always be able to type UNDO and continue the game.

All adventurers should be aware that [Honk] uses TALK TO as the main verb for conversation, although ASK ABOUT is recognised too. Look at the 'How to talk to people in [Honk]' option in the help menu if you want more guidance."
The cdesc is "How to play [Honk]". It is for Menu_main. It flips to Menu_main.

Menu_helptalk is a page.
"In [Honk], you will need to talk to other characters in order to activate certain events and get a few hints. There are two ways to talk to people:

The main way of talking is to just type TALK TO ADAGIO (or whoever you want to talk to). This may open up a conversation menu where you can choose from a list of questions and quips. Conversation menus are operated much like this help menu, by entering the number by the line of dialogue you want to say. Some conversation options may unlock other options. You will have to TALK TO people in order to activate certain scenes and complete the game.

You can also ASK people ABOUT objects or other people. This may get a small response from the character you're talking to, or it may open a new conversation menu. You never have to ASK anyone about anything, but doing so may get you some puzzle hints, or a little background information about certain characters and things.

Notes for experienced text adventurers: TELLing people about objects and SHOWing objects to them are treated the same as ASKing them (but GIVE is still a separate action). ASKing about general topics is less likely to work, but it might take you to part of the TALK TO conversation tree."
The cdesc is "How to talk to people in [Honk]". It is for Menu_main. It flips to Menu_main.

Menu_helpverbs is a page.
"Here are some of the main commands that will work in [Honk]. Every verb you need to complete the game is listed on this page somewhere.

To go somewhere:[line break]GO direction[line break](The eight compass directions are recognised (GO NORTH, GO SOUTHEAST, etc). You can also GO IN or OUT, or GO UP or DOWN. That's if the direction leads anywhere, of course. You can also just type the direction by itself - instead of GO NORTHWEST, you can say NORTHWEST, or even just NW.)

To look around at your surroundings:[line break]LOOK

To look at an object or a person more closely:[line break]EXAMINE something (or just X something)

To interact with people:[line break]TALK TO someone (or just T someone)[line break]ASK someone ABOUT something[line break]GIVE something TO someone

To take an object:[line break]TAKE something

To drop an object:[line break]DROP something

To use an object:[line break]It depends on what you're trying to use. Different verbs work for different objects. You can HONK your red nose, for instance. You could try to EAT something, SHOOT something AT something else, SQUEEZE something, THROW something, WRAP something AROUND something...

To manage your game:[line break]UNDO to undo the last move you made[line break]SAVE to save your game so far[line break]RESTORE to load an older game[line break]RESTART to start a new game[line break]QUIT to end the game[line break]SCRIPT ON/OFF to record your play session (this will usually save a text file somewhere on your computer or in your browser's file, but it depends on the program you're playing [Honk] in)."
The cdesc is "Verbs that [Honk] recognises". It is for Menu_main. It flips to Menu_main.

Menu_credits is a page.
"[Honk] was written by Alex Harby, or rabbit or wisprabbit, whatever you want to call me.

[Honk] was programmed in Inform 7, developed by Graham Nelson, and adapts some code from the Inform 7 documentation examples by Graham Nelson and Emily Short.

It also uses the following extensions:[line break]Hybrid Choices by AW Freyr[line break]Gender Options by Nathanael Nerode[line break]Nathanael's Cookbook by Nathanael Nerode (not actually included in the game code, but helped me sort out a few whitespace bugs)[line break]Basic Screen Effects by Emily Short

In addition to the documentation and the extensions, I've stolen bits of code from all over the IntFiction forums like a magpie. This project uses code written by climbingstars, Dannii Willis, Felix Larsson, StJohnLimbo and zarf. Proper citations are in the source code, which should be released alongside the game file.

Thanks to StJohnLimbo and Mike Russo for providing help with using Hybrid Choices.

Andrew 'Drizzle' Bedno and Susan 'Sweetie' Hooper's ebook [i]Clowning 101[/i] was the starting point for writing the main character. http://tritontrouperscircus.com/clowning".
The cdesc is "Credits". It is for Menu_main. It flips to Menu_main.

Menu_bye is a page.
"Returning to the game..."
The cdesc is "Back to the game". It is for Menu_main. It is an end-page.



Book - Credits

Calling the credits is an action out of world. Understand "credits" as calling the credits.
	
Carry out calling the credits (this is the open menu at credits rule):
	switch to cyoa at Menu_credits.


]


Book - Good jokes I came up with

[

There was a magician that really divided the crowd... until the cops made him stop using volunteers for the saw trick

three clowns: Lola, Roflo, Lmaouie

names for the rabbit:
	The Last Harebender
	Rabbit and Costello
	Grigori Rasputin "The Mad Monk"
	Loadsabunny
	

]

Book - Links, resources, bibliography

[
On accommodating circuses and carnivals:
http://www.knowsley.gov.uk/pdf/PG12_Circular0407-TravellingShowpeople.pdf

]

Book - Testing post

Part - Alpha

[

Hi all!

I've been working on a comedy-puzzly parser-based game for IFComp called Honk!. I'm about to go on holiday and won't be working on the game for a week or two, and I was hoping to get a couple of people to test what I have so far.

I'm calling this alpha testing for now, because the game is not complete. Bits of the writing haven't been done yet, the writing that IS there needs redrafting, some custom responses are missing, some scenery is unimplemented, some new actions haven't been thoroughly roadtested, NPCs are too static, and I want to add more conversation options. Despite all that, the game is playable with all scenes and puzzles implemented, in-game hints and a few good jokes (I hope), and you can get to a winning ending. (I would have liked to get it closer to finished before testing, but I really badly need a break from it!)

Honk! is set in a circus and carnival. It's kid-friendly, although not aimed directly at kids. I don't think there is any content that requires a warning, apart from maybe implied blood (only if you take an obviously wrong action), food, and clowns (but a very nice clown!). I'm writing for IFComp, so the game should take less than two hours to play through.

If anyone's willing to take time out of ParserComp to play a much scrappier and less polished game, I would really appreciate the help! I'd like a transcript of your play session recorded if you can. Turnaround doesn't have to be immediate - some time in the next two weeks would be ideal. I've got a hint menu in place if you get stuck - I'll be happy if you avoid using it, but it's there if the puzzles are too obtuse. I've used Inform's Release for Testing option, so testing commands like PURLOIN will be available (and I'm also releasing with the source code if you really want to get into it). 

Please let me know here or by private message if you're interested in testing. I'll message you a link to an itch page with a downloadable .zip on it. Of course, I will be happy to trade testing with anyone working on their own thing for IFComp, Ectocomp or whatever other comp (I can do parser-based or choice-based).

]

Part - Beta 1

[

Hi all!

I'm still plugging away at Honk!. It was supposed to be ready for Spring Thing 2023. Whoops! Now I'm aiming for IFComp 2023 as an absolute "stop fiddling around and finish what you have" deadline. (The slowness is for happy reasons - that temporary job I got in August has extended my contract to July and they say they want to make me permanent. It means I've been too tired to devote lots of thought to game development, but it also means I'm not panicking about money and miserable about my future, so I'll take that trade-off.)

The game is mostly content-complete at this point, so I'd like to open this thread up for beta-testing. I'd especially like testers willing to hunt for bugs and for missing responses. I'm not looking to add extra puzzles or other game-changing content at this point, but feel free to suggest it if you feel something's missing.

For alpha testers, here are the major changes made as a result of your feedback:
	- A new puzzle has been added to the endgame
	- The Magic Show puzzle has an extra step, and the previous steps have been tweaked to be less exacting
	- The Strength Show puzzle has an extra mini-puzzle to get a certain item
	- A few extra minor NPCs
	- All the placeholder text has been filled in (apart from stuff which you're not supposed to see unless there's a bug)
	- Major NPCs have more idle behaviours, extra dialogue, and more context-sensitive conversation options (but there's more I want to do here, especially with adding responses to asking x about y)
	- Better handling of certain complicated objects (especially the burger stand, the stepladder and the clown car)
	- Better scenery (especially the crowd, which now exists - there's still more scenery I want to add, though)
	- Bug fixes and typo corrections
	
There are still a lot of bugfixes and potential rewrites which need doing. If you were an alpha-tester who ends up beta-testing, and you notice that some of the issues you flagged haven't been fixed, you're not being ignored! Feel free to send me a message about it if you're concerned or annoyed. I also need to rewrite the hints to be more fine-grained (they're useless for certain puzzles right now), do some redrafting and rethinking of certain descriptions, and figure out what I'm doing for cover art... So much to do. But it's very close to being publishable now.

I'd like to have beta-testing done by the start of June if possible. No rush, but I'd like to get my testing out of the way before the ParserComp 2023 requests come in. I'm happy to exchange testing if you're working on something for a competition - as long as it runs in a web browser or on a Windows system, I'll be able to test it.

]


Book - Alpha to Beta changes

[
Lots of bug fixes, added scenery, etc. Most important changes:
	- Adagio's puzzle has an extra step now; extra items have been added elsewhere in the map which you will need to use
	- Adagio's puzzle is also more forgiving now, and less reliant on setting everything up. [Specifically, the rabbit won't eat lettuce while you're holding it, but will wait for you to drop it or put it somewhere first]
	- Freda's puzzle has an extra step: it's more difficult to get a certain item now
	- There's another extra puzzle in the endgame, just after the Phantom makes their escape
	- The carnival is more lively now, featuring a crowd and audience
	- Major NPCs should feel a little more lively now, with a few passive behaviours and more conversation. (I'd like to add even more optional dialogue between now and release.)
	- A handful of minor NPCs have been added for flavour and jokes
	- Improved handling of the more complicated objects (especially the stepladder, the clown car and the burgers)
	- A bunch more dialogue options, many of which are hidden - try asking characters about objects and each other
]


Book - Puzzle ideas

[
Tightrope
	Phantom cuts rope? Replace with ladder?
	Have to unicycle across?

Adagio: Magic contest(?)
	Need legs for something
		Was going to be for tightrope, but I think the ladder puzzle is better, more natural
		Use as assistant for magic show?
	Big trick to do right:
		Bullet catch
		Disappear an elephant (or a rabbit)
		Escapology (but Adagio must still be available to talk to)
			Hands and feet tied together (have to release Adagio without getting close to her), lowered into water tank - trick fails if Adagio touches the water, since she'll drown if she doesn't abort right now
				how it should be done: Adagio has key in cuff of trouser leg which she can grab with hand - however, Phantom steals the key before the trick starts, so handcuffs / rope must be cut remotely
				if not handcuffs, then rope and a little razor blade?
					lure rabbit into position?
				misdirection: Adagio is doing something with head/mouth to disguise what hands are doing
	IDEA SO FAR:
		Scenario: Adagio is tied up for an escape trick, but the Phantom has stolen the item (little knife?) that lets her escape. Lola can't go near Adagio because the audience gets disappointed (it's not much of an escape if the assistant just unties the magician)
		Solution: Adagio is missing the rabbit in her hat, because she's accidentally swapped hats with the Ringmaster. Restore the hats. Now the rabbit will be present in the stage show. Get a burger from a concession stand and take the lettuce and tomato out of it. Go to the trick apparatus and tie the lettuce to the ropes [note that this step needs a lot of hinting!!] Now the trick solves itself when you activate it: the rabbit will be lured over to the trick and will chew Adagio free.
			Why not cut the ropes beforehand? Because it's not much of a trick if the ropes are already cut. Adagio will just have to replace the rope beforehand, forcing you to cut the rope during the trick
			Why not use the bow-and-arrow? It's a precise shot and Lola fears that they'll puncture Adagio's hands
	

Freda: Strength contest between Freda and Phantom
	Idea: Lifting a car
		Lighten Freda's load
			She lifts a car
				Fill its tyres with helium
				Replace with your own car
		Add load to Phantom
			(but this has to be done remotely, because the player would have to carry it up to drop onto the Phantom. If it's light enough that Lola can climb a ladder while carrying it, it's not heavy enough to make a plausible difference to the Phantom)
			Put a basketball hoop over whatever the Phantom is carrying, so that the audience throws tons of rubbish in it and makes the Phantom's load heavier?
			Banana skin pie to make Phantom slip? (could also come back to make the Phantom's car skid off the road a la Mario Kart)
	Idea: Bending iron
		A barbell?
		Or just lift the barbell
	Idea: Carrying people - audience volunteers?
		Lighten audience members - big helium balloons, stock audience with children, distract bigger audience members
	Idea: Pull a truck
	Idea: Cannonball catch
	
	What is the Phantom doing and how is it a trick?
		Lifting barbell
			Helium bells - pop them
		Is an audience member that Freda must lift
			Wearing weights
				Iron vest
				Bags of flour (cut them open)
				
	initial idea:
		Scenario: Freda's trick is to lift Lola's car, as The Strongest Person In the Vicinity. However, the Phantom has shown up to perform their own feats of strength. Freda can only lift the car for so long before collapsing. Lola needs to help Freda and work out how the Phantom is cheating
		Solution: Drive the car to the balloon stand, and fill the tyres with helium to make it lighter. (Maybe you can fill the interior as well?) This lets Freda hold the car for a lot longer. 
		
	reworking:
		Scenario: Freda will lift a random audience member as part of the act. The Phantom forces themself into the action. Freda has real trouble lifting the Phantom, and Lola must work out why and lighten the load.
		Possible solutions:
			Phantom has a weighted trenchcoat (a la Hubert in To Hell in a Hamper) - cut the coat open, dump the weight out?
				Phantom holding coat closed. Throw pie at them to make them clean eyes, loosening grip on coat, exposing flour(?)
				Open bags of flour with something sharp
					Has to be big, like a sword - something small would be an alt solution for the Adagio puzzle - needs to be something that Adagio could not use
					Have to also come up with an excuse why it can't be the rabbit chewing the sacks open as with Adagio's ropes? (or do I? could allow alt solution?)
						Maybe you only have a turn to get the sacks open, and the rabbit's reactions are more delayed? Maybe you can't throw the lettuce high enough, since the Phantom is hoisted high above?
					How about a bow and arrow? Get from a Tunnel of Love Cupid?
					
			Find a way to work the helium in? Fill the coat with helium? (Swap the helium canister out for, I don't know, cement or something)
			
		Note:
			Will have to revise the Phantom to be a former-strongperson(-turned-politician), otherwise it won't make sense why the Phantom can carry the load but Freda can't
		
	IDEA SO FAR:
		Scenario: Freda will lift a random audience member as part of the act. The Phantom forces themself into the action, wearing a conspicuously thick trenchcoat which they're holding closed. Freda has real trouble keeping the Phantom held above her head, and Lola must work out why and lighten the load before Freda collapses.
		Solution: This will be the one time that the player can directly interact with the Phantom before the endgame, although the Phantom is too high above the ground to interact with. The player should harass the Phantom by throwing pies at them (or maybe something else). As the Phantom moves their hands to clean their eyes, etc, they expose bags of flour hidden underneath the coat. In this small window of opportunity, shoot the bags with the bow and arrow from the Tunnel of Love to open them up and lighten the load, exposing the Phantom's cheating to the audience and protecting Freda's reputation.
			Why not use the lettuce and rabbit? a) there's only a small window of time where the player has the rabbit b) the lettuce bounces off the Phantom's coat/is brushed off easily, so not enough time for the rabbit to get to work
			Why not throw something else? Lola is a clown, they're only trained to throw pies
	

Lawn: Lure goose to do tricks after Phantom sedates it
	Provoke goose
		Honk nose
			From tightrope platforms to make goose jump up
		Honk car horn
		Honk trumpet/trombone/french horn?
		Bigger goose with mirror from Hall of Mirrors
		Make Lawn blow nose
	IDEA SO FAR:
		Scenario: Lawn's show is to induce a goose to do tricks other than attacking him. However, the Phantom has sedated the goose, and now it's not very responsive. The goose and Lawn are locked inside a cage, so Lola must provoke the goose remotely.
		Solution: The player must realise at some point that different types of honking sound provoke the goose. Gather items and honk them at appropriate times (i.e. when Lawn announces a trick) to make the goose behave:
			Clown nose - given at start of game. Makes the goose jump and attack the honker (fly into the cage bars)
			Car horn - in Lola's car. Makes the goose spread its wings
			French horn - in the ghost train (n.b. will prob be revamped to Tunnel of Love). Makes the goose bob its head up and down
			Lawn blowing nose - more involved to set up - trick Lawn into sniffing squirty flower (through the bars) while the flower is full of something irritating (bad cola?). Makes the goose play dead
			

CURRENT WALKTHRU SEEMS TO BE:
	Adagio:
		Get Adagio's hat off her
		Give hat to Ringmaster to get his hat (which is actually Adagio's real hat with the rabbit in it)
		Give hat to Adagio
			Now the rabbit is in Magic Show
		Get burger from concession stand
		Take lettuce out of burger
		Tie lettuce to Magic Show ropes
		Activate Magic Show and wait for the rabbit to go to the lettuce ropes and chew through them
	Lawn:
		Drive car into circus stage
			Now the car horn is available in Beast Show
		Get French horn from Tunnel of Love
		Use various horns on goose (red nose, car horn, French horn, making Lawn sneeze) to check reactions
		Activate Beast Show
		Use horns in right order as Lawn's story suggests to make Beast Show successful
	Freda:
		Get bow-and-arrow from Tunnel of Love
		Get pies from Lola's caravan
		Activate Strength Show
		Throw pies at Phantom
			Phantom drops guard and exposes bags of flour
		Fire arrows at flour to open them
	Endgame:
		Unmask Phantom
		Motorway:
			Throw pies/fire bow-and-arrow/other viable solution to get car off the road
		Lakeside:
			Honk nose to provoke geese behind Phantom
PROBLEMS:
	Lack of balance: Strength Show is simpler than the other two
		Could we work in cut ideas? Ladder? Helium? Balloon art?
		Since Lawn's bit is pretty full and requires a lot of experimentation, I could cut the pollen cola from here, and combine it with the pie - make Phantom sneeze with pollen squirt/pollen pie, perhaps?
			To replace final difficult step in Lawn's puzzle, maybe you climb above the cage and honk the horn to make the goose go straight up?
		
	Instead of a tunnel of love, how about a love-themed version of those old fortune-telling machines? Can put the Cupid with bow-and-arrow (or crossbow?) on there
	
	Right now we're not using the tightrope platforms, so we can probably get rid of them to reduce world complexity. (If we go with the getting-above-the-cage idea for the Beast Show, maybe we can just climb the cage)
	
NEW WALKTHRU:
	Adagio:
		Get Adagio's hat off her
		Give hat to Ringmaster to get his hat (which is actually Adagio's real hat with the rabbit in it)
		Give hat to Adagio
			Now the rabbit is in Magic Show
		Get burger from concession stand
		Take lettuce out of burger
		Tie lettuce to Magic Show ropes
		Activate Magic Show and wait for the rabbit to go to the lettuce ropes and chew through them
	Lawn:
		Drive car into circus stage
			Now the car horn is available in Beast Show
		Get French horn from Ghost Train
		Use various horns on goose (red nose, car horn, French horn) to check reactions
		Activate Beast Show
		Use horns in right order as Lawn's story suggests to make Beast Show successful
			Final step: climb cage to make goose fly up
	Freda:
		Get bow-and-arrow from Fortune Machine
			Need ladder from Ferris Wheel to climb up to it
		Get pies from Lola's caravan
		Activate Strength Show
		Throw pies at Phantom
			Phantom drops guard and exposes bags of flour
		Fire arrows at flour to open them
	Endgame:
		Unmask Phantom
		Motorway:
			Throw pies/fire bow-and-arrow/other viable solution to get car off the road
		Lakeside:
			Honk nose to provoke geese behind Phantom
			
	still a little unbalanced - in particular Adagio's puzzle feels less intuitive than other two? - but good enough. I can work with this, and then check later how it feels to play through each puzzle and add as needed.

]

Book - Some good jokes I didn't come up with

[
I know a couple who work in a circus - he's a sword-swallower, she's an acrobat. Last time I saw them, they told me she was pregnant. I said congratulations, and I asked what they were hoping for, a boy or a girl? They said they don't care as long as it fits in the cannon.

...

A priest, an imam and a rabbit walk into a blood donation clinic. The nurse asks them if they know what blood type they are. The rabbit says "well, I think I'm a Type O."
]