PDA

View Full Version : Adding a New Button to the Sidebar



ronalmb
November 20th, 2016, 04:27
Hi,
I wish to make an extension that lets me track Kingdom stats ala Ultimate Campaigns for Pathfinder. I've done the tutorial for being able to make a custom sheet and data and i can open and close that with the proper /open commands.

But now I wish to add a new button to the sidebar that lets me open or close that window but have been stymied by it. I am sure I am missing something.

So far I have:
1. Included my icons in an .xml file
2. Made sure that the icon graphics are in the correct location
3. added ["kingdoms"] to the aRecords in my own kingdom_library.lua
4. Made sure that kingdom_lua script has been included in my include file.

Clearly there is more to do... but i have no idea where to track it down. I've tried following some of the other buttons (i.e. button_book for the story button) through the CoreRPG files but I am not sure what else needs to be done to make it appear on the right (and able to toggle it on and off through the Library to).

Is there a tutorial anywhere on adding buttons? One that is updated for the current version of FG2?

Any help would be welcome. I'm desperate!

Thank you so very much.

damned
November 20th, 2016, 05:52
did you also include the xml file that points to the icons?
there are few coding tutorials

ronalmb
November 20th, 2016, 09:28
Yep, I have. That was #1 on the list. I am sorry I was not clear on that.

I have both made an xml that includes the icons and then made sure that my "xKingdomFiles.xml" includes that xml file.

I am fairly certain what I am missing involves making sure that whatever it is that manages deciding what buttons show and do not show knows of my new button. I thought that was aRecords, but there must be more.

I know there are a good number of tutorials.. i tried to point out that i've been following them. BUT as awesome as Fantasy Grounds is, commenting in the xml and scripts is less than stellar and the API documentation wouldn't be hurt by being a bit more user-friendly. It's very easy to not see/miss a few small but vital lines scattered in some place you wouldn't think of looking.

But Fantasy Grounds is an awesome DM tool that is so beautiful on the outside that it doesn't matter how ugly she is deep down on the inside :)

And there are indeed a few coding tutorials. I cannot see one for adding buttons to the sidebar. If anyone can point me to the proper tutorial for that, I'll use it.

damned
November 20th, 2016, 12:19
By "few I meant that there are not many tutorials not the other way around... sorry.

Does it just need to be activated in Library?

ronalmb
November 20th, 2016, 12:44
If you mean "Do i need to click the button to toggle it on/off in the Library for GM/Player" then no. I can't get it to appear there so I CAN toggle it on or off.

If you mean "did i activate it in the .lua so it appears" then No, I haven't been able to figure out where i do that yet.

I'll admit I'm out of my depth, but I'm running the Kingmaker Adventure Path and I thought that the Kingdom Building rules from Ultimate Campaign would be prime for an extension.
I have been trying to work through what tutorials exist but its quite the Mount Everest.

Basically, I need a special Character Sheet for a Kingdom. It does the usual stuff character sheets do and doesn't look to require much other than track numbers (and eventually click to roll like a normal character sheet).

I've taken to copying and editing DOELocations.extension's Location sheet but that really isn't an idea solution as future updates to that will stunt things.

All this frustration for just making a button! I've made working buttons in Unity, Unreal, Visual Basic, Visual C... but here.. with no Reference Sourcebook. Yikes! I'm fumbling around in the Tomb of Horrors without a torch.

ronalmb
November 20th, 2016, 13:01
Double Post searching for the delete button here.

Moon Wizard
November 23rd, 2016, 18:58
Pop open either the 3.5E or 5E rulesets, and look at the file called data_library_35E / data_library_5E (respectively). These contain examples of record types being added and overriden for each of those game systems.

Also, make sure that any icons specified in .aDisplayIcon are defined in your extension, as well as making sure that the .sRecordDisplayClass window class is defined in your extension.

Regards,
JPG

ronalmb
November 24th, 2016, 15:47
Thank you, that did it.

Quick follow up: In the Library, i can toggle it to appear on the sidebar... but the text display is blank. I'm sure it's because i haven't linked it to the string in my define file.... but where do i look for how to "link" the two?

Thanks again!

Moon Wizard
November 24th, 2016, 20:30
You need to add two string definitions for each record type. Here's an example for a "spell" record type:

<string name="library_recordtype_label_spell">Spells</string>
<string name="library_recordtype_empty_spell">&#171; New Spell &#187;</string>

Regards,
JPG

Nickademus
November 25th, 2016, 02:49
As a side question, these defined records all bring up windowclass that hold lists of assets. Is it possible to have a sidebar button that brings up a windowclass that does something totally different?

