Starfinder Playlist
Page 2 of 5 First 1234 ... Last
  1. #11
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    Quote Originally Posted by Diablobob View Post
    I think what my main problem is I was trying to define them in the ext, but was missing adding them to the mod file definitions...
    You don’t need to add individual token names to the module definition.xml file. The <name> tag I mentioned is for the module name, to be used after the @ sign when referencing any tokens from that module in code.
    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!

  2. #12
    Quote Originally Posted by Trenloe View Post
    You don’t need to add individual token names to the module definition.xml file. The <name> tag I mentioned is for the module name, to be used after the @ sign when referencing any tokens from that module in code.
    Well... I feel stupid... I just realized I've been trying to use them as images for bitmapWidget... And using it as stated for that purpose isn't working... I need to overhaul the code and use tokenmanager.setprototype(X)

    Wish me luck!

  3. #13
    Quote Originally Posted by Trenloe View Post
    For tokens you need the full path to the token within the .mod file, plus the @<module name> reference (the <name> field from the module definition.xml file). For example: tokens/tokenname.png@Token Module

    I'm not really sure what you're trying to do and when. If you're trying to access tokens in modules during the initialization of an extension, then that probably won't work - which is what damned was mentioning. If your code is only ran once the campaign is fully loaded, then you should be able to access the token files in a module - assuming you have the path and module name correct.
    So I'm still having issues...

    Is the <tokencontrol>.setprototype... Supposed to be in the XML or the LUA?

    Also does setprototype change the token, or just token reference/I'd? Would I still need a replaceCombatantToken?

    Lastly, I'm having issues getting the refnode and refid for the token...

    Any help or suggestions would be appreciated!

  4. #14
    I should probably clarify that I'm trying to change the token on the map with a different token... 5e ruleset
    Last edited by Diablobob; December 27th, 2018 at 14:57.

  5. #15

    Join Date
    Jun 2013
    Location
    Isanti, MN
    Posts
    2,922
    Why don't you just drop a new token onto the entry on the CT?

  6. #16
    Quote Originally Posted by Andraax View Post
    Why don't you just drop a new token onto the entry on the CT?
    I'm trying to automate the swap to make things easier

  7. #17
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    Quote Originally Posted by Diablobob View Post
    Is the <tokencontrol>.setprototype... Supposed to be in the XML or the LUA?
    It always has to be in LUA code. LUA can be in specific LUA files (.lua file extension) or it can be within <script> tags in FG XML. Where you put it really relies on what you're doing. If you're doing anything complex, it's better doing it in a LUA file - as error checking/commenting is better in LUA files rather than LUA code embedded in XML.

    Quote Originally Posted by Diablobob View Post
    Also does setprototype change the token, or just token reference/I'd? Would I still need a replaceCombatantToken?
    It should change the image used for the token instance, it shouldn't change the ID.

    CombatManager.replaceCombatantToken is used when the token for a creature is changed in the CT (drag/drop a token to the token entry in the CT) - this replaces the token graphic in the CT and the linked token instance on an image with the new token instance (the old token instance on the map is deleted).

    Quote Originally Posted by Diablobob View Post
    Lastly, I'm having issues getting the refnode and refid for the token...
    If the token is already on the image (which I'm guessing it is based off your follow up post), then you can get the tokeninstance object using the CombatManager.getTokenFromCT command - which takes the database node of the linked combat tracker entry.

    If you don't know the combat tracker entry, then you'll need to get all of the tokens on a specific image control: https://www.fantasygrounds.com/refdo....xcp#getTokens which will give you a LUA table of tokeninstance objects, which you can iterate through and use getName, getPrototype, etc. to try to identify the individual tokeninstance.
    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!

  8. #18
    Quote Originally Posted by Trenloe View Post
    It always has to be in LUA code. LUA can be in specific LUA files (.lua file extension) or it can be within <script> tags in FG XML. Where you put it really relies on what you're doing. If you're doing anything complex, it's better doing it in a LUA file - as error checking/commenting is better in LUA files rather than LUA code embedded in XML.


    It should change the image used for the token instance, it shouldn't change the ID.

    CombatManager.replaceCombatantToken is used when the token for a creature is changed in the CT (drag/drop a token to the token entry in the CT) - this replaces the token graphic in the CT and the linked token instance on an image with the new token instance (the old token instance on the map is deleted).


    If the token is already on the image (which I'm guessing it is based off your follow up post), then you can get the tokeninstance object using the CombatManager.getTokenFromCT command - which takes the database node of the linked combat tracker entry.

    If you don't know the combat tracker entry, then you'll need to get all of the tokens on a specific image control: https://www.fantasygrounds.com/refdo....xcp#getTokens which will give you a LUA table of tokeninstance objects, which you can iterate through and use getName, getPrototype, etc. to try to identify the individual tokeninstance.

    So if I'm understanding it all, I need to update the prototype for the linked token entry inside the token instance... And when I update the prototype, the token image, on the map, will change accordingly?
    Last edited by Diablobob; December 27th, 2018 at 17:34.

  9. #19
    So how does this look?
    CombatManager.getTokenFromCT(setPrototype("TokenNa me.png@ModuleName")

    Would that update the token image on the map if triggered by a player action or click? Or would I need to do a getActor type thing for the getTokenFromCT ?

  10. #20
    Possibly better to nest them?

    Local CharEntry = CombatManager.getTokenFromCT

    CharEntry.setPrototype("TokenImageName.png@ModuleN ame")

    But would I still need to identify the actor(CT actor) for the getTokenFromCT?

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