Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: About automation scripts/macros  (Read 2218 times)

joaodosgrao

  • Bay Watcher
    • View Profile
About automation scripts/macros
« on: September 24, 2017, 09:13:50 pm »

So, with the new manager I usually try and automate some industries as best as I can. For example: I set every piece to be made 5 times, and add a condition so it will restart once there are less than 5 available (10 for pairs).

As in: Make 5 cloth vest => condition: restart if there are less than 5 cloth dresses available.

The thing is, setting this up every single game is pretty annoying, even more so because it has to be done for 3 distinct materials (cloth, silk, yarn)

Is there a way I could set up a dfhack script to run that on the manager with a single command line, so I could avoid the hundreds of keytaps to get this done? Would it be considered a script or a macro?

Is it too hard to learn? Could anyone point me in some direction so that, if such script/macro doesn't exist, I could develop my own? It would be rather simple, I guess, and I'm all for learning a little bit of programming language to get this done (it will probably spare me a lot of time in the long run to have such customized fancies)

Anyways, don't really know if this is the right subforum for this. If I'm wrong, please move the topic.

Thanks in advance.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: About automation scripts/macros
« Reply #1 on: September 24, 2017, 09:56:46 pm »

There's orders plugin in dfhack-43.05-r2. Supports export, import and clear. There's also Manager order macros and manager macro generator.

You might be also interested in workflow/stockflow for alternatives to using vanilla manager.

joaodosgrao

  • Bay Watcher
    • View Profile
Re: About automation scripts/macros
« Reply #2 on: September 25, 2017, 09:09:48 am »

THanks for the tip! I will take a loot at the plugin and the macros :)

I used workflow for sometime, but it is annoying the fact that it has to be set up on the workshop itself, and in workshops like the clothier, since the maximum number of orders is 10 per workshop, it would take about 6 workshops to have all types of clothing with all types of materials set for it; it is not very efficient in this manner (although it is good for brewing and workshops with few job orders).

Another annoying thing about workflow is how damn hard it is to set it up to mill specific plants, such as rock nuts, lots of trial and error involved. The manager conditiong is still a little better at it (although it also needs a lot of improvement)

Thanks again, I'ma check the plugins now!
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: About automation scripts/macros
« Reply #3 on: September 25, 2017, 06:01:31 pm »

Hm, *checks* Mill plants is one of those detailless jobs that should benefit from workflow + gui/job-material to mill specific ones without stockpile links. I take it you were  confused by the myriad of options available.

I can honestly say I don't brother with producing every type of clothing, though if you need 6 for that you've gotten lucky in worldgen. A random result I'm looking at now only has dress, robe, cloak, trousers, cap, hood, glove, mitten, sock, shoe - 10 types total. You could probably toggle off looking for silk/yarn/plant subtypes of cloth in specific as well, though that uses flags...

Hm. gui/workshop-job doesn't enable affecting that, but this should work (just select job after making it but before dwarf picks it (can't make them decide to take a different cloth mid-job) and enter in console/bind to hotkey in dfhack.init and use that hotkey):

:lua local j = dfhack.gui.getSelectedJob() local c = j.material_category c.yarn = false c.cloth = false c.silk = false local i = j.job_items[0].flags2 i.yarn = false i.silk = false i.plant = false

Dwarf definitely started using pig tail cloth for a previously silk and yarn jobs in a quick test. Obviously, I expect they'd also use adamantine cloth, if you had sewn any strands into it. Still, could cut down from 6 to 2...Still, not something you can easily automate setup of; when every fort has different placement of workshops a macro is not going to work.

Mind, I recall there were reasons for job-material to not do this. I think, amongst the others, was not permitting cooking of rotten food.
« Last Edit: September 25, 2017, 06:04:44 pm by Fleeting Frames »
Logged

joaodosgrao

  • Bay Watcher
    • View Profile
Re: About automation scripts/macros
« Reply #4 on: September 26, 2017, 02:30:20 pm »

You forgot vests, tunics, shirts and bags xD
That would make 2 workshops for cloth, 2 for yarn and 2 for silk (not counting adamantine, because I'd rather use it for armor and weapons)

And, yeah, I might have screwed up on workflow milling jobs. I'll double check it asap.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: About automation scripts/macros
« Reply #5 on: September 26, 2017, 04:33:58 pm »

I didn't include bags because you don't need to constantly produce more (you really only need socks, trousers, cloak to avoid bad thoughts and most military conflicts). And the random example civ I picked doesn't have vests, tunics, shirts, much like some dwarven civs can't produce high boots.

The yarn/cloth/silk thing is why I posted the above script though.
« Last Edit: September 26, 2017, 04:35:41 pm by Fleeting Frames »
Logged