• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Question - Managing Slider Settings using Lua

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
 
Last edited:
There may be a property on OGP_SoundVolumeSlider with the value but I can't see it.
However, if you look at the Text property of OGP_SoundVolumeValueLabel, it has the value (with the percent sign).

This might be what you are after...

mq.TLO.Window('OptionsWindow').Child('OGP_SoundVolumeValueLabel').Text

Don't forget the Window Inspector is you best friend with stuff like this. :)
 
There may be a property on OGP_SoundVolumeSlider with the value but I can't see it.
However, if you look at the Text property of OGP_SoundVolumeValueLabel, it has the value (with the percent sign).

This might be what you are after...

mq.TLO.Window('OptionsWindow').Child('OGP_SoundVolumeValueLabel').Text

Don't forget the Window Inspector is you best friend with stuff like this. :)
Hi Redmud,
Yes, I'd seen the label, but it'd be my last choice.
For checkboxes and comboboxes I can iterate through using the value grabbed from the actual control.
My data structures look like this currently:
[CODE lang="Lua" title="Control References"]settings = {}
data = {}

settings.PCNamesCheckBox = {
foreground = false,
background = true
}
settings.LoadScreenCombobox = {
foreground = 1,
background = 1
}
settings.ClipPlaneSlider = {
foreground = 2,
background = 0
}

data.PCNamesCheckBox = {
window = "OptionsWindow",
child = "ODP_PCNamesCheckBox"
}
data.LoadScreenCombobox = {
window = "OptionsWindow",
child = "ODP_LoadScreenCombobox"
}
data.ClipPlaneSlider = {
window = "OptionsWindow",
child = "ODP_ClipPlaneSlider"
}[/CODE]
So, from there I can do iterate through the tables, grab type on the way ...
[CODE lang="Lua" title="Get Windows Type"]local type = mq.TLO.Window(data[key].window).Child(data[key].child).Type()[/CODE]
And then test value and apply settings as appropriate.
If I add a different field to test for some of my items, I'll have to redesign my entire data strategy.
As mentioned above:
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.
If I have to go down that path I will, but for me its the worst, worst option currently.

I am using the window inspector, and also the nifty Lua eval that aquietone published.
 
when you set the value you'd use 'newvalue #" so perhaps the .Value is what you're after.

Example:
/notify SpellParticlesPage ODP_SpellParticlesOpacitySlider newvalue 0

perhaps ${Window[SpellParticlesPage].Child[ODP_SpellParticlesOpacitySlider].Value} would get that value, and if it's not what you want you can use the notify to set it.
I use this to set values on multiple clients at the same time without needing to set it on each one manually.

Not in game to check, but figured it was worth trying if you're interested in looking into it more (obv translate into Lua)


PS. Yes I did that on purpose, Language Unknown Alright?
 
Last edited:
when you set the value you'd use 'newvalue #" so perhaps the .Value is what you're after.

Example:
/notify SpellParticlesPage ODP_SpellParticlesOpacitySlider newvalue 0

perhaps ${Window[SpellParticlesPage].Child[ODP_SpellParticlesOpacitySlider].Value} would get that value, and if it's not what you want you can use the notify to set it.
I use this to set values on multiple clients at the same time without needing to set it on each one manually.

Not in game to check, but figured it was worth trying if you're interested in looking into it more (obv translate into L.U.A.)


PS. Yes I did that on purpose, Language Unknown Alright?
Value didn't do the trick.
It's late here but I'll try again tomorrow.

Next step is to literally try every member and method in the window datatype. I suspect it's not exposed, but this will confirm.
 
when you set the value you'd use 'newvalue #" so perhaps the .Value is what you're after.

Example:
/notify SpellParticlesPage ODP_SpellParticlesOpacitySlider newvalue 0

perhaps ${Window[SpellParticlesPage].Child[ODP_SpellParticlesOpacitySlider].Value} would get that value, and if it's not what you want you can use the notify to set it.
I use this to set values on multiple clients at the same time without needing to set it on each one manually.

Not in game to check, but figured it was worth trying if you're interested in looking into it more (obv translate into L.U.A.)


PS. Yes I did that on purpose, Language Unknown Alright?
Grabbed the output from the following members and methods, none returned a value which represented the slider setting
[CODE title="member and methds used"]-- members and methods used
Child
VScrollMax
VScrollPos
VScrollPct
HScrollMax
HScrollPos
HScrollPct
Children
Siblings
Parent
FirstChild
Next
Minimized
X
Y
Height
Width
MouseOver
BGColor
Text
Tooltip
List
Checked
Style
Enabled
Highlighted
Name
ScreenID
Type
Items
HisTradeReady
MyTradeReady
GetCurSel
Size
Value

-- in the following format
print(mq.TLO.Window('OptionsWindow').Child('ODP_ClipPlaneSlider').Value())[/CODE]
I'll publish a beta of what I have so far, maybe someone will see the whole code and be able to see a simple way through that I'm missing.
 
@brainiac is there a way to get the value from a slider. you can set one with notify but either the .Value is what we want and is currently not functional, or the choice may not be exposed to get the value perhaps? It seems reasonable to want to be able to get the value.
 
Question - Managing Slider Settings using Lua

Users who are viewing this thread

Back
Top
Cart