PDA

View Full Version : MoreCore: Just noticed I broke something big. Not sure when



Varsuuk
August 7th, 2020, 04:43
I have git entries for all my changes, so I will backtrack. However, I was planning on other work tonight and if anyone can point me in direction of where to look, you might be able to save me a lot of time.

Basically, just created a simple module of rolls and started testing arranging in the new Sheet layout when noticed that I could not DELETE rolls (CLIs in CASs) I already added. This is doable in MoreCore and CoreRPG normally via rightclick. But no delete option now pops up.

I went back to vanilla MoreCore and see that clicking in an empty box creates a stub entry for that particular list box.Agan, this no longer happens in mine.

If I was to guess, I'd say I broke it somewhere when I literally copied MoreCore's record_char_more to record_char_more_modded_morecoe.xml and early on made some changes in place then created my own record_char_more.xml to work with the copied file. I am in the middle of undoing a log of that, now that have better understanding - but in case I do not stumble across the answer - posting here.

damned
August 7th, 2020, 05:14
change the frame for the list so that you can see if teh list is actually there?

Varsuuk
August 7th, 2020, 18:01
Yeah, I haven't been able to do anything - a new work project JUST got nuts.

I am sure I can backtrace to where I broke it - if don't "see" it (likely) then simply by going back in my git until the problem goes away then seeing which commit did it for the culprit. I was concentrating on changing the appearance and layouts that I must have removed some "hook" for double-click and right-click. I'll first look at the window handler in More or Core to look for rightclick/dblclick code - then see how I bypassed it inadvertently (is my guess)

