PDA

View Full Version : Beta: Load & Save commands for CombatTracker



rh4300
September 10th, 2007, 19:30
Hi folks,

attached you'll find a modification for FG2 which will add two new slash commands for the chat window:

/cts <name>
Combattracker save; saves the current combattracker under as <name> inside the campaign registry.

/ctl <name>
Combattracker load; loads a saved combattracker called <name> from the campaign registry.

Credits go to Smiteworks; I just made some code-recycling :D


Installation instructions:
Either replace the complete combattracker.lua with the attached one or make a copy and paste of CTLoad, CTSave, onInit and onClose.

Beware - this is a beta release. Use at your own risk!

Any feedback is welcome!


Update 2007-09-12:
to do: show a list of saved combattrackers
to do: command to add saved combattrackers (merge; for adding groups like the players)

richvalle
September 12th, 2007, 00:42
Oh wow... I missed what this was doing. I thought it was to make sure you didn't lose it in a crash (which happens to me at times).

I'm... very tempted to use this!

How about a way to list the ones that have already been saved? Hmmm ctl is used. Maybe just ct?

Thanks,

rv

Griogre
September 12th, 2007, 02:39
Think he is using a slash command in the chat window not the Control key.

joshuha
September 12th, 2007, 02:46
He was referring to a slash command. He was suggesting another one to list all the saved registry entries and though /ctl would be a good one but thats already taken for the load command he built in :)

Nalfien
September 12th, 2007, 03:13
Perfect! Great timing too. Now how do I install or replace the combattracker.lua? I can't find it. I'm using vista so I have a program files as well as user folder with FGII stuff in it. I used a search on the whole C: but can't find this .ula

EDIT: To answer my own question:

Run the d20unpak exe (in the folder where FGII is installed - usually c:\program files\fantasy grounds II\)

EDIT 2: Well, maybe not:

I replaced the combattracker.lua in the examples/scripts folder, but the command doesn't appear to work in FGII.

joshuha
September 12th, 2007, 04:55
Perfect! Great timing too. Now how do I install or replace the combattracker.lua? I can't find it. I'm using vista so I have a program files as well as user folder with FGII stuff in it. I used a search on the whole C: but can't find this .ula

EDIT: To answer my own question:

Run the d20unpak exe (in the folder where FGII is installed - usually c:\program files\fantasy grounds II\)

EDIT 2: Well, maybe not:

I replaced the combattracker.lua in the examples/scripts folder, but the command doesn't appear to work in FGII.

Move the whole d20 folder over to the rulesets directory not the examples one. Make sure to rename the folder something like D20+ or something and then start a campaign using that as the ruleset.

Nalfien
September 12th, 2007, 04:59
Thanks, but how can I take advantage of this in my current campaign? Wouldn't copying the d20 and customizing it mean I have to recreate everything?

EDIT: Got it! I just needed to change my campaign.xml to say the ruleset was my new ruleset instead of the d20.

I really appreciate it. This tool and your advice has really helped me for tomorrows game. Thanks guys! Time to create some encounters then get some sleep!

EDIT 2: Or not... I can't load my modules. Can't build encouters without monsters! Why can't I see my modules?

EDIT 3: Ok, just go into the base.xml and before the </root> add the code:

<importinfo>
<acceptfrom ruleset="d20" />
</importinfo>

Modules will show up then!

Nalfien
September 12th, 2007, 05:49
I saved some encounters, and the would load as long as I was in that same session. However if I closed down FGII and opened it again, the saved combat tracker setups were gone. When I close, my campaignregistry.lua is blank.

zifnab69_fr
September 12th, 2007, 07:50
it'll be very usefull if the saved combat trackers survive when we close the campaign...
the game master can prepare all the campaign, creat the combats trackers and then, call them when players are in the right place ...

Dachannien
September 12th, 2007, 08:10
Sometimes the campaignregistry.lua file doesn't save properly. I have no idea why, but it is sometimes related to the severe crash problems I've mentioned elsewhere which also sometimes result in the db.xml file being either corrupted or not written to since the session started.

Why FG doesn't actually flush the buffer when it says 'Campaign saved' is beyond me.

Tokuriku
September 12th, 2007, 10:42
OMG You just like changed my world forever.
You have no idea how pleased I am about this!!! :D

And Nalfien, thanks for the acceptfrom thing, it is awsome. I used to copy and rename the modules and change the ruleset definition in them manually wich needed for my players to do the same or download some big files, thanks you are a saver too!

