Skip to content

Get Sansar

Script API

SimpleScript.OnTimerOptionsAttribute

Where: Client
More page actions

For the complete documentation index, see llms.txt. This page is also available as Markdown.

Set options for OnTimer() overrides, or use to create more simple timers.

[System.AttributeUsage(System.AttributeTargets.Method, AllowMultiple=false)]
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)]
protected class SimpleScript.OnTimerOptionsAttribute : SimpleScript.SimpleScriptOptionsAttribute

Remarks

This attribute is optional when overriding OnTimer which by default will run once per second.

Add this attribute to any method that matches Action<> to create extra timers.

[OnTimerOptions(Rate=5)]
void TimerEvery5()
{
// run every 5 seconds
}
void OnTimer()
{
// run every 1 second
}

Example

// Run this timer every 5 seconds
[OnTimerOptions(Rate=5)]
protected override OnTimer()

Members at a glance

KindMembers
ConstructorsOnTimerOptionsAttribute
FieldsMinimumRate
PropertiesRate

Constructors

OnTimerOptionsAttribute

public SimpleScript.OnTimerOptionsAttribute()

Fields

MinimumRate

Deprecated
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] public readonly double MinimumRate

Minimum value for Rate is 0.025, which is 40 times per second.

Properties

Rate

Deprecated
[System.Obsolete("SimpleScript is deprecated and will not receive new features. Please use SceneObjectScript or ObjectScript.", false)] public double Rate { get; set; }

Set the rate in seconds between events.

Value: double — The value in seconds between OnTimer events.

Remarks

A Rate of 1 would call OnTimer once every second, 0.1 would call OnTimer 10 times every second, and 10 would call OnTimer once every 10 seconds.

Minimum value for Rate is 0.025, which is 40 times per second.

Example
// Set OnTimer to happen every 0.2 seconds.
[OnTimerOptions(Rate=0.2)]
protected override void OnTimer(Int64 frame)

Generated from the Sansar 47.10.0 client ScriptApi snapshot.