If allDiaryRecords is used immediately after removeDiaryRecord, it blocks the display update.
The diary record is removed internally but remains visible on the screen.
The player must manually switch to another subject before the display updates.
This issue does not occur if removeDiaryRecord runs after the allDiaryRecords command.
Worth to notice that issue also does not occur if player didn't selected affected subject before (Must be selected for the issue to appear).
Description
Description
Details
Details
- Severity
- Minor
- Resolution
- Open
- Reproducibility
- Always
- Operating System
- Windows 10 x64
- Operating System Version
- 22H2
- Category
- Scripting
Steps To Reproduce
- Place the player and two units on the map.
- Use the variables for the units: TestUnit1 and TestUnit2.
- Place the following code into init.sqf and run the preview.
- Open map and select Shop list subject in diary.
- Close the map and remove record through provided action attached to the unit.
- Open map and look at Shop list subject in diary again.
- Optional- Switch diary subject to update the display.
//Code that blocks display update player createDiarySubject ["ShopLists","Shop lists"]; _list = player createDiaryRecord ["ShopLists", ["List 1","example list 1"]]; TestUnit1 setVariable ["ShopList",_list]; _list2 = player createDiaryRecord ["ShopLists", ["List 2","example list 2"]]; TestUnit2 setVariable ["ShopList",_list2]; { _x addAction [ "Remove", // title { params ["_target"]; private _list = _target getVariable ["ShopList",diaryRecordNull]; player removeDiaryRecord ["ShopLists",_list]; (player allDiaryRecords "ShopLists");//Problem-blocks display update } ]; } forEach [TestUnit1,TestUnit2];
Additional Information
//Working code player createDiarySubject ["ShopLists","Shop lists"]; _list = player createDiaryRecord ["ShopLists", ["List 1","example list 1"]]; TestUnit1 setVariable ["ShopList",_list]; _list2 = player createDiaryRecord ["ShopLists", ["List 2","example list 2"]]; TestUnit2 setVariable ["ShopList",_list2]; { _x addAction [ "Remove", // title { params ["_target"]; private _list = _target getVariable ["ShopList",diaryRecordNull]; (player allDiaryRecords "ShopLists");//No problem at all player removeDiaryRecord ["ShopLists",_list]; } ]; } forEach [TestUnit1,TestUnit2];
I believe removeDiaryRecord should work independently of other commands and update the display at the moment the diary record is removed.
I don’t have much else to add, except thank you for looking into this issue. If you need anything else, I’m happy to help however I can.