• Hail, we're RedGuides. We want you to play six (yes, 6!) EverQuest characters at once. We have scripts and a friendly community to help, please join our playstyle and say hello! 👋
  • We've added LLM sections to our Terms & Rules and Resource Rules, for everyone's sanity & in-game safety.
    Read more
    a. Do not replace your voice with an LLM. This goes for your posts and your scripts. Drafting and editing with a tool is fine, but don't take you out of what you share.
    b. Do not replace your EQ character's voice with an LLM. We don't want scripts that speak over /ooc, /shout or other public channels. This has been an unwritten rule that's kept casino scripts off the site for decades, but we're now compelled to make it clear: keep automated communication private.

    Why Does RG Review Scripts?
    Nearly every LLM-written Lua script we see is making your character do impossible things, and rarely in a way that's beneficial to you. We've seen heavy server hammering, /target over impossible distances when /nav spawn would passively accomplish the same thing, a spawn search that fires 20+ times per second, and other pointless actions that are likely annoying GMs.

    You are welcome to use LLMs as a tool to structure, draft, and edit your work, but please read critically before hitting /lua run

Question - Managing Slider Settings using Lua

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
Checkbox
Lua:
if (mq.TLO.Window('OptionsWindow').Child('OGP_EnvSoundsCheckbox').Checked() ~= desired_value) then
    mq.TLO.Window('OptionsWindow').Child('OGP_EnvSoundsCheckbox').LeftMouseUp()
end
But for sliders, I'm stuck with
Slider Settings
Lua:
mq.cmdf('/notify OptionsWindow OGP_SoundVolumeSlider newvalue ' .. desired_value)

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:
lua slider statement
Lua:
mq.TLO.Window('OptionsWindow').Child('OGP_SoundVolumeSlider').?

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:
Control References
Lua:
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"
}
So, from there I can do iterate through the tables, grab type on the way ...
Get Windows Type
Lua:
local type = mq.TLO.Window(data[key].window).Child(data[key].child).Type()
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
member and methds used
Code:
-- 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())
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