Adding "unscheduled" as a flag causes a 'call' to return <null> or Any on any code block defined within a key.
Description
Details
- Severity
- Major
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 11 x64
- Category
- Scripting
Control Test - run within both scheduled and unscheduled environment
_def = [ ["#type","Test"], ["HintTest", { hint "Test"; MyVar = 1; }] ]; _obj = createHashmapObject [_def]; _obj call ["HintTest"]; // works fine - hints "Test" and MyVar is set to 1
Unscheduled Test - run within both scheduled and unscheduled environment
_def = [ ["#type","Test"], ["#flags",["unscheduled"]], ["HintTest", { hint "Test"; MyVar = 1;}] ]; _obj = createHashmapObject [_def]; _obj call ["HintTest"]; // returns <null> - MyVar never gets assigned
It behaves as if the code block doesn't exist or isn't assigned to the key (i.e. it is Nil) but when checking with 'values _obj' the code block is clearly there. It is just not executed.
Event Timeline
_def = [ ["#type","Test"], ["#flags",["unscheduled"]], ["HintTest", { hint "Test"; MyVar = 1;}] ]; _obj = createHashmapObject [_def]; _obj call ["HintTest"]; // returns <null> - MyVar never gets assigned
Can't reproduce
Both unscheduled and scheduled, works fine for me
Ok, something weird is definitely happening. Because now the code IS executing but still not returning anything. I haven't done a reboot or anything. Just restarted Arma 3 (which I had restarted several times when I discovered my issue). I have no proof of yesterday when it wouldn't set MyVar nor return anything... I wish I had taken screenshots. But here is proof today that I cannot return a value which was half my issue yesterday.
Note: I altered the code a bit to return something instead of hint
_def = [ ["#type","Test"], ["#flags",["unscheduled"]], ["Test", { MyVar = 1; "Test"}] ]; _obj = createHashmapObject [_def]; [_obj call ["HintTest"]]
Images : no flag, with flag, and with flag but in game rather than editor
So in this case, MyVar IS being set but I do not get "test" returned.
I am going to do a full reboot on this machine and reply if issue changes or if I get same results.
Full reboot same issue with return results. Even though it seems the MyVar assignment seems to be working now.
The only thing I can think is I did flip between prof and stable branch a few times yesterday but, that was long before I started using "unscheduled" flag and discovered the issue.
Here is RPT if it helps:
Found it. There was a missing return line in the unscheduled execution.
Because the scheduled execution actually returns nil intentionally, but the unscheduled should've exited earlier
Btw your test script
_def = [ ["#type","Test"], ["#flags",["unscheduled"]], ["Test", { MyVar = 1; "Test"}] ]; _obj = createHashmapObject [_def]; [_obj call ["HintTest"]]
cannot work because the method is named "Test", and you call "HintTest"