# Revscriptsys

### Script Structure

> **Constructor**:
>
> * *GlobalEvent(eventName)*
> * > **eventName**: Equivalent to the `name` tag in XML.
>
> **Events**:
>
> * onStartup()
> * onShutdown()
> * onTime(time)
> * onThink(interval)
> * onRecord(current, old)
>
> **Methods**:
>
> * register(): Finalizes the definition of the global event and registers it.
> * type(eventType):
> * > **eventType**: Equivalent to the `type` tag in XML.
> * time(executionTime):
> * > **executionTime**: Equivalent to the `time` tag in XML.
> * interval(executionInterval):
> * > **executionInterval**: Equivalent to the `interval` tag in XML.

### Examples

```lua
local annoyPlayers = GlobalEvent("annoy players")
annoyPlayer:interval(100) -- executes onThink every 100 milliseconds

function annoyPlayers.onThink(interval)
    Game.broadcastMessage("...")    
    return true
end

annoyPlayers:register()
```

```lua
local recordEvent = GlobalEvent("new record")
recordEvent:type("record")

function recordEvent.onRecord(current, old)
    Game.broadcastMessage("New player record: " .. current)    
    return true
end

recordEvent:register()
```


---

# 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://stigmax.gitbook.io/tfs-guide/interface-globalevents/globalevent-revscripts.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.
