Core.AddTimedFunctionCS
Adds the name of a Timed Function Method to the SILVIA Core timers and sets a 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 someone had 5 seconds to answer a question, and then time's up.
public bool Invoke() {
_core.AddTimedFunctionCS("JeopardyTimeLimit", 5.0, false); return true;
}
//Below is the method we named above, which will execute after the delay public bool JeopardyTimeLimit( int id ) {
_core.ApiBrain().SetJump("jeopardy", "buzzed_in_times_up", 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 |
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. |
Returns
The int id of the scheduled Timed Function in SILVIA Core Variable, if it has been executed.
See Also
- Core.RemoveTimedFunctionCS
- ApiBrain().SetJump
- ApiBrain().SetBypassResponse