Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: DFHack Embark and Continue Auto Commands  (Read 1096 times)

Rogue Yun

  • Bay Watcher
  • Beware of the Carp
    • View Profile
DFHack Embark and Continue Auto Commands
« on: June 07, 2013, 06:08:16 pm »

I have a question... I tried searching for a solution to this without success.

I tend to rethink my fortress design and start over a lot. So I would like to try to create a list of dfhack commands that I can activate immediately after embark

commands like

Code: [Select]
autolabor 1
workflow enable
workflow enable drybuckets
workflow enable auto-melt
workflow count BED 10
workflow count DRINK 30
workflow count BLOCKS//OBSIDIAN 100
workflow count TOOL:ITEM_TOOL_LARGE_POT//OBSIDIAN 30
workflow count WEAPON:ITEM_WEAPON_SWORD_SHORT_TRAINING 4
workflow count WEAPON:ITEM_WEAPON_AXE_TRAINING 2
workflow count CAGE 10
workflow count TRAPPARTS 20
workflow count AMMO:ITEM_AMMO_BOLTS 1000
workflow count PANTS:ITEM_PANTS_LEGGINGS//STEEL 300
workflow count TRAPCOMP:ITEM_TRAPCOMP_MENACINGSPIKE//STEEL 300
workflow count WEAPON:ITEM_WEAPON_MACE//STEEL 2
workflow count WEAPON:ITEM_WEAPON_SPEAR//STEEL 2
workflow count WEAPON:ITEM_WEAPON_SWORD_SHORT//STEEL 2
workflow count WEAPON:ITEM_WEAPON_HAMMER_WAR//STEEL 2
workflow count WEAPON:ITEM_WEAPON_AXE_BATTLE//STEEL 2
workflow count ARMOR:ITEM_ARMOR_MAIL_SHIRT//STEEL 10
workflow count ARMOR:ITEM_ARMOR_BREASTPLATE//STEEL 10
workflow count HELM:ITEM_HELM_HELM//STEEL 10
workflow count GLOVES:ITEM_GLOVES_GAUNTLETS//STEEL 10
workflow count SHOES:ITEM_SHOES_BOOTS//STEEL 10
workflow count SHIELD:ITEM_SHIELD_SHIELD/ STEEL 10
workflow count BOX//STEEL 10
workflow count TABLE//STEEL 10
workflow count CHAIR//STEEL 10

I tried putting this code in at the end of the dfhack.init file and though it ran the script these commands gave me the following error multiple times

World is not loaded: please load a game first.

Clearly I need to embark or load a game before these commands can take effect, but I really don't feel like manually putting in the same commands over and over again.
.. is there a shorter route to take? While writing this I also tried to create a shortcut key to do multiple commands.
Code: [Select]
keybinding add Ctrl-Shift-Z "autolabor 1" "workflow enable" "workflow enable drybuckets" "workflow enable auto-melt" "workflow count BED 10" "workflow count DRINK 30" "workflow count BLOCKS//OBSIDIAN 100" "workflow count TOOL:ITEM_TOOL_LARGE_POT//OBSIDIAN 30" "workflow count WEAPON:ITEM_WEAPON_SWORD_SHORT_TRAINING 4" "workflow count WEAPON:ITEM_WEAPON_AXE_TRAINING 2" "workflow count CAGE 10" "workflow count TRAPPARTS 20" "workflow count AMMO:ITEM_AMMO_BOLTS 1000" "workflow count PANTS:ITEM_PANTS_LEGGINGS//STEEL 300" "workflow count TRAPCOMP:ITEM_TRAPCOMP_MENACINGSPIKE//STEEL 300" "workflow count WEAPON:ITEM_WEAPON_MACE//STEEL 2" "workflow count WEAPON:ITEM_WEAPON_SPEAR//STEEL 2" "workflow count WEAPON:ITEM_WEAPON_SWORD_SHORT//STEEL 2" "workflow count WEAPON:ITEM_WEAPON_HAMMER_WAR//STEEL 2" "workflow count WEAPON:ITEM_WEAPON_AXE_BATTLE//STEEL 2" "workflow count ARMOR:ITEM_ARMOR_MAIL_SHIRT//STEEL 10" "workflow count ARMOR:ITEM_ARMOR_BREASTPLATE//STEEL 10" "workflow count HELM:ITEM_HELM_HELM//STEEL 10" "workflow count GLOVES:ITEM_GLOVES_GAUNTLETS//STEEL 10" "workflow count SHOES:ITEM_SHOES_BOOTS//STEEL 10" "workflow count SHIELD:ITEM_SHIELD_SHIELD/ STEEL 10" "workflow count BOX//STEEL 10" "workflow count TABLE//STEEL 10" "workflow count CHAIR//STEEL 10"
I think it performed the "autolabor 1" and then stopped.

Any suggestions? Thank you in advance!
Logged

.:Simple Mood 16x16 ASCII:.
Keep it Simple. Keep it Safe.

cdombroski

  • Bay Watcher
    • View Profile
Re: DFHack Embark and Continue Auto Commands
« Reply #1 on: June 07, 2013, 08:02:31 pm »

The dfhack-run command can be used to run commands in an already running fortress.

So you could start your embark and then run a file in the dwarf fortress directory that looks something like:
Code: (after_embark.cmd) [Select]
dfhack-run autolabor 1
dfhack-run workflow enable
dfhack-run workflow enable drybuckets
.
.
.

Alternatively I think you could save your command list as is in a text file and use shell pipes to input it to dfhack-run e.g.
Code: [Select]
dfhack-run < after_embark.txt
Logged

Rogue Yun

  • Bay Watcher
  • Beware of the Carp
    • View Profile
Re: DFHack Embark and Continue Auto Commands
« Reply #2 on: June 07, 2013, 08:23:24 pm »

Thank you kindly sir. Just what the doctor ordered : ) I use linux so I'll just create a bash file to run all the commands.
Logged

.:Simple Mood 16x16 ASCII:.
Keep it Simple. Keep it Safe.

milo christiansen

  • Bay Watcher
  • Something generic here
    • View Profile
Re: DFHack Embark and Continue Auto Commands
« Reply #3 on: June 10, 2013, 03:49:40 pm »

I'm a little late here but if you use soundSense you can use executor.xml to automate running your script.
Logged
Rubble 8 - The most powerful modding suite in existence!
After all, coke is for furnaces, not for snorting.
You're not true dwarven royalty unless you own the complete 'Signature Collection' baby-bone bedroom set from NOKEAS

Rogue Yun

  • Bay Watcher
  • Beware of the Carp
    • View Profile
Re: DFHack Embark and Continue Auto Commands
« Reply #4 on: June 11, 2013, 09:25:24 pm »

Sounds sense fails to load in my version of linux... Being new to dwarf fortress (about 7 months now). And extremely new to DFHack (I would say a few weeks). I never really got around to finding out what sound sense does. I thought it was the isometric graphic engine.
Logged

.:Simple Mood 16x16 ASCII:.
Keep it Simple. Keep it Safe.