Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 5 6 [7] 8 9 ... 32

Author Topic: Dwarf Foreman 0.7.2 - Tool to automatically dispatch jobs to your workers  (Read 113004 times)

theqmann

  • Bay Watcher
    • View Profile

On cutting trees...

What about if the player designates a burrow (possibly with a specific name) and all trees within that burrow are auto-selected for cutting?

Also, I'd really like an option for automatic prepared food to go along with the nice auto-drink feature. But maybe that'll come with the xml stuff?
Logged

LucasUP

  • Bay Watcher
  • Devout Cheeseist
    • View Profile
Re: Dwarf Foreman 0.4.5 - Tool to automatically dispatch jobs to your workers
« Reply #91 on: September 07, 2010, 07:59:08 pm »

Yeah, this is cool!

I see you're trying to figure out how to get EVERYTHING added as an option but:
What I'm really feeling a lack of is Bins/Barrels.
Also Beds/Cabinets/Coffers. Theoretically once you place them, would they still count for items? (ie if you set Beds to 10, and then place the 10, would foreman set another 10 to be built even if you didn't want it to?)
Logged
OG founder of the Lazy Newb Pack

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: Dwarf Foreman 0.4.5 - Tool to automatically dispatch jobs to your workers
« Reply #92 on: September 07, 2010, 08:02:22 pm »

No, it ignores items that are built as a construction, part of another item, part of a caravan, forbidden, etc.

If you had 10 beds set in foreman, it would build another 10 once you placed them. That is the point of foreman, to make sure you have the items available to make finished goods with. If you want 10 beds in reserve, use foreman. If you just want 10 beds, use DF's built in manager :P



« Last Edit: September 07, 2010, 08:05:08 pm by devek »
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: Dwarf Foreman 0.4.5 - Tool to automatically dispatch jobs to your workers
« Reply #93 on: September 08, 2010, 02:23:56 am »



Wow.. QT has the worst tree widget I have ever used.

It is finally starting to work based off a user defined xml. Should have 0.5 up in the next few days.
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: Dwarf Foreman 0.4.5 - Tool to automatically dispatch jobs to your workers
« Reply #94 on: September 09, 2010, 01:46:01 am »

Sorry for the long delay, but 0.5 is here.

Known bugs: It deletes all existing jobs the first time it is ran. This is a good thing, it does it on purpose. It doesn't understand the manager structure very well and if it didn't you would run into problems. It also may or may not be compatable with jobs you add manually.. which means it might notice your manual order for 100 drinks or it may not. This may or may not be a good thing lol.

dfjobs.xml is pretty straight forward.

The name of a job doesn't matter as long as it is unique, it only decides how it is displayed. The catagory of a job doesn't matter, it only decides how it is broken up in the tree view. The manager field is a joke, doesn't really work, and will be done differently in .6. It is the raw bytes that I found when added a job myself.  You too can find the raw bytes for a job by running the test.exe file and doing dump jobs with one job active.. cut and paste the text into that field.

Each job can have one or more items. This method works and won't change because it works with modded versions of DF. To get an idea of what to use here, use the dump items function of test.exe. There is a special material type called all which will use all materials for that item type. It doesn't support specific weapons and such, but will soon.

The ablity to forbid items to mill is gone for now lol. I'll have to think of a way to implement it in a general way. It is a feature I use, so it is important. :P

For the most part, don't go crazy and make some big massive .xml file you want the world to use. The format will change in 0.6, I just wanted to release something people could test for now.

Future plans: Small bug fixes while waiting on the next version of Dwarf Fortress and focusing most of my effort on understanding the manager structure.
« Last Edit: September 09, 2010, 01:52:36 am by devek »
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #95 on: September 09, 2010, 09:52:21 am »

Oh man... if you downloaded 0.5, download it again lol.

I noticed DF was crashing a lot when using this, but I never can tell when the crash is my fault or DF is just crashing anyway :P. Stupid mistake fixed.
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

Reverb

  • Bay Watcher
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #96 on: September 09, 2010, 10:49:36 am »

Can't wait to get home to try this! I'm almost done with my bed assignment script so now hopefully with yours updated I won't have any reason not to be playing this game and not hacking it. Yeah right :P

I think I remember you mentioning the Henry Ford assembly line and pulling ropes whenever someone falls behind with their task on the assembly line. I was wondering if you were thinking about doing something like that b/c it got me thinking about it as well. Though this would require keeping a job dependency graph up to date and also worry about if Toady makes people switching tasks often cost ineffective like I think I remember as being a future feature. However, I think I was thinking more about just making sure that say armoring had at least 1 dwarf actively armoring or at least 1 idling/doing menial jobs but ready to be switched back to armoring when a job appears.

Scenario: I always find that I dedicate a dwarf to armoring then get a hauling job going. I see this inactive armorer dwarf, so I add him to hauling and forget to remove him from hauling when said hauling job is done.  Now when I expect him to be working on his armor job I just added, he is off moving furniture :P.

The more likely scenario I run into is my architect screwing around doing other jobs when he should be planning buildings. So maybe this would be a job prioritizing problem instead of a assembly line efficiency problem.

Anyways, that was what I was contemplating at looking at addressing next or at the minimal, figuring out where active military duty info is so at least dwarf therapist can show that a dwarf is patrolling and not idling because this always complicates things. Maybe this would add too much automation and I should talk to the dwarf therapist team about just being able to visualize this kind of information.

Anyways, sorry for fleshing out of unrelated thoughts in your Foreman thread. And sorry the XML suggestion gave you so much trouble and still is. :P
Logged

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #97 on: September 09, 2010, 11:39:25 am »

I totally got you on that. Earlier I was talking to someone about therapist and I was like, I would rather do things differently. I would rather assigns dwarfs classes instead of professions.

So a dwarf could be in the hauler when idle class and in the armorer class. Then you could assigns jobs to dwarfs based off their classes and the current situation.

It wasn't the XML that gave me trouble, it was turning an item into the string representation it would have in the game. It seems straight forward, but once you get into it you are looking at 500-1000 painstaking lines of code. Sometimes an item is a saguro something, other times it is a saguro rib-wood something. The something depends on the material. There are 5 different material vectors. The description of the material could be a 8 different offsets in the material vector. Certain elements of the description are not in there at all and you have to make exceptions when to look at different vectors (like rib-wood). Many of the functions involved are like function(blah, blah, bool, bool) with the bools at the end changing the total logic of the function. There is a different code path for each class of item (51 I think?) with different paths based on the situation defined by the bools earlier. You really have to get it all right too because people might mod their own custom materials in...

Needless to say, I gave up and compromised.
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

theqmann

  • Bay Watcher
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #98 on: September 09, 2010, 08:55:59 pm »

Works great so far! :)

