Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

script.update stops when main ui window in an lua app is closed or minimized? #1

Open
Halvhjearne opened this issue Jul 1, 2022 · 7 comments

Comments

@Halvhjearne
Copy link

idk if this is the intended behavior, but if i close the main ui window in an lua app i made, script.update stops running, if app is opened again script.update will start running again.

if i close the main window and then restart the game, script.update will run from the beginning without the main window open.

if this is intended, is there then some way to prevent it, so that script.update will still run, after main ui window is closed?

regards
Halvhjearne

@Halvhjearne Halvhjearne changed the title script.update stops when app is closed or minimized? script.update stops when main ui window in an lua app is closed or minimized? Jul 1, 2022
@Blumlaut
Copy link

pretty sure that's related to your LAZY mode in the app manifest

[CORE]
LAZY = FULL  ; Possible values:
; • NONE (or 0, default value): load script when Assetto Corsa is loading, run it until it’s closed
; • PARTIAL (or 1): load script only when app is first opened, after that keep it running until Assetto Corsa is closed.
; • FULL (or 2): load script when app is opened, when all windows are closed, unload an app completely.
; Note: when app unloads, all of its internal state (apart from stored with things like `ac.connect()`, 
; `ac.storage()` or `ac.store()`) is completely lost. That’s why sometimes it might make more sense to
; use partial laziness and unload app manually on closing (for example, if your app has manual saving
; and a user closed or hid window without saving).

@Halvhjearne
Copy link
Author

Halvhjearne commented Jul 14, 2022

@Blumlaut i already tried that, it makes no difference what it is set to

edit: ... also even if i did not set that, it seems to me that the default is to start when ac loads and end when ac is closed

@Blumlaut
Copy link

Blumlaut commented Jul 14, 2022

i'm not at my PC right now so cant really test, what exactly happens if you add

[CORE]
LAZY = NONE

to your manifest then?

im running FULL on my own app and it seems to work as intended, for reference, here is it's full manifest:

[ABOUT]
NAME = Tork Display
AUTHOR = Blumlaut
VERSION = 0xDEADBEEF
DESCRIPTION = Displays live torque

[CORE]
LAZY = FULL

[WINDOW_...]
ID = main
NAME = Tork Display
ICON = icon.png
FUNCTION_MAIN = windowMain
FLAGS = FIXED_SIZE, SETTINGS
FUNCTION_SETTINGS = windowSettings
SIZE = 295, 320

@Halvhjearne
Copy link
Author

@Blumlaut i know how its supposed to work ... i litterally tried all values and there is no difference
in your script.update put a line that sends a message or something constantly and try to close your app main window ...

@Blumlaut
Copy link

coming back to this after a while, confirmed bug, tried it myself and can reproduce, LAZY = NONE / LAZY = 0 has no effect

@Halvhjearne
Copy link
Author

@Blumlaut this has already been confirmed and is/will be fixed next version of csp, i have a preview version where it is already fixed.

@Blumlaut
Copy link

next version of csp

let's hope thats soon then, thanks for the confirmation!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants