Timing Flows (timing.co)#
Flows related to timing and reacting to periods of silence.
- wait $time_s $timer_id="wait_timer_{uid()}"
Wait the specified number of seconds before continuing
Example:
import timing import core flow delayed bot say $text wait 0.5 bot say $text flow main user said something start delayed bot say "I say this later" start bot say "I say this first" wait indefinitely
> hello I say this first I say this later
- repeating timer $timer_id $interval_s
Start a repeating timer
Example:
import timing import core flow reacting to my timer match TimerBotAction.Finished(timer_name="my_timer") bot say "tick" flow main activate reacting to my timer user said something start repeating timer "my_timer" 0.4 wait 1.0
> test tick tick
- user was silent $time_s
Wait for when the user was silent for $time_s seconds
Example:
import timing import core flow reacting to user silence user was silent 5.0 bot say "Can I help you with anything else?" flow main activate reacting to user silence while True user said something bot say "sounds interesting"
> I am going to the zoo sounds interesting # (Wait for more than 5 seconds) Can I help you with anything else?
- user didnt respond $time_s
Wait for when the user was silent for $time_s seconds while the bot was silent
Example:
import timing import core flow repeating if no user response global $last_bot_script user didnt respond 5.0 bot say $last_bot_script flow main activate tracking bot talking state activate repeating if no user response user said something bot say "How can I help you today?" user said something
> hi How can I help you today? # (Wait for more than 5 seconds) How can I help you today?
- bot was silent $time_s
Wait for the bot to be silent (no utterance) for given time
Example:
import timing import core flow inform processing time user said something bot was silent 2.0 bot say "This is taking a bit longer" flow processing user request user said "place the order" wait 4.0 bot say "order was placed successfully" flow main activate inform processing time activate processing user request
> place the order # After about 2 seconds: This is taking a bit longer # After and additional 2 seconds: order was placed successfully