Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joningold/43065b56ca3227b625cbb8c7274cde1a to your computer and use it in GitHub Desktop.
Save joningold/43065b56ca3227b625cbb8c7274cde1a to your computer and use it in GitHub Desktop.
Looping conversation blocks using implicit threads
The space elevator climbs slowly towards the stars.
- (opts)
<- talk_to_my_companion(-> opts)
* I look out of the window...
* I whistle a tune...
=== talk_to_my_companion(-> return_to)
// create a tunnel, so conversation blocks can end with simple tunnel returns
-> options -> return_to
= options
// list all conversation blocks, in rough "priority order"
<- insert(-> talk_about_elevator)
<- insert(-> talk_about_dog)
-> DONE
// use "insert" as a default here
VAR mostRecentConversationChosen = -> insert
= insert(-> convBlock)
{mostRecentConversationChosen == convBlock:
-> DONE
}
-> convBlock ->
// if we're here, then we CHOSE something from this block
~ mostRecentConversationChosen = convBlock
->->
== talk_about_elevator
* "Tell me about the elevator?"
"What's to say?" my companion replies. "It's very tall."
- ->->
== talk_about_dog
* (first) "What a delightful dog you have!"
"Thank you," my companion answers. "Mr Scruffles is a true gentleman. Gentledog."
* { first && not gentledog }
"Wait, did you call your dog a gentledog?["] Because that really isn't a word."
-
* * "Gentledog is NOT a word."
- - - (gentledog)
"It is for Scruffles. It is!"
-
* * (nasty) {gentledog} "I respectfully disagree."
My companion tickles the mutt. "Don't listen to the nasty person, gentledog."
-
* * {nasty} "I'm not nasty."
The man looks at me through furrowed brows. "People are so hard to read," he grumbles. "They lie so easily."
* * {nasty} "It's true. I am nasty."
The man stands up. "Good day to you!" He huffs away. The dog looks back at you, longingly.
- ->->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment