FG Spreadshirt Swag
  1. #1

    Got a weird CT one...

    So I'm having a weird thing going on with my CT in the ruleset I'm working on. The CT entry is getting created correctly for chars and npcs. When applying damage, the CT is being updated correctly. However the charsheet is not reflecting the update to the damage field (the NPC is being updated properly). On the flip side, when I edit that same field on the charsheet, the CT is being updated as expected. Essentially its working in one direction but not the other. Anyone seen this behavior before or have an idea on where I should dig deeper? Willing to upload any additional data/code needed. Below is my data for the ct_entry object:

    Code:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    
    <root>
    <windowclass merge="join" name="ct_entry">
    <placement>
    <size width="450" height="45"/>
    </placement>
    <script> function onInit()
    super.onInit();
    linkNewPCFields(); 
    end 
    function linkNewPCFields()
    local nodeChar = link.getTargetDatabaseNode();
    if nodeChar then
    hp.setLink(nodeChar.createChild("hp", "number"), true);
    dmg.setLink(nodeChar.createChild("dmg", "number"), true);
    stamina.setLink(nodeChar.createChild("stamina", "number"), true);
    end 
    end </script>
    <sheetdata>
    <genericcontrol name="leftcontrol" insertbefore="targetingicon">
    <bounds>5,5,20,20</bounds>
    </genericcontrol>
    <link_ctentry merge="join" name="link" insertbefore="activeeffects">
    <bounds>425,5,20,20</bounds>
    </link_ctentry>
    <genericcontrol name="rightanchor">
    <bounds>400,5,20,20</bounds>
    </genericcontrol>
    
    <string_ctname_nonid merge="join" name="nonid_name" insertbefore="targetingicon">
    <bounds>55,10,100,20</bounds>
    <lineoffset default="on">2</lineoffset>
    </string_ctname_nonid>
    
    <number_ctentry_initresult merge="join" name="initresult">
    <frame>
    <name>buttonup</name>
    <offset>5,2,5,1</offset>
    </frame>
    <bounds>175,7,15,22</bounds>
    <color>#FF000000</color>
    <description textres="ct_entry_initresult_DescriptionText"/>
    </number_ctentry_initresult>
    <number_ct_crosslink name="hp">
    <frame>
    <name>border</name>
    </frame>
    <bounds>200,5,25,25</bounds>
    <color>#FFFF0000</color>
    <description textres="ct_entry_hp_DescriptionText"/>
    </number_ct_crosslink>
    <number_ct_crosslink name="dmg">
    <frame>
    <name>ct_wound</name>
    <offset>5,2,5,1</offset>
    </frame>
    <bounds>235,7,15,22</bounds>
    <description textres="ct_entry_dmg_DescriptionText"/>
    </number_ct_crosslink>
    <number_ct_crosslink name="stamina">
    <frame>
    <name>bonus</name>
    <offset>5,2,5,1</offset>
    </frame>
    <bounds>265,7,15,22</bounds>
    <color>#FFFFFFFF</color>
    <description textres="ct_entry_stamina_DescriptionText"/>
    <script> </script>
    </number_ct_crosslink>
    </sheetdata>
    </windowclass>
    </root>

    Thanks in advance.

  2. #2
    You should look at ct_entry.lua in 3.5E and 5E as well as the CT customizations.

    Remember that when the CT database node is very first created, the window will be created and the onInit function will be called. However, if the CT entry is being created dynamically (for example, via drop on CT), the link value has not been set yet. So, you also need handle when the link changes.

    Regards,
    JPG

  3. #3

  4. #4
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,638
    Blog Entries
    1
    <script> function onInit()
    super.onInit();
    linkNewPCFields();
    end
    function linkNewPCFields()
    local nodeChar = link.getTargetDatabaseNode();
    if nodeChar then
    hp.setLink(nodeChar.createChild("hp", "number"), true);
    dmg.setLink(nodeChar.createChild("dmg", "number"), true);
    stamina.setLink(nodeChar.createChild("stamina", "number"), true);
    end
    end </script>

    this is normally done in ct_entry.lua
    id put it back there and retest

  5. #5
    Still having some issues so I'll go back through your RSW videos on the CT and see what I missed.

  6. #6
    is setLink covered in the documentation somewhere?
    I had no idea it existed.

  7. #7
    No, it's just a specialized template function in a CT template for attempting to link a field to another database location. It's used in many rulesets to link CT fields to the PC sheet fields. It only works when the CT is open.

    Regards,
    JPG

  8. #8
    Quote Originally Posted by bmos View Post
    is setLink covered in the documentation somewhere?
    I had no idea it existed.
    In CoreRPG there is a template_ct.xml file in the ct folder. The template looks like this:

    Code:
    <template name="number_ct_crosslink">
    	<basicnumber>
    		<script file="common/scripts/number_crosslink.lua" />
    	</basicnumber>
    </template>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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
  •  
DICE PACKS BUNDLE

Log in

Log in