Core.AddVariableTimedFunction
Adds the name of a Variable Timed Function Method to the SILVIA Core timers and sets a minimum and a maximum delay time in seconds to wait before executing said Method, also provides for recurring execution of the Method.
Description
If a Timed Function has been scheduled with the SILVIA Core, you can cancel it at any point by using RemoveTimedFunctionCS or RemoveTimedFunctionsByIDs.
Example Usage (C#)
//An internal Post-Behavior Script, for instance.
//Note the use of "_core" for internal scripting.
//Suppose you want to bring a User back to a conversation prompt variably.
public bool Invoke() {
_core.AddVariableTimedFunction("ConversationalRedirect", 5.0, 10.0, false);
return true;
}
//Below is the method we named above, which will execute after the delay public bool ConversationRedirect( int id ) {
_core.ApiBrain().SetJump("conversational", "new_topic", 1.0f); return true;
}
//Note there must be an input ( int id ) so that the SILVIA Core can
//schedule the function and track it. It also must return a bool true to work.
Parameters
string |
methodName |
The name of the Method in SILVIA’s internal scripts to call after the given delay time. |
double |
minimumTime |
The minimum delay time in seconds, as a double. |
double |
delayTime |
The delay time in seconds, as a double. |
bool |
recurring |
The boolean flag whether to repeat the execution of the named Method. The delay time serves as a repeat interval if true. |
See Also
- Core.RemoveTimedFunctionCS
- ApiBrain().SetJump
- ApiBrain().SetBypassResponse