-
TL;DR - Do you happen to have any ideas or advice on how I can create a delay between 2 automated commands, such as 2 commands in onMapLoad.init? Full situation - Hello, me again. So I was messing around with autolabor and DwarfTherapist today. Wasn't super fond of the interaction. Noticed weird things such as... trying to let autolabor handle some things like stonecarving, with 0 2 2.. and never having the job get assigned, despite there being a whole bunch of stone furniture workorders. I'm not certain why this happened, or if DT had anything to do with it, but I decided I should try to minimize problems by sticking with autolabor or DT independently. So I went back to using only autolabor. This lead me to once again think about the issue I've asked about before. Where sometimes autolabor will assign a job to a lower skilled worker, because the best skilled worker happened to be busy at that moment. I started wondering if I could make my own workaround. Something like, at specific triggered moments, or just every couple in-game days, clear all assigned jobs, then re-assign everything while no one is busy. This might result in occasional task interruption, but I thought it might be worth a try. So first I tested manually clearing a job, autolabor BREWER 0 0. It seems this isn't immediate and the job clearing is queued. So next I tested clearing it and waiting a short amount of time unpaused. This cleared it as expected. So then I tested clearing all jobs, waiting a bit, then assigning my personal list of autolabor preferences. This seems to have worked, and autolabor was able to better assign jobs to the best skilled, while important jobs with minimum counts locked them in. Meaning in theory, I should be able to do this after a big wave of immigrants, or just every so often, and if any dwarves happen to be higher skilled than current workers, they'll take the job like I'd hope, while autolabor can do it's thing on everything else that I'm not worried about. Yay! However, I really don't want to input a console command, wait a bit, then input another console command, every time my population changes. So I set out to automate things. So far, I haven't figured out how to automate having a delay before running another console command though. I experimented with repeat, on the hope that it wouldn't run until it's scheduled time was up, so I could do something like...
So that's where I'm at right now. Looking for a way to automate running a command, then running a second command after X amount of time, to see if this will aid in autolabor's worker selection. It might not, who knows, I'm making a lot of assumptions and not super thoroughly testing lol. Plus you guys mentioned current vanilla labor bugs.. dunno how they tie in either. But it does feel like autolabor mostly works for me. Ideally I'd want the first command to run when population changes, then the second command to run after 100 ticks or however long it takes autolabor to process it's queue. But for testing purposes, I'd be happy if I could figure out how to get the commands (and delay) to run every couple days or something. Do you happen to have any ideas or advice on how I can get that delay/timing between commands? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The call you're looking for is You can use it to both set up a repeating check for new migrants and to control the delayed running of other commands. Check out emigration.lua for an example of how to get it set up. https://github.com/DFHack/scripts/blob/master/emigration.lua |
Beta Was this translation helpful? Give feedback.
The call you're looking for is
dfhack.timeout()
You can use it to both set up a repeating check for new migrants and to control the delayed running of other commands.
Check out emigration.lua for an example of how to get it set up.
https://github.com/DFHack/scripts/blob/master/emigration.lua