# Timer

### Timer Class

The Timer class is a static class that manages timer events for a script.

### Syntax

public static class **Timer**

### Member Details

#### Cancel Method

> Cancels a repeating timer.
>
> #### Syntax
>
> \[System.Obsolete("Named timers are deprecated. Use the IEventSubscription returned from Timer.Create to cancel a timer.", false)]\
> public static [void](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void) **Cancel** ([string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) name)
>
> **Parameters**
>
> > *name*
> >
> > Name of the timer to cancel.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a one time event.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDurationSeconds*
> >
> > The minimum duration to elapse before the event is generated in seconds.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a one time event.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDuration*
> >
> > The minimum duration to elapse before the event is generated.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a one time event.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDurationSeconds*
> >
> > The minimum duration to elapse before the event is generated in seconds.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
> >
> > *persistent*
> >
> > Set to true to continue generating events, false to stop after the first one
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a repeating event with an initial duration and a repeat duration.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDurationSeconds*
> >
> > The minimum duration to elapse before the event is generated in seconds.
> >
> > *repeatDurationSeconds*
> >
> > After the initial duration, events will be generated at this interval in seconds.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a one time event.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDuration*
> >
> > The minimum duration to elapse before the event is generated.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
> >
> > *persistent*
> >
> > Set to true to continue generating events, false to stop after the first one
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a repeating event with an initial duration and a repeat duration.
>
> #### Syntax
>
> **Parameters**
>
> > *initialDuration*
> >
> > The minimum duration to elapse before the event is generated.
> >
> > *repeatDuration*
> >
> > After the initial duration, events will be generated at this interval.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
>
> **Returns**
>
> > Documentation for this section has not yet been entered.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***

#### Create Method

> Generates a repeating event with an initial duration and a repeat duration. The event will continue as long as the script is active or until [Timer.Cancel(string)](https://help.sansar.com/hc/en-us/articles/115003551888#M:Sansar.Script.Timer.Cancel\(System.String\)) is called.
>
> #### Syntax
>
> \[System.Obsolete("Named timers are deprecated. Use the IEventSubscription returned from Timer.Create to cancel a timer.", false)]\
> public static [void](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void) **Create** ([TimeSpan](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.TimeSpan) initialDuration, [TimeSpan](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.TimeSpan) repeatDuration, [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) handler, [string](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String) name)
>
> **Parameters**
>
> > *initialDuration*
> >
> > The minimum duration to elapse before the event is generated.
> >
> > *repeatDuration*
> >
> > After the initial duration, events will be generated at this interval.
> >
> > *handler*
> >
> > The [Action](http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action) to be called when the time has elapsed.
> >
> > *name*
> >
> > A short string to identify this Timer.
>
> #### Remarks
>
> #### Requirements
>
> **Namespace:** Sansar.Script\
> **Assembly:** Sansar.Script (in Sansar.Script.dll)\
> **Assembly Versions:** 1.0.0.0
>
> ***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sansar.com/latest/script-api-docs/sansar-script-namespace/timer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
