Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBA_Settings_fnc_parse fails to parse strings over multiple lines #1573

Closed
johnb432 opened this issue Mar 12, 2023 · 6 comments
Closed

CBA_Settings_fnc_parse fails to parse strings over multiple lines #1573

johnb432 opened this issue Mar 12, 2023 · 6 comments
Labels
Milestone

Comments

@johnb432
Copy link
Contributor

Mods (complete and add to the following information):

  • Arma 3: 2.12 profiling branch
  • CBA: 3.15.8 steam release

Description:
If you use a cba_settings.sqf file with a setting value of a string spread over multiple lines, it will not parse the setting correctly.

Steps to reproduce:

  • Make a mission.
  • Make a cba_settings.sqf file within the mission folder.
  • Paste this within the cba_settings.sqf file:
force tsp_cba_breach_military = "[
""Land_Budova4_in"",
""Land_Budova4""
]";
  • Run this in the debug console (It's the first lines of CBA_Settings_fnc_parse):
_info = preprocessFile "cba_settings.sqf";

// remove whitespace at start and end of each line 
private _result = []; 
 
{ 
    _result pushBack (_x call CBA_fnc_trim); 
} forEach (_info splitString toString[10]); 
 
{ 
    if (_x select [count _x - 1] != ";") then { 
        _result set [_forEachIndex, _x + ";"]; 
    }; 
} forEach _result; 
 
_info = (_result joinString toString[10]) + toString[10];

_info

Result:

"force tsp_cba_breach_military = ""[;
""""Land_Budova4_in"""",;
""""Land_Budova4"""";
]"";
"

This leads to CBA_settings_fnc_parse to fail parsing this setting.

Expected behavior:
Result should be:

"force tsp_cba_breach_military = ""[""""Land_Budova4_in"""",""""Land_Budova4""""]"";

Where did the issue occur?

  • Dedicated / Self-Hosted Multiplayer (Error spam was first detected on dedicated, replicated issue in self-hosted multiplayer)

Log Files:

  • I don't have a good RPT file to send and since I have found the source of the issue I figure it's not necessary. However, if needed, I can make one.

Additional context:
The solutions I can come up with:

  • When exporting from the CBA settings tab, make settings with default settings of this type not export with newlines.
  • Modifying CBA_Settings_fnc_parse.

Screenshots:
I can add some if necessary.

@johnb432 johnb432 added the Bug label Mar 12, 2023
@commy2
Copy link
Contributor

commy2 commented Mar 12, 2023

Why do you think it ougth to in the first place?

force tsp_cba_breach_military = ""[;
""""Land_Budova4_in"""",;
""""Land_Budova4"""";
]"";

This syntax seems wrong. What are those semi-colons doing in there?

@johnb432
Copy link
Contributor Author

johnb432 commented Mar 12, 2023

Why do you think it ougth to in the first place?

force tsp_cba_breach_military = ""[;
""""Land_Budova4_in"""",;
""""Land_Budova4"""";
]"";

This syntax seems wrong. What are those semi-colons doing in there?

I'm not sure where you got your syntax, but that's not the syntax I wrote. This is what I posted earlier:

force tsp_cba_breach_military = "[
""Land_Budova4_in"",
""Land_Budova4""
]";

There are no semicolons in between, there is only one at the end.

The following code is only a partial result within CBA_Settings_fnc_parse:

"force tsp_cba_breach_military = ""[;
""""Land_Budova4_in"""",;
""""Land_Budova4"""";
]"";
"

However, this partial result shows why the parsing of that setting fails: It think it's multiple settings, despite it only being one.

@commy2
Copy link
Contributor

commy2 commented Mar 12, 2023

Ok. It doesn't support multiline and was never intended to.

@johnb432
Copy link
Contributor Author

Ok. It doesn't support multiline and was never intended to.

Thanks for the answer.

Can this information be mentioned on the wiki page?

@commy2
Copy link
Contributor

commy2 commented Mar 13, 2023

I can't edit the page, unfortunately.

@veteran29
Copy link
Member

Added info to the Wiki:
https://github.com/CBATeam/CBA_A3/wiki/CBA-Settings-System#userconfig-limitations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants