Default values of mod settings not respected

This is for troubleshooting of problems with the FAF client and Forged Alliance game.

Moderator: PhilipJFry

Default values of mod settings not respected

Postby EntropyWins » 02 Oct 2016, 21:54

Final Rush Pro4 4v4 has this setting definition:

Code: Select all
   {
      default = 0,
      label = "Auto Reclaim",
      help = "AutoReclaim.",
      key = 'opt_AutoReclaim',
      pref = 'opt_AutoReclaim',
      values = {
         {text = "Disabled (Wreckages On)", help = "Off", key = 0, },
         {text = "Auto Reclaim 10 percent", help = "10 percent", key = 1, },
         {text = "Auto Reclaim 15 percent", help = "15 percent", key = 2, },
         {text = "Auto Reclaim 20 percent", help = "20 percent", key = 3, },
         {text = "Auto Reclaim 30 percent", help = "30 percent", key = 4, },
         {text = "Auto Reclaim 40 percent", help = "40 percent", key = 5, },
         {text = "Auto Reclaim 50 percent", help = "50 percent", key = 6, },
      },
   },


When I change
Code: Select all
default = 7,
(the index for 50 percent), the lobby shows the 50 percent in the options menu as expected. However, when the game is started, it is not getting key=6. It does when in the option menu I open the dropdown and select (the already selected) default value. That step defeats the purpose of having the default option of course.

Lobby version 3659, no idea how long this has been broken
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins

Re: Default values of mod settings not respected

Postby Uveso » 02 Oct 2016, 22:03

Default is the key value.
You don't have a "key = 7"

Your option number seven has the key 6.

So if you want the option "{text = "Auto Reclaim 50 percent", help = "50 percent", key = 6, }," because of key = 6, you must write:

default = 6,
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: Default values of mod settings not respected

Postby EntropyWins » 02 Oct 2016, 22:35

Hey Uveso, that's what I assumed when I first looked at this as well. However that is not how it appears to work. If I put the default to 6, I the lobby will show the 40% option. In neither case does the game actually pick up the intended value.

I just verified this again.
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins

Re: Default values of mod settings not respected

Postby Uveso » 03 Oct 2016, 10:00

Well, i tryed to debug the map, but it has to many errors for a short view. (tryed version 0007)

But now i know, the option array is merged into the normal option array, and the default value is the index of the value array.

So default = 7, is indeed for the last (50%) option line.

This need further investigation.
Can you please post a issue report on Github ?

Name it like "Default game options from Maps are not used ingame"
Write some lines about the problem and maybe set a link to this forum thread.

Link to Github:
https://github.com/FAForever/fa/issues
Klick on the button "New Issue"

I have already a clue what happens there. I guess we have fixed this in the next patch.
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: Default values of mod settings not respected

Postby KeyBlue » 04 Oct 2016, 13:31

when you use the default value, the lobby doesn't set the value ScenarioInfo.Options.opt_AutoReclaim, and it stays nil. (unless you manually chose the default option)
In the script this is usually fixed by using something like
Code: Select all
opt_AutoReclaim = ScenarioInfo.Options.opt_AutoReclaim or [default value]


So if you want to adjust the default value of an option, one has to go inside the script and change the default value used there.
So not broken, just stupid.
User avatar
KeyBlue
Priest
 
Posts: 403
Joined: 28 Jan 2016, 01:06
Has liked: 140 times
Been liked: 93 times
FAF User Name: KeyBlue

Re: Default values of mod settings not respected

Postby Uveso » 04 Oct 2016, 16:16

@KeyBlue:

and how you explain this:

EntropyWins wrote:If I put the default to 6, I the lobby will show the 40% option.


The default value works with number 6 but not with number 7.
User avatar
Uveso
Supreme Commander
 
Posts: 1788
Joined: 11 Dec 2015, 20:56
Location: Germany
Has liked: 70 times
Been liked: 291 times
FAF User Name: Uveso

Re: Default values of mod settings not respected

Postby KeyBlue » 04 Oct 2016, 17:39

Uveso wrote:@KeyBlue:

and how you explain this:

EntropyWins wrote:If I put the default to 6, I the lobby will show the 40% option.


The default value works with number 6 but not with number 7.


You explained this already, no?
The default is matched with the index, so default = 6 for 40% and default = 7 for 50% (this works according to his posts)

Reading the entire thread again:
In both cases (6 and 7) he encountered the problem i explained.
In both cases the lobby showed the correct default option. (resp. 40% and 50%)

So default doesn't work with neither 6 and 7.
User avatar
KeyBlue
Priest
 
Posts: 403
Joined: 28 Jan 2016, 01:06
Has liked: 140 times
Been liked: 93 times
FAF User Name: KeyBlue

Re: Default values of mod settings not respected

Postby EntropyWins » 07 Oct 2016, 20:43

Uveso wrote:I have already a clue what happens there. I guess we have fixed this in the next patch.


Great, let's hope that is the case. Any idea when it will be rolled out?

@KeyBlue: the workaround you describe could work yes, though I really rather avoid it.

Uveso wrote:Well, i tryed to debug the map, but it has to many errors for a short view. (tryed version 0007)


Yeah I know... the reason I noticed the issue reported here is because I'm working on a new version of the map that is not as broken: https://github.com/JeroenDeDauw/FinalRushPro5
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins

Re: Default values of mod settings not respected

Postby KeyBlue » 07 Oct 2016, 22:30

EntropyWins wrote:@KeyBlue: the workaround you describe could work yes, though I really rather avoid it.


Do you mean the little code snippet I posted?
Code: Select all
opt_AutoReclaim = ScenarioInfo.Options.opt_AutoReclaim or [default value]


The original map that you linked uses the same workaround though.
See here: https://github.com/JeroenDeDauw/FinalRu ... pt.lua#L92
all those if's do the same thing as i described.
User avatar
KeyBlue
Priest
 
Posts: 403
Joined: 28 Jan 2016, 01:06
Has liked: 140 times
Been liked: 93 times
FAF User Name: KeyBlue

Re: Default values of mod settings not respected

Postby EntropyWins » 12 Oct 2016, 10:50

Yes. I've done that now. Reason for avoiding: the information is duplicated in two places. One of which can't easily be modified by whoever is hosting the game without risking desync, unlike modifying the options file, which is fine. Both are not deal breakers, just not nice...
EntropyWins
Avatar-of-War
 
Posts: 113
Joined: 02 Oct 2016, 20:26
Has liked: 18 times
Been liked: 4 times
FAF User Name: EntropyWins


Return to Tech Support

Who is online

Users browsing this forum: No registered users and 1 guest