Description:
interact_menu sets this global variable:
https://github.com/acemod/ACE3/blob/b778df2c3bb48b058046c0107fdc902eaa09d56a/addons/interact_menu/functions/fnc_keyUp.sqf#L28
https://github.com/acemod/ACE3/blob/b778df2c3bb48b058046c0107fdc902eaa09d56a/addons/interact_menu/functions/fnc_render.sqf#L94
Expected behavior:
A global variable should NOT be set called this, it should be named in some manner so as to not easily conflict with other uses. If you are trying to hack the use of this in a subsequent call you should find a better way, this is not reliable in any case.
Agreed.
The problem is taking something like
statement = "([this, 1, 1] call BIS_fnc_Door)";
and converting any use of this to a neutral gvar isn't easy in sqf
Can't you just unset the magic variable after the statement if you want to keep bwc?
And also backup the previous value before setting it?
Is this code guaranteed to run atomically (I might hope ui event handlers do but I have no idea)? If so then yeah definitely store previous this value and restore it afterwards.
Is this code guaranteed to run atomically
Pretty much all of ACE is, because the scheduler is cancer.
and converting any use of this to a neutral gvar isn't easy in sqf
stringReplace command useful here?
No, that is more complicated than a temporary variable holding this.
Parsing something like this would be awful:
Statement = "hint 'this is the way!'; [this] call fnc_empathise";
probably just save and restore the var
same issue here: https://github.com/acemod/ACE3/blob/master/addons/repair/functions/fnc_normalizeHitPoints.sqf#L50
// Define global variables
Total = damage _vehicle;