After the 2.18 update my dialogs w/ buttons using 'action' don't work. The only solution I've found is to switch over to the EH 'onButtonClicked', but this is not a solution for mods / missions that no longer receive updates.
Description
Details
- Severity
- Minor
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 10 x64
- Category
- Ingame UI
Repro mission:
0. Load up repro mission
- Run in debug console createDialog "test_dialog_input_working" and observe working 'onButtonClicked' button
- Run in debug console createDialog "test_dialog_input_broken" and observe non-working 'action' button
Expected behaviour is for both dialogs to run test_function_1 and print to systemChat.
Event Timeline
Cannot reproduce.
Running 2.18 (post hotfix) 2.18.152302
Both working and "broken" buttons work for me.
Running latest internal build, also working fine on both.
Please try again? Maybe the hotfix already fixed it?
Though, you created this ticket after we published the hotfix.
Tested again on both stable and v8 profiling, it doesn't work for me on either.
Video (recorded on stable): https://youtu.be/V4KHzvNyPA0
Oh I see the mistake.
You talked about the buttons not working, so I thought you meant the buttons don't work, while they do work just fine and close the dialog.
You meant that they don't execute the action script code..
You also didn't specify that the mission needs to be in play mode and not just in editor. In editor there is no systemChat, so there was no visible difference between the two buttons.
Play mode doesn't even work with the mission you submitted, there is no character, and trying to use the AI in splendid camera doesn't work.
The scripts execute just fine, the closeDialog works for both variants.
Running your mission in game version 2.14, it throws undefined variable "this" error.
And yeah, your code is just plain wrong. There is no this, there was not previously, and there is not now. (I see the wiki had wrong documentation on it)
In 2.14 there used to be a _this that was always empty string (thus completely useless/meaningless).
In 2.18 the _this is now not there anymore and is undefined.
I went back till 2012.
ShortcutButton: Unscheduled SQF with _this = nil
XButton: Unscheduled SQF with _this = nil
ActiveText: Unscheduled SQF with _this = nil
Button: Scheduled SQS with _this = "", but right next to the code of it, is a commented out codeblock of Unscheduled SQF with _this = nil
It looks like back then, the reason _this isn't nil is just because a programmer made a typo. It was never anything, if you were using _this, even back in 2012 you were doing it wrong.
Thus I don't think this is a problem for backwards compatibility with older missions.
Sorry for the ambiguous repro steps and wrong code, I believe my intention was originally to use _this instead of this but I didn't catch the error because it currently doesn't work either way.
I feel differently about _this though. If it was included before and now isn't, then I see that as a bug.
"... if you were using _this, even back in 2012 you were doing it wrong." - well large mods such as Overthrow did use (and the outdated versions still use) _this and were broken by 2.18 when _this became undefined.
I don't see any reason to not bring _this back, actively updated mods that were broken and have since been fixed won't be affected and unmaintained mods that were broken will start working again.