damned
November 25th, 2016, 03:55
As a side question, these defined records all bring up windowclass that hold lists of assets. Is it possible to have a sidebar button that brings up a windowclass that does something totally different?

Yes.
Look at Combat Tracker and Party Sheet.

Moon Wizard
November 25th, 2016, 04:53
There are a few different ones that you can look at: Character Selection, Effects, Modifiers, Combat Tracker, Party Sheet...

Cheers,
JPG

Nickademus
November 25th, 2016, 05:46
Okay. I figured the Modifiers, Effects, and Character Selection were just fancy record lists, but the Combat Tracker and Party Sheet are about what I was thinking.

ronalmb
November 25th, 2016, 14:31
You need to add two string definitions for each record type. Here's an example for a "spell" record type:

<string name="library_recordtype_label_spell">Spells</string>
<string name="library_recordtype_empty_spell">« New Spell »</string>

Regards,
JPG

Thank you. Maybe I am misunderstanding or have miscommunicated the issue -- as I think your reply is for something different (but not positive).

When i press the Library button, at the top are a series of toggle check boxes for "feats, characters, npcs, spells, etc". Each toggle has the button icon and the checkbox, as well as a single label that identifies it as "feats, characters, npcs, spells, etc." The "Kingdoms" mini button shows up there as does the checkbox, but there is no text for the label. Is your answer a pointer for doing this? I think your answer applies to when i add a new record(?) to a list of records, getting the text to show up next to the link there (i.e., "New Spell")

damned
November 25th, 2016, 20:35
You will need something like this in strings:

<string name="library_recordtype_label_YOURWINDOWCLASSNAME">Rolls</string>

and I think it will get picked up by one of the lua scripts

ronalmb
November 25th, 2016, 22:11
Thanks. That tells me I didn't understand Moon Wizard the first time when he told me that :)

damned
November 25th, 2016, 22:31
Does that mean you got it working?
Screenshots!

ronalmb
November 26th, 2016, 00:47
Alas, no. I thought that it would, but I'm clearly still missing something somewhere.

Here is a screenshot of what I'm not having happen:
16619

Basically, what I am doing is running the Kingmaker Adventure Path from Pathfinder. In this path, players get to run a kingdom. Kingdoms have attributes like a character, and have settlements and special features. I feel that Fantasy Grounds is awesome for tracking this in a way that players have quick access to the info. Below is a partial image of the Kingdom character sheet from Ultimate Campaigns that I want to emulate.

16620

I can make DOE_Extensions do what I want by changing that out, but it isn't ideal and if DOE_Locations ever updates, I'll have to do all my customization to mimic that kingdom sheet all over again.

And just to share screenshots of the campaign because I'm a horrible braggart, this is a section of the current campaign map where they will be choosing to start their kingdom.

16621

Each of the larger blue hexes, once entered and exploration has started has a regional map. It is here that they'll be placing settlements, building forts, etc as per the Ultimate Campaign rules.

16622

I have a long way to go and a lot to learn, but I'm willing. The artist in me is rebelling against learning how to work with data and what tutorials there are just seem to make my brain bleed.. but I will master it. With lots of pleading for help, of course!


Edit: Added L to ideal to correct my illiteracy.

damned
November 26th, 2016, 01:02
Hi ronalmb please PM a dropbox link or similar to the extension and I will have a quick look.

damned
November 26th, 2016, 02:24
Ok it looks like you might have used the DOE files as a base template.

Unfortunately I think this is a mistake.
Not because these are not good and well written extensions but they are far more complex than what you want to start with.
Some of the Locations supporting code is in Base for example.
You would be far better off using Story or NPCs from CoreRPG as your base to learn from.

Your string should be one of these but there is still something else missing.

<string name="library_recordtype_label_kingdomSheet">Kingdom</string>
<string name="library_recordtype_label_kingdoms">Kingdom</string>

and I suspect it is due to the DOE dependencies on each other.

ronalmb
November 26th, 2016, 11:13
Thanks for the insight. Yes, DOE is definitely a complex place to start. It was just the only place of reference I have had any luck getting anything to work from at first. I don't think in the .ext I sent you there was any dependencies on DOE -- I think I started from scratch with 3.5 --> There is nothing in CoreRPG for library_recordtype_label items nor for aRecords, which is used for the sidebar. I think everything I am using is based off that.

