# Revscriptsys

### Script Structure

> **Constructor**:
>
> * *MoveEvent()*
>
> **Events**:
>
> * onEquip(player, item, slot)
> * onDeEquip(player, item, slot)
> * onStepIn(creature, item, position, fromPosition)
> * onStepOut(creature, item, position, fromPosition)
> * onAddItem(moveitem, tileitem, pos)
> * onRemoveItem(moveitem, tileitem, pos)
>
> Methods:
>
> * register(): Finalizes the definition of the move event and registers it.
> * type(eventType):
> * > **eventType**: Equivalent to the `event` tag in XML.
> * level(reqLevel):
> * > **reqLevel**: Equivalent to the `level` tag in XML.
> * magicLevel(reqMagLevel):
> * > **reqMagLevel**: Equivalent to the `maglevel` tag in XML.
> * aid(actionIds):
> * > **actionIds**: List of action ids, equivalent to the `aid` tag in XML, but with multiple AIDs in 1 method (if needed)
> * uid(uniqueIds):
> * > **uniqueIds**: List of unique ids, equivalent to the `uid` tag in XML, but with multiple UIDs in 1 method (if needed)
> * slot(slotType):
> * > **slotType**: Equivalent to the `slot` tag in XML.
>   >
>   > > CONST\_SLOT\_HEAD
>   > >
>   > > CONST\_SLOT\_NECKLACE
>   > >
>   > > CONST\_SLOT\_BACKPACK
>   > >
>   > > CONST\_SLOT\_ARMOR
>   > >
>   > > CONST\_SLOT\_RIGHT
>   > >
>   > > CONST\_SLOT\_LEFT
>   > >
>   > > CONST\_SLOT\_LEGS
>   > >
>   > > CONST\_SLOT\_FEET
>   > >
>   > > CONST\_SLOT\_AMMO
>   > >
>   > > CONST\_SLOT\_RING
> * vocation(vocName\[, showInDescription\[, lastVoc]])
> * > **vocName**: Vocation name, equivalent to the `vocation` tag in XML.
>   >
>   > **showInDescription** \[Optional]: Boolean value to determine if the vocation will show in the item description.
>   >
>   > > Default: false
>   >
>   > **lastVoc** \[Optional]: Boolean value to fix the vocation string with, should be true when adding the last vocation to the item.
>   >
>   > > Default: false
> * position(positions):
> * > **positions**: List of positions where the move event will be executed.
> * premium(reqPremium):
> * > **reqPremium**: Equivalent to the `premium` tag in XML.

### Examples

```lua
local moveEvent = MoveEvent()

moveEvent:type("equip")

function moveEvent.onEquip(player, item, slot)
    if player:getName() == "Delusion" then
        return true
    end
    return false
end

moveEvent:register()
```

```lua
local moveEvent = MoveEvent()

moveEvent:type("stepin")
moveEvent:aid(2001, 2002, 2003)

function moveEvent.onStepIn(creature, item, position, fromPosition)
    -- Push the creature back if they are not a player
    if not creature:isPlayer() then
        creature:teleportTo(fromPosition, true)
    end
end

moveEvent: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-movements/movement-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.
