PDA

View Full Version : "adventure" options



Visvalor
December 20th, 2009, 23:31
On the right as you all know there is an image and story control ( sometimes more depending on the ruleset )

I'm trying to add custom controls that bring up custom windows, where do I go about finding out where all it needs to be?

So far trying to find all the aspects in teh desktop_ portions of the ruleset that point to persay the story window being opened, but not having much luck so far, I seem to be overlooking something


Best I can figure it's spread over;

desktop_classes
desktop_panels
graphics_frames

and it's main

adventure_

Am I missing something cause I can't seem to figure it out >_<

Foen
December 21st, 2009, 06:08
desktopmanager.lua and desktop.lua are used in many rulesets for this purpose. The areas on the right hand side are called the stack (top right) and the dock (main right), and icons are added there using registerStackShortcut and registerDockShortcut respectively.

Older rulesets won't have this feature, as it was added to the base code in about FG version 2.3, but more recent rulesets should have this facility enabled.

The adventure_xxx.xml files contain the definitions used for the dock items (story, images etc), and you can find an overview of them in an earlier post (https://www.fantasygrounds.com/forums/showthread.php?t=10924).

Hope that helps

Foen

Visvalor
December 21st, 2009, 19:15
Looking into it, still having a hard time finding where the icon is defined and placed :P

Visvalor
December 21st, 2009, 20:09
AHHHHHH Ok I am confused.

I've looked through EVERY xml using a search feature for button_book (The icon used to show the story stuff) to try and find where the actual icon is declared (Every single XML) and then did the same for every LUA script... nothing came up but inside graphics.xml file.

I'm confused. Very confused.

Foen
December 22nd, 2009, 06:08
Taking the story book as an example, and using foundation...

The icons for the book itself are defined in two steps: first the images are stored as icons\button_book.png and icons\button_book_down.png, then they are declared available to Lua scripting in graphics.xml using the line:


<icon name="button_book" file="icons/button_book.png" />

(This makes the Lua name 'button_book' point to the image file 'icons/button_book.png'.)

Having defined the icon, the next bits to define are the three window classes (all in adventure_story.xml, although confusingly called 'encounter-something'):

encounterlist: the definition of the window that opens when you click the book, with a list of story entries;
encountersmall: the definition of the entries in the book, each one showing the name of the entry and a link to the full description; and
encounter: the expanded view of a single entry in the list.

These three are the subject of my earlier post (https://www.fantasygrounds.com/forums/showthread.php?t=10924).

Having defined the icons and the window classes, the last piece is to add the icons to the right-hand stack of icons. This is done in scripts/basedesktop.lua using the line:


DesktopManager.registerDockShortcut("button_book", "button_book_down", "Story", "encounterlist", "encounter");

This call registers the story list. The first two parameters are the name of the icon for the story book and the name of the icon used when the book is pressed down. The third parameter is the tooltip text for the icon, displayed when you mouse over it. The fourth icon is the name of the window class to be opened when it is clicked (the first of the ones described above). The last parameter is the database node to used as the source of the book contents (the window class is 'bound' to this node).

Different ruleset may have this code in different places (my rulesets use desktop.lua instead of basedesktop.lua), and older rulesets don't use this technique at all.

Hopefully that helps

Foen