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

    Join Date
    Jan 2015
    Location
    Grand Rapids, MI
    Posts
    136

    Reassigning Anchors to new elements in Extension

    I am trying to modify and create an extension where I want to move some fields by attaching them to a new field I've created. However, when I add the anchor tags in my extension for an existing field like the following where curhp is a new text field
    Code:
    <number_curhp name="curhp">
    	<anchored to="healthtitle" width="40" height="30">
    		<top anchor="bottom" offset="15" />
    		<right anchor="center" offset="-70" />
    	</anchored>
    	<font>reference-b-large</font>
    	<description textres="char_tooltip_hpcurrent" />
    	<min value="0" />
    	<script>
    		function onValueChanged()
    			window.onHealthChanged();
    		end
    	</script>
    </number_curhp>
    			
    <label_charfieldtop name="label_curhp">
    	<anchored to="curhp" offset="0,15" />
    	<static textres="char_label_hpcurrent" />
    </label_charfieldtop>
    			
    <number_dropadd name="hp">
    	<anchored to="curhp" position="righthigh" offset="15,0" width="40" height="30"/>
    </number_dropadd>
    I get the following error message x 4
    Code:
    Ruleset Error: window: Control (hp) anchoring to uncalculated control (curhp) in windowclass (charsheet_main)
    Ruleset Error: window: Control (hp) anchoring to uncalculated control (curhp) in windowclass (charsheet_main)
    Ruleset Error: window: Control (hp) anchoring to uncalculated control (curhp) in windowclass (charsheet_main)
    Ruleset Error: window: Control (hp) anchoring to uncalculated control (curhp) in windowclass (charsheet_main)
    Additionally, I'm going to want to move an HP label that exists on the character sheet, but it hasn't been named. Is there a way to retrieve this element without it having been named?

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    if you remove your hp code does the rest of it anchor properly?

    Can you add a Debug.console() to the hpcur script in an oninit and see if it is executing before the hp anchor warnings.

    --

    For the other - request from the devs to name the object.
    In the meantime you will need to copy the whole windowclass if the element is not named.

  3. #3
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    The XML tag <number_curhp> control needs to be the name of a valid FG control or control template.
    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

    Join Date
    Jan 2015
    Location
    Grand Rapids, MI
    Posts
    136
    Quote Originally Posted by Trenloe View Post
    The XML tag <number_curhp> control needs to be the name of a valid FG control or control template.
    I have a control template for for number_curhp based off from number_chartotal

    I've added the debug script to both elements, it looks like the hp element is loading before the curhp element, even though I'm changing the anchors in my Extension after the curhp element has been created.

    Code:
    Ruleset Error: window: Control (hp) anchoring to uncalculated control (curhp) in windowclass (charsheet_main)
    Ruleset Error: window: Control (hp) anchoring to uncalculated control (curhp) in windowclass (charsheet_main)
    Runtime Notice: s'hp is loaded'
    Runtime Notice: s'curhp is loaded'
    Ruleset Error: window: Control (hp) anchoring to uncalculated control (curhp) in windowclass (charsheet_main)
    Ruleset Error: window: Control (hp) anchoring to uncalculated control (curhp) in windowclass (charsheet_main)

  5. #5

    Join Date
    Jan 2015
    Location
    Grand Rapids, MI
    Posts
    136
    I'm wondering if I could run an onInit script in the curhp element to change the anchors there.

  6. #6

    Join Date
    Jan 2015
    Location
    Grand Rapids, MI
    Posts
    136
    Also, any thoughts how to move this unnamed element from the record_char_main.xml?

    <label>
    <anchored to="wounds" position="lefthigh" offset="15,5" />
    <static textres="hp" />
    </label>

  7. #7
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    Quote Originally Posted by Tielc View Post
    Also, any thoughts how to move this unnamed element from the record_char_main.xml?

    <label>
    <anchored to="wounds" position="lefthigh" offset="15,5" />
    <static textres="hp" />
    </label>

    See damned's reply:

    Quote Originally Posted by damned View Post
    For the other - request from the devs to name the object.
    In the meantime you will need to copy the whole windowclass if the element is not named.
    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. #8
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,411
    Quote Originally Posted by Tielc View Post
    I have a control template for for number_curhp based off from number_chartotal

    I've added the debug script to both elements, it looks like the hp element is loading before the curhp element, even though I'm changing the anchors in my Extension after the curhp element has been created.
    Use the insertbefore merge command to make sure that curhp is inserted in the final merged windowclass before the controls anchored on it.

    To see some examples, search the 5E ruleset for insertbefore
    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!

  9. #9
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,685
    Blog Entries
    1
    Quote Originally Posted by Trenloe View Post
    Use the insertbefore merge command to make sure that curhp is inserted in the final merged windowclass before the controls anchored on it.

    To see some examples, search the 5E ruleset for insertbefore
    Cool - Id not see that before!

  10. #10

    Join Date
    Jan 2015
    Location
    Grand Rapids, MI
    Posts
    136
    Quote Originally Posted by damned View Post
    For the other - request from the devs to name the object.
    What is the correct or proper way to go about this?

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 Character Create Playlist

Log in

Log in