STAR TREK 2d20
  1. #1

    API calls to remove "token selection" ?

    I've been fiddling around with some highlighting/indicators in the combat tracker. One thing I noticed is that there is apparently no way to "remove selection" of a token. I do not me "target" for another token I mean when you click on a token and select it.

    I'd like to be able to clear the token select when it's another person's turn. The reason being is that I will select a token during one npcs turn, next round another npc goes and the "selected" token is from the previous turn selection and if I target something, for what I think is the current npc, it will actually target for the previously "clicked on/selected" token. To clear up that problem I'd like to just clear selection.

    tldr; selecting a token persists, I'd like to clear selection on each turn.

    Am I missing something and there is a API to allow you to clear the token selection?
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    It's based off the image control, not an individual token: https://www.fantasygrounds.com/refdo...SelectedTokens
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    Quote Originally Posted by Trenloe View Post
    It's based off the image control, not an individual token: https://www.fantasygrounds.com/refdo...SelectedTokens
    AH! Perfect, I knew there had to be something. Thanks!
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  4. #4
    Okay, so I've implemented the clearselections and it "seems" to do something but not everything.

    Here is the token before selection.



    Here is the token AFTER selection.



    And here is the token after the clear has been initiated.



    You'll note the token does appear to be unselected however it still seems to be acting like it is. You can see it even it showing the indicator for range to it's target. If I immediately "control-click" another token to target it adds those targets to that token. I needed to auto-select the "active" token as well.

    Code:
    -- clean any selected token, select active one
    function clearSelectionToken()
      local nodeCT = getDatabaseNode();
      local tokenMap = CombatManager.getTokenFromCT(nodeCT);
      local imageControl = ImageManager.getImageControl(tokenMap, true)
      imageControl.clearSelectedTokens();
      imageControl.selectToken( tokenMap, true ) ;
    end
    That seems to be working on client and host side.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  5. #5
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    Please dont change the way Targeting works....

    As GM in large battles I will try to do as much targeting as possible whole the PCs are taking their turns so that i can fire off my attacks on the NPC turns without slowing things too much.
    In more cases than not an NPC will attack the same target they attacked on their previous turn - not always but certainly more often than not...

  6. #6
    Quote Originally Posted by damned View Post
    Please dont change the way Targeting works....

    As GM in large battles I will try to do as much targeting as possible whole the PCs are taking their turns so that i can fire off my attacks on the NPC turns without slowing things too much.
    In more cases than not an NPC will attack the same target they attacked on their previous turn - not always but certainly more often than not...
    I'm not changing targeting, just token selection. It sounds the same but it's not. Token selection is the token you've clicked on, it shows the black ring when you do, that's it. When you target (control-click) that is targeting (which shows on the CT entry with each name of targeted tokens), that I did not change.
    Last edited by celestian; June 11th, 2019 at 00:30.
    ---
    Fantasy Grounds AD&D Reference Bundle, AD&D Adventure Bundle 1, AD&D Adventure Bundle 2
    Documentation for AD&D 2E ruleset.
    Custom Maps (I2, S4, T1-4, Barrowmaze,Lost City of Barakus)
    Note: Please do not message me directly on this site, post in the forums or ping me in FG's discord.

  7. #7
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,678
    Blog Entries
    1
    Quote Originally Posted by celestian View Post
    I'm not changing targeting, just token selection. It sounds the same but it's not. Token selection is the token you've clicked on, it shows the black ring when you do, that's it. When you target (control-click) that is targeting (which shows on the CT entry with each name of targeted tokens), that I did not change.
    Gotcha.

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