Starfinder Playlist
  1. #1
    GKEnialb's Avatar
    Join Date
    Jul 2017
    Location
    Castle Rock, CO
    Posts
    515

    Token IDs [5E, FGU]

    I override getDistanceBetween in my Token Height extension, but originally was just looking at both arguments being tokens. bmos was kind enough to extend that to handle points as well, but also found that tokenids are valid arguments as well:

    Code:
    function getDistanceBetween(token OR tokenid OR point, token OR tokenid OR point)
    Can anyone give any tips on how to tell if the argument is a tokenid and if so, how to get an actual token from that? We currently use sourceToken.getContainerNode (with sourceToken being one the getDistanceBetween arguments) to determine if we're looking at a token or point.

  2. #2
    If the value being passed into the API is:
    * A "tokeninstance" data object - Use the data object
    * A simple number value - Assume token ID; attempt to look up token ID on current image control; use that token object if found
    * A table with two values (or x/y values) - Assume point; use in distance calculation

    Regards,
    JPG

  3. #3
    GKEnialb's Avatar
    Join Date
    Jul 2017
    Location
    Castle Rock, CO
    Posts
    515
    Thanks - that's nice and straightforward. I was overthinking it. Do you know off the top of your head anything that would call getDistanceBetween with tokenids so I can test it out in real life?

  4. #4
    It was more of a parameter thrown in to allow information to be stored asynchronously based on token ID; since token instances would only be valid in synchronous scenarios. You can always test by using tokeninstance.getId(); if you really want to try it out.

    Regards,
    JPG

  5. #5
    GKEnialb's Avatar
    Join Date
    Jul 2017
    Location
    Castle Rock, CO
    Posts
    515
    Quote Originally Posted by Moon Wizard View Post
    It was more of a parameter thrown in to allow information to be stored asynchronously based on token ID; since token instances would only be valid in synchronous scenarios. You can always test by using tokeninstance.getId(); if you really want to try it out.

    Regards,
    JPG
    Awesome - thanks for the thought. I was able to test all the cases.

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
  •  
DICE PACKS BUNDLE

Log in

Log in