Revscriptsys

Script Structure

Constructor:

  • Action()

Event:

  • onUse(player, item, fromPosition, target, toPosition, isHotkey)

Methods:

  • register(): Finalizes the definition of the action and registers it.

  • id(itemId[, itemIds...]):

  • itemId [Required]: Item id to register the event to.

    itemIds [Optional]: All extra item ids to register.

  • aid(actionId[, actionIds]): Follows the same behavior as the id(itemId[, itemIds...]) method.

  • uid(uniqueId[, uniqueIds]): Follows the same behavior as the id(itemId[, itemIds...]) method.

  • allowFarUse(bool):

  • bool: Accepts true/false values, same behavior as allowfaruse in XML.

  • blockWalls(bool):

  • bool: Accepts true/false values, same behavior as blockwalls in XML.

  • checkFloor(bool):

  • bool: Accepts true/false values, same behavior as checkfloor in XML.

Example

-- data/scripts/change_gold.lua
local action = Action()

action:id(2148)

function action.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getName() == "Delusion" then
        item:transform(2160)
        return true
    end
    return false
end

action:register()

Last updated