PDA

View Full Version : Window Saver Extension



lokiare
May 20th, 2017, 01:59
I'd like to let everyone know that this is a community extension and does not have official Fantasy Grounds support. All problems should be directed to this thread.


After a good chunk of work and some back-and-forths with lokiare1, I've split off my changes into a separate extension, Window Saver X (https://www.fantasygrounds.com/forums/showthread.php?43706-Window-Saver-X-Extension) (with his OK on the name similarity)

From what I can tell, it should work with every ruleset. If anyone finds any issues with it, know that I plan to actively support the extension for the forseeable future.

I'm no longer supporting or updating this extension.

Window Saver is a simple Fantasy Grounds extension that opens the windows you last had open when you closed Fantasy Grounds (with the extension enabled). (Version 3.3.2 saves desktop panel locations out of the box, so that feature has been removed).

Version 0.5.1.

Remembers and opens (tested in 5E, PFRPG, Savage Worlds, but should work in most rulesets):

Master Index
Characters
Notes
Images
Tables
Story
Quests
NPCs
Encounters
Items
Parcels
Feats
Classes
Backgrounds
Races
Spells
Party Sheet
Effects
CT
Modifiers


Windows that don't open:

Unknown


Known issues:

Some windows don't open, and may throw errors.


Version History:
V0.5.1

Removed desktop panel saving and loading code.

V0.4.1

Changed the prompt frame to something that doesn't hurt the eyes.

V0.4.0

Removed use on Client. Added custom Frames and classes so that it runs in any ruleset.

V0.3.0

Added prompt to load windows from last time, which gives delay and removes masterindex bug.

V0.2.0

Allows multiple windows of same class to open, saves position of desktop panels: chat, dice tower, modifier stack.

V0.1.0

Initial Version


Let me know if you get an error and what window class is listed right above the error in the console and I'll add it to the ignore list. Also remember this is Alpha test software, it may not work all the time and you may get errors using it.

Nickademus
May 20th, 2017, 02:19
I'm glad to see this. One question that did raise when I saw this was that a few windows in FG always reopen in the center, on purpose. Moon said this was to ensure that the windows never get lost off the edges of the program window. I think the Characters window was one of them. What are your thoughts on this?

lokiare
May 20th, 2017, 02:21
I'm glad to see this. One question that did raise when I saw this was that a few windows in FG always reopen in the center, on purpose. Moon said this was to ensure that the windows never get lost off the edges of the program window. I think the Characters window was one of them. What are your thoughts on this?

Fantasy Grounds saves the location of each window when its opened. This extension doesn't affect that at all. It simply re-opens the windows you had open previously.

Trenloe
May 20th, 2017, 02:49
Very cool. Great idea.

One Issue I've seen - it only saves one type of window - you can't have two story windows saved. And if you have two masterindex window classes open - i.e. the base Story, NPCs, Images, etc. campaign data list windows opened from the desktop sidebar, you'll get an error on reload and the relevant windows will open completely empty, until you close them and restart the campaign.

Error when reloading after having two campaign data lists open = Script Error: [string "common/scripts/windowtitlebar.lua"]:48: bad argument #1 to 'setText' (string expected, got nil)

EDIT: I think these are both related to the two issues listed in post #1.

One of the main issues is that the child entry in the database is created with createChild(class, "string"); which results in the child XML key being the class name - which is not unique, hence clashing with previous entries as the createChild command will fetch the previous entry - the API doc says: "Create, or if it already exists fetch, the specified child node under the current node."

I'd suggest just using .createChild() (without any parameters) so that a unique id-XXXXX node is created - then store the class and db reference under that unique node.

lokiare
May 20th, 2017, 03:00
Very cool. Great idea.

One Issue I've seen - it only saves one type of window - you can't have two story windows saved. And if you have two masterindex window classes open - i.e. the base Story, NPCs, Images, etc. campaign data list windows opened from the desktop sidebar, you'll get an error on reload and the relevant windows will open completely empty, until you close them and restart the campaign.

