Haplo on 23/11/2018 at 09:14
I'm writing a command script that would run a few commands and then quit DromEd. Unfortunately it seems like quit_game does not wait for the completion of the previous commands and closes DromEd abruptly. Is there another way to quit DromEd, or to wait for all the previous commands to complete?
Unna Oertdottir on 23/11/2018 at 09:53
Maybe put quit_game in a 2nd cmd, so the first cmd runs the 2nd cmd in the end?
Haplo on 23/11/2018 at 10:45
Already tried it, no cigar unfortunately.
Unna Oertdottir on 23/11/2018 at 14:36
I put this in optimize.cmd
Code:
compress_br_ids
clear_surface_cache
optimize
save_cow
game_mode
play_schema dinner_bell
quit_game
Dromed does step 1-3
It's trying to save a cow (I deleted the line)
game_mode is working (I deleted the line)
It doesn't play dinner bell (no time for this, I guess) because
Dromed quits.
vfig on 23/11/2018 at 20:25
Dromed doesn't keep track of commands (like "play_schema") that don't inherently wait for completion. It doesn't know when they're completed, so doesn't have a way to wait for them to be done.
Don't know if this will work for your situation, but one thing you can do is wait for user input just before the quit_game, such as:
Code:
...
; the user must wait for things to finish before hitting ok/cancel on this dialog
find_obj @@
quit_game
Haplo on 23/11/2018 at 23:06
Thanks, but that would defeat the purpose.
I'll work around it. I can write a bash script and use inotifywait to kill DromEd when it's the right time. Another benefit of running DromEd under WINE!
Unna Oertdottir on 24/11/2018 at 08:29
Maybe it's Wine issue. As far as I can see each command has been executed and then DromEd quits.
What's that script doing?
Haplo on 24/11/2018 at 09:05
Try a "dump_screen" before "quit_game". For me the screenshot is not dumped before DromEd quits.
Unna Oertdottir on 24/11/2018 at 10:06
The command is
screen_dump
I think this is the only command which doesn't work with quit_game. Maybe the cache is cleared after quitting DromEd.
vfig on 24/11/2018 at 22:40
All right, I got interested in this cause one thing I'd like to do after release is do timelapse screenshots of my map being built. So I could definitely use the ability to launch dromed and have it take a screenshot and quit!
The core of the problem is that screen_dump only saves a screenshot at the end of the event loop, but quit_game ends the game before that. So the screenshot never gets saved. And since Dromed runs scripts synchronously, without pumping the event loop as it goes, there's no way with just a single script to get a screenshot to be saved and then to quit. But there is an ugly hack you can do instead, that might work! :cheeky:
(These instructions assume you have a "cmds" subdirectory for commands, but you can just edit all the paths below if that's not the case.)
1. Create cmds\AutoQuit.cmd, and put the following in it:
2. Create cmds\ScreenshotQuit.cmd, and put the following in it:
Code:
set game_always_script_AutoQuit .\cmds\AutoQuit.cmd
screen_dump
game_mode
Then when you "run .\cmds\ScreenshotQuit.cmd", it will take a screenshot, save it, and quit.
This works because game_mode only sets a flag to enter game mode at the end of the event loop, which is after the screenshot gets saved. Then when entering game mode, it runs all the game_always_script_* scripts; we've helpfully just set up one which tells it to quit right away.
If you need the screenshot from game mode instead of edit mode, this general approach should work there too—you'll need to use an edit_always_script_* config variable instead, and have your script switch from game mode back to edit mode. And this still has the potential to pause for user input if the level hasn't been portalized, so you should make sure that's been done beforehand.