Currently, the getVariable command wont work as expected on locations with its alternative syntax (without a default value --> only string, it will work as expected)
Description
Details
- Legacy ID
- 603081175
- Severity
- None
- Resolution
- No Bug
- Reproducibility
- Always
- Category
- Scripting
Execute following code somewhere in your environment
GVAR_GVARS_missionContext = createLocation ["NameVillage", [0, 0, 0], 0, 0];
GVAR_GVARS_missionContext getVariable [ "MissionReady" , false ]
Event Timeline
Can confirm this issue. RPT says:
11:46:45 Error in expression <LOC getVariable ["Test", 2]>
11:46:45 Error position: <getVariable ["Test", 2]>
11:46:46 Error Generic error in expression
for me.
Wiki claims that the alternative syntax is supposed to work with locations:
Syntax:
varspace getVariable [name, defaultValue]
Parameters:
varspace: [Namespace]], Object, Display, Control, Group, Location, Task or Team Member
This is not a bug but rather a copy paste mistake on wiki. You can always check supported syntax either using in game help F1 or by looking it up with supportInfo command.
tbh this is the biggest BS i have ever had to read
the alternative syntax adds a default value thus it is not a C&P mistake on the wiki but more that somebody at BI forgot to C&P the default part for locations
i cannot see a valid reason why locations should not have default values in getVariable
TASK and LOCATION both support only STRING argument:
"b:TASK getvariable STRING"
"b:LOCATION getvariable STRING"
This is why both throw error when ARRAY is passed. Both variants are also pretty old and alt syntax was simply never implemented. I resolved this ticket because according to its content, this is not a bug. But feel free to make a feature request to extend functionality.