The AfterEveryCommand() block on the world element is called after the successful/failed blocks (and the sets of enqueued commands after each) are called, if any.
action general a_quit named "quit";
action transitive a_examine named "examine", "look at", "x";
object o_inf_ball named "infinity ball", "ball" uses determiners "the"
{
// not examinable.
onWorldBrowse()
{
textln("There is an infinity ball here.");
}
}
object o_solid_ball named "solid ball", "ball" uses determiners "the"
{
onAction (a_examine)
{
textln("Looks like a ball.");
}
onWorldBrowse()
{
textln("There is a solid ball here.");
}
}
world
{
init()
{
giveObject(this, o_inf_ball);
giveObject(this, o_solid_ball);
}
function splash()
{
textln("Examine things with \"examine\".");
textln("Type \"quit\" to quit.");
browse(world);
}
start()
{
splash();
textln("Try to hit all of the error conditions with your input!");
}
onAction(a_quit)
{
quit;
}
onUnhandledAction(a_examine)
{
textln("I can't examine that.");
}
onMalformedCommand(a_examine)
{
textln("I don't understand what you want to examine.");
}
onIncompleteCommand(a_examine)
{
textln("What should I examine?");
}
onAmbiguousCommand(a_examine)
{
textln("I need to be more specific.");
}
afterSuccessfulCommand()
{
textln("Command successful.");
}
afterFailedCommand()
{
textln("Command failed.");
}
afterEveryCommand()
{
splash();
}
}
AfterSuccessfulCommand() — "Lifecycle" block: called if interpretation succeeds.
AfterFailedCommand() — "Lifecycle" block: called if interpretation fails.
Initializing a context is wrapped in one request-response loop. The response cues that come back are the result of all init() blocks plus start(). All operations executed contribute towards the operations and function depth limits, which is TAME's soft protection against infinite loops and stack overflows. This may vary by implementation, but the author can override these in the module header.
TAME's general flow of handling commands are:
There's a full diagram available that outlines TAME's logic.