My actual game campaign currently uses DOE (I dug into his files and changed the Locations sheet around to mimic the Kingdom information from pathfinder -- but it is less than idea because it means i'll have conflicts aplenty should the actual one update and I want to ever use it. But I thought that the .ext I sent you made no use of any part of it. I'll double check.

Followup: Starting in xKingdomFiles.xml, I use only the following includes and script references:



<icon name="iKingdomExtensionIcon" file="kingdoms_logo.png" />
<includefile source="Kingmaker/XMLFiles/xKingdomIcons.xml" />
<includefile source="Kingmaker/XMLFiles/xKingdomStrings.xml" />
<includefile source="Kingmaker/XMLFiles/xKingdomTemplates.xml" />
<includefile source="Kingmaker/XMLFiles/xKingdomsWindowClasses.xml" />

<script name="LibManager" file="Kingmaker/Scripts/data_library_KM.lua" />


Icons and Strings have entries as expected. The Templates.xml has one entry in it so far, but no actual content between the <template> and </template>.

WindowClasses DID have a reference to DOE in the <script> </script> and I have cleaned that out since you saw the .ext. Removing it has had no change on the problem I am having. What is contained there:

xKingdomsWindowClasses.xml


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

<root>
<windowclass name="kingdoms">
<margins control="0,0,0,2" />
<script>

</script>
<sheetdata>

</sheetdata>
</windowclass>

<windowclass name="kingdomSheet">
<frame>charsheet</frame>
<placement>
<size width="525" height="568" />
</placement>
<minimize>minimized_npc</minimize>
<tooltip field="name" />
<nodelete />
<softclose />
<playercontrol />
<script></script>
<sheetdata>

<!-- This will be the background frame I will use for the flag-->
<!-- Once I figure out how to make the character portrait selection work for me -->
<genericcontrol>
<bounds>-137,21,45,45</bounds>
<icon>charlist_base</icon>
<disabled />
</genericcontrol>
<portrait_flaglocal name="localflag">
<bounds>-137,21,45,45</bounds>
<invisible />
</portrait_flaglocal>
<portrait_char name="portrait">
<bounds>-137,21,45,45</bounds>
</portrait_char>

<frame_char name="something">
<bounds>15,20,-140,45</bounds>
</frame_char>

</sheetdata>
</windowclass>
</root>



I do get a blank window to pop up when I use /openwindow kingdomsheet so I know the very basic works.

BUT I still can't get that simple line of text to appear in the library toggles!

www.michaelbrandeberry.com/files/Kingdom_Screenshot.png

Hmmm why is my IMG not working?

damned
November 26th, 2016, 11:23
Hi ronalmb Im not saying your extension depends on the DOE extensions. Im saying the the Locations extension (which you have based yours off) is dependant on the DOE Base extension. This means that you also have to pull some code from that extension into yours to make it work.

There are 14 library_recordtype_label strings plus 2 more hits in data_library.lua in CoreRPG...
There are more in 3.5e like spells

You will be better off going back to these. Try spells from 3.5e....

ronalmb
November 26th, 2016, 11:44
I admit, I'm baffled.
I unzip CoreRPG. I do a search in the CoreRPG folder for data_library.lua and it doesn't come up with any entry for that file. I imagine that's why I don't find the 14 strings you found.

I can find the data_library_35 in the 3.5 folder. But if I can't even handle a simple task as finding a .lua file in a folder... it doesn't instill me with confidence that I'll figure any of this out.

The buttons for the sidebar in CoreRPG are located in desktop.lua tho.

ronalmb
November 26th, 2016, 11:52
Although I can't seem to find my posterior with two hands and a roadmap, I HAVE managed to get the Kingdom text to show up in the library toggles finally.

I'm sure that's the easy part. Next is getting the window that pops up when i press the button to actually let me create new entries in it!
Thanks for your help.

damned
November 26th, 2016, 12:08
Send me your email in a PM ronalmb

ronalmb
November 26th, 2016, 13:41
Will do. Once i get this whole kingdom maker process done, I'm gonna write up a nice tutorial targeted to me. If I can follow it, it'll help others down the road!

Bidmaron
January 2nd, 2017, 16:27
Hey, ronalmb, how did you make your new Kingdom graphic? I need to make one titled 'Generators', but I am graphically-challenged.

Nickademus
January 2nd, 2017, 16:53
Hey, ronalmb, how did you make your new Kingdom graphic? I need to make one titled 'Generators', but I am graphically-challenged.

Have you seen this (https://www.fantasygrounds.com/forums/attachment.php?attachmentid=6322&d=1395754215)? It's buried in the Dev Guides in the Wiki.

Bidmaron
January 2nd, 2017, 16:58
I forgot about that resource, to be honest, Nickademus. Psd is a Photoshop file, but I think my Corel PSP will let me work with it.