PDA

View Full Version : Ruleset error...with windowclass



GrimmSpector
February 22nd, 2016, 05:45
Getting this error, two files are below, first is the main file, second is the include file, LUA is inline, looks like an issue with it not finding the class I've set up? But it seems fine when I look at it. Probably something silly small again. Hope someone can point out my error, thanks!

Main:


<?xml version="1.0" encoding="iso-8859-1"?>

<!--
Please see the license.html file included with this distribution for
attribution and copyright information.
-->

<root>
<include source="charsheet_listclasses.xml" />
<windowclass name="charsheet_main">
<margins control="0,0,0,2" />
<sheetdata>
<genericcontrol name="attributesframe">
<bounds>15,90,220,200</bounds>
<frame>
<name>sheetgroup</name>
</frame>
<stringcontrol>
<anchored>
<to>attributesframe</to>
<position>insidetopleft</position>
<offset>15,8</offset>
<size>
<width>110</width>
</size>
</anchored>
<font>sheetlabelsmall</font>
<static>Attribute</static>
</stringcontrol>
<stringcontrol>
<anchored>
<to>attributesframe</to>
<position>insidetopleft</position>
<offset>115,8</offset>
<size>
<width>35</width>
</size>
</anchored>
<font>sheetlabelsmall</font>
<static>Score</static>
<center />
</stringcontrol>
<stringcontrol>
<anchored>
<to>attributesframe</to>
<position>insidetopleft</position>
<offset>165,8</offset>
<size>
<width>35</width>
</size>
</anchored>
<font>sheetlabelsmall</font>
<static>Link</static>
<center />
</stringcontrol>
<stringcontrol>
<anchored>
<to>attributesframe</to>
<position>insidetopleft</position>
<offset>205</offset>
<size>
<width>35</width>
</size>
</anchored>
<font>sheetlabelsmall</font>
<static>XP</static>
<center />
</stringcontrol>
</genericcontrol>
<windowlist name="attributes">
<anchored>
<to>attributesframe</to>
<position>over</position>
<offset>-15,-20</offset>
</anchored>
<class>charsheet_attribute</class>
<datasource>.attributes</datasource>
<noscroll />
<script>
STR = nil;
BOD = nil;
RFL = nil;
DEX = nil;
INT = nil;
WIL = nil;
CHA = nil;
EDG = nil;

local order = 1;

function onInit()
STR = addEntry("STR","Strength");
BOD = addEntry("BOD", "Body");
RFL = addEntry("RFL", "Reflex");
DEX = addEntry("DEX", "Dexterity");
INT = addEntry("INT", "Intelligence");
WIL = addEntry("WIL", "Willpower");
CHA = addEntry("CHA", "Charisma");
EDG = addEntry("EDG", "Edge");
applySort();
end

function addEntry(name, label)
local node = getDatabaseNode().getChild(name);
local win = nil;
if not node then
node = getDatabaseNode().createChild(name);
end
for i,w in ipairs(getWindows()) do
if w.getDatabaseNode().getName()==name then
win = w;
end
end
if win then
win.label.setValue(label);
win.order.setValue(order);
order = order + 1;
end
return win;
end

function onSortCompare(w1, w2)
return (w1.order.getValue() > w2.order.getValue());
end
</script>
<skipempty />
</windowlist>
</sheetdata>
</windowclass>

<windowclass name="char_main_category_header">
<margins control="0,0,0,5" />
<frame>rowshade</frame>
<sheetdata>
<genericcontrol name="leftanchor">
<anchored height="0" width="0">
<top offset="5" />
<left offset="10" />
</anchored>
</genericcontrol>

<genericcontrol name="rightanchor">
<anchored height="0" width="0">
<top offset="5" />
<right offset="-10" />
</anchored>
</genericcontrol>

<stringfield name="label">
<anchored>
<top offset="5" />
<left offset="30" />
<right offset="-30" />
</anchored>
<stateframe>
<keyedit name="fieldfocus" offset="7,5,7,5" />
<hover name="fieldfocus" offset="7,5,7,5" hidereadonly="true" />
<drophilight name="fieldfocus" offset="7,5,7,5" hidereadonly="true" />
</stateframe>
<font>reference-b-large</font>
<multilinespacing>20</multilinespacing>
<center />
</stringfield>
</sheetdata>
</windowclass>
</root>


Include:


<?xml version="1.0" encoding="iso-8859-1"?>

<root version="1.0">
<windowclass name="charsheet_attribute">
<sizelimits>
<maximum>
<height>23</height>
</maximum>
<minimum>
<height>23</height>
</minimum>
</sizelimits>
<sheetdata>
<numbercontrol name="order">
<bounds>0,0,0,0</bounds>
<invisible />
</numbercontrol>
<stringcontrol name="label">
<anchored>
<position>insidetopleft</position>
<offset>0,6</offset>
<size>
<width>95</width>
<height>17</height>
</size>
</anchored>
<font>sheetlabel</font>
<static />
</stringcontrol>
<numberfield name="score">
<anchored>
<position>insidetopleft</position>
<offset>100,1</offset>
<size>
<width>35</width>
<height>20</height>
</size>
</anchored>
<font>sheettext</font>
<frame>
<name>modifier</name>
<offset>5,4,5,4</offset>
</frame>
<keyeditframe>
<name>sheetfocus</name>
<offset>5,4,5,4</offset>
</keyeditframe>
</numberfield>
<numberfield name="link">
<anchored>
<to>score</to>
<position>right</position>
<offset>15</offset>
<size>
<width>35</width>
</size>
</anchored>
<font>sheettext</font>
<frame>
<name>modifier</name>
<offset>5,4,5,4</offset>
</frame>
<keyeditframe>
<name>sheetfocus</name>
<offset>5,4,5,4</offset>
</keyeditframe>
</numberfield>
<numberfield name="XP">
<anchored>
<to>link</to>
<position>right</position>
<offset>15</offset>
<size>
<width>35</width>
</size>
</anchored>
<font>sheettext</font>
<frame>
<name>modifier</name>
<offset>5,4,5,4</offset>
</frame>
<keyeditframe>
<name>sheetfocus</name>
<offset>5,4,5,4</offset>
</keyeditframe>
</numberfield>
</sheetdata>
</windowclass>
</root>

