PDA

View Full Version : Another Character Sheet Tab



danielhalond
July 4th, 2015, 19:53
Hi!

I would like to know if it is possible to create another tab that opens another window in the character sheet, below the notes tab. That tab would be like the Main tab, one that you can add a list with values etc. If it is possible, how can I do it? I know it must be annoying having someone that know almost nothing about programing asking that kind of thing but I would really really really appreciate if someone could help me here ((((((:

thanks guys

dulux-oz
July 5th, 2015, 02:10
Hi daniel,

Yes, it can be done. You do need to know XML, LUA (ie be able to code/program at a "talented amateur" level, or be willing to learn) and also be competent in manipulating images in a program such as Paint.net or Photoshop (if you want things looking "shmeck"). Its not something that you should tackle thinking it'll only take a few minutes - there is real work involved and it will take some time - but yes, as I said, it is possible.

If you're OK with coding then I suggest take a look at a simple Extension (such as my Alternate ColourGizmo Extension) to see the type of coding required to make a simple change (like I did when I added the ability to enter a Hexadecimal ColourCode into the ColourGizmo) - that should give you a good idea of what you're in for.

And ask questions - there's lots of professional coders and other ICT people on these boards who can and will help :)

Cheers

damned
July 5th, 2015, 12:29
Have a look at the MoreCore extension. It adds an extra Tab to the Character sheet (and a few other things).
Ive applied quite a lot of comments - never enough though!
Use the Find in Files feature of notepad++ to see how each thing you are doing is usually made up of 2 or more components in 2 or more files.

Good luck!

danielhalond
July 5th, 2015, 13:21
Thanks for the replies!

I'm wiling to learn for sure! I'll check the simple extension then. Image manipulation isn't a problem at least. I tried MoreCore already, it won't work for me because I already did some changes in the core ruleset such as the main tab, the npc now has the exact char sheet as the players so when I run it all those things are gone, because it replaces it. But I believe I can have a look at it to see how things are done, something like that. Like I said, I know almost nothing about coding.

So, how can I start learning whats required? Is there something that you can say for sure "Well, you certainly need 'that thing' to start".

thanks again for your attention (((:

dulux-oz
July 5th, 2015, 14:44
If you know nothing about coding then I suggest the best thing to do is find a beginners coding tutorial (an interactive one) on the web and start there. There are some good ones, but you'll have to look.

A 1st year beginners university course (again, free on the web if you look) will also be helpful.

Apart from that, look at the code of other people's Extensions and Rulesets and try to figure out what's going on.

In terms of software, grab Notepad++ from the web - all of the (good) coders use it - or something similar - to code with.

Cheers

Nylanfs
July 5th, 2015, 16:08
I like using jEdit

Trenloe
July 6th, 2015, 02:18
So, how can I start learning whats required? Is there something that you can say for sure "Well, you certainly need 'that thing' to start".
Check here: https://www.fantasygrounds.com/forums/showthread.php?20651-Modifying-the-CoreRPG-ruleset The "A few steps to do before getting started:" list is where you want to look.

irpagan
July 6th, 2015, 11:27
I'd like to suggest also either visual SVN or something similar, even good coders make mistakes and this is a way of backing up any changes you make, so that later if you decide it is an extension or a layered ruleset it will be easier to see what files you affected. If your not comfortable with that approach you can always create an original folder in the directory you're working in, copy any file you want to work on into before you start that way you can always revert and keep track of what you've touched. For tools I use eclipse with the lua extension mostly but I also use notepad++ and sometimes textpad. For ease of use I'd suggest notepad++. It's a little dated but Anatomy of a Ruleset which you can get from the Wiki under the Ruleset heading is still a good place to start. Start with small changes and take good notes. I'd also highly recommend commenting any changes in your code as well - that way you will know why you did what you did at the time, be verbose write a whole paragraph if you need to. You can always shorten it or take it out later when you become comfortable.

Regards,
d0gb0y

danielhalond
July 7th, 2015, 20:05
Thanks for all the replies, guys!

So far I'm gathering stuff so I can start learning how to code. Since I can't tell the differences between all the languages there are (btw all the subjects you mentioned and links posted helped a lot to begin to understand the path that leads to what I need. Thanks for the tips on the software too!) I would like to ask what should I learn first. I know FG requires Lua, but I don't know if I can start from there and even when I edit sutff in the .xml files I feel like I need more knowledge. What would you suggest?

Trenloe
July 7th, 2015, 21:44
I would like to ask what should I learn first. I know FG requires Lua, but I don't know if I can start from there and even when I edit sutff in the .xml files I feel like I need more knowledge. What would you suggest?
If you've used a structured programming language before then just using the references in the scripting section of the ruleset modification guide should be enough to refer to when you need LUA specific info: https://www.fantasygrounds.com/modguide/scripting.xcp

If you haven't programmed before then you'll need to spend some time understanding how to do structured computer programming - there's no quick way around this, spending the time now will save you hours in the long run (and save the sanity of the helpful community members). Do a search for "beginning lua" and see what comes up. The Wrox Press Beginning Lua Programming is an excellent book, free in PDF format here: https://it-ebooks.info/book/2556/

You only need to know the very basics of XML - that is, how tags and properties work. The rest is all FG specific. There is various documentation about the FG APIs here: https://www.fantasygrounds.com/refdoc/ This is the deep down stuff of how the various components of FG work, are defined and how you can customise them.

Then it's a case of starting to look at the FG code. damned's more core extension is a good one to look at - as he's put comments in the code and it deals with specifics of extending the CoreRPG character sheet and Combat Tracker. If this isn't your thing, you might want to pick a piece of small functionality you're interested in learning, modifying or adding and then dive into the code. However, this can quickly get very confusing.

damned
July 8th, 2015, 05:04
If you've used a structured programming language before then just using the references in the scripting section of the ruleset modification guide should be enough to refer to when you need LUA specific info: https://www.fantasygrounds.com/modguide/scripting.xcp

If you haven't programmed before then you'll need to spend some time understanding how to do structured computer programming - there's no quick way around this, spending the time now will save you hours in the long run (and save the sanity of the helpful community members). Do a search for "beginning lua" and see what comes up. The Wrox Press Beginning Lua Programming is an excellent book, free in PDF format here: https://it-ebooks.info/book/2556/

You only need to know the very basics of XML - that is, how tags and properties work. The rest is all FG specific. There is various documentation about the FG APIs here: https://www.fantasygrounds.com/refdoc/ This is the deep down stuff of how the various components of FG work, are defined and how you can customise them.

Then it's a case of starting to look at the FG code. damned's more core extension is a good one to look at - as he's put comments in the code and it deals with specifics of extending the CoreRPG character sheet and Combat Tracker. If this isn't your thing, you might want to pick a piece of small functionality you're interested in learning, modifying or adding and then dive into the code. However, this can quickly get very confusing.

I have abused the sanity of many helpful people thru my lack of coding knowledge, patience and ability... to you all - you have my eternal gratitude for what that is worth.

For adding another Tab on the Char Sheet I think its all XML from memory... no need for LUA to add that extra sheet.

danielhalond
August 5th, 2015, 16:09
Hi, I've been learning a bit about coding and I believe I made some progress. I got the new tab, but FG tells me it couldn't find the window class I created, which is charsheet_espec. I edited the record_char to create the new tab and I specified the subwindow thing there too. Also created another xml file which contains the information for this new tab. But still FG tells me:

Ruleset Error: subwindow: Could not find windowclass (charsheet_espec) for control (specializations) in windowclass (charsheet)
Ruleset Warning: bitmapwidget: Logical icon (tab_espec) does not exist

And also this bitmapwidget error, I created the icon for the new tab and named it tab_espec inside the tabs folder. So anyways I'm stuck and hopefully you can help me here. I'll post two screenshots too

Thanks (:

10675
10676

kylania
August 5th, 2015, 16:33
The windowclass below yours (char_spec_category_header) in that pic has a <frame> property while yours is missing that line (2nd line of the block). Is that required?

Trenloe
August 5th, 2015, 16:42
Also created another xml file which contains the information for this new tab.
Sounds like you haven't put this new file in an <includefile> (https://www.fantasygrounds.com/refdoc/includefile.xcp) statement in your extension/ruleset. Have a look at an ruleset base.xml file or an extension extension.xml file for some examples.

danielhalond
August 5th, 2015, 18:27
Sounds like you haven't put this new file in an <includefile> (https://www.fantasygrounds.com/refdoc/includefile.xcp) statement in your extension/ruleset. Have a look at an ruleset base.xml file or an extension extension.xml file for some examples.

Yes, I figured that out. Thanks Trenloe! You were totaly correct. It seems we are very close to complete this. I got another error. I copied the code from record_char_main, so in that tab I'll have the same utilities, but that generated another problem. It is duplicating the code, and I believe that's because of list_charmainattribute (correct me if i'm mistaken). So I went to template_char and added a list_charmainattribute2 like this:

<template name="list_charmaincategory2">
<windowlist>
<class>char_main_category2</class>
<datasource>.maincategorylist2</datasource>
<columns width="222" filldown="true"/>
<allowcreate />
<allowdelete />
<sortby><field>label</field></sortby>
<script>

function onListChanged()
update();
end

function update()
local sEdit = getName() .. "_iedit";
if window[sEdit] then
local bEdit = (window[sEdit].getValue() == 1);
for _,wCategory in ipairs(getWindows()) do
wCategory.idelete.setVisibility(bEdit);
wCategory.attributes_iadd.setVisible(bEdit);
wCategory.attributes.update(bEdit);
end
end
end

function addEntry(bFocus)
local w = createWindow();
if bFocus then
w.header.subwindow.label.setFocus();
end
return w;
end
</script>
</windowlist>
</template>

but it isn't enough. I gotta create char_main_category2 and .maincategorylist2 but I don't know where :T

danielhalond
August 6th, 2015, 18:30
I did it! Thanks for all the help!

Now it doesn't seem that hard xD. Anyways, the last step was to edit record_char_main and add a windowclass named char_main_category2, so I went back to template_char and used that windowclass.

Anyways I don't know, maybe someone tries to do the same thing so I'll paste the steps I did it:

First I edited record_char.xml > I created a subwindow and a tab
Then I created a .xml file with the codes I needed, in this case the same as the main tab (record_char_main.xml)
Then I included that xml, editting the 'base.xml' (ex: <includefile source="campaign/record_char_spec.xml" />)
In this step I got a problem because since the code was duplicated the new tab had the same information as the tab I copied from (which was the main tab)
Then I edited the record_char_main and added the new windowclasses I needed, same thing with record_char and that is (:

Thanks again for the patience, for the attention and everything. :))))

Trenloe
August 6th, 2015, 19:05
Glad you got it working.

Are you modifying the ruleset directly or using an extension?

If you're modifying the ruleset, make sure you rename the ruleset or make a copy so that future FG updated don't overwrite your work.

danielhalond
August 6th, 2015, 19:07
I'm modifying the ruleset directly. I made a backup. Is if possible to achieve the same results using extensions?

Trenloe
August 6th, 2015, 19:17
Is if possible to achieve the same results using extensions?
Absolutely, an extension would be the best way to do it. Check out the More Core Extension and https://www.fantasygrounds.com/forums/showthread.php?25234-Jeff-s-Excruciatingly-Simple-Extension-Tutorial&highlight=extension