PDA

View Full Version : TEST and ct_entry - heads up



SilentRuin
August 9th, 2022, 20:20
Heads up for anyone who inserts stuff into the ct_entry as the most recent TEST has been reshuffled to the point extensions will no longer find controls they previously anchored off of to do insertions. I've only superficially tested TEST to see what extensions of mine got blown out of the water and it appears (as in really not tested thoroughly yet) that positional controls anchored among the CT entry controls are going to fail. SO be prepared to do a forensic dig to find out what new way we need to deal with this.

SilentRuin
August 12th, 2022, 05:05
Question: It appears a lot of control names have been shifted out of ct_host.xml and moved into templates. Why? I used to insertafter the activateeffects name in ct_host.xml but now I see it has been moved to template_ct.xml buried under a template name and is no longer locatable. In fact, I can't see where <template name="button_ctentry_activateeffects"> is ever used looking at 5E/CoreRPG. Would like an explanation of how the ct stuff has been shifted around and how to access it now for placement of my own buttons in there.

Moon Wizard
August 12th, 2022, 07:47
I left the old templates in place, in case anyone had written mods which used them. They are not shifted out, but no longer used at all in the CoreRPG/5E combat trackers. They've been replaced with new templates that support the new subwindow method for CT entry subsections. That is the essence of the change in this release.

All the controls for toggling sections and the CT entry subsections themselves have been changed, and subsection fields have been moved into individual subwindows.

5E has some fairly straightforward examples. Just look at:


<template name="button_ct_section_active">
<button_ct_section>
<tooltip textres="ct_tooltip_offense" />
<state icon="button_sword" merge="add" />
<state icon="button_sword_down" merge="add" />
<target>active</target>
</button_ct_section>
</template>
<template name="button_ct_section_defense">
<button_ct_section>
<tooltip textres="ct_tooltip_defense" />
<state icon="button_shield" merge="add" />
<state icon="button_shield_down" merge="add" />
<target>defense</target>
</button_ct_section>
</template>

<windowclass name="ct_entry">
<sheetdata>
...
<button_ct_section_defense name="button_section_defense" />
<button_ct_section_active name="button_section_active" />
...
<sub_ct_section name="sub_active" />
<sub_ct_section name="sub_defense" />
...
</sheetdata>
</windowclass>

<windowclass name="ct_section_active">
...
</windowclass>
<windowclass name="ct_section_defense">
...
</windowclass>


Regards,
JPG

SilentRuin
August 12th, 2022, 19:55
I left the old templates in place, in case anyone had written mods which used them. They are not shifted out, but no longer used at all in the CoreRPG/5E combat trackers. They've been replaced with new templates that support the new subwindow method for CT entry subsections. That is the essence of the change in this release.

All the controls for toggling sections and the CT entry subsections themselves have been changed, and subsection fields have been moved into individual subwindows.

5E has some fairly straightforward examples. Just look at:


<template name="button_ct_section_active">
<button_ct_section>
<tooltip textres="ct_tooltip_offense" />
<state icon="button_sword" merge="add" />
<state icon="button_sword_down" merge="add" />
<target>active</target>
</button_ct_section>
</template>
<template name="button_ct_section_defense">
<button_ct_section>
<tooltip textres="ct_tooltip_defense" />
<state icon="button_shield" merge="add" />
<state icon="button_shield_down" merge="add" />
<target>defense</target>
</button_ct_section>
</template>

<windowclass name="ct_entry">
<sheetdata>
...
<button_ct_section_defense name="button_section_defense" />
<button_ct_section_active name="button_section_active" />
...
<sub_ct_section name="sub_active" />
<sub_ct_section name="sub_defense" />
...
</sheetdata>
</windowclass>

<windowclass name="ct_section_active">
...
</windowclass>
<windowclass name="ct_section_defense">
...
</windowclass>


Regards,
JPG

Not sure how you think its straightforward - It's been completely rewritten with no directions on how it works. I think I'm going to have to rewrite everything that added a CT entry from scratch and figure out how it works by trial and error. Trying to translate between old stuff and new stuff is not working for sure. Will have to pretend I never wrote anything and develop it from scratch for this stuff.

Moon Wizard
August 12th, 2022, 20:12
I think you're making this bigger than it is.

If you are inserting controls in the top line, then you would do it just like you did before (though the names have changed slightly with the new controls).
If you are inserting controls in a subsection, then use a window class merge on that new subsection window.
If you are inserting a completely new section, then you would need a new section button template (see example) which you add to entry, and you need to define a new subwindow with a name matching the button template and put any controls you need in there.

While I was migrating the rulesets, this new method actually made things much easier to add/remove. You just need to look at the 5E example (with more to come shortly after for other included rulesets).

Regards,
JPG

SilentRuin
August 14th, 2022, 21:18
I think you're making this bigger than it is.

If you are inserting controls in the top line, then you would do it just like you did before (though the names have changed slightly with the new controls).
If you are inserting controls in a subsection, then use a window class merge on that new subsection window.
If you are inserting a completely new section, then you would need a new section button template (see example) which you add to entry, and you need to define a new subwindow with a name matching the button template and put any controls you need in there.

While I was migrating the rulesets, this new method actually made things much easier to add/remove. You just need to look at the 5E example (with more to come shortly after for other included rulesets).

Regards,
JPG

I'm trying to port this stuff but having issues where I think I just have to start over. One thing I'm noticing I cannot find the global buttons (for sections) anymore. They were removed it appears. Are we no longer going to be able to display "all" effects or other sections in the ct entry?

Moon Wizard
August 14th, 2022, 21:35
As exampled in this post:
https://www.fantasygrounds.com/forums/showthread.php?74713-TEST-and-ct_entry-heads-up&p=659335&viewfull=1#post659335

The buttons have been changed to a new template and renamed, in order for them to work in conjunction with other templates and renaming. (i.e. the naming is tied to the way the templates work)

Example:
"button_ct_section_targets" is used to toggle the "targets" subsection which is embedded in the "ct_section_targets" subwindow. In all CoreRPG derived rulesets, the window class used for targets is "ct_section_targets".

Example 2:
"button_ct_section_defense" is used to toggle the "defense" subsection which is embedded in the "ct_section_defense" subwindow. In 5E, the windowclass used for defense is one of the following: "ct_section_defense", "ct_section_defense_npc", "ct_section_defense_vehicle". The ct_entry.lua script controls which windowclass is placed in the defense subsection when toggled. The default child window class would be "ct_section_defense", if the ct_entry.lua doesn't specify an alternate as part of the override in the onSectionChanged function defined in the CT entry.

Regards,
JPG

SilentRuin
August 14th, 2022, 21:41
As exampled in this post:
https://www.fantasygrounds.com/forums/showthread.php?74713-TEST-and-ct_entry-heads-up&p=659335&viewfull=1#post659335

The buttons have been changed to a new template and renamed, in order for them to work in conjunction with other templates and renaming. (i.e. the naming is tied to the way the templates work)

Example:
"button_ct_section_targets" is used to toggle the "targets" subsection which is embedded in the "ct_section_targets" subwindow. In all CoreRPG derived rulesets, the window class used for targets is "ct_section_targets".

Example 2:
"button_ct_section_defense" is used to toggle the "defense" subsection which is embedded in the "ct_section_defense" subwindow. In 5E, the windowclass used for defense is one of the following: "ct_section_defense", "ct_section_defense_npc", "ct_section_defense_vehicle". The ct_entry.lua script controls which windowclass is placed in the defense subsection when toggled. The default child window class would be "ct_section_defense", if the ct_entry.lua doesn't specify an alternate as part of the override in the onSectionChanged function defined in the CT entry.

Regards,
JPG

The globals are still missing - you can bring up a TEST CT with no extensions and see they are no longer in the header after wounds.

SilentRuin
August 14th, 2022, 23:51
Here is what I have tried...



<windowclass name="ct_entry" merge="join">
<sheetdata>
...
<button_ct_section_ctgroup name="button_section_ctgroup" insertbefore = "button_section_effects"/>
<sub_ct_section name="sub_ctgroup" insertafter = "sub_effects"/>
</sheetdata>
</windowclass>

<template name="button_ct_section_ctgroup">
<button_ct_section>
<tooltip textres="ct_tooltip_ctgroup" />
<state icon="combatgroups_icon" />
<state icon="combatgroups_icon_down" />
<target>ctgroup</target>
</button_ct_section>
</template>

<windowclass name="ct_section_ctgroup">
<sheetdata>
<!-- CTGroup section -->
<icon_ctsection name="ctgroupicon">
<icon>combatgroups_icon</icon>
</icon_ctsection>

<anchor_ct_section name="anchor_section" />

<combobox name="combatgroup">
<anchored to="anchor_section" width="200" height="30">
<top anchor="bottom" relation="relative" offset="10" />
<left parent="ctgroupicon" anchor="right" offset="40" />
</anchored>
<empty textres="empty_combatgroup_select" />
<listmaxsize>15</listmaxsize>
<listdirection>down</listdirection>
<tooltip textres="combatgroup_tooltip" />
<script>
function onInit()
super.onInit();
CombatGroupsManager.InitCombatGroups(window, true);
end
function onValueChanged()
wCombatTracker = Interface.findWindow("combattracker_host", "combattracker");
if wCombatTracker then
wCombatTracker.list.applyFilter();
end
end
</script>
</combobox>
<genericcontrol name="spacer_ctgroup">
<anchored to="anchor_section" height="30">
<top anchor="bottom" relation="relative" />
<left />
<right />
</anchored>
<disabled />
</genericcontrol>
<frame_ct_section name="frame_section">
<anchored>
<left parent="ctgroupicon" anchor="right" offset="0" />
<bottom parent="spacer_ctgroup" offset="10" />
</anchored>
</frame_ct_section>
</sheetdata>
</windowclass>


When I try to access the "combatgroup" value in combobox per usual it tells me its nil. Fine you've moved it all around I can see that - so I look in .getControls() and among many things I see sub_ctgroup - which using my vChild.sub_ctgroup - I can't find anything. I'm at a loss how I can access my values in this sub class or how it works. Becuase while the icon shows in the list of icons at top of entry - clicking on it does nothing. So I'm still missing some important clue on how to do this and on how to access my window values whether visible or not.

The landscape has completely changed and I no longer understand how to do what I was doing.

And is "combatgroup" combo box DB entry still going to be at the same level of DB under the CT list entry? If that will move to some other level in DB that would truly suck.

Moon Wizard
August 14th, 2022, 23:51
The global toggles in the top level CT have been removed, as they negatively affect performance in large CT lists.

JPG

SilentRuin
August 15th, 2022, 01:03
The global toggles in the top level CT have been removed, as they negatively affect performance in large CT lists.

JPG

If they have a large list then it would be a nightmare to find and turn on/off stuff manually without being able to do it in one button click. Seems its a catch 22 - your losing valuable ability to cater to a rare large CT group - which would still find it more convenient than not.

SilentRuin
August 15th, 2022, 05:37
Never mind its only targets that remove the text target list - which I suppose is legit and always done that my bad.

LordEntrails
August 15th, 2022, 15:40
So what global toggle is going away with this build?

SilentRuin
August 15th, 2022, 17:48
So what global toggle is going away with this build?

53974

LordEntrails
August 15th, 2022, 18:39
53974
ok, thanks. Minorly inconvenient for me. But welcome change for performance improvements. I often run 30+NPC active on the CT (and no, its not all the NPCS in the location, just those actively engaged in combat!)

SilentRuin
August 15th, 2022, 19:29
Another warning - anyone accessing the old ct entry section window data directly will no longer be able to guarantee that will work. The subwindow is not defined when its not there - where previously that section was just invisible. I kluged my way around it by checking if the subwindow was present and if not access the DB instead.

SilentRuin
August 17th, 2022, 05:14
Another warning on this latest patch - with the removal of global headers when you add in a ct_entry header button now it will force the above header labels to not line up with the columns because for some reason they hardcoded it to go off the right side of the header_labels frame for each header. As I'm not going to override every header I'm just overriding this to back it up -25 for extra button I added - this won't be playing nice for anyone else who adds ct_section buttons in now because of the way this was set to go off the right size of the header_label.


<template name="frame_ctbox_host_header_labels">
<metalplate name="header_labels">
<anchored to="headeranchor" height="26">
<top />
<left offset="40" />
<right offset="-25" />
</anchored>
</metalplate>
</template>


For sure a catch 22.

bmos
August 17th, 2022, 14:12
As I'm not going to override every header I'm just overriding this to back it up -25 for extra button I added - this won't be playing nice for anyone else who adds ct_section buttons in now because of the way this was set to go off the right size of the header_label.

<template name="frame_ctbox_host_header_labels">
<metalplate name="header_labels">
<anchored to="headeranchor" height="26">
<top />
<left offset="40" />
<right offset="-25" />
</anchored>
</metalplate>
</template>


For sure a catch 22.Can't you just use insertbefore?
That seems to be how the 5E ruleset is adding columns without overwriting things from CoreRPG.

CoreRPG:


<windowclass name="client_ct_entry">
<margins control="0,0,0,2" />
<frame>ctentrybox</frame>
<script file="ct/scripts/clientct_entry.lua" />
<sheetdata>
<hidden_record_isidentified name="isidentified" />
<hlink_clientct name="link" />
<hs name="tokenrefid" />
<hs name="tokenrefnode" />
<hn name="tokenvis" />

