PF2E Playlist
Page 1 of 2 12 Last
  1. #1

    Adding tab to 5e character sheet

    I want to add a new tab to the 5e character sheet, I have got the tab to display on the sheet but currently the tab name is blank. I have looked at the MoreCore extension as suggested in another thread, but that is using graphics for the tabs, from what I can tell the 5e ruleset doesn't do that, and I would like to keep the look consistent. Where do I look to find the tab names.

  2. #2
    Zacchaeus's Avatar
    Join Date
    Dec 2014
    Location
    Scotland
    Posts
    14,512
    I don't know specifically but if you search for the name of an existing one in the files you should find it.
    If there is something that you would like to see in Fantasy Grounds that isn't currently part of the software or if there is something you think would improve a ruleset then add your idea to the wish list http://fg2app.idea.informer.com/

  3. #3
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    22,124
    Blog Entries
    1
    All rulesets use graphics for the tab names.

    MoreCore - Generic Ruleset
    --- Projects ---
    Extensions | Tutorials | MoreCore | MoreCore Themes | Call of Cthulhu | Maelstrom | FG Con

  4. #4
    I would love to do the same thing, but can't find where the xml looks for the tabs. If I were to do this in C# I would likely use reflection to just look for a type of file or property in the class. But I can't seem to find out how to create a new tab, it keeps crashing the load on me.

  5. #5
    I have never added one, but I've certainly had to write my own version of the \common\template_windows.xml templates for tabs_charsheet and tabs_recordsheet. That's the raw code that I overwrote because I needed to be notified when tabs changed and had to add that code in myself. The only reason I needed to do the xml's was because they are what point to the script file and I needed it to point to my version of it. I tell you this because all things with tabs start with these templates and the

    Code:
    <script file="common/scripts/buttongroup_tabs.lua" />
    When dealing with the charsheet you need to understand that you'll need to create a merge version of 5E\campaign\record_char.xml in your extension. Looking at this file you can see where the tabs are defined - there are 7 of them. Be aware other people write extensions and if you go off and break the world to fit your stuff in you'll probably break them to if they touch that. I'm purposely ignoring any extensions outside of these 7 in my current extension so it should not impact me.

    Here is the relevant chunk of that xml that deals with tabs..

    Code:
    			<sub_charsheet name="main">
    				<class>charsheet_main</class>
    			</sub_charsheet>
    			<sub_charsheet name="skills">
    				<class>charsheet_skills</class>
    			</sub_charsheet>
    			<sub_charsheet name="abilities">
    				<class>charsheet_abilities</class>
    			</sub_charsheet>
    			<sub_charsheet name="inventory">
    				<class>charsheet_inventory</class>
    			</sub_charsheet>
    			<sub_charsheet name="notes">
    				<class>charsheet_notes</class>
    			</sub_charsheet>
    			<sub_charsheet name="logs">
    				<class>charsheet_logs</class>
    			</sub_charsheet>
    			<sub_charsheet name="actions">
    				<class>charsheet_actions</class>
    			</sub_charsheet>
    
    			<tabs_charsheet name="tabs">
    				<tab>
    					<icon>tab_main</icon>
    					<subwindow>main</subwindow>
    				</tab>
    				<tab>
    					<icon>tab_skills</icon>
    					<subwindow>skills</subwindow>
    				</tab>
    				<tab>
    					<icon>tab_abilities</icon>
    					<subwindow>abilities</subwindow>
    				</tab>
    				<tab>
    					<icon>tab_inventory</icon>
    					<subwindow>inventory</subwindow>
    				</tab>
    				<tab>
    					<icon>tab_notes</icon>
    					<subwindow>notes</subwindow>
    				</tab>
    				<tab>
    					<icon>tab_log</icon>
    					<subwindow>logs</subwindow>
    				</tab>
    				<tab>
    					<icon>tab_actions</icon>
    					<subwindow>actions</subwindow>
    				</tab>
    				<activate>1</activate>
    			</tabs_charsheet>
    That's it. Each of those tabs hold a subwindow which holds a class which you can look up elsewhere - but you'd obviously have your own new subwindow and class of your own.

    All the tab logic is buried in the tabs_charsheet template (remember I mentioned it earlier and the code tied into it).

    I suspect to add a new tab you'd do something like this (not sure - don't blame if it doesn't work I've never done it - this is theory)...
    In your extensions version of record_char.xml...
    Code:
    <root>
    <!-- Add your stuff to the character sheet -->
    	<windowclass name="charsheet" merge="join">
    		<sheetdata>
    			<sub_charsheet name="YOUR_STUFF">
    				<class>charsheet_YOUR_STUFF</class>
    			</sub_charsheet>
    			<tabs_charsheet name="tabs" merge="join">
    				<tab>
    					<icon>tab_YOUR_STUFF</icon>
    					<subwindow>YOUR_STUFF</subwindow>
    				</tab>
    			</tabs_charsheet>
    		</sheetdata>
    	</windowclass>
    </root>
    where that charsheet_YOURS_STUFF is something you make yourself based on the 7 other examples you have to work with.

    Now - none of this may work.

    But that is my guess based on having had to rewrite parts of the core of it.

    Then in your code you can mess around with the nitty gritty if you need to with stuff like this.

    Code:
    	local nActiveTab = window.parentcontrol.window.tabs.getIndex();
    Good luck - if it doesn't work - that's all I got

  6. #6
    Much appreciated. I should have dug a bit more before asking to be honest but this points me in the right direction.

    When/If I get this working I will post how I did it.

  7. #7
    Edit - Sorry might be double information since I didn't refresh the page and see SilentRuin's response.

    Creating a new tab onto the character sheet is done by adding a reference to the new tab in the campaign/record_char.xml file
    Capture.PNG
    As you can see in the image, it lists the subwindows that are going to be created and their associated windowclasses. Add your tab's own reference there and also add the graphic for the tab in the tabs_charsheet section of code. The icon is the graphic being used for the tab and subwindow points to the subwindow name.

    This can work in reverse if you wish to remove a tab as well. Just delete the references in both sections and the tab will not appear on the character sheet.
    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Idea Informer

  8. #8
    Quote Originally Posted by superteddy57 View Post
    Edit - Sorry might be double information since I didn't refresh the page and see SilentRuin's response.

    Creating a new tab onto the character sheet is done by adding a reference to the new tab in the campaign/record_char.xml file
    Capture.PNG
    As you can see in the image, it lists the subwindows that are going to be created and their associated windowclasses. Add your tab's own reference there and also add the graphic for the tab in the tabs_charsheet section of code. The icon is the graphic being used for the tab and subwindow points to the subwindow name.

    This can work in reverse if you wish to remove a tab as well. Just delete the references in both sections and the tab will not appear on the character sheet.
    Don't know if my response is correct - it was a theory - I've never done it myself.

  9. #9
    Ah, well then what I described would be the fastest and easiest approach to adding tabs to the character sheet in my opinion.
    How to provide an Unity Connection issue?-Connection Issues and What to Provide

    Unity Updater issue?-Updater Issues

    Classic and Unity Port Forwarding?-Fantasy Grounds Connections Explained

    Comcast or Cox ISP User?-Comcast XFinity and Cox Users

    Have a suggestion?-Idea Informer

  10. #10
    Quote Originally Posted by SilentRuin View Post
    Don't know if my response is correct - it was a theory - I've never done it myself.
    Your suggestions worked for the most part. So I have created the new tab (which is blank atm because I have not created a graphic) but it is not styling to the bottom of the tabs. It appears where the "Main" tab would be and the data is overlaying the tabs as I to through them. Right now I am just using a mock up of the Inventory tab as that will be the base.

    The idea is to have a tab with the assets and property that a character has but is not currently carrying. In the current campaign the party has procured an old Manor House and they have rooms there that contain their valuables that are not convenient to carry. Some of them also have items in another player's bag of holding. The Inventory is getting cluttered and I was looking to reorganize it a bit.

    I have been digging through all of the XML and see the styling for the pieces inside a given window but do not see a styling for the main framing of the character sheet.

    So my extended record_char looks like this:

    <windowclass name="charsheet" merge="join">
    <sheetdata>
    <sub_charsheet name="assets" merge="add">
    <class>charsheet_assets</class>
    </sub_charsheet>

    <tabs_charsheet name="tabs" merge="add">
    <tab>
    <icon>tab_assets</icon>
    <subwindow>assets</subwindow>
    </tab>
    </tabs_charsheet>

    <close_charsheet />
    <resize_charsheet />
    </sheetdata>
    </windowclass>

    I assume that the merge="join" would only be required on the parent node but was being safe.
    Last edited by Slagmoth; August 13th, 2020 at 01:35.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Starfinder Playlist

Log in

Log in