PDA

View Full Version : Extension and png error?



Felderburg
November 23rd, 2023, 06:37
It was recommended on discord that I post this here:

Hello, I have a question about an extension I'm trying to make. It's to add sidebars in Star Trek 2d20, and it mostly does what I need it to in that I have sidebar menu items and can enter stuff in them.

However, when I try to change the icons for the sidebar, I get:

[ERROR] Error loading extension XML file. [STA Reputation Spends 2] [graphics/sidebar/sidebar_icon_background.png]: Invalid character in the given encoding. Line 1, position 1.
That almost looks like it's saying the error is in the png file? I copy/pasted the icons from CoreRPG's icons (unzipped ruleset "C:\Users\redacted\AppData\Roaming\SmiteWorks\Fanta sy Grounds\rulesets\CoreRPG\graphics\sidebar") so that shouldn't be causing issues, and the line 1 position 1 of all actual xml files is "<", as part of the xml version prolog.

superteddy57
November 23rd, 2023, 06:39
Well the path you pasted has a space in Fantasy

Felderburg
November 23rd, 2023, 06:47
Well the path you pasted has a space in Fantasy

I think that got added when I copy/pasted from discord; it's not there in the original discord post. Either way, that's where I got the png from, not where it's located in the extension.

(Edit: It's also not present when I go to edit my original post here, so *shrug*.)

Trenloe
November 23rd, 2023, 08:17
Adding a space in long strings is a "feature" of the forum software.

@Felderburg - assuming the ruleset is layered on top of the CoreRPG ruleset (which I believe STA is) then you don't need to copy resources from CoreRPG - you can just reference them with the CoreRPG resource name - in this case the icon resource name is "sidebar_icon_recordtype_background"

If you've edited the graphics file, then that's a different matter...

I think the reason for the error you detail in post #1 is that you've used <includefile source="graphics/sidebar/sidebar_icon_background.png" /> in your extension. <includefile> is for XML files only. To reference an icon resource, use the <icon> tag - for example (taken from CoreRPG): <icon name="sidebar_icon_recordtype_background" file="graphics/sidebar/sidebar_icon_background.png" />

Felderburg
November 25th, 2023, 21:54
I think the reason for the error you detail in post #1 is that you've used <includefile source="graphics/sidebar/sidebar_icon_background.png" /> in your extension. <includefile> is for XML files only. To reference an icon resource, use the <icon> tag - for example (taken from CoreRPG): <icon name="sidebar_icon_recordtype_background" file="graphics/sidebar/sidebar_icon_background.png" />

That was it, thanks! So I don't need to include the graphics since they're part of the CoreRPG default set, but I assume Istill need the graphics xml to tell it what icons I want where?

Trenloe
November 25th, 2023, 22:56
...but I assume Istill need the graphics xml to tell it what icons I want where?
The XML files under the ruleset graphics directory purely define the icons, frames, etc. resources - basically matching a name to a graphics file.

For example:


<icon name="sidebar_icon_recordtype_background" file="graphics/sidebar/sidebar_icon_background.png" />

This means that in the ruleset, or extensions, this graphic file resource can be referred to as "sidebar_icon_recordtype_background" when you're defining your own graphical elements (buttons, controls, etc). See the "Icons" section in the Wiki ruleset guide here: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644438/Ruleset+-+Assets

And also the developer API: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996645466/icon