<spacer_ctentry_active_top name="active_spacer_top" />

<button_clientct_active name="active" />
<token_clientct name="token" />

<anchor_ctentry_right name="rightanchor" />
<button_clientct_activateeffects name="activateeffects" />
<button_ctentry_friendfoe name="friendfoe" />
<number_clientct_init name="initresult" />

<string_clientct_name name="name" />
<string_clientct_name name="nonid_name">
<invisible />
</string_clientct_name>

<icon_clientctsection_effect name="effecticon" />
<spacer_clientctsection_effect name="effectspacer" />
<list_clientct_effect name="effects" />

<string_ctentry_targets name="target_summary" />
<string_ctentry_effects name="effect_summary" />

<spacer_ctentry_middle name="spacer" />
<spacer_ctentry_active_bottom name="active_spacer_bottom" />
</sheetdata>
</windowclass>

5E:

<windowclass name="client_ct_entry" merge="join">
<script file="ct/scripts/clientct_entry.lua" />
<sheetdata>
<base_clientct_health name="healthbase" insertbefore="initresult" />
<string_clientct_status name="status" insertbefore="initresult" />
<number_clientct_wounds name="wounds" insertbefore="initresult" />
<number_clientct_hptemp name="hptemp" insertbefore="initresult" />
<number_clientct_hp name="hptotal" insertbefore="initresult" />

<sub_ct_section name="sub_active" insertbefore="sub_effects" />
</sheetdata>
</windowclass>

In case it helps, here is what those 5E templates look like:

<template name="base_clientct_health">
<genericcontrol name="healthbase">
<anchored to="rightanchor" width="110" height="20">
<top />
<right anchor="left" relation="relative" offset="-10" />
</anchored>
<disabled />
</genericcontrol>
</template>
<template name="string_clientct_status">
<simplestring name="status">
<anchored to="healthbase" position="over" />
<frame name="fieldlight" offset="7,5,7,5" />
<center />
<static />
<invisible />
</simplestring>
</template>
<template name="number_clientct_wounds">
<number_ct_static name="wounds">
<anchored to="healthbase" width="30" height="20">
<top />
<right />
</anchored>
<min value="0" />
<script>
function onValueChanged()
window.onHealthChanged();
end
</script>
</number_ct_static>
</template>
<template name="number_clientct_hptemp">
<number_ct_static name="hptemp">
<anchored to="wounds" width="30" height="20">
<top />
<right anchor="left" offset="-10" />
</anchored>
<color>0000AA</color>
<script>
function onValueChanged()
window.onHealthChanged();
end
</script>
</number_ct_static>
</template>
<template name="number_clientct_hp">
<number_ct_static name="hptotal">
<anchored to="hptemp" width="30" height="20">
<top />
<right anchor="left" offset="-10" />
</anchored>
<min value="0" />
<script>
function onValueChanged()
window.onHealthChanged();
end
</script>
</number_ct_static>
</template>

SilentRuin
August 17th, 2022, 18:23
Can't you just use insertbefore?


Not sure what your looking at but in 5e - ct_host.xml - this is the header labels I'm referring to - they are hardcoded - you can't just "insert" your way into changing those as they are tied to the right - while the things they are supposed to be line up with are placed relative. So when an insert happens in the relative ct_entry section - the above header_labels will never line up unless you shorten the length of the frame its positioning from (I'm not going override all the labels to do something sensible just for me).
I've highlighted the hardcoded positioning below:


<frame_ctbox_host_header_labels name="header_labels" />
<label_ct name="label_name">
<anchored to="header_labels" position="insidetopleft" offset="0,3">
<right offset="-343" />
</anchored>
<static textres="ct_label_name" />
<center />
</label_ct>
<label_ct name="label_init">
<anchored to="header_labels" position="insidetopright" offset="303,3" width="30" />
<static textres="init" />
<center />
</label_ct>
<label_ct name="label_hp">
<anchored to="header_labels" position="insidetopright" offset="258,3" width="30" />
<static textres="hp" />
<tooltip textres="hitpoints" />
<center />
</label_ct>
<label_ct name="label_temp">
<anchored to="header_labels" position="insidetopright" offset="218,3" width="30" />
<static textres="ct_label_hptemp" />
<tooltip textres="ct_tooltip_hptemp" />
<center />
</label_ct>
<label_ct name="label_wounds">
<anchored to="header_labels" position="insidetopright" offset="178,3" width="30" />
<static textres="ct_label_wounds" />
<tooltip textres="ct_tooltip_wounds" />
<center />
</label_ct>