Here's my updated XML file that adds the following:
  • lavish meals
  • rock doors
  • beds
  • wood cages
  • mechanisms
  • rock cabinets
  • shell crafts (set to any number (2 works best) to keep doing em forever)
  • bone bolts (set to any number (2 works best) to keep doing em forever)
  • totems (set to any number (2 works best) to keep doing em forever)

Code: [Select]
<dfjobs>
    <dfjob name="ash" catagory="wood furnace" manager="uwD/////4ggYUeIIAFHiCBhR4ggYUeIIGFHiCAAAAAAPAAAA///iCP////8AAAAAAAAAADIA">
        <item type="bar" material="ASH" />
    </dfjob>
    <dfjob name="charcoal" catagory="wood furnace" manager="ugD/////QVRFUklBAF9URU1QTEFURTpQT0lTTwAAAAAPAAAA//9fRf////8AAAAAAAAAADIA">
        <item type="bar" material="COAL derivate" />
    </dfjob>
    <dfjob name="potash" catagory="ashery" manager="vwD/////4ggYUeIIAFHiCBhR4ggYUeIIGFHiCAAAAAAPAAAA///iCP////8AAAAAAAAAADIA">
        <item type="bar" material="POTASH" />
    </dfjob>
    <dfjob name="lye" catagory="ashery" manager="vAD/////AQABAQEBAAEBAQEBAQEBAQEBAQEBAQAAAAAPAAAA//8AAP////8AAAAAAAAAADIA">
        <item type="liquid_misc" material="LYE derivate" />
    </dfjob>
    <dfjob name="pearlash" catagory="kiln" manager="1QD/////AQABAQEBTUFLRV9QRUFSTEFTSAABAQ0AAAAPAAAA//8AAP////8AAAAAAAAAADIA">
        <item type="bar" material="PEARLASH" />
    </dfjob>
    <dfjob name="plaster" catagory="kiln" manager="1QD/////AQABAQEBACu8CV9QRUFSTEFTSAABARMAAAAfAAAA//8AAP////8AAAAAAAAAADIA">
        <item type="powder_misc" material="PLASTER" />
    </dfjob>
    <dfjob name="drink" catagory="food" manager="lgD/////AQABAQEBAAEBAQEBAQEBAQEBAQEBAQAAAAAPAAAA//8BAP////8AAAAAAAAAADIA">
        <item type="drink" material="all" />
    </dfjob>
    <dfjob name="lavish food" catagory="food" manager="cwD/////YXZlL3JlAGlvbjEtc3VtLTEwNTIvcgAAAAAPAAAABABzL/////8AAAAAAAAAAAAA }">
        <item type="food" material="all" />
    </dfjob>
    <dfjob name="plant thread" catagory="farmer's workshop" manager="bwD/////AQABAQEBAAEBAQEBAQEBAQEBAQEBAQAAAAAPAAAA//8BAP////8AAAAAAAAAADIA">
        <item type="thread" material="GRASS_TAIL_PIG" />
        <item type="thread" material="REED_ROPE" />
    </dfjob>

    <dfjob name="rock door" catagory="furniture" manager="RQD/////UwIAAAAAAAAAAP////8AAFU0AAAAAAAAAAAPAAAAAAABAP////8AAAAAAAAAAP// }">
        <item type="door" material="all" />
    </dfjob>

    <dfjob name="rock cabinet" catagory="furniture" manager="TwD/////UwIAACIAAAAIC7ABUwKwdBgMAAAAAAAAAAAPAAAAAAA6U/////8AAAAAAAAAAP// }">
        <item type="cabinet" material="all" />
    </dfjob>
    <dfjob name="wood bed" catagory="furniture" manager="RwD/////UwIAAVMCAKkCNEVfVElMRToxAAAAAAAAAAAPAAAA//8MC/////8AAAAAAgAAAP// }">
        <item type="bed" material="all" />
    </dfjob>

    <dfjob name="mechanisms" catagory="traps" manager="jQD/////UwIAAAAAAAAAAA8AAAD/////AAAAAAAAAAAPAAAAAAAzNP////8AAAAAAAAAALB5 }">
        <item type="trapparts" material="all" />
    </dfjob>
    <dfjob name="wood cages" catagory="traps" manager="eAD/////UwIAXQAAAAAAAA8AAAB4AVMCAAAAAAAAAAAPAAAA//9PRf////8AAAAAAgAAAP// }">
        <item type="cage" material="all" />
    </dfjob>

<dfjob name="shell craft (max 2)" catagory="butchering" manager="UwD/////UwIAXQAAAAAAAA8AAAB4AVMCAAAAAAAAAAAPAAAA//9PRf////8AAAAAQAAAAP// }">
        <item type="XXXX" material="all" />
    </dfjob>
<dfjob name="bone bolts (max 2)" catagory="butchering" manager="gwD//wAAUwIAAAAAAAAAAP////8AAFU0AAAAAAAAAAAPAAAA//8BAP////8AAAAAIAAAAP// }">
        <item type="XXXX" material="all" />
    </dfjob>
<dfjob name="skull totem (max 2)" catagory="butchering" manager="ggD/////UwIAXQAAAAAAAA8AAAB4AVMCAAAAAAAAAAAPAAAA//9PRf////8AAAAAAAAAAP// }">
        <item type="XXXX" material="all" />
    </dfjob>

</dfjobs>

On a related note, I tried using wood barrels/bins, but every barrel/bin was found as available, regardless of whether it was empty or not.  Any way to see if the contents of an item are non-zero to take it off the available list?
Logged

Reverb

  • Bay Watcher
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #99 on: September 09, 2010, 09:38:36 pm »

Here's my updated XML file that adds the following:

Awesome thanks for posting this.

On a related note, I tried using wood barrels/bins, but every barrel/bin was found as available, regardless of whether it was empty or not.  Any way to see if the contents of an item are non-zero to take it off the available list?

