-
December 27th, 2018, 18:05 #21
Yes you need to pass that data into the getTokenFromCT function - otherwise it won't know which CT entry you're referring to.
Unpack the CoreRPG ruleset into some temporary folder on your hard drive and use a text editor Find in files functionality for "getTokenFromCT" (notepad ++ works well) - this will show you examples of how to use the function.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, 18:33 #22
- Join Date
- Jun 2018
- Posts
- 112
Thank you! I will be able to fully test it this evening...
I apologize for being any kind of bother... I'm still very new to FG programming
-
December 28th, 2018, 17:28 #23
- Join Date
- Jun 2018
- Posts
- 112
ok, so I've gotten further... but now I keep getting a nil error... I don't know what I'm doing wrong.
so far:
Code:local CharEntry = CombatManager.getTokenFromCT(rTarget); local sType = (variable token image name set by another function); local aProto = "tokens/" .. sType .. ".png@ModuleName"; CharEntry.setPrototype(aProto);
Code:attempt to call field 'setPrototype' (a nil value)
Code:CharEntry.token.setPrototype(aProto);
Code:attempt to index field 'token' (a nil value)
-
December 28th, 2018, 18:32 #24
- Join Date
- Jun 2018
- Posts
- 112
is the problem that aProto isn't setup as a "token" type?
how would I declare that?
Is my syntax wrong?Last edited by Diablobob; December 28th, 2018 at 20:39.
-
December 28th, 2018, 20:38 #25
- Join Date
- Jun 2018
- Posts
- 112
-
January 4th, 2019, 16:41 #26
- Join Date
- Jun 2018
- Posts
- 112
Further down the rabbit hole: So, I've managed to successfully swap out the token like I need... however, I am getting an error that I cannot seam to get around.
After the token is switched to the new one using:
Code:local aProto = "tokens/TokenName.png@ModuleName"; local nodeTok = ActorManager.getCTNode(rTarget); local tokCT = CombatManager.getTokenFromCT(rTarget); DB.setValue(nodeTok, "token", "token", aProto); local nodeContainerOld = tokCT.getContainerNode(); local newTokenInst = Token.getToken(nodeContainerOld.getNodeName(),DB.getValue(nodeTok, "token", "")); CombatManager.replaceCombatantToken(nodeTok, newTokenInst);
Code:Script Error: [string "scripts/manager_token.lua"]:378: attempt to index local 'tokenCT' (a userdata value)
I've tried update owner, updateEffects, many other iterations... and if the token switches, I get the error...
Also newTokenInst is coming up as a nil value... which is where the issue is probably stemming from... however, how do I feed the correct "newTokenInstance" into replaceCombatantToken... I've also tried many iterations of trying to manually create or derive the token instance from
Code:DB.setValue(nodeTok, "token", "token", aProto);
Last edited by Diablobob; January 4th, 2019 at 18:35.
-
January 4th, 2019, 21:55 #27
can you post screenshots or short video?
-
January 4th, 2019, 23:31 #28
- Join Date
- Jun 2018
- Posts
- 112
I will as soon as I can get to my computer this evening... ATM...newTokenInst is coming up nil... I tried a manual addToken, and that came up nil as well...
I know I need to create a new token instance and feed that through the process... But I don't know the correct way to create a token instance... (Pretty sure I keep getting the syntax wrong)... I will post more tonight when I get to comp
-
January 5th, 2019, 07:24 #29
- Join Date
- Jun 2018
- Posts
- 112
I don't have time this evening to post the screenshots... however I can explain what I'm trying to do very simply...
I am trying to do the same function as dropping an image onto the combat tracker character. How when you drop it, the image in the combat tracker and the map both change.
I am guessing, I need to ImageManager.registerImage(aProto) or something... and then update the refnode... at least that is where my thought process is at the moment... things have been hectic, and I'm not getting as much keyboard time as I'd like due to life... so ideas I come up with are far between tests... I am still new-ish to the specific callouts of the commands of FG...
so if I do an ActorManager.getCTnode(rTarget) I can use that to change the image on the combat tracker... however, that is where things start to fall apart... Although the image in the combat tracker changes, the token on the map does not...
if I run CombatManager.replaceCombatantToken.. it replaces the token on the map... but in doing to,throws up the error... I am unsure what is causing the image to update... if I could isolate that, I could try to emulate it and possibly circumvent the error...
If there is an easier way, I would appreciate any help I could get on this matter.
-
January 5th, 2019, 08:08 #30
You are way over my head - but if the image on the map can be replaced with CombatManager.replaceCombatantToken Id keep working at how/why the error is being generated and fix the error...
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks