PDA

View Full Version : How would have an EXPERIENCED xml guy done this change to a MoreCore window



Varsuuk
May 9th, 2021, 06:41
Hey there, I was trying to change a couple fields in MoreCore's record_spells.xml (campaign) in my extension.
So I added the file, removed the unchanging stuff and tried to merge some changes. No matter what I did, I could not get them to go in right place (replacing existing Spell Level / Spell Cost elements.
(one thing, the first divider is not given a name so I cannot remove it or reference it so it was "extra" no matter what.)

Eventually I gave up and did the "test" update to the roller part and did a delete after delete merge rule to "clear" everything then readded my updated fields. No linking original since it is there for anyone with MoreCore (1.62):



...

<windowclass name="spells_stats" merge="join">
<script>
function onInit()
update();
end
function update()
local bReadOnly = WindowManager.getReadOnlyState(getDatabaseNode());
description.setReadOnly(bReadOnly);
end
</script>
<sheetdata>
<!-- <anchor_column name="columnanchor" />

<label_column>
<static textres="ref_label_command" />
</label_column> -->
<string_column name="clichatcommand" merge="join">
<script>
function onLoseFocus( )
local nameWindowDBNode = window.getDatabaseNode()
local nodeWin = nameWindowDBNode
local sName = nodeWin.getChild("name").getValue()
local sCommand = nodeWin.getChild("clichatcommand").getValue()
local sRollstype = nodeWin.getChild("rollstype").getValue();

local nStart,nEnd,sCommand,sParams = string.find(sCommand, '^/([^%s]+)%s*(.*)');

--[[ Will add my own icon overrides here calling "base" if not handled --]]
if sCommand == "TEST" then
nodeWin.getChild("rollstype").setValue("heal")
else
super.onLoseFocus()
end
end

</script>
</string_column>


<label_column name="new_spells_lvl" merge="delete"/>
<number_column name="new_spells_level" merge="delete"/>
<label_column_right name="new_spells_cst" merge="delete"/>
<number_column_right name="new_spells_cost" merge="delete"/>
<line_column name="divider" merge="delete"/>
<ft_columnh name="description" merge="delete"/>


<label_column name="label_new_spells_class">
<static textres="new_spells_class" />
</label_column>
<string_column name="new_spells_class"/>

<label_column name="new_spells_lvl">
<static textres="new_spells_level" />
</label_column>
<number_column name="new_spells_level">
<default>1</default>
</number_column>


<line_column name="divider" />

<ft_columnh name="description">
<separator>line_desc</separator>
</ft_columnh>
</sheetdata>
</windowclass>

superteddy57
May 9th, 2021, 07:07
With all those deletes and merges, might be best to just clone the windowclass and make your own

Varsuuk
May 9th, 2021, 07:14
I dig that, basically all I wanted is to be able to access the base windowclass’ onLoseFocus() for cases where I am not overriding and to allowed chance for Damned updates (hmmm lol) to be used automatically when morecore was updated to a newer version.

I probably should have pointed this out and asked the better question:

Assuming I wanted to call super for just that one method - what’s the best way to go?

(I tried NOT deleting all those but I couldn’t get the elements I wanted to appear in place where old ones were)

damned
May 9th, 2021, 07:42
Its a catch 22 Varsuuk

The "delete" method is correct but some of these pages are quite complex and not friendly for that process.
That is actually why moredata exists - these were all flip frame on the more window originally...

Varsuuk
May 9th, 2021, 16:38
Gotcha.

The window I am speaking about has:



Diceroll:
Separator
Level: Cost:
Separator
Description:


If I recall here away from the PC

Mine was just minor change except it changes the template on the Dara from number to string too:



Diceroll:
Separator
Class:
Level:
Separator
Description:

I don’t have Class: & Level: on same line only because class is strong and that doesn’t seem to fit on with the spacing those templates give mixed with a number field following the other direction works. I’m sure I could find one or edit a new template to do it but new line is fine and I said FIDO.

I’m talking the SPELLS sidebar dialog not the More or MoreData sheet.

damned
May 10th, 2021, 00:33
Spells.... I thought Spells were deprecated in MoreCore... Generally use Rolls for everything...

Varsuuk
May 10th, 2021, 07:28
Well, I do use Rolls for "everything" but thought the record_spells you left in MoreCore (oops?) was a nice was to include a "dice roll" AND be able to add more fields to it if I so desired. Then when you looked at it, it was nice and clean (the clisomething has tons of fields) where you just see description, my fields and of course, the diceroll. Then I edited some of the listboxes to have "accepts from" to include Spells. I can drag from rolls or spells to it.

Then plan on adding GM/Player buttons to spells so you can click "Cleric" or "Magic-user" to see only them and "view by class/level" etc. In my "Rolls" sidebar, I just have "categories" - adding "Cleric" "Magic-user" buttons there seemed too specialized and if I did that for several things it would be crowded.

But, if I am wrong due to things I don't know yet - would gladly make the changes, I am only up to letter "D" in spells thus far.