PDA

View Full Version : Extension build tools or code listeners



sturtus
May 23rd, 2018, 21:08
In web dev, I have build tools and compilers that listen for file changes and compile then refresh the web page I'm working on. These are super valuable to doing front end design. Is there any equiv here for extension dev? Ideally it would:

- reload the extension in the campaign when files are saved/updated
- flush any extension caches
- perform any build scripts defined in the build tool

Is there anything like this, or do we have to quit a campaign and relaunch each time to see updates to extensions as we dev?

celestian
May 23rd, 2018, 21:20
In web dev, I have build tools and compilers that listen for file changes and compile then refresh the web page I'm working on. These are super valuable to doing front end design. Is there any equiv here for extension dev? Ideally it would:

- reload the extension in the campaign when files are saved/updated
- flush any extension caches
- perform any build scripts defined in the build tool

Is there anything like this, or do we have to quit a campaign and relaunch each time to see updates to extensions as we dev?

Look in the code for "addHandler". The examples you find from that should get you where you need.

Something like this.



DB.addHandler(DB.getPath(nodeChar, "defenses.ac.temporary"), "onUpdate", onSourceUpdate);


Whenever defenses.ac.temporary is changed the function onSourceUpdate() is run.

Andraax
May 23rd, 2018, 21:38
"/reload" in the chat box reloads the ruleset and all extensions.

Trenloe
May 23rd, 2018, 21:45
Yep, use /reload

Some info here: https://www.fantasygrounds.com/wiki/index.php/Developer_Guide_-_Appendix_-_Development_and_Debugging

celestian
May 23rd, 2018, 21:47
"/reload" in the chat box reloads the ruleset and all extensions.

Oh, duh, yeah. That one. I totally mis-read what he was asking.

I actually make keyslots "F5" /reload, "F6" /console.

sturtus
May 23rd, 2018, 22:14
Yes, that! Thank you!

Moon Wizard
May 24th, 2018, 01:26
I usually assign reload to the F12 hot key in all my test campaigns. Just type /reload in the chat box, and drag to hot key before hitting Enter.

Cheers,
JPG

dulux-oz
May 24th, 2018, 04:43
for me its F2 = /save, F3 = /console and F4 = /reload :)