Skip to content

Return of Reckoning

Wiki

RoR Wiki

API:ButtonSetTexture

From RoR Wiki

UI Lua API · Button functions
Version: WAR 1.4.8

Sets the texture a Button draws in one of its states.

ButtonSetTexture(buttonName, state, textureName, x, y)

Arguments

buttonName
string – Name of a Button window.
state
number – The button state, a Button.ButtonState value (see ButtonSetTextColor).
textureName
string – Name of the texture. "" removes the texture for that state.
x, y
number – Pixel position in the texture of the top-left corner of the area to show.

Returns

Nothing.

Details

  • The previous texture for that state is always removed first. If no texture is found under textureName, the state is left without a texture and no error is raised.
  • state is not range-checked. Use only the Button.ButtonState values.

Errors

  • Error in function call 'ButtonSetTexture': Window %s does not exist
  • Error in function call 'ButtonSetTexture': Window %s is not a Button

Example

Changing an ability button's highlight frame to match its shape, and clearing it, from ea_abilitieswindow/source/abilitieswindow.lua:

ButtonSetTexture (SystemData.ActiveWindow.name, Button.ButtonState.HIGHLIGHTED, "EA_SquareFrame_Highlight", 0, 0)
...
ButtonSetTexture (SystemData.ActiveWindow.name, Button.ButtonState.HIGHLIGHTED, "", 0, 0)

See also