Hi JLV,
It will be great if we can reload js files on the server without restart it. With this feature, we have not to setup again all tracks on it after each little update on js.
[Server] Reload JS File
-
- Crushed Dissenter
- Posts: 62
- Joined: Fri Aug 03, 2018 6:37 pm
Re: [Server] Reload JS File
How do you mean, like if you add a track?
Discord: StorkeN#6883 - StorkenMXS Youtube - StorkenMXS Instagram - StorkenMXS Facebook - TMFR on Faceboook
-
- Crushed Dissenter
- Posts: 62
- Joined: Fri Aug 03, 2018 6:37 pm
Re: [Server] Reload JS File
Yes, may be. Or just a command which reloads all js scripts like 'server, reloadjs'
Re: [Server] Reload JS File
You could double it. Like *inserting stuff in js file via GUI button click* also runs something like:
It perhaps isn't the full solution you want, but for specifically adding tracks, this could work.
Code: Select all
x<XCMD PASSWORD>server,addtrack <time> <laps> <change interval> <trackinfo>
or
x<XCMD PASSWORD>server,removetrack <track number>
Discord: StorkeN#6883 - StorkenMXS Youtube - StorkenMXS Instagram - StorkenMXS Facebook - TMFR on Faceboook
Re: [Server] Reload JS File
You could try 'eval(mxserver.file_to_string("myscript.js"))'. You'd have to make sure you reset any handlers you hooked at the start of your script to avoid turning the handler chain into a loop. I'd feel safer just restarting the server.
It'd also be possible to save your track list and reload it when the server starts.
It'd also be possible to save your track list and reload it when the server starts.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
-
- Crushed Dissenter
- Posts: 62
- Joined: Fri Aug 03, 2018 6:37 pm
Re: [Server] Reload JS File
It's not just for tracks. It's also to allow me to make a little update without have to ask at all players to come back after few minutes.
If I could restart js without restart server, it will be easier for me to fix issues very fast on MxsRank.
If I could restart js without restart server, it will be easier for me to fix issues very fast on MxsRank.
Re: [Server] Reload JS File
Probably best to just do the eval thing in that case and be careful with the hooks. The default handlers are all just empty functions so it's safe to not call them.
Josh Vanderhoof
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.
Sole Proprietor
jlv@mxsimulator.com
If you email, put "MX Simulator" in the subject to make sure it gets through my spam filter.