Ask for a grammar
Posted: Fri Dec 24, 2021 10:30 am
I want to add a drag bar in the setting interface. How do I do it? Thank you
You can either click and drag the little notch indicator, or type in the number box:
Oh, I should have seen what forum it was in.sdgmlj wrote: Sat Dec 25, 2021 6:50 am Thank you. I think you understand it wrong. I mean: I want to implement this drag bar in my own mod. How to add it grammatically
Maybe I didn't express it clearly enough. Thank you
Code: Select all
/c
local player = game.player
player.gui.center.clear()
local frame = player.gui.center.add
{
type = 'frame'
}
local slider = frame.add
{
type = 'slider',
style = 'notched_slider',
minimum_value = 1,
maximum_value = 10,
value = 1,
value_step = 1,
discrete_slider = true,
discrete_values = true,
name = 'testslider',
}
slider.style.width = 200
Code: Select all
{
type = "int-setting",
name = "setting6",
setting_type = "startup",
default_value = 7,
minimum_value = 3,
maximum_value = 32,
discrete_slider = true,
discrete_values = true,
value_step = 1,
order = "2-4"
},
Can it be implemented in "settings. Lua"?NotRexButCaesar wrote: Sat Dec 25, 2021 7:18 amOh, I should have seen what forum it was in.sdgmlj wrote: Sat Dec 25, 2021 6:50 am Thank you. I think you understand it wrong. I mean: I want to implement this drag bar in my own mod. How to add it grammatically
Maybe I didn't express it clearly enough. Thank you
I am not sure what you mean by 'grammatically'.
Here is an example of a script that will create one:Code: Select all
/c local player = game.player player.gui.center.clear() local frame = player.gui.center.add { type = 'frame' } local slider = frame.add { type = 'slider', style = 'notched_slider', minimum_value = 1, maximum_value = 10, value = 1, value_step = 1, discrete_slider = true, discrete_values = true, name = 'testslider', } slider.style.width = 200
Code: Select all
{
type = "int-setting",
name = "setting6",
setting_type = "startup",
default_value = 7,
minimum_value = 3,
maximum_value = 32,
discrete_slider = true,
discrete_values = true,
value_step = 1,
order = "2-4"
},
It should be in control.lua
Thank you.NotRexButCaesar wrote: Sat Dec 25, 2021 9:59 pmIt should be in control.lua
Here is an example of a mod using notched sliders:
https://github.com/raiguard/Factorio-Qu ... st.lua#L95
That file is required in control.lua:
https://github.com/raiguard/Factorio-Qu ... ol.lua#L14
I still want to ask you for help. I'm stupid. I studied the content you provided for a long time, but finally failed. I just want to know the following:NotRexButCaesar wrote: Sat Dec 25, 2021 9:59 pmIt should be in control.lua
Here is an example of a mod using notched sliders:
https://github.com/raiguard/Factorio-Qu ... st.lua#L95
That file is required in control.lua:
https://github.com/raiguard/Factorio-Qu ... ol.lua#L14