Skip to content

Instantly share code, notes, and snippets.

@rodel77
Created April 4, 2020 00:32
Show Gist options
  • Save rodel77/282c4fe9c87a5bf35a2eb0553b794486 to your computer and use it in GitHub Desktop.
Save rodel77/282c4fe9c87a5bf35a2eb0553b794486 to your computer and use it in GitHub Desktop.
:greeting // Label: This stores in memory as a pointer (same for all references to this label)
set_tx "message.greeting" // Set the text, clear decision list
add_dc "message.good" // Set decision
add_dc "message.bad"
decide // The program yields, then moves the result (index) to register #D
if D=="message.good" // Maybe test suits to check that "message.good" REALLY exists, in order to avoid typos
set_tx "message.me_too"
continue // The first option will be continue
decide
else bad // Jumps to "bad" label
end
:bad
add_stack idle // Add "idle" label to the execution stack
set_tx "message.what_a_shame"
add_dc "message.yes_it_is"
add_dc "message.i_wanna_cry"
decide
// Nothing else to do... jump to "idle" as the stacks says
// This can allow me to not be a psychopath putting "jump" tags everywhere after a sub-branch ends
end
:idle
if G[first_greeting]
set_tx "message.what_do_you_need"
else
set_tx "message.need_anything_else"
add_dc "message.felling_bad"
add_dc "message.gimme_information"
decide
if D=="message.felling_bad"
jump bad
else information
end
:information
set_tx "message.no_info"
decide // Since there are no decisions the program will end here
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment