Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:DestroyItem

From RoR Wiki

UI Lua API · Game functions
Version: WAR 1.4.8

Asks the server to destroy the item in a given location and slot.

DestroyItem(location, slot)

Arguments

location
number – Where the item is, as a GameData.ItemLocs value (the stock UI passes Cursor.Data.Source).
slot
number – Slot of the item within that location.

Returns

Nothing.

Details

  • There is no confirmation step in the client. The stock UI shows a Yes/No dialog first and only calls DestroyItem when the player confirms.
  • The request is only sent for the item locations the client handles here. For any other location the call does nothing.
  • Whether the item is actually destroyed is decided by the server; the inventory updates when the server replies.
  • The function needs at least two arguments and only reads the last two.

Errors

None besides the Invalid Parameters argument check.

Example

From ea_cursor/source/cursor.lua (Cursor.DoDestroyItem, the dialog's Yes callback):

if( Cursor.Data.Source == Cursor.SOURCE_EQUIPMENT or
    Cursor.Data.Source == Cursor.SOURCE_BANK or
    Cursor.Data.Source == Cursor.SOURCE_INVENTORY or
    ... ) then
    DestroyItem( Cursor.Data.Source, Cursor.Data.SourceSlot )
    Cursor.Clear()
end

See also