Page 1 of 1

Ask for a grammar

Posted: Fri Dec 24, 2021 10:30 am
by sdgmlj
I want to add a drag bar in the setting interface. How do I do it? Thank you
屏幕截图 2021-12-24 182749.jpg
屏幕截图 2021-12-24 182749.jpg (26.41 KiB) Viewed 3504 times

Re: Ask for a grammar

Posted: Fri Dec 24, 2021 10:05 pm
by NotRexButCaesar
sdgmlj wrote: Fri Dec 24, 2021 10:30 am How do I do it?
You can either click and drag the little notch indicator, or type in the number box:
2021-12-24 13-58-15.mp4
(4.88 MiB) Downloaded 247 times
Video

Re: Ask for a grammar

Posted: Sat Dec 25, 2021 6:50 am
by sdgmlj
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

Re: Ask for a grammar

Posted: Sat Dec 25, 2021 7:18 am
by NotRexButCaesar
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
Oh, I should have seen what forum it was in.
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

Re: Ask for a grammar

Posted: Sat Dec 25, 2021 9:09 am
by sdgmlj
Can it be implemented in "settings. Lua"?
I the following paragraph is invalid:

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"
   },

Re: Ask for a grammar

Posted: Sat Dec 25, 2021 9:19 am
by sdgmlj
NotRexButCaesar wrote: Sat Dec 25, 2021 7:18 am
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
Oh, I should have seen what forum it was in.
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
Can it be implemented in "settings. Lua"?
I the following paragraph is invalid:

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"
   },
   

Re: Ask for a grammar

Posted: Sat Dec 25, 2021 9:59 pm
by NotRexButCaesar
sdgmlj wrote: Sat Dec 25, 2021 9:19 am Can it be implemented in "settings. Lua"?
It 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

Re: Ask for a grammar

Posted: Sun Dec 26, 2021 4:00 am
by sdgmlj
NotRexButCaesar wrote: Sat Dec 25, 2021 9:59 pm
sdgmlj wrote: Sat Dec 25, 2021 9:19 am Can it be implemented in "settings. Lua"?
It 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
Thank you.

Re: Ask for a grammar

Posted: Sun Jan 16, 2022 8:10 am
by sdgmlj
NotRexButCaesar wrote: Sat Dec 25, 2021 9:59 pm
sdgmlj wrote: Sat Dec 25, 2021 9:19 am Can it be implemented in "settings. Lua"?
It 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:

What to add in "control. Lua" and what to add in "settings. Lua".

This may be troublesome. Sorry