API:SliderBarSetCurrentPosition
From RoR Wiki
UI Lua API · SliderBar functions
Version: WAR 1.4.8
Moves a SliderBar to a position.
SliderBarSetCurrentPosition(sliderBarName, position)
Arguments
- sliderBarName
string– Name of the SliderBar.- position
number– New position, from 0 (start) to 1 (end).
Returns
Nothing.
Details
- Values below 0 become 0 and values above 1 become 1.
- The call is ignored while the SliderBar is disabled (see SliderBarSetDisabledFlag). Enable it first if you need to move it.
- The SliderBar's
OnSlidehandler is not run by this function. It runs only when the user moves the slider. - The function needs at least two arguments and only reads the last two. Any extra arguments placed in front of them are ignored.
Errors
Error in function call 'SliderBarSetCurrentPosition': Window %s does not exist.Error in function call 'SliderBarSetCurrentPosition': Window %s is not a SliderBar.
Example
Setting colour sliders from a 0–255 colour, from default/ea_chatwindow/source/chatoptionswindow.lua:
local colorRatio = color.r / 255
SliderBarSetCurrentPosition("ChatOptionsWindowCustomColorRedSlider", colorRatio )
colorRatio = color.g / 255
SliderBarSetCurrentPosition("ChatOptionsWindowCustomColorGreenSlider", colorRatio )
