5E Character Create Playlist
Page 3 of 5 First 12345 Last
  1. #21
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    Quote Originally Posted by Diablobob View Post
    But would I still need to identify the actor(CT actor) for the getTokenFromCT?
    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!

  2. #22
    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

  3. #23
    Quote Originally Posted by Trenloe View Post
    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.
    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);
    The error I've been getting is:
    Code:
    attempt to call field 'setPrototype' (a nil value)
    So I tried to change it to
    Code:
    CharEntry.token.setPrototype(aProto);
    Now I'm getting:
    Code:
    attempt to index field 'token' (a nil value)

  4. #24
    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.

  5. #25
    Quote Originally Posted by Diablobob View Post
    is the problem that aProto isn't setup as a "token" type?

    how would I declare that?
    Additional notes: the module is loaded and the token that the addressing points to is displayed in the tokens menu (normal way of selecting tokens)...

    I've been tryin different ways of trying to get this to work and keep getting nil errors

  6. #26
    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);
    The token switches, and then I get the following error:
    Code:
    Script Error: [string "scripts/manager_token.lua"]:378: attempt to index local 'tokenCT' (a userdata value)
    The error is happening in the "updateName(nodeName)" function in the TokenManager...

    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);
    Any help on how to get this straight would be appreciated greatly!
    Last edited by Diablobob; January 4th, 2019 at 18:35.

  7. #27

  8. #28
    Quote Originally Posted by damned View Post
    can you post screenshots or short video?
    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

  9. #29
    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.

  10. #30
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,684
    Blog Entries
    1
    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

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