PDA

View Full Version : WindowList getWindows() and invisibility



Minty23185Fresh
March 13th, 2018, 19:53
According to the WindowList page XML and Scripting Reference document, the getWindows() function (https://www.fantasygrounds.com/refdoc/windowlist.xcp#getWindows) allows an optional "visible only" argument.

The members of a WindowList are windowinstances not window controls so they don't have the <invisibility /> option. So how does one make a member of a WindowList invisible?

It looks like I could use close() with the <softclose /> option in the <windowclass> and then Interface.openWindow() to make it visible when desired. Or I could use celestian's methodology described in this thread (https://www.fantasygrounds.com/forums/showthread.php?37360-Issues-hiding-using-windowlist). Is one of them the preferred or is there possibly another methodology I've failed to ferret out?

What I am hoping to accomplish is to "generisize" the Ability Points Trackers on the 5E Character Sheet. Currently there are two trackers, for Spells and for Pact Magic. My Mystic Class extension added a tracker for Psionics. Monks have Ki points. Other classes have special abilities that could benefit from trackers for those points. I want to make it database driven so users could add their own tracker definitions for homebrew classes, so I am moving the individual tracker controls into the subwindows of a WindowList. For some classes, no trackers would be shown for other classes one of the trackers would be displayed, and for multiclass characters two or more trackers might show up.

Below is a screenshow (Preparation mode is on the left, Combat mode is on the right). In prep mode all trackers show up so that the user can set the point slots needed for their character. In Combat and standard mode only the appropriate (non-zero) trackers show up.
22628

Nickademus
March 13th, 2018, 21:43
I believe the basic way of using the 'visible only' argument for the getWindows() function is the onFilter() function. The windowlist makes the entries invisible automatically when it filters the list and getWindows() can observe that filtering by setting the 'visible only' argument to true.

Moon Wizard
March 13th, 2018, 22:13
Yes, the window visibility is not a setting you control directly, but a consequence of filtering. Windows can be filtered by setting a category, specifying a filter control, or by overriding the "onFilter" event.

Also, the 5E ruleset will already handle specific ability groups (such as Ki Points, Superiority Dice, ...), without needing to have seperate fields at the top. Just set up an ability group with a number of uses per day or per rest.

The spell slots are specifically broken out, because they are meta-data that is shared across multiple groups (i.e. multiclass with multiple spell-using classes share the same spell slot pool).

Regards,
JPG

Minty23185Fresh
March 14th, 2018, 14:36
Thanks Nickademus. Upon your reply I started thinking about it and it seems to be a much more elegant way of approaching the solution.

Minty23185Fresh
March 14th, 2018, 16:11
Yes, the window visibility is not a setting you control directly, but a consequence of filtering. Windows can be filtered by setting a category, specifying a filter control, or by overriding the "onFilter" event.

Thank you Moon Wizard.


Also, the 5E ruleset will already handle specific ability groups (such as Ki Points, Superiority Dice, ...), without needing to have seperate fields at the top. Just set up an ability group with a number of uses per day or per rest.

In another thread (https://www.fantasygrounds.com/forums/showthread.php?42702-Trackers-for-more-than-spells), Axoid and Zacchaeus kindly also point this out. However, as stated in my response posted on that thread I find the implementation unpalatable.

And here's why:
For the screenshot below Psi Point tracking has been set up three ways (for illustration purposes). At the top my Mystic Class extension provides a special tracker coincident with the Spell Slots trackers. Just below that I set up an ability group just for the points. And at the bottom I have attached the points to other abilities (as suggested in the other thread). Here are the behaviors I dislike:
1) (Left panel of the screenshot) When set up using ability groups, each time a Psi Point is applied it is announced to everyone in the Chat. My extension doesn't do this. (Can it be silenced, without silencing other announcements?)
2) (Right panel) When any rest is applied the Psi Points are all cleared. This is incorrect for Psi Points, they should only be cleared on a long rest (again properly handled by my extension).
3) (Right panel, the red arrows.) If point tracking is attached to individual abilities, because of window width, the longer descriptions are crunched up. True, I could just make the Character Sheet wider, but at the expense of valuable total display real estate.
22634

BTW, the extension also correctly sets the number of points by level, something that must be done by hand with the other implementations.

In my opinion, having all the points in one place and handled properly, just as the Spell Slots are makes the most sense and it parallels the way I am already used to dealing with spell points.

Nickademus
March 14th, 2018, 19:14
2) (Right panel) When any rest is applied the Psi Points are all cleared. This is incorrect for Psi Points, they should only be cleared on a long rest (again properly handled by my extension).

Is the ability set to recharge on 'Rest' or 'Daily'?

Minty23185Fresh
March 14th, 2018, 22:02
Is the ability set to recharge on 'Rest' or 'Daily'?
I had it set to Rest in both cases. I didn't try Daily, given your question, I'm guessing Daily implies Long Rest?

Moon Wizard
March 14th, 2018, 22:04
Yes, that’s correct. “Daily” is equivalent to “Long Rest”.

Cheers,
JPG