5E Product Walkthrough Playlist
Page 1 of 2 12 Last
  1. #1

    .getColor/.setColor

    I'm trying to control the color of labels, dynamically, but I'm not having any luck. Can someone clue me on on the syntax?

  2. #2

  3. #3
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,701
    1) Look in the API guide for details of available API commands. setColor() for a text based control is detailed here: https://fantasygroundsunity.atlassia...ntrol#setColor As @damned mentions, there's no getColor API function.
    2) As @damned mentions, look for examples in existing rulesets. I extract the CoreRPG ruleset and the ruleset I'm working on into directories outside of the FG rulesets directory (so FG doesn't read the extracted data) and then use find in files to get examples of what I'm working on.
    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!

  4. #4
    Quote Originally Posted by Trenloe View Post
    1) Look in the API guide for details of available API commands. setColor() for a text based control is detailed here: https://fantasygroundsunity.atlassia...ntrol#setColor As @damned mentions, there's no getColor API function.
    2) As @damned mentions, look for examples in existing rulesets. I extract the CoreRPG ruleset and the ruleset I'm working on into directories outside of the FG rulesets directory (so FG doesn't read the extracted data) and then use find in files to get examples of what I'm working on.
    Didn't realize that API was available, thank you. Yup, looks like I was trying to shove the wrong type of data into that method, but even when I corrected it, it's still not working.

    Here's the specific error I'm getting.
    [ERROR] Script execution error: [string "chkStrength"]:8: attempt to index a nil value

  5. #5
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,832
    Blog Entries
    1
    That specific error is telling you to look at the script code associated with the object chkStrength on line 8 or line 7.
    Please post the whole code you have there.

  6. #6
    Quote Originally Posted by damned View Post
    That specific error is telling you to look at the script code associated with the object chkStrength on line 8 or line 7.
    Please post the whole code you have there.
    Here's my test code there...

    Code:
    function onValueChanged()
    
    	local nodeChar = window.getDatabaseNode();
    	local colValue = 008000;
    	
    	nodeChar.getChild("lblStrength").setColor("A3A29D");
    
    end

  7. #7
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,832
    Blog Entries
    1
    Quote Originally Posted by bloodylemming View Post
    Here's my test code there...

    Code:
    function onValueChanged()
    
    	local nodeChar = window.getDatabaseNode();
    	local colValue = 008000;
    	
    	nodeChar.getChild("lblStrength").setColor("A3A29D");
    
    end
    This looks like you are doing it on a LABEL
    Can you try the same commands on a STRING FIELD?
    What happens?

  8. #8
    Quote Originally Posted by damned View Post
    This looks like you are doing it on a LABEL
    Can you try the same commands on a STRING FIELD?
    What happens?
    Same error

  9. #9

  10. #10
    Quote Originally Posted by damned View Post
    please share your RWP file and the exact window and object that the code is attached to and how to initiate the error
    Here's the RWP file. I've pared it down to just the items in question and confirmed it's throwing the error. Just click the checkbox.
    Should be attached...
    Attached Files Attached Files

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
  •  
GI JOE RPG Launch

Log in

Log in