Closed lehrax closed 9 months ago
-$
, which allows to run a console command in the end of level loading.run_script
console command, which allows runs main
function from the selected script file.run_string
console command, which allows to run a Lua string directly in the console.You can use the first two like this:
xrEngine.exe -$ run_script myscriptfile
Since -$
runs the command only at the end of level loading, it makes sense to use -start
command line key, to tell the engine to load a level straightforward instead of showing main menu:
xrEngine.exe -start server(all/single/alife/new) client(localhost) -$ run_script myscriptfile
That will start singleplayer game as if you had pressed New game in the main menu.
all
is a spawn file name from gamedata/spawns
folder or just a level name from gamedata/levels
folder.
Is your feature request related to a problem? Please describe.
A. Scripts literally are scenarios that we can schedule for execution. Starting the demo would be as easy as choosing the right script to pass as CLI argument.
B. Mods are buggy. Whether development teams lack time or experience, manual testing always leaves room to unexpected outcomes (a.k.a. "it was never supposed to happen like this!"). What if we could have actual system and integration tests to automate flow and save a bit of time and effort for other tasks?
Approximate possible test structure to confirm expected behaviour in game: -- load actual gamesave file or create certain preconditions -- simulate player's actions (activating interactable object, making dialogue choice, triggering quest condition by other means etc) -- assert expectations to be reached
Very vague theoretical example without code:
This suggestion could just be borderline madness, but I strongly believe having the capability to automate certain aspects of quality assurance would drive the projects quality sky high.
Describe the solution you'd like
--headless
flag would start the game without GUI, allowing controlled conditional execution of lua snippets.Maybe a full fledged test framework is too much to even think about, but loading script on demand could definitely be very handy 😁
Describe alternatives you've considered
Doing the same from tilda menu in the game, although, that would not be 100% same experience.
Additional context
I got original inspiration from the principle how some gamedata extractors work (example: tool by xrLil Batya): lua injection through dll replacement that allows to execute script.