Yes, to see the number of items that a certain item is linked to u can use code that looks like this, not 100% this will compile though:
Code: [Select]
int linkedCount(uint32_t itemAddress) {
uint32_t start = p->readDWord(itemAddress+ 0x3C);
uint32_t end = p->readDWord(itemAddress+ 0x40);
return ((end - start)/sizeof(uint32_t));
}

So if the item is a container (bin/barrel/bag) and not empty, then this count will be larger than 0 as it is linked/filled with items. Items that are in the container will have a count of 1 b/c they are linked to the container. I also think that if the barrel isn't linked to anything, it isn't being used yet for storage as I've seen dwarfs put items in the barrel before moving it to the stockpile. Also as a note, this info maybe inaccurate as I'm remembering from a couple of weeks ago but see my post here for clarification or 'mudification' :P http://www.bay12forums.com/smf/index.php?topic=58809.msg1471259#msg1471259 for information on how to pull a vector of "item ids" of the linked items.
Logged

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #100 on: September 09, 2010, 09:48:28 pm »

Thanks Reverb, I'll add that and it should ignore containers that have something in them.

Thanks theqmann, nice to see you get some use from it. Jobs can have more than one item or none at all, your craft entry doesn't need an item :P
Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

theqmann

  • Bay Watcher
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #101 on: September 09, 2010, 09:56:29 pm »

Thanks theqmann, nice to see you get some use from it. Jobs can have more than one item or none at all, your craft entry doesn't need an item :P

No problemo. Thanks for the tip!

I'll post updated versions as I need new things.  (Was thinking of coffers, tables, chairs, serrated discs and a few others.)
Logged

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #102 on: September 09, 2010, 10:29:22 pm »

One gotcha is that Foreman doesn't currently track an item's subtype.

It doesn't know the difference between a crossbow or a spear. They are all weapons to Foreman. You can't just look at the actual subid because if someone modded in their own weapon, it may end up shifting the existing subids. To look them up by name involves tracking another memory offset for each item type that uses subids...

Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"

theqmann

  • Bay Watcher
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #103 on: September 10, 2010, 12:18:51 am »

Couple of minor things: 

XML file uses "catAgory" instead of "catEgory"

gui window title is "dwarf forman" instead of "dwarf forEman"

Auto-Tree/Shrub harvesting does not select trees/shrubs on the map edge tile
Logged

devek

  • Bay Watcher
  • [KILL_EVERYTHING]
    • View Profile
Re: Dwarf Foreman 0.5 - Tool to automatically dispatch jobs to your workers
« Reply #104 on: September 10, 2010, 12:49:36 am »

Haha, sorry. English is hard for me.

I specific told it not to designate the edge of map titles when I was tracking down a bug and forgot to undo the code. Reverted it and fixed the spelling errors.





Logged
"Why do people rebuild things that they know are going to be destroyed? Why do people cling to life when they know they can't live forever?"
Pages: 1 ... 5 6 [7] 8 9 ... 32