PunishXIV / YesAlready

Clicks Yes in various dialogues you've specified.
https://puni.sh/plugin/YesAlready
108 stars 34 forks source link

Evaluate the list of Talk matches less often #124

Closed mallowmew closed 3 months ago

mallowmew commented 4 months ago

This is my fix to the issue #123 I raised about FPS dropping.

I saw that the entire list of NPCs in the user's Talk list is evaluated on every frame that any dialog box is open. If the user uses a lot of regex (like me) that could well get quite slow, block the frame, and result in decreased frame rate any time a dialogue box is open.

My changes make it so that the list of Talk skips is only tested on the frame that you start dialogue with a different targeted NPC. The state of whether or not a match is found in the list now persists across updates, so we don't have to keep testing the list and slowing the game down. The frame where the list is initially tested is still blocked, but that is much less noticeable.

A similar change could probably be made anywhere else lists of regexes are evaluated in the Update event.

mallowmew commented 4 months ago

The issue I found in my own testing is that when a user talks to a skipped NPC, then removes that NPC from their skipped list, the NPC keeps being skipped until the user talks to some other NPC. In a quick check I didn't find a good way to find out if the Talk skips list has been changed / invalidated requiring its re-checking. Alternatively, the last seen talk target could be cleared when a dialogue ends (is closed) - after the check on line 37?