Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ColorPickerGetColorById

From RoR Wiki

UI Lua API · ColorPicker functions
Version: WAR 1.4.8

Looks up a colour swatch of a ColorPicker by its id.

r, g, b, id, x, y = ColorPickerGetColorById(colorPickerName, id)

Arguments

colorPickerName
string – Name of the ColorPicker.
id
number – The id given when the colour was added (converted to a whole number).

Returns

r, g, b
number – Colour components, 0–255.
id
number – The id (the same value you passed).
x, y
number – The swatch's position in the picker, in unscaled pixels.

Details

  • If several swatches share the id, the first one added is returned.
  • If no swatch has the id, the function returns no values.

Errors

The error messages name the wrong function:

  • Error in function call 'ColorPickerGetCoordinatesForColor': Window %s does not exist
  • Error in function call 'ColorPickerGetCoordinatesForColor': Window %s is not a ColorPicker

Example

From default/ea_characterwindow/source/characterwindowdyes.lua:

local _, _, _, _, bleachX, bleachY = ColorPickerGetColorById( "DyeMerchantColorPicker", bleachId )
local x, y = WindowGetOffsetFromParent( "DyeMerchantColorPicker" )
WindowSetOffsetFromParent("DyeMerchantBleachSwatch", bleachX + x - 3, bleachY + y - 3)

See also