Once¶
Definition¶
<once>
...
</once>
<once id="once_key">
...
</once>
A part of a dialogue plan, consisting of a sequence of plan items, which is run only once.
| Attribute | Type | Description |
|---|---|---|
| id | string | Optional. Name of the predicate used to track that the once block has executed. Reusing the same id shares the once-state across different once blocks. |
Parents¶
Children¶
- <assume_issue>
- <assume_shared>
- <assume_system_belief>
- <bind>
- <findout>
- <forget>
- <forget_all>
- <get_done>
- <if>
- <inform>
- <invoke_service_action>
- <invoke_service_query>
- <jumpto>
- <log>
- <raise>
- <signal_action_completion>
- <signal_action_failure>
Behaviour¶
The plan items inside this element will be run only once. After the "once" element has been run, TDM will keep track of it and make sure that it isn't run again until the session is restarted or until the tracking predicate is forgotten (e.g. via <forget> or <forget_all>).
Internally, the compiler creates (or reuses) a boolean predicate and checks it as a private belief. If it is already set, the once block is skipped. Otherwise the predicate is assumed and the child plan items are executed.
There is nothing that prohibits using the once element inside another once element, but it is not intended, and the consequences are unknown.
Examples¶
Plan for asking a sequence of questions and getting the price of a trip.¶
<plan>
<once>
<inform>
<proposition predicate="info" value="Listen carefully! I will say this only once!"/>
</inform>
</once>
<inform>
<proposition predicate="other_info" value="I will say this any time I get the chance!"/>
</inform>
</plan>
Share the same once-state across different plans¶
<plan>
<once id="initial_greeting">
<inform>
<proposition predicate="info" value="Welcome!"/>
</inform>
</once>
</plan>
<postplan>
<once id="initial_greeting">
<inform>
<proposition predicate="info" value="You will only hear this once."/>
</inform>
</once>
</postplan>