Things to Know
General
* You are trying to "merge" in your scripts. Scripts don't allow merging, but they do layer. It's very similar, but an important distinction. This happens automatically and no merge tag is required.
* For layers, script calls will fall through to a lower layer, but any calls on the same layer only call functions on the same layer. This can be bypassed by using "super" and "self" variables.
* Additionally, each layer has it's own scope, which means that local variables are only accessible within the layer, not across layers.
getWindowSortByNode
* So, the reason your getWindowSortByNode is not getting called is because, the call to getWindowSortByNode in the original script is the one in the same layer as the updateHeaders function. (i.e. not yours which is one layer higher)
setHeaderCategory
* Since the setHeaderCategory calls are being made from outside the script, then the calls start at the top layer and fall down through the layers. Since your newly defined script is the top layer, then your version of setHeaderCategory is getting called.
The Fix
Since you are trying to replace a function that is only called within the same script and uses variables that are local to the script that other functions also depend on, you will need to replace the entire script in that case. So, you would need something like:
Regards,Code:<windowclass name="power_page" merge="join">
<script merge="delete" />
<script file="campaign/scripts/power_page_new.lua" />
</windowclass>
<windowclass name="power_group_header" merge="join">
<script>
function setHeaderCategory(rGroup, sGroup, nLevel, bAllowDelete)
if sGroup == "" then
name.setValue(Interface.getString("char_label_powers"));
name.setIcon("char_abilities_orange");
else
if rGroup.grouptype ~= "" then
if not nLevel then
name.setValue(sGroup);
elseif nLevel == 0 then
name.setValue(sGroup .. " (" .. Interface.getString("power_label_groupcantrips") .. ")");
else
name.setValue(sGroup .. " (" .. Interface.getString("level") .. " " .. nLevel .. ")");
end
name.setIcon("char_powers");
level.setValue(nLevel);
else
name.setValue(sGroup);
name.setIcon("char_abilities_orange");
end
group.setValue(sGroup);
setNode(rGroup.node);
if bAllowDelete then
idelete.setVisibility(true);
end
end
end
</script>
</windowclass>
JPG