The online racing simulator
[Help] Detect LFS entry and exit via LFS Script?
I'm using LFS Script to set controller profiles plus some other LFS related settings for the different cars. It all works very well except for one minor annoyance. If I exit LFS or return to the entry screen, I would like to reset my controllers to a default setting. I've read all of the docs, searched the forums, and tried everything I can think of short of using an external program via InSim.

Here is a rough outline of what I'm doing.

I set some defaults using autoexec.lfs which is called at LFS start.

For every car that is used, the associated *.lfs script calls an external app to apply the controller settings.

The problem.
If LFS is exited using Alt+F4, or drilling down the menus to exit, the last cars settings are still in force. Returning to the entry screen does not re-invoke autoexec.lfs.

My current workaround is to call LFS via a CMD script that resets controllers on LFS exit. This is a bit messy and suboptimal. LFS started via a replay association for example, will bypass the loader script, and therefore miss resetting the controllers.

Does anyone have a suggestion on how to detect LFS entry screen, or signal LFS exit from within an LFS script?
The only thing I could suggest is to type "//autoexec" whenever you need to reload the scripts. Not a solutions, but it's better than having to close the game
Or you can just go with your batch script and change file association in Windows. The script would probably have to be a bit more advanced (it'd probably have to pass some parameters to LFS to open replays and stuff), but I don't see any better way how to do this...
Thanks for the suggestions guys.

This might be a worthy improvement request, but I wanted to be sure I hadn't overlooked some obvious way of detecting a return to entry screen and shut down from within LFS. I'm sure there are others that could use these signals for their scripts without having to resort to an InSim app too.
Quote from Whiskey :The only thing I could suggest is to type "//autoexec" whenever you need to reload the scripts. Not a solutions, but it's better than having to close the game

That's what I have been doing, but I don't always remember. Although I always try to start any app with known parameters to avoid odd behaviour, it's not always possible, and I do like to have things finish up properly on exit.

So, supplemental to autoexec.lfs, I'd like to see entry.lfs, and exit.lfs, to be run on returning to the entry screen and on LFS shutdown respectively.

Quote from MadCatX :Or you can just go with your batch script and change file association in Windows. The script would probably have to be a bit more advanced (it'd probably have to pass some parameters to LFS to open replays and stuff), but I don't see any better way how to do this...

The last round of patch testing made me think about having the associations point to a batch/CMD anyway so I could then pick which LFS install to start. That is still relevant for a dev/test install, so I might just do that anyway. It's much easier/safer to edit a text file than hack the registry to achieve the same ends.

FGED GREDG RDFGDR GSFDG