PDA

View Full Version : One simple trick that saved me much time and many mouse clicks during development



AmadanNaBriona
March 24th, 2020, 03:16
I'm a beginner. Still working on my first Fantasy Grounds ruleset. But the first thing I realized was that zipping up my directory, renaming it as a ".pak" file, and copying it over to the rulesets directory of my Fantasy Grounds app (and confirming I want to overwrite the old one), over and over and over again with each iteration, is an extremely tedious step. It only takes a few seconds each time, but that's a few seconds over and over and over again.

So, I made a Windows .bat script. It is super-simple. So simple that I doubt anyone who is writing FG code can't figure out a similar solution for themselves, but still, it took me enough trial and error to get it exactly right that maybe it will save someone else time.

(Obviously, you can do the same thing more easily with Linux or Mac, but this is a Windows-specific solution, as command line tools in Windows tend to be more clunky.)

Step one: You want 7-Zip as your archive manager. Specifically, the command-line version. Using Powershell or some other solution to do compression and move files using Windows native utilities is a pain with access controls. Download and install the command-line version of 7-zip.

Step two:

Here's the script:

SET fg="path\to\your\AppData\Roaming\Fantasy Grounds"
7z a -tzip %fg%\rulesets\nameofyourruleset.pak "path\to\your\ruleset\development\directory\*" 1>NUL

That's it. name it "fg.bat" or something and you're done.

The "\*" at the end of the second argument is crucial. The 1>NUL is optional to suppress stdout.

This is just for repeatedly "pak"ing up one particular ruleset under development. You could of course make the batch script more flexible by adding command-line arguments to specify the source and target. But since I'm only working on one thing at a time, it's easier for me to just to hardcode them in there.

Hope this is helpful to someone.

damned
March 24th, 2020, 03:19
Welcome AmadanNaBriona

Ive got two better tips for you -

You dont need to zip it up and rename it. FG will use your unpacked ruleset. You only need to PAK it to share it.
Type /reload in chat and dont hit enter, Drag it to the F1 key and then after you make changes in your code hit F1.

What are you working on?

AmadanNaBriona
March 24th, 2020, 03:26
Ah.... huh. Now that I think of it, I kind of remembered you can just make your development directory the same as your runtime. I keep my development directory separate, for.... reasons, I guess. Oh well. Maybe this trick is only useful to me.

I'm working on The Fantasy Trip. I started with the GURPS ruleset as my base, and started hacking it. It's maybe 50% functional at this point.

damned
March 24th, 2020, 03:40
you can use something like mklink to link a stub in the FG directories to your dev directory - save you copying
please make sure you ask ronnke for permission to fork the ruleset too!