View Full Version : Progress information - slow function
Xarxus
January 19th, 2024, 11:15
I've a slow function. This function creates a large amount of data for my system during character creation.
I would like to show something to the user. I had thought of a field with a description of the progress (textual),
but it only updates at the end, so it's not needed.
Do you have suggestions?
Trenloe
January 19th, 2024, 11:38
Is your code running in an onInit function? If so, this function is generally called before windows (and contained) controls are displayed, for example: https://fantasygroundsunity.atlassian.net/wiki/spaces/FGCP/pages/996644858/windowinstance#onInit
So, if you want to display something to the user during an onInit function, then you may want to display another window showing progress, or perform the code outside of an onInit function.
Xarxus
January 19th, 2024, 11:52
No, it is not always called during onInit. What I assume is that when the process starts, no updates come to the presentation,
so the effects are only seen at the end. I believe that even if I opened a window, perhaps to be removed at the end, all the
effects would be made visible at the end (i.e. I believe that the window would not be seen at all).
What I would need is a command that "show output now", i.e. redraws it without waiting for the current process to finish.
Trenloe
January 19th, 2024, 14:31
I think we'll need a comment from one of the FG devs on this.
Moon Wizard
January 20th, 2024, 18:07
Due to the fact that the Lua scripts can modify anything in the UI or database and need to be processed sequentially with network and other updates, the Lua runs in a single threaded manner with the UI/database. So, there will be no screen updates nor user inputs during a long-running process.
In general, I highly recommend rethinking/redesigning any processes which run so long that you would need to do this.
Regards,
JPG
Powered by vBulletin® Version 4.2.1 Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.