version 9/140814 by Leonardo Boselli
Example: ** The Gnome's Holiday - A full example of emphasized objects, compassless directions, and conversation topics.
We'll create a slightly longer scenario with several locations and a simple puzzle, to demonstrate the full potential of Hyperlink Interface. This story has "hyperlinks required" set to true, so it begins with a menu that helps players calibrate hyperlinks.
We implement an extremely simple conversation system to demonstrate emphasized topic words. Note that a real conversation system would need to be much more robust and elaborate. We'll also create a variation on the exits verb to show our compassless exits.
"The Gnome's Holiday"
Include Hyperlink Interface by Leonardo Boselli. Use American dialect.
Topic hyperlink highlighting is true. Parser highlighting is true. Hyperlinks required is true.
After printing the banner text: say "First time players type ABOUT for more instructions.".
Section - Conversation
hyperlink-asking is an action applying to one thing. Understand "[a speakable]" as hyperlink-asking when the number of other people in location > 0.
Carry out hyperlink-asking:
let subject be a random other person in the location;
say "[message of noun][paragraph break]".
A speakable is a kind of thing. A speakable has some text called the message. Instead of doing anything other than hyperlink-asking to a speakable: say "That's merely a topic of conversation.". Does the player mean doing something other than hyperlink-asking to a speakable: it is very unlikely.
Section - Exits
Every room has some text called the exits text.
First carry out listing exits:
unless the exits text of location is "":
say the exits text of location;
say line break;
stop the action.
After looking: try listing exits.
Section - Instructions
Understand "about" as requesting the about text. Requesting the about text is an action out of world applying to nothing. Carry out requesting the about text: carry out the showing the hyperlink introduction text activity.
Section - Game
Gnome's Garden is a room with description "Brightly pastel flowers dot this well-kept garden, bordering a button-cute shack with whimsical stylings on the edge of the river, which is spanned here by a [drawbridge]." and exits text "A [d]path[x] of cherry-colored bricks winds off towards some distant hills, while the [if shack door is open][d]door[x] to the gnome's shack stands open[else]door to the gnome's shack is closed[end if][if drawbridge is open]. The lowered drawbridge spans the river to a treasure-strewn [d]wonderland[x][end if].". Understand "path" as west when location is Gnome's Garden.
A stone table is a hyperlinkless fixed in place supporter in Gnome's Garden. On the table is a copy of the Daily Gnomon with description "You can't read gnomish, but you can make a great gnocchi." The hyperlink of the Daily Gnomon is "copy". The button-cute shack is scenery in Gnome's Garden. Instead of entering shack, try going north.
The shack door is a closed locked undescribed door with hyperlink "door". It is north of Gnome's Garden and south of Cozy Shack. The can't go through undescribed doors rule is not listed in any rulebook. Instead of going inside in Gnome's Garden, try going north.
The drawbridge is a closed unopenable door. "[if closed]The drawbridge is raised, allowing passage by a steady stream of tiny steamboats, but preventing access to the treasure-strewn wonderland on the other side of the river[else]Wee steamboats queue impatiently behind the lowered drawbridge[end if].". It is east of Gnome's Garden and west of the Treasure-Strewn Wonderland. The description of drawbridge is "[if closed]If only you could find a way to lower it and cross the river![else]The treasure-strewn wonderland across the river awaits![end if]".
The cherry-brick path is a backdrop. It is everywhere. Understand "cherry/cherry-colored/colored" as path.
Golden Pasture is a room with description "The grass here is thick and heavy, sparkling with gold and amber hues." and exits text "Only the [d]path[x] back to the garden is clear." Golden Pasture is west of Gnome's Garden. Understand "path" as east when location is Golden Pasture.
The gnome is a person in Golden Pasture. "A [gnome] perches on a checkered toadstool here, stroking his beard in relaxed contentment." The description is "Dressed in brightly colored clothes, he has the cheerful air of someone on holiday.".
After examining the gnome, say "You could ask him about his [t]dragon[x], the [t]weather[x], or the [t]drawbridge[x].".
A pet dragon creature is a female animal in Golden Pasture. "Clinging anxiously to the gnome's cap is a tiny bronze [o]creature[x].". The description is "Looking closer, you see she is a beautiful baby dragon. She regards you [if we have hyperlink-asked the personality topic]with a friendly twinkle in her eye[else]fearfully, clutching the gnome's hat with an almost comically tight grip[end if]."
The dragon topic is a speakable with message "'You like her?' the gnome says fondly, petting the dragon which watches you nervously. 'She's named [t]Quinnabel[x].'".
The Quinnabel topic is a speakable with message "'Found her in an old mushroom mine,' the gnome says, warming to his subject. The dragon sniffs you tentatively. 'She's got quite a [t]personality[x].'".
The personality topic is a speakable with message "'Oh, she's shy at first, but she'll warm up to you right away if you let her.' And sure enough, the dragon finally seems to take a liking to you, and purrs contentedly as you scratch it behind the ears.". After hyperlink-asking the personality topic for the first time: say "'See, you're not such a bad sort,' the gnome says. 'Why don't you take this key and see to that drawbridge yourself.' And he hands you a scuffed silver key (oversized even for you)."; move silver key to player. The silver key unlocks the shack door.
The drawbridge topic is a speakable with message "'Hrmph,' the gnome mutters, crossing his arms defiantly, 'I'm supposed to be on vacation.'".
The weather topic is a speakable with message "'Looks like another day of beautiful sunshine again,' he grumbles.".
The gnome carries dragon topic, Quinnabel topic, personality topic, drawbridge topic, and weather topic.
The description of Cozy Shack is "Strewn with bric-a-brac; your eyes are drawn immediately to the prominent [lever] on the riverward wall.". The exits text of Cozy Shack is "The only place to go is back [outside].". Instead of going outside in Cozy Shack, try going south. Instead of exiting in Cozy Shack, try going south.
A lever is an undescribed device in Cozy Shack. Instead of pushing or pulling the lever, try switching on the lever. After switching on the lever: now drawbridge is open; say "You hear a splash and a creak from outside the shack.".
After going to Treasure-Strewn Wonderland for the first time: say "You enter the land of treasure. Congratulations!"; end the story saying "You have won". Understand "wonderland" as east when location is Gnome's Garden.
Test me with "copy / drawbridge / door / open door / path / x path / gnome / drawbridge / dragon / Quinnabel / personality / path / unlock door / open it / exits / door / pull lever / out / wonderland".