API:DyePreview
From RoR Wiki
UI Lua API · Dye functions
Version: WAR 1.4.8
Shows on the character how an equipped item would look with a dye from the player's inventory.
DyePreview(dyeLocation, dyeSlot, tintMask, targetLocation, targetSlot)
Arguments
- dyeLocation
number– Where the dye item is, as aGameData.ItemLocsvalue.- dyeSlot
number– Slot of the dye item, starting at 1.- tintMask
number– Which colour of the target to change: 1 = primary, 2 = secondary, 3 = both (GameData.TintMasksvalues; the stock UI passes the result of GetDyeTintMasks or the tint picked in its dye window).- targetLocation
number– Must beGameData.ItemLocs.EQUIPPED.- targetSlot
number– Equipment slot of the item to preview on.
Returns
Nothing.
Details
- Nothing happens unless:
targetLocationisEQUIPPEDandtintMaskis not 0;- the dye slot holds an item of type
GameData.ItemTypes.DYE.
- The target starts from its current dye colours. The colour(s) selected by
tintMaskare replaced by the dye's colour. Any othertintMaskvalue leaves the colours as they are. - A colour is only applied to a channel the item's model supports (see GetDyeTintMasks). Only armour slots take a preview.
- This is a preview in the client. It does not use up the dye. The stock UI calls RevertDyePreview before it sends the real use request with SendUseItem.
GameData.ItemLocs.BANKis not supported for the dye's location.- If there is no player object, nothing happens.
- The function needs at least five arguments and only reads the last five.
Errors
None besides the generic Invalid Parameters message when an argument is not a number.
Example
From default/ea_modifyitem/source/useitemtargeting.lua:
function UseItemTargeting.PreviewDye( tintMask )
...
local sourceSlot = UseItemTargeting.TargetData.SourceSlot
local sourceLoc = UseItemTargeting.TargetData.Source
local targetLoc = UseItemTargeting.TargetData.TargetLoc
local targetSlot = UseItemTargeting.TargetData.TargetSlot
DyePreview( sourceLoc, sourceSlot, tintMask, targetLoc, targetSlot )
end
