Skip to content

Module: TimedActionUtils

albion edited this page Jun 6, 2025 · 2 revisions

Important

Documentation has moved to the docs. This wiki will no longer be updated, and may be deleted in the future.

local TimedActionUtils = require("Starlit/timedActions/TimedActionUtils")

Note: In Build 41 the TimedActionUtils module is located in Starlit/client/timedActions/TimedActionUtils.

The TimedActionUtils module provides utilities for creating and working with timed actions. Currently it focuses primarily on handling prerequisite timed actions (e.g. equip item used in next timed action).

Functions

TimedActionUtils.transfer(character: IsoGameCharacter, item: InventoryItem)

Queues an action to transfer an item into the character's main inventory. If the item is already in the character's inventory, this function does nothing.


TimedActionUtils.transferFirstType(character: IsoGameCharacter, type: string, predicate?: function)

Queues an action to transfer the first found item of a given type into the character's main inventory. This differs from doing this manually with transfer because the specific item is not actually determined until the action starts - this avoids issues where multiple queued timed actions all 'claim' the same item, but an earlier timed action destroys that item, despite the player still having enough valid items to finish the queue.

Predicate is an optional argument to select items. It uses the same signature as the ones used by the ItemContainer -Eval functions.


TimedActionUtils.transferAndEquip(character: IsoGameCharacter, item: InventoryItem, slot?: "primary"|"secondary")

Queues actions to transfer an item into the character's main inventory (if not already there) and equip it. Slot should be the string "primary" or "secondary". If no slot is passed primary will be assumed.


TimedActionUtils.transferAndEquipFirstEval(character: IsoGameCharacter, eval: function, slot?: "primary"|"secondary") -> equipped: boolean

Finds an item that passes the evaluator function (again using the same signature as ItemContainer -Eval functions), transfers that item and equips it. No actions will be queued if the currently equipped item passes the eval. See TimedActionUtils.transferAndEquip.

Returns true if actions were queued or the already equipped item is acceptable. Returns false if no matching item could be found.


TimedActionUtils.transferAndWear(character: IsoGameCharacter, item: InventoryItem)

Queues actions to transfer the item to the character's main inventory (if needed) and wear it. Does nothing if the item is already worn.


TimedActionUtils.transferAndWearFirstEval(character: IsoGameCharacter, eval: function) -> equipped: boolean

Finds the first item that passes the eval function, and queues actions to transfer it into the main inventory (if needed) and wear it (if needed).

Returns true if actions have been queued or a passing item is already worn. Returns false if no matching item could be found.

Clone this wiki locally