rh4300
September 12th, 2007, 12:09
I saved some encounters, and the would load as long as I was in that same session. However if I closed down FGII and opened it again, the saved combat tracker setups were gone. When I close, my campaignregistry.lua is blank.

while testing I always used the /save command and I never had any problem with it. maybe this will also solve your problem.

Sorontar
September 12th, 2007, 13:20
?

EDIT 3: Ok, just go into the base.xml and before the </root> add the code:

<importinfo>
<acceptfrom ruleset="d20" />
</importinfo>

Modules will show up then!

Okay I'm putting my dunces hat on here as when I had a go at this bit and booted up I just got dice cascading over the top right of the screen and a freeze :)

Could you post a screeny of what you changed in the base.xml so I can see the exact positioning perchance?

*stands in the corner stood on a chair*

zifnab69_fr
September 12th, 2007, 13:55
well, i use the moded base.xml with the <importinfo...
an all work fine.

Nalfien
September 12th, 2007, 19:07
...And Nalfien, thanks for the acceptfrom thing, it is awsome. I used to copy and rename the modules and change the ruleset definition in them manually wich needed for my players to do the same or download some big files, thanks you are a saver too!

Thank the Goblin King (wherever he may be, take this child far away from me) for that tip. I found it using the message board search.

Sorontar, I just opened the base.xml file in WORDPAD (I think other programs might corrupt it. Then I went down to the bottom of the file right before the </root> and entered a few times to give it some space. I pasted in the code:

<importinfo>
<acceptfrom ruleset="d20" />
</importinfo>

right before the </root> and made sure the font was consistant with the rest of the file. I saved and closed then it was fine.

rh4300, thanks for the tip. It was late and I didn't think about trying a manual save. Sounds like that will probably work!

Sorontar
September 12th, 2007, 19:13
Sorted , many thanks.

*gets off the chair and returns the pointy hat to teacher*

;)

Nalfien
September 12th, 2007, 20:31
while testing I always used the /save command and I never had any problem with it. maybe this will also solve your problem.

Now that I know how useful these scripts can be, is there a way you can make the program /save when you close the program?


EDIT: Actually, I just got my first opportunity to test it out and /save will not fix the problem of losing the /cts setups I've done. When I do a /cts name, the chat wind

Tokuriku
September 12th, 2007, 22:48
Thank the Goblin King (wherever he may be, take this child far away from me) for that tip. I found it using the message board search.

Sorontar, I just opened the base.xml file in WORDPAD (I think other programs might corrupt it. Then I went down to the bottom of the file right before the </root> and entered a few times to give it some space. I pasted in the code:

<importinfo>
<acceptfrom ruleset="d20" />
</importinfo>

right before the </root> and made sure the font was consistant with the rest of the file. I saved and closed then it was fine.

rh4300, thanks for the tip. It was late and I didn't think about trying a manual save. Sounds like that will probably work!

It also works inside the root command.

Nalfien
September 14th, 2007, 16:16
I had a chance to use the /save after I was making some combat tracker set ups. It still didn’t save my “cts” names after the program was restarted. Anyone able to help me on this? It becomes about useless to me without this feature.

zifnab69_fr
September 14th, 2007, 17:45
It work fine for me , i can save CTS and reload it after the program restart.
you may have an other problem

rh4300
September 14th, 2007, 21:46
I had a chance to use the /save after I was making some combat tracker set ups. It still didn’t save my “cts” names after the program was restarted. Anyone able to help me on this? It becomes about useless to me without this feature.

Can you please verify the following:
open the CampaignRegistry.lua file of your campaign and look if you find nodes called "CT<savename>" where <savename> equals the name you entered with the /cts command.

Example (saved with /cts test):

["CTtest"] = {
[1] = {
["initresult"] = 0,
["willsave"] = 0,
["atk"] = "",
["reach"] = 5,
["token"] = "",
["reflexsave"] = 0,
["hp"] = 0,
...

Tokuriku
September 15th, 2007, 14:48
I have found a new "unexpected" use for this script :)
I use it to "CLEAR" the tracker.

Often time, when the tracker was full and I needed to delete the entries one by one by hand, I always wished for a clear tracker command.

So I saved a tracker instance as clear and I just have to "Load" it as /ctl clear.

I searched a bit though and found this (https://www.fantasygrounds.com/forums/showthread.php?t=6685&highlight=clear+tracker) wich is also cool.
You choose the way you prefer...