Error when reloading after having two campaign data lists open = Script Error: [string "common/scripts/windowtitlebar.lua"]:48: bad argument #1 to 'setText' (string expected, got nil)

EDIT: I think these are both related to the two issues listed in post #1.

One of the main issues is that the child entry in the database is created with createChild(class, "string"); which results in the child XML key being the class name - which is not unique, hence clashing with previous entries as the createChild command will fetch the previous entry - the API doc says: "Create, or if it already exists fetch, the specified child node under the current node."

I'd suggest just using .createChild() (without any parameters) so that a unique id-XXXXX node is created - then store the class and db reference under that unique node.

Thanks Trenloe, if I have time Sunday I'll definitely do that.

Wookiee420
May 20th, 2017, 07:29
hey I have a question about this, may I request that it remembers chat window changes? for example i like to unlock my chat window, shrink its size down to a quarter of is original size, move it so it almost touches the modifiers and then relock it. When all is said and done, that isnt much effort to do, in fact this post takes more time and effort, but i would love it if it could be done.

lokiare
May 21st, 2017, 22:23
hey I have a question about this, may I request that it remembers chat window changes? for example i like to unlock my chat window, shrink its size down to a quarter of is original size, move it so it almost touches the modifiers and then relock it. When all is said and done, that isnt much effort to do, in fact this post takes more time and effort, but i would love it if it could be done.

I've updated the initial post with the new version which now saves the chat, dice tower, and modifier stack positions (and size for chat) for CoreRPG based rulesets.

If you like this let your friends know. The more people that test this the better it will get.

Wookiee420
May 22nd, 2017, 00:26
thank you!!

Trenloe
May 22nd, 2017, 00:55
I've updated the initial post with the new version which now saves the chat, dice tower, and modifier stack positions (and size for chat) for CoreRPG based rulesets.
Nice one.

A few issues:
1) if the campaign doesn't already have the <windowsaverdesktop> node - i.e. it is the first time the extension has been loaded, then there's an error raised at line 78 with nWindowSaverDesktop being nil. This is because the code just does a DB.findNode for windowsaverdesktop in onDesktopInit() when the node is only created in onDesktopClose.
2) The masterindex issues appears to be if it is a completely empty masterindex window, it generates an error in windowtitlebar.lua. If there are any records in the masterindex window then it doesn't appear to generate the error. Or if you try again after the first error then it works OK. It seems to be related to the state (empty? Not fully created?) of the base database node - e.g. <encounter> for story entries.
3) Doesn't work for players, just GMs. This could be your next challenge! Writing some OOB functions that allow the player window positions to be saved as well. :)

lokiare
May 22nd, 2017, 20:14
Nice one.

A few issues:
1) if the campaign doesn't already have the <windowsaverdesktop> node - i.e. it is the first time the extension has been loaded, then there's an error raised at line 78 with nWindowSaverDesktop being nil. This is because the code just does a DB.findNode for windowsaverdesktop in onDesktopInit() when the node is only created in onDesktopClose.
2) The masterindex issues appears to be if it is a completely empty masterindex window, it generates an error in windowtitlebar.lua. If there are any records in the masterindex window then it doesn't appear to generate the error. Or if you try again after the first error then it works OK. It seems to be related to the state (empty? Not fully created?) of the base database node - e.g. <encounter> for story entries.
3) Doesn't work for players, just GMs. This could be your next challenge! Writing some OOB functions that allow the player window positions to be saved as well. :)

Thanks. I've put these things on the list to update in the next version.

Number 3 is caused by players not being able to change the DB nodes created by the GM. I might be able to do an if statement to create and store the client values in a separate part of the DB which the clients get ownership of.

Trenloe
May 22nd, 2017, 20:34
Number 3 is caused by players not being able to change the DB nodes created by the GM. I might be able to do an if statement to create and store the client values in a separate part of the DB which the clients get ownership of.
Yep, that's why I mentioned OOB messaging. You can use OOB messaging to send the info from the client to the GM so that the GM side stores the data in the database. Then, the GM side needs to make the nodes public so that the player side can read the data to create the windows without OOB messaging. OOB messaging would be needed when the player side needs to create the data or needs to delete it.