Moon Wizard
February 22nd, 2016, 08:39
What's the error you are getting exactly?

You can copy the console window text to the Windows clipboard by selecting the "Copy To Clipboard" option in the console window. Just paste it here, and it will help point us closer to the issue.

Regards,
JPG

leozelig
February 22nd, 2016, 12:38
Make sure the the file with the windowclass is included in the base.xml file.

GrimmSpector
February 22nd, 2016, 15:00
it needs to be included in both files? Or specifically must be included in the base file?

Edit: Well putting the include directive in both seems to have fixed the issue, but now it looks like my frames/generics aren't rendering anything, so no pretty frames on my controls, strange.

GrimmSpector
February 22nd, 2016, 17:40
ok, so I've got some of this working, but it looks like it's not rendering the frames, or genericcontrol area at all, so I'm just getting blank text, and I can edit the fields as expected, here's a screen shot. And if you look at the code you'll see in the included file the second two numbers on each line should have frames, and edit frames, and the whole thing should have a generic control window frame around it as per the main file.

13119

Moon Wizard
February 22nd, 2016, 19:25
One thing I did notice was that your stringcontrol "labels" are inside the genericcontrol XML defintion, which means they would be ignored.

Also, make sure the "sheetgroup" frame is defined somewhere in your ruleset. There should be a <framedef name="sheetgroup"> somewhere.

You can also define like this:
<frame name="separatorline" />

Regards,
JPG

GrimmSpector
February 22nd, 2016, 19:39
One thing I did notice was that your stringcontrol "labels" are inside the genericcontrol XML defintion, which means they would be ignored.

Also, make sure the "sheetgroup" frame is defined somewhere in your ruleset. There should be a <framedef name="sheetgroup"> somewhere.

You can also define like this:
<frame name="separatorline" />

Regards,
JPG

Hmmm good point, I adjusted that, looks like no visible change on the sheet though. Shouldn't have anything to do with the frames/generic control drawing, since the frames are in the include, part of the class construct, and the generic control should be rendering on it's own anyways...

But I imagine that would have stopped the string headers from rendering above the columns, though they still aren't showing...

Trenloe
February 22nd, 2016, 19:46
Open the FG console using /console before you open your custom window for the first time. Are there any warnings/errors?

Also, post here the full XML for your sheetgroup framedef - where is this defined?

GrimmSpector
February 22nd, 2016, 20:21
Console is empty, no errors before opening.

Errors after, font not found, I imagine that's why the text labels aren't showing up at least, which is fine I'll just have to see if the font I'm looking for is in the dir, probably isn't.

"sheetgroup" was a frame referenced in the anatomy of a ruleset doc, so I assumed it was a standard class defined by the corerpg set...looks like a lot has changed for how those frames work, so I'm going to poke around CoreRPG and PFRPG/3.5E sets and see if I can figure out the issue.

Though I'd have expected a console error telling me that sheetgroup isn't defined if it's missing...

Trenloe
February 22nd, 2016, 20:24
Anatomy of a Ruleset was created 8 years ago. The main principles are still the same, but any references should be thoroughly checked in the ruleset you're using. Hence why Moon Wizard mentioned above "make sure the "sheetgroup" frame is defined somewhere in your ruleset.".

Trenloe
February 22nd, 2016, 20:27
Golden Rule: don't assume anything, always check that elements you're referencing exist in the ruleset/s you're using.

GrimmSpector
February 22nd, 2016, 20:28
Good call!

I don't suppose there is much documentation on the types of frame setups and all those bits for the more recent stuff...a quick grep shows me that there's no such frame reference, which is probably a big part of my problem. So I'll have to dig through the files and find them.

Given that I'll eventually want to replace them with appropriately themed styles, I suppose getting to know them in more detail isn't a bad idea! Thanks again guys. I'll post again if I have further difficulty with this particular issue.

Moon Wizard
February 22nd, 2016, 21:12
There are no built-in graphical assets (frame, font, dice, templates, etc.); so if it's not defined in your ruleset, then FG will not be able to find it.

This is one of the reasons that the ruleset layering system and CoreRPG layer were created; in order to lessen the burden on defining every asset when you just one to change one sheet (or just a few sheets).

Regards,
JPG

GrimmSpector
February 22nd, 2016, 21:30
Makes sense, thanks. I figured that was the case, I was just hoping that the guide was modifying existing assets so I could get a handle on the concepts. Worked out ok, and I'm making progress, thanks guys!