STAR TREK 2d20
  1. #1

    Token selection timing, select after double-click

    Following up on my post from yesterday about working on double-click to target, I am now attempting to select the active token after completing the double-click. As I complete the "set target," I have the owner look up their token's active window and select it. This process works when there are no clicks involved (I use the same function when moving between turns, to auto-select the active token), but with a double-click, it becomes apparent that the timing of mouse click handling is in play here. I'm pretty sure this is just not practicle to fix, but maybe there is a trick I don't know about!

    You can see a video of it in action here:
    https://www.loom.com/share/0cbe7a8e0...041c99785c03fc

    And the relevat select-self code:
    Code:
    function toggleSelectedToken(bSelect)
        local nodeActive = CombatManager.getActiveCT();
    
        if not DB.isOwner(nodeActive) then
            return;
        end
    
        local nodeCT = CombatManager.getTokenFromCT(nodeActive);
        local container = ImageManager.getImageControl(nodeCT, false);
        Debug.chat('rcv token select', bSelect, nodeActive);
    
        if nodeCT and container then
            container.clearSelectedTokens();
            container.selectToken(nodeCT, bSelect);
        end
    end

  2. #2
    At this point, I don't think it's something that we will be looking at adjusting. Any time you change the ordering of triggers/scripts, you can have unintended knock-on effects to existing behaviors.

    My guess is that the actual token "selection" updating is happening after the script; but I would have to go rooting around in the code that @cpinder maintains (and he is currently away for a bit).

    Regards,
    JPG

  3. #3
    Fair enough. I know it's a funky thought, but there's no way to callback after a delay in FG, is there? I could see postponing the self-select for 100ms or something goofy like that. Part of me hopes the answer is no

  4. #4
    No, that would require a whole event tracking system that works differently than it works before. I know that there are several scripts that are dependent on events happening inline with UI actions and API call events.

    Regards,
    JPG

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in