PDA

View Full Version : Foundation Ruleset Contributions



Foen
September 27th, 2008, 07:05
Until such time as we have a repository, I thought it would be handy to have a thread to track contributions to the foundation ruleset.

I have developed a preference manager, allowing global (campaign-level) and local (user-registry) preferences to be declared, saved, loaded and edited. They can also be flagged gm-only so that clients do not see those preferences.

This is quite flexible, allowing ruleset extensions to add their own preferences for features of the extension. Preferences are grouped, using free-form named groups, and can be expanded and collapsed like inline index entries.

The screenshot shows two preferences defined, the first using a default string control and the second using a custom control (enabling the user to cycle through four possible values by repeatedly clicking the text).

Cheers

Foen

Edit: I forgot to add that this builds on the work of Toadwart, for the Rolemaster ruleset. Stuart

Foen
September 27th, 2008, 11:36
Another extension to the basic ruleset is the ability to share notes between players, and to allow GMs to have access to the players' notes. The attached screenshot shows this facility. It is worth observing:

GMs can see all notes, whether the players have marked them as public or not
Players can see their own notes and any others flagged as public
Note ownership is associated with the client login name, not the player character name
Creating notes from the client side was difficult to achieve in Lua, due to a problem with shared database nodes. The solution used in this case is to pass the command through to the host, which executes it for the client

This last point means that a mechanism is needed for client sessions to invoke asynchronous commands on the host machine, so I have implemented a rudimentary remote procedure call facility using the chat manager.

A code segment on the host can register a command handler for a particular subset of commands, which can then be called from the client. The chat manager methods to facilitate this are:

ChatManager.registerCommandHandler(tag,handler)
ChatManager.sendCommand(tag,command)

The tag parameter distinguishes one handler from another, so no two code segments should register the same tag.

The chat manager then invokes the handler on the host whenever the client send a command through. This is necessarily asynchronus: there are no return values.

This is based on code developed for the Call of Cthulhu ruleset.

Cheers

Foen

Bidmaron
September 27th, 2008, 20:56
Where are the extension files? Thanks, Foen. This is great stuff.

Foen
September 28th, 2008, 07:23
Sorry, I used the term 'extension' inappropriately. These are both included in the foundation ruleset which you can find on this thread (https://www.fantasygrounds.com/forums/showthread.php?t=9036).

I can make the preference manager an extension which you can use with other rulesets and extensions, and will try to post it soon.

The notes facility needs to override chatmanager and chat_chat functionality (to implement the remote command functions) and would almost certainly interfer with your ruleset.

Stuart

Foen
September 28th, 2008, 07:55
Here is a zipped version of the preferences extension. I haven't created an ext file from it because I thought it would be easier for folks to see what is going on as an unpacked extension.

A few notes:

The preferences.lua file is just a sample to show how preferences are registered. For your own use you would remove this file (and the reference to it from extension.xml). Other extensions using this preference manager would instead register their own preferences using similar code.
For the low-down on how to register and access preferences, take a look at preferencemanager.lua. It includes some documentation at the top of the file.
The extension creates a new desktop shortcut (looking like two cogs) regardless of which mode FG is launched in (Host, Client or Local), but you might want to change that in the preferencemanager.lua onInit function (some way down that file).
The extension is ruleset-agnostic.
This is OGL stuff.

Please let me know what you think!

Stuart

Bidmaron
September 28th, 2008, 13:42
Foen, I'll try to look at it when I work on the new FG2 Help stuff tonight. Looks like a great idea. I wonder if we can sweet-talk Moon_Wizard and Joshuha to mod their d20_JPG and 4e_JPG sets to use this? (Although they already have a functional preference system as it stands, so maybe not an effective use of time).

madman
January 6th, 2010, 13:49
Just wondering if the preferences.zip of this extension is still around, and if i can get a copy of it .

Thanks
Chris

Foen
January 6th, 2010, 16:17
Err, yes, just click the link on the post above.

BTW, there is now a functioning preference system in the Foundation ruleset and the above version is built into the Base ruleset.

madman
January 7th, 2010, 01:53
the link is not working for me?

Chris