lokiare
May 24th, 2017, 05:14
I've uploaded v.0.3.0 which adds a prompt that asks whether it should load the windows from last time, which seems to get rid of the masterindex bug. Please tell me how it goes and if the bug resurfaces.

lokiare
May 24th, 2017, 20:08
To explain the bug. It didn't have anything to do with having a blank story entry. It had to do with the onDesktopInit() function not loading in any particular order and each encounter (story) loading up the masterindex window for the navigation buttons to see which encounter (story) entry was the index, previous, and next. So masterindex was trying to access something that was not initialized in its own onDesktopInit().

Since Fantasy Grounds doesn't have any kind of timers, I solved the problem by adding a prompt that comes up. By the time the user clicks the prompt, everything has loaded up.

Trenloe
May 24th, 2017, 23:22
Since Fantasy Grounds doesn't have any kind of timers, I solved the problem by adding a prompt that comes up. By the time the user clicks the prompt, everything has loaded up.
Nice solution. :-)

lordjeb
May 25th, 2017, 00:09
First of all, this extension is awesome. IMHO one of the big things missing from FG ui in general. A couple of ideas for improvement:

* Remember the scaleui setting - this has a pretty large impact on window placement, so if the scaleui isn't done before the extension rearranges windows it gets a bit wonky
* Maybe remember whether the FG window was maximized

