PDA

View Full Version : Utility Extension



SpudmanWP
November 22nd, 2010, 18:00
I just upgraded from Lite to Full and have a question. Has anyone come up with an Extension (that can be called from the /command interface) that does things like:

1. DB memory dump to the console (and thereby can be copied to the clipboard). This could have a tree-like structure that matches the DB Parent/Child structure. This could have a limited output by using commands like "/MemDmp chr[chr_name]", "/MemDmp monsters" dumps list of monsters, "/MemDmp mon[monster_name]"

2. Hotkey dump that does the above but with the Hotkeys

Basically I am looking for anything that will help with programming (yes I have the docs).

drahkar
November 22nd, 2010, 20:11
Unfortunately all of the file I/O functionality has been disabled in Lua. This is done for security reasons within the application. That means anything of that sort would have to be built into the application framework.

Moon Wizard
November 23rd, 2010, 00:38
You could build that using the existing interface. You just need to register a slash handler, then write the function to handle the resulting slash command.

I built an extension for myself that allows me to insert Debug.chat commands anywhere into my LUA code in order to export LUA variables to the chat window. Invaluable for ruleset creation and debugging.

Cheers,
JPG

SpudmanWP
November 23rd, 2010, 04:53
Care to share the ext?

EDIT----

Nevermind, I found the "ChatManager.addMessage" function.

Thanks

Zeus
November 23rd, 2010, 21:10
You could create the extension to dump the specified XML node data directly to FGII's console window. This way you would prevent the chat window from being spammed and potentially flooding your chat log.

For console output use the print() function.

SpudmanWP
November 24th, 2010, 02:49
Yeah, I figured that and have moved it to the console log. I am still very new to the structure of FG2 and would appreciate any help you can give.

Moon Wizard
November 24th, 2010, 06:07
I'm going to make the Debug extension available in the next few weeks, once I make sure it is ready to go.

Cheers,
JPG

drahkar
November 29th, 2010, 16:29
That would be fantastic. Look forward to seeing that.

phantomwhale
December 7th, 2010, 05:48
Ah cool - been using the Debug commands from the 4E by just plonking the lua script into my extension. It's harmless there, of course, but would be great to have it as a separate extension, esp. as I probably trimmed out some handy features in doing so.

Are there any functions around to print out all "local" or "global" variables in a script ? I tried using some code examples I found on Stack Overflow (https://stackoverflow.com/questions/2834579/print-all-local-variables-accessible-to-the-current-scope-in-lua) but assume that certain parts of lua might be disabled which prevented these from assisting me.

Moon Wizard
December 7th, 2010, 19:39
The LUA access is limited on the machine for security purposes, like most in-application scripting. There is a page in the Library which goes into details about which are disabled/enabled.
https://www.fantasygrounds.com/modguide/scripting.xcp

Cheers,
JPG

Bidmaron
January 2nd, 2011, 17:24
I'm going to make the Debug extension available in the next few weeks, once I make sure it is ready to go.

Cheers,
JPG
How's this coming, Moon_wizard? Any possibility of adding a facility to dump the non-standard characters for a font to a table? That way, we could see all the nifty symbol characters in a given fg font resource (since they aren't windows fonts).

Bidmaron
February 1st, 2011, 12:27
Interrogative status if you can spare the time?

Moon Wizard
February 1st, 2011, 20:22
In general, the whole 3.5E consolidation is taking way longer than I envisioned or hoped. There are several client changes and patches included in the update as well, which has also added some time.

For viewing the fonts, you could just build a string in LUA with the characters 32-255 in it, and dump it to the chat window with a given font name.

Cheers,
JPG

Bidmaron
February 2nd, 2011, 02:28
Sorry it's taking so long, and please prioritize as you see fit. You are right that I can take care of this myself.