Ask for a grammar

Place to get help with not working mods / modding interface.
sdgmlj
Fast Inserter
Fast Inserter
Posts: 154
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Ask for a grammar

Post 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 3124 times
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: Ask for a grammar

Post 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 209 times
Video
Last edited by NotRexButCaesar on Sat Dec 25, 2021 7:21 am, edited 1 time in total.
—Crevez, chiens, si vous n'étes pas contents!
sdgmlj
Fast Inserter
Fast Inserter
Posts: 154
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: Ask for a grammar

Post 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
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: Ask for a grammar

Post 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
—Crevez, chiens, si vous n'étes pas contents!
sdgmlj
Fast Inserter
Fast Inserter
Posts: 154
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: Ask for a grammar

Post 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"
   },
sdgmlj
Fast Inserter
Fast Inserter
Posts: 154
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: Ask for a grammar

Post 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"
   },
   
User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1133
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: Ask for a grammar

Post 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
—Crevez, chiens, si vous n'étes pas contents!
sdgmlj
Fast Inserter
Fast Inserter
Posts: 154
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: Ask for a grammar

Post 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.
sdgmlj
Fast Inserter
Fast Inserter
Posts: 154
Joined: Sun Jul 04, 2021 11:12 pm
Contact:

Re: Ask for a grammar

Post 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
Post Reply

Return to “Modding help”