(Right now, I'm using this by (1) launching FG, (2) /scaleui command, (3) maximize window, (4) click the extension prompt to restore my window locations.)

Trenloe
May 25th, 2017, 00:32
* Remember the scaleui setting
Set "UI Scale" in the FG settings window before you start your campaign. This setting will be remembered for all of your sessions.

lokiare
May 26th, 2017, 18:17
Updated to version 0.4.0.

Changes:
Added custom frame, and classes so prompt works on all rulesets.
Disabled it from showing the prompt or saving windows on clients (will add client support later).

Rondor
May 29th, 2017, 15:18
Big, Fat, Total

Thank you!

lokiare
June 2nd, 2017, 22:34
First of all, this extension is awesome. IMHO one of the big things missing from FG ui in general. A couple of ideas for improvement:

* Remember the scaleui setting - this has a pretty large impact on window placement, so if the scaleui isn't done before the extension rearranges windows it gets a bit wonky
* Maybe remember whether the FG window was maximized

(Right now, I'm using this by (1) launching FG, (2) /scaleui command, (3) maximize window, (4) click the extension prompt to restore my window locations.)

Unfortunately there is no API command to maximize or restore the FG window, so that feature is not going to happen. See other post about ScaleUI.

Nickademus
June 2nd, 2017, 23:16
There is a way to have FG always start maximized; one of my players does it. It might have something to do with Steam though. I'll ask him.

LordEntrails
June 2nd, 2017, 23:19
There is a way to have FG always start maximized; one of my players does it. It might have something to do with Steam though. I'll ask him.
In Windows, on the properties of the shortcut you can choose "Run" > "Maximized".

I've not tried it, but that should work.

rob2e
June 6th, 2017, 21:40
I'm having an issue where the extension decides to move the modifier box higher up the chat log. Weird?
19265

Moon Wizard
June 6th, 2017, 21:43
When the extension is saving the modifier box position, it probably saved it during a previous session where your desktop was smaller. Lokiare will have to see if he can write the panel saves to know whether they are custom positions.

Regards,
JPG

lokiare
June 7th, 2017, 07:41
When the extension is saving the modifier box position, it probably saved it during a previous session where your desktop was smaller. Lokiare will have to see if he can write the panel saves to know whether they are custom positions.

Regards,
JPG

You mean where it knows where it should be relative to the desktop resolution? I can do that.

I'll do both size and position if I can query the desktop resolution (which I think I can).

lokiare
June 8th, 2017, 14:25
You mean where it knows where it should be relative to the desktop resolution? I can do that.

I'll do both size and position if I can query the desktop resolution (which I think I can).

Panel saving requires some changes, and we are looking into this.

Stonesnake
June 8th, 2017, 15:31
I have the same issue with the modifier box AND the dice tower moving. I was able to test it and it occurs when I minimize/resize my screen and then close the program. It will put the modifier box and dice tower in the center of the screen instead of their default locations. However I do also have those in their "default" locations if that helps at all. Not sure if there is a way to pick up on that in the code and then put them back in that location.

Also this is what the popup box looks like on my screen when it asks to put the boxes back, is it supposed to look like this?

https://i.imgur.com/4WbSczJ.jpg

lmp802
June 17th, 2017, 23:30
So I have the extension installed and I attempted to open windows from my past session multiple times now. I get the box asking if I want to load Windows from the last time and I say yes, but I have yet to have it do anything. I am DMing a d&d 5e campaign. Am I missing something? Do I need to tell it to save etc? Any thoughts are appreciated.

Zacchaeus
June 18th, 2017, 01:24
It will only work if you have closed a campaign with the extension installed and then opened it again.

lokiare
June 19th, 2017, 15:51
So I have the extension installed and I attempted to open windows from my past session multiple times now. I get the box asking if I want to load Windows from the last time and I say yes, but I have yet to have it do anything. I am DMing a d&d 5e campaign. Am I missing something? Do I need to tell it to save etc? Any thoughts are appreciated.

Can you open your campaign, then open the console window by typing /console in the chat. Then type /reload and when the prompt comes up say yes, then copy the output from the console and post it here? That would help me figure out what's going on in your particular case.

Also keep in mind it can't remember every window just Story, Image, Quest, Characters, etc...etc...

lokiare
June 19th, 2017, 22:24
Also I would like to apologize for the graphics. I made custom graphics so that it would work in all rulesets and not just the CoreRPG rulesets. I'm not an artist. If someone wants to create better graphics I'll give you credit and include it in the extension.

lokiare
June 23rd, 2017, 17:46
I've updated the graphics for the prompt. It is much better and doesn't hurt the eyes as much.

waldrop32
August 1st, 2017, 04:00
where the hell do you put the extensions? I can't find it anywhere.

celestian
August 1st, 2017, 04:06
where the hell do you put the extensions? I can't find it anywhere.

CLick on the box then drop them in the folder extensions.
https://i.imgur.com/JHDG8Gr.png

lokiare
September 19th, 2017, 20:27
Updated this extension, removed desktop panel saving and loading code.

LordEntrails
September 19th, 2017, 21:26
How does this differ with the new capabilities of 3.3.2 for saving window positions?

Moon Wizard
September 19th, 2017, 21:43
Lokiare's extension will remember all the individual record windows and campaign lists that you have open when you end your session, and restore them when you start your next session.

Regards,
JPG

KlatuB
November 19th, 2017, 01:22
How does a player connected to a campaign use this extension. Both the DM computer and my player computer have the extension and only the DM version of FG will run the extension

damned
November 19th, 2017, 01:38
Extensions are all GM side.
Players cannot load their own extensions and they get what the GM sets.

KlatuB
November 19th, 2017, 04:56
Our GM does have the extension loaded, and can use it himself. But when I join his game I don't have the option to restore any open windows I had open at the end of the last session. The question I have is this a GM only extension or can players also use it.

LordEntrails
November 19th, 2017, 05:01
Yes, this extension only works for the GM.

cas206
November 19th, 2017, 21:36
I'm new to this extension and have the latest FG build. Should PCs -> Characters Selection window be remembered, either as part of the new build or with the extension? Mine always goes back to center screen (which is split across my two monitors). Others, such as NPCs, Story, etc. open where I left them. Even without closing FG, closing the Character Selection window and hitting PCs moves Characters Selection back to the center.

Zacchaeus
November 19th, 2017, 21:51
According to the first post it should be. But having said that I've never moved the character selection screen anywhere so I've never noticed.

lokiare
November 20th, 2017, 05:06
I'm new to this extension and have the latest FG build. Should PCs -> Characters Selection window be remembered, either as part of the new build or with the extension? Mine always goes back to center screen (which is split across my two monitors). Others, such as NPCs, Story, etc. open where I left them. Even without closing FG, closing the Character Selection window and hitting PCs moves Characters Selection back to the center.

This extension has nothing to do with window positions, it only re-opens windows that you had open when you closed Fantasy Grounds or exited the campaign, so this is probably a feature of Fantasy Grounds to keep the window in the middle of the screen.

Moon Wizard
November 20th, 2017, 09:20
The Character Selection window has been specifically excluded from the window location memory function, and will always open in the center of the screen. Since this window is so important for users connecting to a live game, it was designed that way.

Regards,
JPG

cas206
November 21st, 2017, 03:29
Thanks for the clarification on the Character Selection screen (i.e working as intended :)

Just wanted to say that despite that one screen, this extension is awesome. Thanks for sharing it.

JohnD
December 25th, 2017, 21:19
Thank you for this.

JohnD
December 26th, 2017, 00:58
This is not working for me in C&C. I get the prompt upon loading but when I click yes, nothing happens.

lokiare
December 26th, 2017, 16:39
This is not working for me in C&C. I get the prompt upon loading but when I click yes, nothing happens.

It should work with any rulesets that report windows opening. Its possible C&C doesn't do this.

JohnD
December 26th, 2017, 19:16
Huh. Oh well.

Trenloe
December 26th, 2017, 19:26
This is not working for me in C&C. I get the prompt upon loading but when I click yes, nothing happens.
Worked fine for me in C&C.

I opened the Image list and a couple of images. Left them open. Closed the campaign. Opened it back up, clicked "Yes" on the open windows prompt and the same windows opened from before.

JohnD
December 26th, 2017, 21:39
The background theme must be causing a difference then. I was using it with the wood theme for C&C... I just tested it without the theme (the regular green background) and it works.

Edit: and now I've tried it with the wood theme and it works. Frustrating and confusing.

damned
December 26th, 2017, 22:06
I believe JohnD that I have seen that posted elsewhere... The Wood Theme is quite old now and while thats not an issue many things under the hood have changed over time and I see several other issues that were related to the Wood Theme.

JohnD
December 26th, 2017, 22:12
I believe JohnD that I have seen that posted elsewhere... The Wood Theme is quite old now and while thats not an issue many things under the hood have changed over time and I see several other issues that were related to the Wood Theme.

Ah... and I quite prefer the look compared to the green background. Strange that initially it wouldn't work and now that I did get it to function in the regular desktop, it worked in the wood one. Thanks for following-up everyone.

Gkjsdll
May 4th, 2018, 03:38
Thanks. I've put these things on the list to update in the next version.

Number 3 is caused by players not being able to change the DB nodes created by the GM. I might be able to do an if statement to create and store the client values in a separate part of the DB which the clients get ownership of.

Is this something that you're currently working on adding? If not, I could try making some changes locally to allow for this. If I did, would you be willing to merge in my changes?

lokiare
May 4th, 2018, 05:13
Is this something that you're currently working on adding? If not, I could try making some changes locally to allow for this. If I did, would you be willing to merge in my changes?

I've got too many things going on to update this. If you can add the changes feel free to, and I'll test it out and add it to the first post, and add your name to the credits.

Gkjsdll
May 8th, 2018, 16:13
After a good chunk of work and some back-and-forths with lokiare1, I've split off my changes into a separate extension, Window Saver X (https://www.fantasygrounds.com/forums/showthread.php?43706-Window-Saver-X-Extension) (with his OK on the name similarity)

From what I can tell, it should work with every ruleset. If anyone finds any issues with it, know that I plan to actively support the extension for the forseeable future.

houseofdexter
January 23rd, 2021, 19:21
Just want to say thanks...love this extension...