-
December 25th, 2018, 07:02 #11Private 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!
-
December 25th, 2018, 15:46 #12
- Join Date
- Jun 2018
- Posts
- 112
-
December 27th, 2018, 13:59 #13
- Join Date
- Jun 2018
- Posts
- 112
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!
-
December 27th, 2018, 14:54 #14
- Join Date
- Jun 2018
- Posts
- 112
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.
-
December 27th, 2018, 16:21 #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?
-
December 27th, 2018, 16:39 #16
- Join Date
- Jun 2018
- Posts
- 112
-
December 27th, 2018, 16:54 #17
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.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!
-
December 27th, 2018, 17:32 #18
- Join Date
- Jun 2018
- Posts
- 112
-
December 27th, 2018, 17:47 #19
- Join Date
- Jun 2018
- Posts
- 112
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 ?
-
December 27th, 2018, 17:55 #20
- Join Date
- Jun 2018
- Posts
- 112
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