> For the complete documentation index, see [llms.txt](https://stigmax.gitbook.io/tfs-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://stigmax.gitbook.io/tfs-guide/interface-movements/movement-revscripts.md).

# 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()
```
