- Joined
- May 31, 2022
- RedCents
- 4,210¢
I'm looking for a way to Lua natively get and set slider values.
I see question has been approached previously: here, and here.
And there's relevent documentation for window and notify.
I even checked the source: https://github.com/macroquest/macroquest/blob/master/src/main/datatypes/MQ2WindowType.cpp
I would like to be able to grab the slider value directly as this would allow me much greater flexibility.
I may be able to get an interpreted value from the associated label but that would require significant work; changes to data structure; additional data gathering, and the label value may go from 0 to 100, but the slider from 0 to 19, or 0 to 149.
Currently I'm simply stamping the value like using a template regardless of whether or not it already has the correct value.
For checkboxes, I' m able to use
[CODE lang="Lua" title="Checkbox"]if (mq.TLO.Window('OptionsWindow').Child('OGP_EnvSoundsCheckbox').Checked() ~= desired_value) then
mq.TLO.Window('OptionsWindow').Child('OGP_EnvSoundsCheckbox').LeftMouseUp()
end[/CODE]
But for sliders, I'm stuck with
[CODE lang="Lua" title="Slider Settings"]mq.cmdf('/notify OptionsWindow OGP_SoundVolumeSlider newvalue ' .. desired_value)[/CODE]
I'm after the Lua function for applying the setting as well as the member which returns the value. I've tried about every possible member combination in the suffix of this statement to no avail:
[CODE lang="Lua" title="Lua slider statement"]mq.TLO.Window('OptionsWindow').Child('OGP_SoundVolumeSlider').?[/CODE]
Any help appreciated
I see question has been approached previously: here, and here.
And there's relevent documentation for window and notify.
I even checked the source: https://github.com/macroquest/macroquest/blob/master/src/main/datatypes/MQ2WindowType.cpp
I would like to be able to grab the slider value directly as this would allow me much greater flexibility.
I may be able to get an interpreted value from the associated label but that would require significant work; changes to data structure; additional data gathering, and the label value may go from 0 to 100, but the slider from 0 to 19, or 0 to 149.
Currently I'm simply stamping the value like using a template regardless of whether or not it already has the correct value.
For checkboxes, I' m able to use
[CODE lang="Lua" title="Checkbox"]if (mq.TLO.Window('OptionsWindow').Child('OGP_EnvSoundsCheckbox').Checked() ~= desired_value) then
mq.TLO.Window('OptionsWindow').Child('OGP_EnvSoundsCheckbox').LeftMouseUp()
end[/CODE]
But for sliders, I'm stuck with
[CODE lang="Lua" title="Slider Settings"]mq.cmdf('/notify OptionsWindow OGP_SoundVolumeSlider newvalue ' .. desired_value)[/CODE]
I'm after the Lua function for applying the setting as well as the member which returns the value. I've tried about every possible member combination in the suffix of this statement to no avail:
[CODE lang="Lua" title="Lua slider statement"]mq.TLO.Window('OptionsWindow').Child('OGP_SoundVolumeSlider').?[/CODE]
Any help appreciated
Last edited:


