PDA

View Full Version : Extension String Resource Failure



Bidmaron
October 31st, 2017, 05:30
I am trying to add a button similar to the button on the right image in the Story window to the Tables window on the left. The button I have works when you press it, but the text is missing.

Image1.png (https://www.fantasygrounds.com/forums/attachment.php?attachmentid=21257&d=1509419000)

The template for the story window "Templates" button is below:



<template name="button_storytemplate">
<button_text_sm>
<anchored to="buttonanchor" width="80">
<top />
<left anchor="right" relation="relative" offset="5" />
</anchored>
<state textres="story_button_templates" />
<script>
function onButtonPress()
Interface.openWindow("masterindex", "storytemplate");
end
</script>
</button_text_sm>
</template>


Now that string resource is contained in the strings_campaign.xml file as:


<string name="story_button_templates">Templates</string>


Below is my generator.xml file that has the template for my button:


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


<!--
Template and interface materials for generators.
-->


<root>
<icon name="button_generators" file="button_generators.png" />
<!-- General -->
<template name="button_generators">
<button_text_sm>
<anchored to="buttonanchor" width="80">
<top />
<left anchor="right" relation="relative" offset="5" />
</anchored>
<state textres="generator_button_templates" />
<script>
function onButtonPress()
Interface.openWindow("masterindex", "generators");
end
</script>
</button_text_sm>
</template>


</root>


It is included by my extension file:


<?xml version="1.0" encoding="iso-8859-1"?>
<root version="2.8" logo="button_generators.png">
<properties>
<name>Generators</name>
<version>0.1</version>
<author>Bidmaron</author>
<description>Adds functionality to the built-in tables of Fantasy Grounds and augments Story Templates with Generators having additional functionality</description>
<!--<ruleset>
<name>CoreRPG</name>
<minrelease>3</minrelease>
</ruleset>-->
</properties>

<announcement text="Generators - v0.1 for FG V3.3.3 CoreRPG ruleset by Bidmaron. \rCopyright 2016 Smiteworks USA, LLC." font="emotefont" icon="button_generators"/>

<base>

<includefile source="generator.xml" />


<!-- String resources -->
includefile source="strings_super_table.xml"


<!-- Extension loading script - writes info to chat window and contains custom code -->
<script name="Tables_Plus" file="Tables Plus.lua" />
</base>
</root>


And that file also includes my string resources:[/COLOR]


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


<!--
String resources for Super Table.
-->


<root>
<string name="option_label_TABLEBEHAVIOR">Table Roll Behavior</string>
<string name="option_val_chat_IA">Chat Animation</string>
<string name="option_val_sync">No Animation</string>
<string name="option_val_legacy">Legacy</string>
<string name="column_separator">;</string>
<string name="row_separator">&#xD;</string>
<string name="roll_separator"></string>
<string name="generator_button_templates">Generators</string>
<!--error messages-->
<string name="table_error_format_illegal">Font formatting cannot be used inside a frame, or table.</string>
<string name="table_error_nested_format">Font formatting cannot be nested inside the same formatting.</string>
<string name="repeat_missing_target">Multiple roll specification is missing subtable definition.</string>
<string name="missing_endif">If statement missing the 'endif' terminator.</string>
<string name="missing_loop">While statement missing the 'loop' statement.</string>
<string name="missing_while_loop">Loop statement present without the while statement to start the loop.</string>
<string name="missing_while_break">Break statement present without the while statement to start a loop.</string>
<string name="missing_if_else">Else statement present without the if statement.</string>
<string name="missing_if_endif">Endif statement present without the if statement.</string>
<string name="roll_missing">Unable to locate the table or generator roll </string>
<string name="unidentified_caller">Generator roll code invoked from an unidentified source.</string>
<string name="roll_in_progress">Attempt to initiate another table or generator sequence when there is already a table or generator in progress.</string>
<string name="bad_roll_status">Invalid status of table roll process.</string>
</root>

So I am just stymied not figuring out why my button doesn't have the word "Generators" in it. What am I missing?

damned
October 31st, 2017, 05:48
does /console show you any warnings?
is buttonanchor defined? is it possible its show Generators but way off in some corner?

Bidmaron
October 31st, 2017, 05:50
thanks for the look, damned, but the template is identical to the working one in the story window except for the window it chains to (which works) and the string resource called out for the button.

damned
October 31st, 2017, 07:01
you are anchoring to something called buttonanchor
if buttonanchor doesnt exist it has nothing to base its positioning on.


<genericcontrol name="buttonanchor">
<anchored to="contentanchor" width="170" height="0">
<top anchor="bottom" offset="15" />
<left />
</anchored>
</genericcontrol>

Nickademus
October 31st, 2017, 11:06
Change the textres to a static text and see if it displays. If not, the problem is probably anchoring. If it does, then the problem is probably with the string resource (and we can continue).

Bidmaron
October 31st, 2017, 13:25
Ok I will give it a go. Seems like the button wouldn’t be there either if it were an anchoring problem but let me check.

damned
October 31st, 2017, 13:39
Ok I will give it a go. Seems like the button wouldn’t be there either if it were an anchoring problem but let me check.

the button and the text are not anchored to the same thing.
my guess is you either dont have buttonanchor or its not where you think it is.
there are other possibilities but we cant see the rest of your code.

Bidmaron
October 31st, 2017, 15:43
It will be tonight if I get done with Halloween festivities in time.

Trenloe
October 31st, 2017, 17:26
<?xml version="1.0" encoding="iso-8859-1"?>
<root version="2.8" logo="button_generators.png">
<properties>
<name>Generators</name>
<version>0.1</version>
<author>Bidmaron</author>
<description>Adds functionality to the built-in tables of Fantasy Grounds and augments Story Templates with Generators having additional functionality</description>
<!--<ruleset>
<name>CoreRPG</name>
<minrelease>3</minrelease>
</ruleset>-->
</properties>

<announcement text="Generators - v0.1 for FG V3.3.3 CoreRPG ruleset by Bidmaron. \rCopyright 2016 Smiteworks USA, LLC." font="emotefont" icon="button_generators"/>

<base>

<includefile source="generator.xml" />


<!-- String resources -->
includefile source="strings_super_table.xml"


<!-- Extension loading script - writes info to chat window and contains custom code -->
<script name="Tables_Plus" file="Tables Plus.lua" />
</base>
</root>
?
Missing < > around includefile source="strings_super_table.xml" ??

Bidmaron
October 31st, 2017, 18:02
Thanks. Will check but I am getting no console error on it so I think that was probably cut and paste error on my post. At work and cannot check until tonight.

Bidmaron
November 1st, 2017, 03:02
Well, Trenloe, I feel like an idiot. That was the problem. I would have thought there would be a console error on the corrupt file, but there was not.

Trenloe
November 1st, 2017, 18:03
I would have thought there would be a console error on the corrupt file, but there was not.
The XML file is not corrupt. It is valid XML. You can check with a XML validator like the one here: https://www.w3schools.com/xml/xml_validator.asp

Hence why there were no console errors, because there isn't an error in the file. But FG will only read valid XML elements - which need to be within < > brackets.

Bidmaron
November 1st, 2017, 20:38
Much appreciated, Trenloe and good to know that you cannot assume some types of errors (as we would think) will not get flagged as errors. Still can’t imagine how I goobered that up.

LordEntrails
November 1st, 2017, 23:11
... Still can’t imagine how I goobered that up.
Because you are human?

Erin Righ
November 3rd, 2017, 01:31
Because you are human?

Which is further evidence of the T.R.E.N.L.O.E AI, he didn't goober it up