Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:DyeMerchantPreview

From RoR Wiki

UI Lua API · Dye functions
Version: WAR 1.4.8

Shows on the character how one equipped item would look with dye merchant colours.

DyeMerchantPreview(location, slot, primaryColor, secondaryColor)

Arguments

location
number – Must be GameData.ItemLocs.EQUIPPED.
slot
number – Equipment slot of the item.
primaryColor
number – Palette index for the primary colour (paletteIndex from GetDyeMerchantData), or a negative number to keep the item's current primary dye.
secondaryColor
number – Palette index for the secondary colour, or a negative number to keep the current secondary dye.

Returns

Nothing.

Details

  • Nothing happens unless location is EQUIPPED, the slot holds an item, and the item has the GameData.Item.EITEMFLAG_DYE_ABLE flag.
  • A colour is only applied to a channel the item's model supports (see GetDyeTintMasks), and a colour of 0 is not applied. Only armour slots take a preview.
  • The colour values are rounded toward zero.
  • This is a preview in the client. Buying the dyes is a separate step. Use RevertDyePreview or RevertAllDyePreview to undo it.
  • If there is no player object, nothing happens.
  • The function needs at least four arguments and only reads the last four.

Errors

None besides the generic Invalid Parameters message when an argument is not a number.

Example

From default/ea_characterwindow/source/characterwindowdyes.lua:

function CharacterWindow.PreviewDyes()

    if( CharacterWindow.dyeAll )
    then
        DyeMerchantPreviewAll( CharacterWindow.primaryColor, CharacterWindow.secondaryColor )
    elseif( CharacterWindow.selectedDyeSlotName )
    then
        DyeMerchantPreview( GameData.ItemLocs.EQUIPPED, WindowGetId( CharacterWindow.selectedDyeSlotName ), CharacterWindow.primaryColor, CharacterWindow.secondaryColor )
    end

The stock UI starts with both colours at -1 (keep current) when the dye merchant opens.

See also