But it will be a couple days, hopefully over the weekend since during week I will likely be working past normal hours to make a 3 month deadline we were given yesterday which is going to be monitored closely by Development head and likely our CEO. Sucks, without my commute I have had extra time to work on personal stuff :( these last several weeks.


EDIT: Aw heck... so now financial news outlets have published an announcement a few hours ago from my firm on the project. Ah well, deadline is even more real. This is the equivalent of Columbus burning the boats. (if he did that - don't recall - someone did in history - whatever, you get my frazzled point. NO SLEEP 'TIL BROOKLN!

Varsuuk
August 8th, 2020, 08:22
Oddly, although it is really late and I might not be noticing something obvious. I received 2 errors on missing vertical anchors.
Thing is, both had been setup with: merge="delete"



<string_useredit name="pc_label_four">
<anchored to="combatframe" position="insidetopleft" offset="10,94" />
<default>C4</default>
<tooltip textres="label_editable" />
</string_useredit>


<frame_char_switch_attacks name="attackframe">
<!--<bounds>15,45,-190,120</bounds>-->
<anchored position="insidetopleft" offset="15,0">
<right anchor="center" offset="70" />
<!--<right parent="combatframe" anchor="left" offset="0" />-->
<!--<left anchor="left" offset="15" />-->
<bottom anchor="top" offset="215" />
</anchored>
</frame_char_switch_attacks>



The original update, I used the initial "controls" supplied (string_useredit, frame_char_switch_attacks) but they reported errors like:

Ruleset Error: window: No vertical anchor defined for control (pc_label_four) in windowclass (charsheet_more)
Ruleset Error: window: No vertical anchor defined for control (frame_char_switch_attacks) in windowclass (charsheet_more)

Until I changed the control types to "generic_control" in ADDITION to merge="delete"


<generic_control name="pc_label_four" merge="delete" />
<generic_control name="attackframe" merge="delete" />



Thoughts?

Varsuuk
August 9th, 2020, 00:45
Above I posted, even though in the end I got what I wanted (pooled the controls), because I had thought simply


<string_useredit name="pc_label_four" merge="delete" />
<frame_char_switch_attacks name="attackframe" merge="delete" />


should've worked...

damned
August 9th, 2020, 01:09
Above I posted, even though in the end I got what I wanted (pooled the controls), because I had thought simply


<string_useredit name="pc_label_four" merge="delete" />
<frame_char_switch_attacks name="attackframe" merge="delete" />


should've worked...

I only ever use the quoted code that you said didnt work...

Varsuuk
August 9th, 2020, 03:57
Yup, when I did that - I got the error I showed specifically in first post.

My THEORY is the custom control (string_useredit, frame_char_switch_attacks) have something in them that is because they have something in them that gets processed EVEN when deleting? Makes no sense. But I guess doesn't matter as long as I can just redefine it as a generic control and use delete there and no problems.


OK - I put Debug.console() on EVERY onDoubleClick() (before realizing it adds the first roll on a single click...sigh) and then every onClick() and onClickRelease()

I trigger the click and release when ROLL on the newly added roll but not when I click in a blank window (which causes the creation of the entry)


THING the HIT me... MAYBE I somehow clicked some "reasonly" option on those windows ("Attributes," "moves", "powers", "feats" etc) base "class"? I am so far wit's end wasted 3 hours so far on this. On and off.

Recap:
-Clicking in any of the "boxes"/lists I recapped above does nothing. No new entry created (and was still clear so should create initial one)
-If I DRAG an entry from the modules thing (which might be setup wrong RO/GM/etc?) to one of those boxes, it gets added but I cannot RIGHTCLICK it to delete it - that's how noticed both these issues.

Varsuuk
August 9th, 2020, 04:29
Rolled back in git to first "version" and still the same issue.
Grrrr... will look at first changes then - was hoping was a middle one since those tend to be smaller changes...


EDIT: HOPE sneaks in! As I said, my first "versioned" testing release had the problem. But not the first "commit" - so will keep rolling forward until it breaks then check it out. Might figure this out yet.

damned
August 9th, 2020, 04:30
maybe you have some not visible element appearing above/over the list and that is where the clicks are getting eaten?

Varsuuk
August 9th, 2020, 05:16
Thanks Damned- that was a good idea, I HAVE had invisible elements get me in past. This time though, I knew it was not it as I broke even other pages. That's when I realized which areas to look.


One thing that bothered me, when I was adding Attributes, was the sort method, so I changed that.

This was the original list_text from CoreRPG:


<template name="list_text">
<windowlist>
<child mergerule="resetandadd"></child>
<child><backcolor>1A40301E</backcolor></child>
<allowcreate />
<allowdelete />
<sortby mergerule="replace"><control>name</control></sortby>
<script file="common/scripts/list_text.lua" />
</windowlist>
</template>


But I wanted to change the sort. Not looking at the prior one too closely, I VERY early on (3rd commit) changed the sorting.
I had tried just changing<sortby> but that did not allow for complex if/else type sorting (to my knowledge) and switched to an embedded script.



<template name="list_text" merge="join">
<windowlist>
<script name="alt_sort_order">
function onSortCompare(w1, w2)
local node1AltSortOrder = DB.getValue(w1.getDatabaseNode(), "alt_sort_order")
local node2AltSortOrder = DB.getValue(w2.getDatabaseNode(), "alt_sort_order")

if node1AltSortOrder ~= nil and node2AltSortOrder ~= nil then
return node1AltSortOrder > node2AltSortOrder
else
return DB.getValue(w1.getDatabaseNode(), "name") > DB.getValue(w2.getDatabaseNode(), "name")
end
end
</script>
</windowlist>
</template>


This of course BLOWS AWAY the <script> thing.


Unless there is a way to "add script code in xml or lua to prior lua file" ... I guess my only fix is to copy the script from CoreRPG to my extension and add the one-sort code to that and use THAT version of the script.

I wish there was a "merge into existing script" attribute ;)

Varsuuk
August 9th, 2020, 05:23
Yup, that fixed it.

I changed my definition to:



<template name="list_text" merge="join">
<windowlist>
<child mergerule="resetandadd"></child>
<child><backcolor>1A40301E</backcolor></child>
<allowcreate />
<allowdelete />
<script file="common/scripts/list_text.lua" />
</windowlist>
</template>


And added the "onSortCompare" from above to the newly copied "list_text.lua" file I grabbed from CoreRPG.


I assume that was my only choice? Anyone have any better suggestions for me than copying code whole cloth like that?

Varsuuk
August 9th, 2020, 05:46
EDIT:

Turns out - I could ignore what I did above.

ie: delete the copied text_list.lua from CoreRPG.
Remove the entry for templates_list.xml in extension.xml in my extension (and delete the xml file)

because this in the record_char_more.xml file handles it for each control I wanted that functionality on:



<!-- Customize sorting for the Attributes list -->
<list_text name="cliroller1" merge="join">
<script file="utility/scripts/sort_methods/sort_on_alt_sort_order.lua" />
</list_text>



oops - I guess I left some orphaned stuff in git and forgot.


===> So the TAKEAWAY I should learn here, correct if wrong:

If I added the <script> to a redefined (with merge="join") template of same name "list_text" only the <script> in MY override goes into effect. BUT if I merely do an override of an named INSTANCE of that template (e.g. <list_text name="cliroller1" merge="join">) - I am able to ADD more "code" to the template's ummm... "code space?"

??

damned
August 9th, 2020, 06:22
Yes... if i understood you correctly - that is correct.