PDA

View Full Version : Unskilled hoping to add skills...



Oberoten
October 7th, 2007, 11:11
Hola... Work trudging on on the FG ruleset.
And I have of course hit another snag.

Itemlists...
In the old version of FG it was pretty easy, define a class containing it's own frame and it would add a new subwindow in a scrollable section of the character-sheet.

The big snag is this... I work with a formula to add up all the XP from my skills, is it possible to do it in this way and still calculate Xp-costs?

Foen
October 9th, 2007, 06:27
Hi Obe

Any chance you could be a bit more specific? You create lists in FG2 using windowlist tags, which you specify with a class for the list items. Are you looking for a script which responds to changes in the list items and adds up a field from all of the items in the list?

Cheers

Stuart

Oberoten
October 9th, 2007, 19:17
Hi Obe

Any chance you could be a bit more specific? You create lists in FG2 using windowlist tags, which you specify with a class for the list items. Are you looking for a script which responds to changes in the list items and adds up a field from all of the items in the list?

Cheers

Stuart

*grins* I was rather obtuse on exactly what I needed again, wasn't I?

Basically, what I need the most is someone to walk me through how the windowlist tags and how to define them, what is different from FG1...

What I am trying to create is something along the lines of


Skill Specialization Level Xp
______________ ____________ ____ ___
____________
____________


Where pressing enter on the specialization line would add another line.


(Of course justa hint on how to add up the contents of the fields from several instances of a class would be pretty nice too to say the least.)

GoOrange
October 9th, 2007, 23:11
If you are using a windolist, then you can add in the allowcreate tag to let them add new lines using the radial menu.

https://www.fantasygrounds.com/refdoc/windowlist.xcp
<allowcreate /> If given, users can use the radial menu to create new entries in the list

or you could add something like this to the stringfield for your Specialization line:

function onEnter()
window.windowlist.addNewInstance(window.label.getV alue());
end

I don't have much good advice about adding up the total number of skills, but I would look at the d20 ruleset file charsheet_skillranks.lua in the scripts folder and look at how they add up the total planned ranks for skills to start with. I wish I could give you specific advice on how to do it but it's a bit beyond my skill. Still, I think that file may give you some ideas of how to begin.

Oberoten
October 10th, 2007, 06:35
Thanks for the suggestion. The biggest "worry" I have in this though is wether or not it will work with a nested list. Since I need to be able to create more skill-lines as well and each skill line preferably should be able to seat a few specializations.

Oberoten
October 10th, 2007, 09:13
<Sometime between FG1 and FG2 >

Oberoten levels up, Oberoten gains new feat : Epic Dumbass

... Meh. Just realized that I tried to define the class of the listitems INSIDE the charactersheet. No wonder it didn't work out.

Ram Tyr
October 10th, 2007, 13:44
<Sometime between FG1 and FG2 >

Oberoten levels up, Oberoten gains new feat : Epic Dumbass

... Meh. Just realized that I tried to define the class of the listitems INSIDE the charactersheet. No wonder it didn't work out.
That feat has been disallowed in this campaign.

Please select again.

You do receive extra XP for attempting to roleplay as having obtained this feat.

:-)

Later.

Oberoten
October 10th, 2007, 16:22
... that did the trick in so many ways. No more hardcoding 40+ lines of skills. :)

And I think I learned something quite useful for the stats of personalities as well in the deal. Not bad.

((Now all I need to get is a major idea on how to add together all the different instances as to keep track of total XP spent. ))

Foen
October 11th, 2007, 06:33
Hi Obe

You might try getting hold of the windowlist database node and registering a handler for the onChildUpdate event. This should fire whenever one of the skill nodes changes in the list. You would then iterate through the list adding up the XP spent on each item (try: for i,skl in ipairs(getWindows()) do ... end).

Cheers

Stuart

Oberoten
October 11th, 2007, 09:29
And this is where my new feat comes in again...

... I think it is time me an LUA sit down and have a MAJOR chat because my lack of understanding is getting quite annoying at times.

Foen
October 11th, 2007, 22:29
Hehe, I know the Feat you refer to, and am frequently blessed with it.

Does the following help?



<windowclass name="skilllist_item">
...
</windowclass>

<windowlist name="skilllist">
<class>skilllist_item</class>
...
<script>
function recalc()
local totxp = 0;
for i,skl in ipairs(getWindows()) do
totxp = totxp + skl.XP.getValue();
end
--[[ do something with the toal xp ]]
end

function onInit()
local node = getDatabaseNode();
node.onChildUpdate = recalc;
end
</script>
</windowlist>


I haven't tested this code *sheepish admission*, so please let me know how badly it crashes.

Cheers

Stuart