AmadanNaBriona
April 20th, 2020, 23:59
Trying to duplicate the Effects window in the D&D 2E to adapt it for my ruleset, I literally copied the code from the former ruleset's utility_effects.xml in its entirety to mine, changing only the references to conditions (to point to the correct file for my ruleset).
But here is the 2E window:
34131
And here is mine:
34132
So what stupid-obvious thing am I missing to explain why the layout is different and wrong in mine?
Here's the 2E code for utility_effects.xml. The code in red is literally the only thing I have changed (to use the correct filename).
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->
<root>
<windowclass name="effectlist">
<frame>utilitybox3</frame>
<placement>
<size width="520" height="525" />
</placement>
<sizelimits>
<dynamic />
<minimum width="520" height="525" />
</sizelimits>
<playercontrol />
<nodelete />
<tooltip textres="library_recordtype_label_effect" />
<script>
function onInit()
local nHalf = math.ceil(#(DataCommon.conditions) / 2);
for i = 1, nHalf do
local sEffect1 = StringManager.capitalize(DataCommon.conditions[i]);
local c1 = createControl("button_effect", "condition_" .. i);
c1.setEffect(sEffect1);
if (nHalf + i <= #(DataCommon.conditions)) then
local sEffect2 = StringManager.capitalize(DataCommon.conditions[nHalf + i]);
local c2 = createControl("button_effectright", "condition_" .. (nHalf + i));
c2.setEffect(sEffect2);
end
end
end
</script>
<sheetdata>
<windowtitlebar name="title">
<resource>library_recordtype_label_effect</resource>
</windowtitlebar>
<anchor_title_utilitybox3 name="contentanchor" />
<!-- Conditions -->
<label name="label_conditions">
<anchored to="contentanchor" width="170" height="20">
<top anchor="bottom"/>
<left />
</anchored>
<static textres="effect_label_conditions" />
<color>FFFFFF</color>
<center />
</label>
<genericcontrol name="buttonanchor">
<anchored to="contentanchor" width="170" height="0">
<top anchor="bottom" offset="15" />
<left />
</anchored>
</genericcontrol>
<!-- Custom -->
<label name="label_custom">
<anchored to="contentanchor" height="20">
<top anchor="bottom" />
<left offset="195" />
<right offset="-10" />
</anchored>
<static textres="effect_label_custom" />
<color>FFFFFF</color>
<center />
</label>
<list_effects name="list" />
<scrollbar_list />
<anchor_campaign2 />
<button_iedit_campaign />
<button_iadd_utility />
<filter_utility />
<resize_utilitybox3 />
<helper_effects />
<close_utilitybox3 />
</sheetdata>
</windowclass>
<windowclass name="effectsmall">
<margins control="0,0,0,2" />
<script file="utility/scripts/effect.lua" />
<sheetdata>
<buttoncontrol>
<anchored position="insidetopleft" offset="2,2" width="20" height="20" />
<icon normal="button_action_effect" pressed="button_action_effect_down" />
<script>
function onDragStart(button, x, y, draginfo)
return window.actionDrag(draginfo);
end
function onButtonPress(x, y)
return window.action();
end
</script>
</buttoncontrol>
<button_iconcycler name="apply">
<bounds>27,7,24,10</bounds>
<gmeditonly />
<parameters>
<icons>button_toggle_action|button_toggle_roll|button_tog gle_single</icons>
<values>action|roll|single</values>
<tooltipsres>effect_tooltip_applyone|effect_tooltip_applyroll|e ffect_tooltip_applysingle</tooltipsres>
<defaulticon>button_toggle_all</defaulticon>
<defaulttooltipres>effect_tooltip_applyall</defaulttooltipres>
</parameters>
</button_iconcycler>
<genericcontrol name="rightanchor">
<anchored height="0" width="0">
<top />
<right />
</anchored>
</genericcontrol>
<button_idelete name="idelete">
<anchored>
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-5" />
</anchored>
</button_idelete>
<buttonfield name="isgmonly">
<anchored width="20" height="20">
<top offset="3" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-5" />
</anchored>
<gmvisibleonly />
<gmeditonly />
<state icon="visibilityon" tooltipres="effect_visibilityon" />
<state icon="visibilityoff" tooltipres="effect_visibilityoff" />
<gmvisibleonly />
</buttonfield>
<button_stringcycler name="unit">
<anchored width="30">
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-10" />
</anchored>
<gmeditonly />
<parameters>
<defaultlabelres>effect_label_durunitrnd</defaultlabelres>
<labelsres>effect_label_durunitmin|effect_label_durunithr|eff ect_label_durunitday</labelsres>
<values>minute|hour|day</values>
</parameters>
<script>
function onDragStart(button, x, y, draginfo)
return window.actionDrag(draginfo);
end
</script>
</button_stringcycler>
<basicnumber name="duration">
<anchored width="20" height="20">
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-10" />
</anchored>
<gmeditonly />
<min>0</min>
<default>1</default>
<script>
function onDragStart(button, x, y, draginfo)
return window.actionDrag(draginfo);
end
</script>
<tabtarget prev="label" />
</basicnumber>
<string_textlistitem name="label">
<anchored position="insidetopleft" offset="55,2" height="20">
<right parent="rightanchor" anchor="left" relation="relative" offset="-10" />
</anchored>
<gmeditonly />
<script>
function onDragStart(button, x, y, draginfo)
return window.actionDrag(draginfo);
end
function onDoubleClick(x, y)
return window.action();
end
</script>
<tabtarget next="duration" />
</string_textlistitem>
</sheetdata>
</windowclass>
</root>
But here is the 2E window:
34131
And here is mine:
34132
So what stupid-obvious thing am I missing to explain why the layout is different and wrong in mine?
Here's the 2E code for utility_effects.xml. The code in red is literally the only thing I have changed (to use the correct filename).
<?xml version="1.0" encoding="iso-8859-1"?>
<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->
<root>
<windowclass name="effectlist">
<frame>utilitybox3</frame>
<placement>
<size width="520" height="525" />
</placement>
<sizelimits>
<dynamic />
<minimum width="520" height="525" />
</sizelimits>
<playercontrol />
<nodelete />
<tooltip textres="library_recordtype_label_effect" />
<script>
function onInit()
local nHalf = math.ceil(#(DataCommon.conditions) / 2);
for i = 1, nHalf do
local sEffect1 = StringManager.capitalize(DataCommon.conditions[i]);
local c1 = createControl("button_effect", "condition_" .. i);
c1.setEffect(sEffect1);
if (nHalf + i <= #(DataCommon.conditions)) then
local sEffect2 = StringManager.capitalize(DataCommon.conditions[nHalf + i]);
local c2 = createControl("button_effectright", "condition_" .. (nHalf + i));
c2.setEffect(sEffect2);
end
end
end
</script>
<sheetdata>
<windowtitlebar name="title">
<resource>library_recordtype_label_effect</resource>
</windowtitlebar>
<anchor_title_utilitybox3 name="contentanchor" />
<!-- Conditions -->
<label name="label_conditions">
<anchored to="contentanchor" width="170" height="20">
<top anchor="bottom"/>
<left />
</anchored>
<static textres="effect_label_conditions" />
<color>FFFFFF</color>
<center />
</label>
<genericcontrol name="buttonanchor">
<anchored to="contentanchor" width="170" height="0">
<top anchor="bottom" offset="15" />
<left />
</anchored>
</genericcontrol>
<!-- Custom -->
<label name="label_custom">
<anchored to="contentanchor" height="20">
<top anchor="bottom" />
<left offset="195" />
<right offset="-10" />
</anchored>
<static textres="effect_label_custom" />
<color>FFFFFF</color>
<center />
</label>
<list_effects name="list" />
<scrollbar_list />
<anchor_campaign2 />
<button_iedit_campaign />
<button_iadd_utility />
<filter_utility />
<resize_utilitybox3 />
<helper_effects />
<close_utilitybox3 />
</sheetdata>
</windowclass>
<windowclass name="effectsmall">
<margins control="0,0,0,2" />
<script file="utility/scripts/effect.lua" />
<sheetdata>
<buttoncontrol>
<anchored position="insidetopleft" offset="2,2" width="20" height="20" />
<icon normal="button_action_effect" pressed="button_action_effect_down" />
<script>
function onDragStart(button, x, y, draginfo)
return window.actionDrag(draginfo);
end
function onButtonPress(x, y)
return window.action();
end
</script>
</buttoncontrol>
<button_iconcycler name="apply">
<bounds>27,7,24,10</bounds>
<gmeditonly />
<parameters>
<icons>button_toggle_action|button_toggle_roll|button_tog gle_single</icons>
<values>action|roll|single</values>
<tooltipsres>effect_tooltip_applyone|effect_tooltip_applyroll|e ffect_tooltip_applysingle</tooltipsres>
<defaulticon>button_toggle_all</defaulticon>
<defaulttooltipres>effect_tooltip_applyall</defaulttooltipres>
</parameters>
</button_iconcycler>
<genericcontrol name="rightanchor">
<anchored height="0" width="0">
<top />
<right />
</anchored>
</genericcontrol>
<button_idelete name="idelete">
<anchored>
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-5" />
</anchored>
</button_idelete>
<buttonfield name="isgmonly">
<anchored width="20" height="20">
<top offset="3" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-5" />
</anchored>
<gmvisibleonly />
<gmeditonly />
<state icon="visibilityon" tooltipres="effect_visibilityon" />
<state icon="visibilityoff" tooltipres="effect_visibilityoff" />
<gmvisibleonly />
</buttonfield>
<button_stringcycler name="unit">
<anchored width="30">
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-10" />
</anchored>
<gmeditonly />
<parameters>
<defaultlabelres>effect_label_durunitrnd</defaultlabelres>
<labelsres>effect_label_durunitmin|effect_label_durunithr|eff ect_label_durunitday</labelsres>
<values>minute|hour|day</values>
</parameters>
<script>
function onDragStart(button, x, y, draginfo)
return window.actionDrag(draginfo);
end
</script>
</button_stringcycler>
<basicnumber name="duration">
<anchored width="20" height="20">
<top offset="2" />
<right parent="rightanchor" anchor="left" relation="relative" offset="-10" />
</anchored>
<gmeditonly />
<min>0</min>
<default>1</default>
<script>
function onDragStart(button, x, y, draginfo)
return window.actionDrag(draginfo);
end
</script>
<tabtarget prev="label" />
</basicnumber>
<string_textlistitem name="label">
<anchored position="insidetopleft" offset="55,2" height="20">
<right parent="rightanchor" anchor="left" relation="relative" offset="-10" />
</anchored>
<gmeditonly />
<script>
function onDragStart(button, x, y, draginfo)
return window.actionDrag(draginfo);
end
function onDoubleClick(x, y)
return window.action();
end
</script>
<tabtarget next="duration" />
</string_textlistitem>
</sheetdata>
</windowclass>
</root>