How do mod options work?
Moderator: Moderators
How do mod options work?
The SVN TASClient has a mod options tab in the battle screen, how can a mod use those?
Okay, figured it out with a LOT of help. To spare others the experience:
1. The Lobby-side definition is done with a file called ModOptions.lua in the mod's root dir. Specs for the content are here
2. The mod-side handling is done with Spring.GetModOptions(), it returns a table with string keys and values. Note that bools are expressed as "0" and "1".
1. The Lobby-side definition is done with a file called ModOptions.lua in the mod's root dir. Specs for the content are here
2. The mod-side handling is done with Spring.GetModOptions(), it returns a table with string keys and values. Note that bools are expressed as "0" and "1".
I'd need an account for that...Pxtl wrote:Wow, that's really cool. If only the Spring website had some sort of user-editable pages that we could use to keep track of this information, that modders, developers, and players could keep up-to-date with recent developments in the Spring engine.
/sarcasm.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
That would be wonderful, if you could explain generically so that people other than myself could benefit as well.KDR_11k wrote:...the only step further I can imagine is telling you exactly how to implement your mod options.
I have messed around with it some, but from what I've seen I haven't really affected anything.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43
OK I apologize, cause I need to be mroe clear with what I'm saying.
There are all these lists, which seem to have mix and match values. If each list was set up the same then it would make mroe sense...
for example:
{
key = 'deployment',
name = 'Deployment Mode',
desc = 'Players deploy a limited number of units before the game starts',
type = 'bool',
def = false,
},
{
key = 'ai_bonus',
name = 'AI Bonus',
desc = 'Higher numbers mean that the AI gets more resources, health, etc...',
type = 'number',
def = 1.25,
min = 0.25,
max = 10,
step = 0.05, -- quantization is aligned to the def value
-- (step <= 0) means that there is no quantization
},
{
key = 'string_opt',
name = 'String Option',
desc = 'an unused string option',
type = 'string',
def = 'BiteMe',
maxlen = 12,
},
None of these really seem to share much in common.
There are all these lists, which seem to have mix and match values. If each list was set up the same then it would make mroe sense...
for example:
{
key = 'deployment',
name = 'Deployment Mode',
desc = 'Players deploy a limited number of units before the game starts',
type = 'bool',
def = false,
},
{
key = 'ai_bonus',
name = 'AI Bonus',
desc = 'Higher numbers mean that the AI gets more resources, health, etc...',
type = 'number',
def = 1.25,
min = 0.25,
max = 10,
step = 0.05, -- quantization is aligned to the def value
-- (step <= 0) means that there is no quantization
},
{
key = 'string_opt',
name = 'String Option',
desc = 'an unused string option',
type = 'string',
def = 'BiteMe',
maxlen = 12,
},
None of these really seem to share much in common.
- Forboding Angel
- Evolution RTS Developer
- Posts: 14673
- Joined: 17 Nov 2005, 02:43