Bay 12 Games Forum

Dwarf Fortress => DF Modding => Utilities and 3rd Party Applications => Topic started by: peterix on August 14, 2011, 08:04:46 pm

Title: DFHack 0.34.11 r3
Post by: peterix on August 14, 2011, 08:04:46 pm
A new thread has been made for dfhack 0.34.11 r5 and newer. (LINK) (http://www.bay12forums.com/smf/index.php?topic=139553.0)

DFHack is an attempt to unite the various ways hack tools access DF memory and allow for easier development of new tools (and of course, make the game more enjoyable for players). It comes with some useful tools that can fix your fort and make things easier to handle. DFHack integrates with Dwarf Fortress and extends it with plugins, a command console and a way to bind hotkeys to the commands.

Continued development of DFHack would be impossible without its contributors and definitely isn't a one man show. Check this out! (https://github.com/peterix/dfhack/contributors)

Some command examples:
'reveal'     - reveals the map or portions of it.
'prospect'   - counts available raw materials - mostly minerals.
'clean'      - removes nasty bloodstains and other such materials from the map, items and creatures.
'cleanowned' - removes ownership of claimed items, solving problems with worn clothing and military starving out the fort.
'stonesense' - an embedded version of the Stonesense isometric visualizer, ready for use. (http://www.bay12forums.com/smf/index.php?topic=106497.0)
'dfusion'    - an embedded version of DFusion (http://www.bay12forums.com/smf/index.php?topic=93317.0)

And many more...

How to install DFHack:

How to uninstall DFHack:

Read the Readme (https://github.com/peterix/dfhack/blob/0.34.11-r3/Readme.rst) for the full list of commands, their usage and installation instructions :)

Stonesense has a README (https://github.com/peterix/stonesense/blob/master/README.txt) file too. Check it out if you don't know all the keys yet.

DFHack for DF 0.34.11 (release 3) (Current):
Windows version (http://dethware.org/dfhack/download/dfhack-0.34.11-r3-Windows.zip)
Linux version (http://dethware.org/dfhack/download/dfhack-0.34.11-r3-Linux.tar.gz)
OSX version (http://dethware.org/dfhack/download/dfhack-0.34.11-r3-Darwin.zip)

What's new

DFHack for DF 0.34.08 - 0.34.11 (release 2) (older):
Spoiler (click to show/hide)

DFHack for DF 0.34.08 - 0.34.11 (release 1) (older):
Spoiler (click to show/hide)

DFHack for DF 0.34.08, 0.34.09 and 0.34.10 (older):
Spoiler (click to show/hide)

DFHack for DF 0.34.06 and 0.34.07 (older):
Spoiler (click to show/hide)

DFHack for DF 0.34.05 (older):
Spoiler (click to show/hide)

DFHack for DF 0.34.03 and 0.34.04 (older):
Spoiler (click to show/hide)

DFHack for DF 0.34.02 (older):
Spoiler (click to show/hide)

DFHack for DF 0.31.25 (older):
Spoiler (click to show/hide)

DFHack for DF 40dxx (ancient):
See the thread for legacy DFHack: here (http://www.bay12forums.com/smf/index.php?topic=58809.0).

Bugs should be reported here: Issues tracker (http://github.com/peterix/dfhack/issues).

There's an IRC channel on freenode: #dfhack (irc://irc.freenode.net/dfhack (http://irc::://irc.freenode.net/dfhack) or web client (http://webchat.freenode.net/?channels=dfhack&uio=d4))


The source code is available from github (https://github.com/peterix/dfhack), please read the Compile (https://github.com/peterix/dfhack/blob/master/COMPILE.rst) document before building.

Full list of downloadable versions can be found here: http://dethware.org/dfhack/download/ (http://dethware.org/dfhack/download/)
Title: Re: DFHack 0.31.25 (current)
Post by: peterix on August 14, 2011, 08:05:48 pm
History:
Spoiler (click to show/hide)
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Rose on August 14, 2011, 11:09:05 pm
Wootwoot!
Title: Re: DFHack 0.31.25 r1 (current)
Post by: strich on August 14, 2011, 11:25:12 pm
Love your work Peterix, as always. ;)
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Artanis00 on August 15, 2011, 12:16:12 am
Looking good. First time looking at this.

One minor quibble, though: better plugin loading error messages. I can't try to fix it if I don't even know whats going wrong.

$ ./dfhack
dfhack: hooking successful
Dynamically loading the OpenAL library failed, disabling sound
Initializing OpenAL failed, no sound will be played
Loading bindings from data/init/interface.txt
New window size: 640x300
Font size: 8x12
Resizing grid to 80x25
Resizing font to 8x12

Resetting textures
Can't load plugin ./hack/plugins/stonesense.plug.so
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]#

It looks like allegro 5 doesn't have Debian packages at the moment (if I'm wrong, disregard and let me know), which means it's probably dependency problems. The build process for allegro seems easy enough... cmake is not seeing libxcursor, why?

For now, README should probably note that it's not in the package manager.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: peterix on August 15, 2011, 12:19:03 am
Looking good. First time looking at this.
It looks like allegro 5 doesn't have Debian packages at the moment (if I'm wrong, disregard and let me know), which means it's probably dependency problems. The build process for allegro seems easy enough... cmake is not seeing libxcursor, why?

For now, README should probably note that it's not in the package manager.
You don't need allegro. It's statically linked to the stonesense plugin. You need libjpeg8 AFAIK.

The errors are dumped into stderr.log - you can see what happened there.
EDIT: I added some info about the log files into the Readme doc.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Artanis00 on August 15, 2011, 01:15:25 am
Looking good. First time looking at this.
It looks like allegro 5 doesn't have Debian packages at the moment (if I'm wrong, disregard and let me know), which means it's probably dependency problems. The build process for allegro seems easy enough... cmake is not seeing libxcursor, why?

For now, README should probably note that it's not in the package manager.
You don't need allegro. It's statically linked to the stonesense plugin. You need libjpeg8 AFAIK.

The errors are dumped into stderr.log - you can see what happened there.
EDIT: I added some info about the log files into the Readme doc.

Ok. README says allegro 5 is a dependency, so if it's statically linked there's probably no need to mention that (and mentioning libjpeg8 would be better; I have no idea why that one isn't installed by default).

As far as logs go, noting them in the README is a great idea. On that vein, is the stonesense plugin writing a log anywhere? There's nothing in the error log, and stonesense is bringing everything down when I run it.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Rumrusher on August 15, 2011, 01:22:26 am
So the entire DFhack replaces the SDL with a modified version?
This means I have to stick multiple versions of the same DFhack-r1 for each 31.25 Dwarf fortress causing me to be either stuck to one type of Dwarf fortress or constantly updating, copying each DF 31.25 I have.
Oh well I might as well use DFhackr1's Dfusion for helping modders to add extra touch to their Mods and not for personal matters.
how Dfusion set up using dfusion on the start menu will cause Dwarf fortress to freeze. so will there be a unfreeze command or could there be a leave Df running command for the entire Dfusion section?
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Aerval on August 15, 2011, 03:39:50 am
Wow, this is pretty cool. Thanks a lot petrix.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Mikey on August 15, 2011, 04:23:36 am
This is excellent.

Would it be possible to insert some new hotkey definitions into DF itself for triggering specific plugins?  Being able to call cleanmap and such via in-game hotkey would be amazingly convenient.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Sentenza on August 15, 2011, 04:37:29 am
Just had a chance to give it a try, and have to say it's super sweet! :)
Title: Re: DFHack 0.31.25 r1 (current)
Post by: peterix on August 15, 2011, 04:40:55 am
Ok. README says allegro 5 is a dependency, so if it's statically linked there's probably no need to mention that (and mentioning libjpeg8 would be better; I have no idea why that one isn't installed by default).

As far as logs go, noting them in the README is a great idea. On that vein, is the stonesense plugin writing a log anywhere? There's nothing in the error log, and stonesense is bringing everything down when I run it.
Right. Looks like something went wrong with that 'static linking' plan then. I have it working on my linux machine, but it seems it's not working on others... hmm.

I'll see what can be done with it... there's a reason why I've been avoiding external dependencies on linux like the plague before :)
Title: Re: DFHack 0.31.25 r1 (current)
Post by: peterix on August 15, 2011, 04:42:21 am
This is excellent.

Would it be possible to insert some new hotkey definitions into DF itself for triggering specific plugins?  Being able to call cleanmap and such via in-game hotkey would be amazingly convenient.
DFhack reuses the normal F1-F8/Shift F1-F8 hotkeys. Open up the menu with 'h', pick one hotkey, name it 'cleanmap' and there you go :)
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Kaelem Gaen on August 15, 2011, 05:08:46 am
This is cool and all, it'll be really useful, but I don't Always  use it/keep it open (on the older versions) and chance you'll be releasing a stand alone version?  I already have one CMD prompt pop up through soundsense and really dislike having another that I won't be using very often.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: darius on August 15, 2011, 05:30:02 am
I suggest hide/show and then use it by binding F8= toggledfhack in DF.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Savolainen5 on August 15, 2011, 08:09:29 am
Thank you, peterix, it's beautiful!
Title: Re: DFHack 0.31.25 r1 (current)
Post by: peterix on August 15, 2011, 01:12:10 pm
This is cool and all, it'll be really useful, but I don't Always  use it/keep it open (on the older versions) and chance you'll be releasing a stand alone version?  I already have one CMD prompt pop up through soundsense and really dislike having another that I won't be using very often.
Maybe :)

I kept things simple for the first release, but I'll add some toggle key to the console. Something like ~ by default and tweakable in a config file.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Mikey on August 15, 2011, 01:23:59 pm
DFhack reuses the normal F1-F8/Shift F1-F8 hotkeys. Open up the menu with 'h', pick one hotkey, name it 'cleanmap' and there you go :)
Well then.  What determines which plugins or commands work via hotkey?  Basically, is there a way to create a command alias for an existing plugin/command that isn't used by the hotkey system or won't fit in the 9-character limit, e.g. 'lua myscript.lua'?
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Rumrusher on August 15, 2011, 01:44:56 pm
Okay for all those race changers or cross breeders I found the solution to the "yo so ugly the game crash" problem.
When swapping you need to make sure either both race have all the raw descriptions so the game won't crash trying to find a cat part on a dog+cat mix race or here a hunch the race you going to swap to has to have the other race details already in like say you have a dwarf but want to flip over to a dragon well the dragon has to have all detail raws of a dwarf so when you look at the descriptions the game can pull up the dwarf details from the dragon raws.
I'm kicking my self for spending all these months and never thought to just do some raw manipulation.
hope this helps. I guess if I want a hybrid of Dragon and spider I have to make a race called Magic-Dragder that has both creature details then swap the dragon eggs to that.

also peterix how do you feel about having a GitCarry command for Gitfusion?
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Lysabild on August 15, 2011, 05:54:26 pm
Awesome!
Title: Re: DFHack 0.31.25 r1 (current)
Post by: i874236951 on August 15, 2011, 06:01:38 pm
Thanks for the update!

Spoiler (click to show/hide)

I dig that you can bind commands to hotkeys, but are you not able to add options to them?  For example, "vdig" works just fine from a hotkey, but it seems that "vdig -x" does not.  Sorry if that's covered in the readme, but I didn't see it.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: 0x517A5D on August 15, 2011, 10:19:49 pm
Just a little thing here, before even installing.  I saw that "SDLreal.dll" had a different timestamp than DF's "SDL.dll".  This worried me a bit, so I MD5sum'ed them both, and verified that they're identical.

I suspect the timestamp change is an artifact of git SCCS, or maybe from a cp without -p option.  Would it be possible to have that file (only) keep its original timestamp?
Title: Re: DFHack 0.31.25 r1 (current)
Post by: peterix on August 16, 2011, 12:30:13 am
I suspect the timestamp change is an artifact of git SCCS, or maybe from a cp without -p option.  Would it be possible to have that file (only) keep its original timestamp?
I just copypasted the file around... doesn't seem all that important. It's the same file after all. I'll try.
I dig that you can bind commands to hotkeys, but are you not able to add options to them?  For example, "vdig" works just fine from a hotkey, but it seems that "vdig -x" does not.  Sorry if that's covered in the readme, but I didn't see it.
Well then.  What determines which plugins or commands work via hotkey?  Basically, is there a way to create a command alias for an existing plugin/command that isn't used by the hotkey system or won't fit in the 9-character limit, e.g. 'lua myscript.lua'?
Not yet, I'll have to restructure a few things for that... Aliases (http://en.wikipedia.org/wiki/Alias_%28command%29) will be added for sure.
I think vdig is one of the few commands, if not the only one, that would actually fit the 9 character limit with its option...
Here's an example of how it should work in the future:
Code: [Select]
alias rth="revtoggle hell" (set the alias, this will be remembered between sessions)
rth (use the alias)
It should be then possible to fit a command of any length to the limit... and it will work. I also want to add tab completion for commands.

also peterix how do you feel about having a GitCarry command for Gitfusion?
Hmm, I don't know. Can't be that hard to add :)

Oh, and one more thing. I spent some time debugging and poking around in my Ubuntu VMs and I fixed one bug that caused crashes. So, here's a new, updated package to try:
https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r2-Linux.tar.gz
It's bigger and it has debug symbols in it too.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Thoranius on August 16, 2011, 02:31:18 am
I dunno if this has been has been inquired about in a while, but I ran into a "lazy dwarves suspended a build and I failed to notice it until it was too late" scenario, which resulted in one of my underground farm tiles accidentally being transformed into an aboveground tile. Is there any tile-editing supported as of yet through any of the plugins in the new integrated version of DFHack? I looked through all the options of the existing ones and failed to find any, plus browsed the forums and wiki for a couple hours and found nothing other than the old DFTweak program, and I would really like to turn this (now covered) tile back to it's subterranean state.  Any feedback would be appreciated, preferably those leading to a positive solution, and not so much those that result in throwing away a weeks worth of work on a fortress. Thankee kindly in advance, and keep up the good work, Peterix.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Mikey on August 16, 2011, 05:32:53 am
Not yet, I'll have to restructure a few things for that... Aliases (http://en.wikipedia.org/wiki/Alias_%28command%29) will be added for sure.
I think vdig is one of the few commands, if not the only one, that would actually fit the 9 character limit with its option...
Here's an example of how it should work in the future:
Code: [Select]
alias rth="revtoggle hell" (set the alias, this will be remembered between sessions)
rth (use the alias)
It should be then possible to fit a command of any length to the limit... and it will work. I also want to add tab completion for commands.

That sounds perfect.  The only other related suggestion I can think of would be to add command parameters to plugins like liquids and tiletypes so one can create aliases and hotkeys for often-used operations (dwarf-cleaning puddles, etc).
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Rumrusher on August 16, 2011, 05:54:02 am

also peterix how do you feel about having a GitCarry command for Gitfusion?
Hmm, I don't know. Can't be that hard to add :)

Well because the original command doesn't work well on a straight port given that Gitfusion freezes the game and the command needs Dfusion to run in realtime.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: peterix on August 16, 2011, 09:50:41 pm
Well because the original command doesn't work well on a straight port given that Gitfusion freezes the game and the command needs Dfusion to run in realtime.
Hmm... yeah. Looking at the code, it seems it's a problem with LUA and being called from multiple threads. darius solved it with using a single mutex around all the DFusion code, but it needs finer control than that. This could be tricky.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: Rumrusher on August 16, 2011, 11:12:31 pm
Well warmist told me to try out ontick but pretty much gives me an error every time I use it and bring the game to a slow crawl in both adventure mode and fort mode.
though I do like the idea of having dfusion commands that I can turn on and play throughout like a zombie mode or parasite that makes the host lay eggs of huge monsters that hatch fast.
Title: Re: DFHack 0.31.25 r1 (current)
Post by: darius on August 17, 2011, 03:58:28 am
Well because the original command doesn't work well on a straight port given that Gitfusion freezes the game and the command needs Dfusion to run in realtime.
Hmm... yeah. Looking at the code, it seems it's a problem with LUA and being called from multiple threads. darius solved it with using a single mutex around all the DFusion code, but it needs finer control than that. This could be tricky.

Yeah i tried making a different thread but somehow i does not compile (says that tinythread::thread methods are missing during linking)
Title: Re: DFHack 0.31.25 r4 (current)
Post by: peterix on August 17, 2011, 08:25:51 am
Yeah i tried making a different thread but somehow i does not compile (says that tinythread::thread methods are missing during linking)
Hmm. there was a bunch of other linking problems that surfaced after I added the static lua lib. I'll mess with it a bit...

Also, released another version for both linux and windows, adding an exploratory mining tool.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Sentenza on August 17, 2011, 02:05:13 pm
Also, released another version for both linux and windows, adding an exploratory mining tool.

Now if this isn't the shit, I have no idea what would be :P

Thank you so very much!
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Jiopaba on August 17, 2011, 05:19:57 pm
Does tiletypes actually work?

Hmm... I get that it's an experimental feature or some such, but it doesn't seem to do anything at all.  No matter what command I enter I can never get it to acknowledge a material.  I can't seem to change it to paint with stone or air or whatever at all, it just accepts the command and then prints the standard three lines again without anything changing, and still won't paint anything.

The rest of it is all great though.  It's really nice having the tools I find myself using integrated together into a nice interface like this.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: BigD145 on August 17, 2011, 05:20:24 pm
I skimmed the two pages so far. Is Stonesense working at all in Windows? It just crashes my DF, mods or no mods.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: peterix on August 17, 2011, 10:41:25 pm
I skimmed the two pages so far. Is Stonesense working at all in Windows? It just crashes my DF, mods or no mods.
Well, this led me through the computing hell and back. You're using XP, right?

See, the library that stonesense needs uses something called 'thread local storage'. That is, in the process, there are multiple independent CPU states and TLS makes sure that they don't trample over each other's data. This is *COMPLETELY* broken on XP and Microsoft doesn't want to fix it. So XP users get crashes.

I'll try to fix this, but really... this is getting ridiculous :<
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Truean on August 17, 2011, 11:13:37 pm
*likes the idea behind this reworking* [follows politely]
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Thoranius on August 18, 2011, 02:31:15 am
Just a couple quick questions...any chance on adding a command help option for the weather plugin? I ran through about 50 command line ideas trying to get it to make it rain, but ended up going back to the old legacy exe tool to tide me over.

On the other hand, any chance of designing a tool for emptying containers (primarily barrels and buckets, maybe bags/coffers/chests/vials)? Just curious on that one, since many people run into that problem, accidentally buying blood-filled barrels or getting buckets with mixes of lye and water.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Mrhnhrm on August 18, 2011, 02:46:44 am
I had to pull stonesense from the Linux release due to X.org and Allegro bugs. I'm also looking for people who managed to make it run (if there's anyone).
Then you might be interested to know that Stonesense from r2 seems to run fine on my Linux box. Which is rather surprising to me, since my distro is such a mess that I sometimes wonder how anything manages to work in it. It's Gentoo, and like you may know, no two Gentoo installations are alike. Anyway, I'm willing to try and locate this something which makes my box so Stonesense-friendly. For starters, I'm using 2.6.37 kernel, X.Org-1.10.2, Allegro 5.0.3. Any ideas what else can be checked?

And BTW, excellent job with making the thing Linux-compatible!
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Rumrusher on August 18, 2011, 05:34:33 am
Just a couple quick questions...any chance on adding a command help option for the weather plugin? I ran through about 50 command line ideas trying to get it to make it rain, but ended up going back to the old legacy exe tool to tide me over.

On the other hand, any chance of designing a tool for emptying containers (primarily barrels and buckets, maybe bags/coffers/chests/vials)? Just curious on that one, since many people run into that problem, accidentally buying blood-filled barrels or getting buckets with mixes of lye and water.
you could just save flip over to adventure mode(you might want to use Dfusion to change the adventurer to someone close to the task to avoid wasting time walking to the barrels) and use the dump command on the liquids. Though I would love to have some way to shove items into buildings as an adventurer given that we can't hatch eggs outside of the nestbox and having the ability to do that or stick eggs into the box would promote summoning.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: danaris on August 18, 2011, 06:27:12 am
I skimmed the two pages so far. Is Stonesense working at all in Windows? It just crashes my DF, mods or no mods.
Well, this led me through the computing hell and back. You're using XP, right?

See, the library that stonesense needs uses something called 'thread local storage'. That is, in the process, there are multiple independent CPU states and TLS makes sure that they don't trample over each other's data. This is *COMPLETELY* broken on XP and Microsoft doesn't want to fix it. So XP users get crashes.

Well, that would explain why all my attempts at running Stonesense failed...

It would have been nice if this were noted anywhere in its documentation  ::)
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Rose on August 18, 2011, 06:51:20 am
it was just recently discovered.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: BigD145 on August 18, 2011, 10:47:14 am
I skimmed the two pages so far. Is Stonesense working at all in Windows? It just crashes my DF, mods or no mods.
Well, this led me through the computing hell and back. You're using XP, right?

See, the library that stonesense needs uses something called 'thread local storage'. That is, in the process, there are multiple independent CPU states and TLS makes sure that they don't trample over each other's data. This is *COMPLETELY* broken on XP and Microsoft doesn't want to fix it. So XP users get crashes.

I'll try to fix this, but really... this is getting ridiculous :<

Ah, okay. I'll be making the move to 7 when I can afford a better CPU for DF. My laptop is just not powerful enough for embarks over 3x3 if I want a decent framerate.

P.S. Fuck you Bill Gates. Fuck you, your company, and especially your foundation.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Vherid on August 18, 2011, 03:44:23 pm
This is working nicely, and you even have the stonesense with all the crazy plants and such enabled.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: peterix on August 18, 2011, 04:31:24 pm
I had to pull stonesense from the Linux release due to X.org and Allegro bugs. I'm also looking for people who managed to make it run (if there's anyone).
Then you might be interested to know that Stonesense from r2 seems to run fine on my Linux box. Which is rather surprising to me, since my distro is such a mess that I sometimes wonder how anything manages to work in it. It's Gentoo, and like you may know, no two Gentoo installations are alike. Anyway, I'm willing to try and locate this something which makes my box so Stonesense-friendly. For starters, I'm using 2.6.37 kernel, X.Org-1.10.2, Allegro 5.0.3. Any ideas what else can be checked?

And BTW, excellent job with making the thing Linux-compatible!
My linux box is pretty much an always updated Arch machine.
Linux 3.0.1, Xorg 1.10.3 and I'm using the proprietary NVIDIA drivers. The ubuntu VMs I tested with used various versions of the kernel and Xorg, but all failed in similar ways: Either very soon, crashing while initializing the keyboard (this failed on a call to pthread_mutex_lock, suggesting wrong initialization order) or a bit later, initializing the display/window (the window shows up, things fail inside the opengl lib and the whole thing deadlocks).

Maybe it's the NVIDIA driver making things work?
Just a couple quick questions...any chance on adding a command help option for the weather plugin? I ran through about 50 command line ideas trying to get it to make it rain, but ended up going back to the old legacy exe tool to tide me over.
If you tried 'weather help' or 'weather ?' it would have worked. Many, if not all (I'd have to check) of the commands this option. I've added the same to the readme doc.
On the other hand, any chance of designing a tool for emptying containers (primarily barrels and buckets, maybe bags/coffers/chests/vials)? Just curious on that one, since many people run into that problem, accidentally buying blood-filled barrels or getting buckets with mixes of lye and water.
That's a great idea. Hmm. It needs some research though, so it might take me some time to implement it.

P.S. Fuck you Bill Gates. Fuck you, your company, and especially your foundation.
Well, it can be worked around. But it's a PITA for me and the allegro devs...
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Thoranius on August 18, 2011, 05:09:04 pm
Aye, I made the old mistake of trying "help weather", and "? weather" instead of vice versa, I forgot the basic reverse input method. Probably my fault of trying to play DF on over 24 hours without sleep.

And RumRusher, thanks for the heads up, I haven't toyed with the adventure mode very often, and have shied away from the DFusion plugin because of all the instability/save-ruin warnings, I will keep that in mind for the future. Until then, I'll just crank out excess wooden buckets, turn off ponds, and try to remember to check them from time to time to dump the messed up ones into the old Dwarven Atom Smasher.

I'm also glad you like the container-emptying tool idea, I hope it doesn't prove too troublesome from the coding and implementing aspect. I apologize for pushing the burden on you like that, but until Toady fixes it in game, or at least implements a "dump contents" designation for items, you were the first obvious choice to come to for aid. If anyone can think of a way around it, it would be you.

And as always, keep up the good work, I'm sure everyone in the DF community appreciates your dedication to making useful DF tools.

P.S. I may have stumbled across potential issue with one of the tools, has anyone else experienced a repeatable "stopped working" game crash when using the "Clear task" plugin while an ambush is occurring?
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Mrhnhrm on August 18, 2011, 10:16:28 pm
Maybe it's the NVIDIA driver making things work?
Nope, I have an ATI device. However, I am also using proprietary drivers. This is what may be important.

P.S. ---- you Bill Gates. ---- you, your company, and especially your foundation.
http://www.whylinuxisbetter.net/
Title: Re: DFHack 0.31.25 r4 (current)
Post by: KaelGotDwarves on August 18, 2011, 10:21:22 pm
Posting to extend my thanks again and to follow.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: arclance on August 18, 2011, 11:12:55 pm
I am using Ubuntu 11.04, 2.6.38 kernel, Xorg 1.10.1, and the proprietary Nvidia drivers, and when using Stonesense in DFHack-r2 I get this.
Spoiler (click to show/hide)
I compiled stonesense seperately a while ago and it still works fine.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: peterix on August 19, 2011, 12:19:28 am
I am using Ubuntu 11.04, 2.6.38 kernel, Xorg 1.10.1, and the proprietary Nvidia drivers, and when using Stonesense in DFHack-r2 I get this:
Cannot load image: stonesense/stonesense.png
Ok. That's something I haven't seen yet. Some options here:
Look at the DF folder. Is the stonesense.png file in the right spot? it should be (DF being the '/' here) in /stonesense/stonesense.png along with all the other stonesense files.
Might be a missing lib? Try 'ldd hack/plugins/stonesense.plug.so' and pastebin/post the result.
Alternatively try to install some different versions of libpng.

P.S. I may have stumbled across potential issue with one of the tools, has anyone else experienced a repeatable "stopped working" game crash when using the "Clear task" plugin while an ambush is occurring?
there is no clear task plugin. I did port the old tool but decided to remove it shortly after. It was meant to fix the problem with task-locked items after fort reclaim. That bug should no longer be a problem and the tool was never safe for general use - only the first game step after a reclaim when none of the dwarves have any tasks yet.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Rose on August 19, 2011, 12:32:34 am
I am using Ubuntu 11.04, 2.6.38 kernel, Xorg 1.10.1, and the proprietary Nvidia drivers, and when using Stonesense in DFHack-r2 I get this.
Spoiler (click to show/hide)
I compiled stonesense seperately a while ago and it still works fine.

Most common cause of this is an OpenGL issue.

unless it actually can't find the image.
Title: Re: DFHack 0.31.25 r4 (current)
Post by: Thoranius on August 19, 2011, 01:08:18 am
Ah, my bad again, sleep is really starting to sound inviting right about now, I didn't mean plugin, I meant the old exe cleartask one, didn't realize that bug had been fixed, and waited til the first ambush after the reclaim to use it. 

Caffeine, here I come!
Title: Re: DFHack 0.31.25 r4 (current)
Post by: arclance on August 19, 2011, 10:38:53 am
I am using Ubuntu 11.04, 2.6.38 kernel, Xorg 1.10.1, and the proprietary Nvidia drivers, and when using Stonesense in DFHack-r2 I get this:
Cannot load image: stonesense/stonesense.png
Ok. That's something I haven't seen yet. Some options here:
Look at the DF folder. Is the stonesense.png file in the right spot? it should be (DF being the '/' here) in /stonesense/stonesense.png along with all the other stonesense files.
Might be a missing lib? Try 'ldd hack/plugins/stonesense.plug.so' and pastebin/post the result.
Alternatively try to install some different versions of libpng.
stonesense.png is in the stonesenese folder that was the first thing I checked since if it was missing I could just replace it.
The results of ldd hack/plugins/stonesense.plug.so are below.
Spoiler (click to show/hide)
I don't see libpng there could that be the problem?
There are no other packaged versions of libpng to install but I don't think that is the problem since I can run stonesense when it is not a part of dfhack.
The picture below shows the results of running stonesense and running dfhack stonesense side by side.
Spoiler (click to show/hide)

I wonder if it might be related to this problem where stonesense can not find a font if it is called a certain way.
I built allegro5 with all optional dependencies, dfhack 0.5.15, and then stonesense in Ubuntu 11.04.
I got the font not found error by running with
Quote
~/stonesense/stonesense &
I was able to run stonesense without the font error using
Quote
cd stonesense
./stonesense

Most common cause of this is an OpenGL issue.
Do you know a way to figure out if this is the problem?

I tried to build dfhack with stonesense to see if there was a difference but it failed.  Link to the pastebin of the error is below.
http://pastebin.com/Pd3YVtR7
Title: Re: DFHack 0.31.25 r5 (current)
Post by: peterix on August 20, 2011, 06:52:37 am
Alright. New version is up, hopefully now working on all relevant Windows versions.

arclance:
Well, I have no idea what actually happened here. Anyway, I reworked the release process for both Windows and Linux. Check the new version. The build of stonesense you did was the normal, standalone stonesense. The right one is here: http://stonesense.googlecode.com/svn/branches/DFAPI/
Title: Re: DFHack 0.31.25 r5 (current)
Post by: BigD145 on August 20, 2011, 11:14:03 am
I can confirm Stonesense works with r5. Thanks Peter.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: peterix on August 20, 2011, 11:19:34 am
I can confirm Stonesense works with r5. Thanks Peter.
Good to hear that :)
Title: Re: DFHack 0.31.25 r5 (current)
Post by: arclance on August 20, 2011, 05:12:57 pm
I can confirm Stonesense works with r5. Thanks Peter.
Works for me too.  Screenshot below.
Spoiler (click to show/hide)
r5 also built fine using DFAPI stonesense.
You might want to put a reference about needing the DFAPI branch of stonesense with a link to its location in the dependencies section of the compile instructions.

Also any progress on getting dfusion to work on linux?
Title: Re: DFHack 0.31.25 r5 (current)
Post by: i874236951 on August 20, 2011, 06:49:58 pm
So, maybe I'm late to the party on this, but since the new default reveal allows you to safely unpause, you can use it to dig through damp/warm stone without the designation cancellations.  Which is awesome because I know of no other way to do that (eliminating the announcements doesn't stop the un-designations).
Title: Re: DFHack 0.31.25 r5 (current)
Post by: guitarxe on August 21, 2011, 04:43:28 am
Hi, I'm new to the game. Will this tool let me kill nasties on the map? Like the minotaur that's terrorizing my immigrants and caravans outside my fortress walls?
Title: Re: DFHack 0.31.25 r5 (current)
Post by: peterix on August 21, 2011, 05:26:38 am
Hi, I'm new to the game. Will this tool let me kill nasties on the map? Like the minotaur that's terrorizing my immigrants and caravans outside my fortress walls?
Best thing would be to kill the thing properly - with weapons or traps :)
Spoiler (click to show/hide)
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Rumrusher on August 21, 2011, 06:08:33 am
Hi, I'm new to the game. Will this tool let me kill nasties on the map? Like the minotaur that's terrorizing my immigrants and caravans outside my fortress walls?
Best thing would be to kill the thing properly - with weapons or traps :)
Spoiler (click to show/hide)
you could just use Runesmith and avoid that ordeal all together and the FUN of accidentally pouring magma on an important Dwarf or forcing your self out of magma forges.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Eldrick Tobin on August 21, 2011, 10:10:11 am
Hi, I'm new to the game. Will this tool let me kill nasties on the map? Like the minotaur that's terrorizing my immigrants and caravans outside my fortress walls?
Best thing would be to kill the thing properly - with weapons or traps :)
Spoiler (click to show/hide)
you could just use Runesmith and avoid that ordeal all together and the FUN of accidentally pouring magma on an important Dwarf or forcing your self out of magma forges.
Reminds me... I wonder if creaturemanager (is worth porting/will be ported) to the new system. Although I will miss my batchfiles.  8)
Title: Re: DFHack 0.31.25 r5 (current)
Post by: megahelmet on August 21, 2011, 10:31:15 am
Edit: Wow. I solved this one myself. LNP was screwing with it working. Moved stuff around. All better.

Newb question here: How do I actually run a utility? I found one thread that asked this question and all it said was to run the 'binaries'. If it is a command line, please give me an example. Is there a particular file that I need to run? I did not see anything that stood out as an .exe. I read the the readme several times, and I just don't see anything about actually running it. Thanks.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Xen0n on August 21, 2011, 11:09:13 am
Thanks for this useful tool!  I have a weird question, and I think I may be missing something very obvious...  I'm using DFHack through the Lazy Newb Pack, and when I run the different tools (dfcleanmap, dfautodump, dfcleanowned), it seems to run normally, but I read the instructions and there are some options for some commands, like for dfcleanowned which items are dumped.  However, when I run the tools, eother from the LZP gui or from the DFHack folder, it opens a command box, runs automatically, then says press any key to continue, and if I try to type -a or -l for options of dfcleanowned for example, it just closes the window when I hit enter.  I have a feeling I'm not typing the options in the right place, and can't find any explanation in the forums.  Can anyone explain exactly how to use these option commands, as if talking to someone who has no idea what they're doing?
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Quietust on August 21, 2011, 11:11:32 am
If you want to run the tools with parameters, then you'll need to open a command prompt, change to the directory containing the tools, then run them from there.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Rose on August 21, 2011, 11:14:05 am
Edit: Wow. I solved this one myself. LNP was screwing with it working. Moved stuff around. All better.

Newb question here: How do I actually run a utility? I found one thread that asked this question and all it said was to run the 'binaries'. If it is a command line, please give me an example. Is there a particular file that I need to run? I did not see anything that stood out as an .exe. I read the the readme several times, and I just don't see anything about actually running it. Thanks.

if you've installed it right, you should get a command prompt opening with DF.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Xen0n on August 21, 2011, 11:41:06 am
Ah, ok.  Using the windows cmd.exe prompt (after switching partitions), changing to the directory, then entering the tool filename lets me run the tools, but I think I have the syntax for the options off.  Once I was in the right directory, entering "dfcleanowned.exe" will run that tool fine, but if I want to confiscate all owned items, say, I typed "dfcleanowned.exe-a" and it's not recognised.  How should I enter it?
Title: Re: DFHack 0.31.25 r5 (current)
Post by: peterix on August 21, 2011, 12:50:57 pm
Ah, ok.  Using the windows cmd.exe prompt (after switching partitions), changing to the directory, then entering the tool filename lets me run the tools, but I think I have the syntax for the options off.  Once I was in the right directory, entering "dfcleanowned.exe" will run that tool fine, but if I want to confiscate all owned items, say, I typed "dfcleanowned.exe-a" and it's not recognised.  How should I enter it?
With a space between the command and the options.

Also, you're using the old dfhack. You can look at the old thread (http://www.bay12forums.com/smf/index.php?topic=58809.0) for info about it. Don't confuse it with the current dfhack, which works differently.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Xen0n on August 21, 2011, 12:59:58 pm
Ah, thanks!  Finally can clean up after my messy dwarves!  Oh didn't realise LNP had the old version, I'll have to check out the new one.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: DrKillPatient on August 21, 2011, 08:11:49 pm
Stonesense plugin won't load, the log says
Code: [Select]
liballegro.so.5.0: cannot open shared object file: No such file or directory
I have allegro 5.5 (albeit the 64-bit version). What's up?
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Quietust on August 21, 2011, 08:14:59 pm
Stonesense plugin won't load, the log says
Code: [Select]
liballegro.so.5.0: cannot open shared object file: No such file or directory
I have allegro 5.5 (albeit the 64-bit version). What's up?
Dwarf Fortress is 32-bit - therefore, so is Stonesense, so having the 64-bit Allegro library won't do you any good.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: DrKillPatient on August 21, 2011, 10:07:12 pm
Ah, thanks. Works like a charm now. Dunno why that never crossed my mind.

Great work, peterix, by the way. The new layout is infinitely more organized, not to mention convenient. All my favourite DF utilities in one package!
Title: Re: DFHack 0.31.25 r5 (current)
Post by: peterix on August 22, 2011, 03:33:36 am
Cool to see it work for the linux people :D

Anyway, next release will have some fixes for autodig and dfusion, along with a circle designation tool.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Rumrusher on August 22, 2011, 04:16:31 am
Dang I just remember how awesome having indoor lighting was.
I mean back in Tweak there was a way to set up tiles to have lighting so when an adventurer walk on it you can flood the area with light and expand your field of vision.
and to do this it was under the Designation tab of Tweak.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Thoranius on August 22, 2011, 08:07:05 am
Hmm, quick question, Peterix. Any chance when your designing that container emptying tool(if you choose to implement it), any chance of adding a tool to circumvent the endless siege bug? I haven't figured out a way to cure that one yet, via legitimately available means, or even removing all dead goblins/trolls with an external tool. I miss my trade caravans.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Rumrusher on August 22, 2011, 08:58:51 am
the only way I see any one getting into that is if they happen to use runesmith to kill someone.
the cure was to revive one goblin and hope he scatters off on his own.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: peterix on August 22, 2011, 09:03:42 am
the only way I see any one getting into that is if they happen to use runesmith to kill someone.
the cure was to revive one goblin and hope he scatters off on his own.
I fixed this before, but I had a living, caged goblin to work with. I used runesmith to unset his 'caged' flag and set a few flags common to approaching invaders. Goblin got caught instantly by the same cage trap that caught him before and the siege ended.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Thoranius on August 22, 2011, 11:15:11 am
Ah, I'll try that if I get any more fresh ones in, they were coming in before despite the constant siege, but seemed to have stopped. Any plans in the future for a tile fixer for the occupied flag error that sometimes occurs? I seem to get them from site reclaim issues, or vanishing/deleting creatures to clean up the length of my unit list.

Oh, and that siege ending method, does it have to be a goblin/troll turned into an invader with Runesmith, or would any wild animal work, if supplied with the proper flag setup?
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Xen0n on August 22, 2011, 06:07:19 pm
I have a question / request.  Is it possible in the current DFHack to use options to run a command that deletes all instances of "Forgotten Beast Extract" from the floor, puddles, coatings on dwarves, and splashed on items?  If not, is it feasible to include in a future update?  I ask because while dfcleanmap is great, I run it once or twice a (dwarven) month and yest "a pile of frozen forgotten beast extract" miraculously reappears in the same few bathtubs, on the exact same tiles, and most of my dwarves are crippled and blind.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Rumrusher on August 22, 2011, 06:33:18 pm
I have a question / request.  Is it possible in the current DFHack to use options to run a command that deletes all instances of "Forgotten Beast Extract" from the floor, puddles, coatings on dwarves, and splashed on items?  If not, is it feasible to include in a future update?  I ask because while dfcleanmap is great, I run it once or twice a (dwarven) month and yest "a pile of frozen forgotten beast extract" miraculously reappears in the same few bathtubs, on the exact same tiles, and most of my dwarves are crippled and blind.
well you can still use DFcleanmap from the old version of Dfhack.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Thoranius on August 22, 2011, 07:24:32 pm
I dunno if the reoccurring stuff on the floor is tile based or results from tracking/cleaning self dwarf interactions, but I swear I've seen a tile re-blood with no other units in sight, so I'm unsure as to the source.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: BigD145 on August 22, 2011, 07:30:52 pm
Items hold blood. Was it raining? That'll wash it off items and onto the ground. I usually make it rain and then clean all the blood.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: DrKillPatient on August 22, 2011, 08:10:06 pm
In the old DFHack there was a 'dfprospector -a' command that could show even the unrevealed contents of the map. What's the equivalent command for the prospect utility?

EDIT: derp, 'prospect all', so sayeth the readme.
EDIT2: Ah, here's a problem actually. It seems that the list gets cut off, so about half the gem list and all the ores don't show. The list is too long, I think, since I can't scroll up past that point.
EDIT3: After some further testing this seems to be localized to Xterm, URxvt doesn't have that problem.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: Thoranius on August 22, 2011, 09:20:49 pm
Hmm, it could of been items, then. The only section I remember for certain being item free and reblooding was also next to the meeting area well, the prime dwarf-washing area, so it could of been from that. On a side note, anyone ever notice that named-dwarven liver blood never seems to come off, no matter how many time a doctor dwarf performs a "clean self" task?
Title: Re: DFHack 0.31.25 r4 (current)
Post by: i874236951 on August 24, 2011, 10:54:34 pm
Does tiletypes actually work?

Hmm... I get that it's an experimental feature or some such, but it doesn't seem to do anything at all.  No matter what command I enter I can never get it to acknowledge a material.  I can't seem to change it to paint with stone or air or whatever at all, it just accepts the command and then prints the standard three lines again without anything changing, and still won't paint anything.

The rest of it is all great though.  It's really nice having the tools I find myself using integrated together into a nice interface like this.

I think your question went unanswered, so I'm going to bump the thread since I had the same problem.  While I don't know if all the options work, setting material type with the command "p mat" or "paint material" and then a material listed in "help mat" works.  Same goes with shapes from the "help shape" list.  For example, "p mat soil" then "p sh ramp" will allow you to paint soil ramps.
Title: Re: DFHack 0.31.25 r5 (current)
Post by: SalmonGod on August 26, 2011, 06:11:23 pm
Thanks peterix!!
Title: Re: DFHack 0.31.25 r4 (current)
Post by: peterix on August 27, 2011, 11:25:44 am
Does tiletypes actually work?

Hmm... I get that it's an experimental feature or some such, but it doesn't seem to do anything at all.  No matter what command I enter I can never get it to acknowledge a material.  I can't seem to change it to paint with stone or air or whatever at all, it just accepts the command and then prints the standard three lines again without anything changing, and still won't paint anything.

The rest of it is all great though.  It's really nice having the tools I find myself using integrated together into a nice interface like this.

I think your question went unanswered, so I'm going to bump the thread since I had the same problem.  While I don't know if all the options work, setting material type with the command "p mat" or "paint material" and then a material listed in "help mat" works.  Same goes with shapes from the "help shape" list.  For example, "p mat soil" then "p sh ramp" will allow you to paint soil ramps.
The tiletypes tool is a bit weird and I'm not very happy with it. It has all those options, but you can't specify more options at the same time... it's a dumb port from the original tiletypes tool and could benefit from a rewrite or two. I fixed some bad bugs in it so it no longer creates invalid tiles, but it's a long way from done... Now it does nothing in the cases where it would produce DF crashes >_>

Anyway, new release is out! I added a circle designation tool and stonesense got some much needed performance tweaks :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Askot Bokbondeler on August 28, 2011, 03:49:22 pm
posting to keep track of the thread
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Quietust on August 28, 2011, 03:58:41 pm
posting to keep track of the thread
Just so you know, there's a "Notify" button that lets you do that without having to post to the thread...
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Askot Bokbondeler on August 28, 2011, 04:31:06 pm
that button doesn't do what you think it does. or maybe it does, but it doesnt do what i want it to do
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Gabriel A. Zorrilla on August 28, 2011, 06:19:06 pm
Peter, great stuff you've come up! After installing libjpeg8 and trying to load stonesense, i get in the stderr.log:

libjpeg.so.8: wrong ELF class: ELFCLASS64

Any idea? I'm using Ubuntu 11.04 x64.

Thanks!
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on August 28, 2011, 06:47:09 pm
Peter, great stuff you've come up! After installing libjpeg8 and trying to load stonesense, i get in the stderr.log:

libjpeg.so.8: wrong ELF class: ELFCLASS64

Any idea? I'm using Ubuntu 11.04 x64.

Thanks!
Yes, you need the 32bit version of the library. You'll probably also need a few others: libfreetype.so.6 and libpng12.so.0
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Gabriel A. Zorrilla on August 28, 2011, 07:11:18 pm
I'm starting to get into a dependency hell when trying to install all the 32bit libraries. I do not want to run it into a 32bit ubuntu VM and for what i'm checking in your github, stonesense is not included in the source to try to compile it. What do you suggest? You know of any easy way to install the 32bit libraries? Could you find a way to just include all the 32 bit libs in a next release?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Zaerosz on August 28, 2011, 08:01:28 pm
Okay, so I just downloaded this version, and AVG immediately spotted a trojan in dfmode. Explain?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on August 28, 2011, 08:19:40 pm
I'm starting to get into a dependency hell when trying to install all the 32bit libraries. I do not want to run it into a 32bit ubuntu VM and for what i'm checking in your github, stonesense is not included in the source to try to compile it. What do you suggest? You know of any easy way to install the 32bit libraries? Could you find a way to just include all the 32 bit libs in a next release?
You can get the .deb package from the 32bit ubuntu release (http://packages.ubuntu.com/natty/libjpeg8) and extract the library into stonesense/deplibs/. In case of libjpeg, it's named libjpeg.so.8.0.2 - extract it to the deplibs and rename to libjpeg.so.8
Okay, so I just downloaded this version, and AVG immediately spotted a trojan in dfmode. Explain?
Zero explanation I'm afraid. Update your AVG and try again. I'm running AVG 2011 here and it found no problems.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rumrusher on August 28, 2011, 10:11:34 pm
So I notice that "Select all" doesn't work, so is it because of the offset being different or the usual patterns and coding for Select All to work wasn't added in for Hackfusion and I need to plug the patterns and common back in?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: UristMcHuman on August 30, 2011, 03:13:17 pm
Do I need to generate a new world to use this?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on August 30, 2011, 03:39:24 pm
Do I need to generate a new world to use this?
No. You just need the SDL version of DF 31.25.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: UristMcHuman on August 30, 2011, 03:50:05 pm
I mainly use the SDL od 31.24. Will that work, too?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on August 30, 2011, 05:22:19 pm
I mainly use the SDL od 31.24. Will that work, too?
Support for a few of the older versions can be added to the new dfhack. Probably the 31.22 - 31.24 range.
For now, use the legacy dfhack: http://www.bay12forums.com/smf/index.php?topic=58809.0
Title: Re: DFHack 0.31.25 r6 (current)
Post by: dree12 on August 30, 2011, 07:21:50 pm
I mainly use the SDL od 31.24. Will that work, too?
Is there a reason for this? You are missing out on some important bugfixes.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: UristMcHuman on August 30, 2011, 08:19:57 pm
I mainly use the SDL od 31.24. Will that work, too?
Is there a reason for this? You are missing out on some important bugfixes.
Well, I have 31.25, too, but most of my interesting experiences only appear in my 31.24 install. Will this version of DF Hack work with 31.24?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on August 30, 2011, 10:10:37 pm
indeed, it will not. it can be made to work, but it would not be worth it.

You can still play old saves in new DF versions.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mikey on August 31, 2011, 12:28:42 am
There's almost no reason to keep playing older 31.2x forts in their original game version.  31.25 will run them all just fine, with no issues, and will fix several of their non-worldgen bugs as well.  I've been running forts from versions as old as 31.12 just fine in 31.25.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rumrusher on August 31, 2011, 08:29:27 am
There's almost no reason to keep playing older 31.2x forts in their original game version.  31.25 will run them all just fine, with no issues, and will fix several of their non-worldgen bugs as well.  I've been running forts from versions as old as 31.12 just fine in 31.25.
well there is the issue of one version has the creatures ability to take over your nest box and lay eggs. that was a nice feature but was removed because folks didn't like having to protect their boxes from wildlife. Shame really it could have been an option you could select your self.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Quietust on August 31, 2011, 08:31:45 am
There's almost no reason to keep playing older 31.2x forts in their original game version.  31.25 will run them all just fine, with no issues, and will fix several of their non-worldgen bugs as well.  I've been running forts from versions as old as 31.12 just fine in 31.25.
Any fortress made in version 0.31.18 or earlier will exhibit several significant problems if you upgrade:
* Moody dwarves will start asking for yarn cloth, which you cannot make
* Grass on the surface will stop growing, and once it's gone you'll never have any more surface trees or shrubs
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Antonater on August 31, 2011, 10:37:27 am
i downloaded this and it gave my computer a virus according to AVG, and ive never had a virus before in 8 years.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on August 31, 2011, 11:24:47 am
i downloaded this and it gave my computer a virus according to AVG, and ive never had a virus before in 8 years.
Rather an autoimmune reaction really. It's a false positive (http://service1.symantec.com/sarc/sarc.nsf/info/html/what.false.positive.html). Only the legacy dfhack is detected as such. Let me show you what it does here:
Spoiler (click to show/hide)

It pretty much screws up my build of legacy dfhack. I'll have to talk to the grisoft guys about this and get it sorted out on their end. My code is OK :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rumrusher on August 31, 2011, 11:42:05 am
yup false positive it was.

Well I found a solution to "flip from adventurer mode and going insane," make sure your character needs is taken care of before you flip over.
Which means feed, wear nice items, Sleep, look at a sweet waterfall before you flip over or else the character your playing in adventure mode will be over taken by deaths of friends and family members and will hit either melo or SRM or Berserk.
in other news, until I find out how to keep caged things still caged don't leave a site with an insane prisoner lock up he or she will break out and kill a few.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mikey on August 31, 2011, 08:56:34 pm
Any fortress made in version 0.31.18 or earlier will exhibit several significant problems if you upgrade:
* Moody dwarves will start asking for yarn cloth, which you cannot make
* Grass on the surface will stop growing, and once it's gone you'll never have any more surface trees or shrubs
Ah, fair enough.  I hadn't run into either problem yet with imported forts, but I guess the plant issues could be a big deal.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Neowulf on September 02, 2011, 04:36:13 pm
Doubt it, but I still have to check.
Any way to get the magma discovery alert switched on so you can build magma forge/smelt/kiln/glass workshops without having to actually dig down and discover the map's original magma?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Xen0n on September 03, 2011, 02:38:24 pm
Hi, I was wondering how to interpret the results from the 'flows' tool. 
Specifically, what do liquid_1 and liquid_2 represent, and what does it mean when they are 'true'?  (Basically I ran it to see how much flowing water I have on the map, but I'm not really sure what it's telling me.  It also says Magma tiles : 0 when I know I have magma there, so I'm not sure what I'm reading.)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on September 05, 2011, 12:24:20 pm
Hi, I was wondering how to interpret the results from the 'flows' tool. 
Specifically, what do liquid_1 and liquid_2 represent, and what does it mean when they are 'true'?  (Basically I ran it to see how much flowing water I have on the map, but I'm not really sure what it's telling me.  It also says Magma tiles : 0 when I know I have magma there, so I'm not sure what I'm reading.)
Number of map blocks where liquid processing is enabled. If you have a river, there will be a few. If you have a leak in hell, the number will be huge. That's about all it can do :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Xen0n on September 05, 2011, 12:31:52 pm
Ah thanks, much appreciated!
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Buttery_Mess on September 06, 2011, 02:05:28 pm
Okay, I'm really sick of this. I can't find any documentation online to help me. I'm trying to get Stonesense to work with .25. The files in the zip in this thread don't contain binaries, and when I try mashing together the most recent dfhack and stonesense files I can find with the newest binaries I have, stonesense flat out refuses to run. Either I'm being really stupid or there's something wrong with my computer.

What is the exact order I need to install things, in which folders (relative to DF main folder), and precisely what files do I need? I've been told I need to 'run DFHack at least once' before I can get Stonesense to work, but that doesn't make any sense to me. Please, please help me. I don't know what I'm doing wrong.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on September 06, 2011, 02:18:37 pm
extract the latest DFHack into the DF folder.

run DF.

type stonesense into the console that pops up.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Buttery_Mess on September 06, 2011, 02:28:55 pm
waaaaah

I had no idea I was supposed to do that. Where does it say that's what you're to do?

Thanks muchly ;)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on September 06, 2011, 02:30:55 pm
How to install DFHack:
  • First, get the archive meant for your system. Extract the contents into your DF folder.
  • On Windows, you're ready to use DFHack
  • On Linux, use the 'dfhack' script to run DF with DFHack. If you have stonesense problems, you might have to get your own allegro 5 libraries and delete the ones in stonesense/deplibs.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Buttery_Mess on September 06, 2011, 08:41:57 pm
Yeah, I put it in the root folder in which I keep about seven versions of DF, alternate .25 folders and my Phoebus folder. I didn't realise it modified a .dll and started up with DF.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: gsvslto on September 08, 2011, 05:34:37 pm
Is there a way to use DFHack to change the cook/brew settings for a material, as normally controlled by the Status->Kitchen screen in DF?  I've looked for it, but not found it.  Assuming that DFHack didn't have that feature, I tried to use Cheat Engine to see what happens when I toggle those settings, but I couldn't work out what was going on - it didn't look like simple bit flags were involved.  Any help would be much appreciated.

PS:
peterix, DFHack is a really great tool!  Thanks for the work you, and others, have put into it!
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Qmarx on September 09, 2011, 02:31:05 pm
When I try to run stonesense from the dfhack window, the stonesense window pops up.  It creates an image of the current DF window just fine, but after that stonesense doesn't refresh, and trying to close it results in DF crashing.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on September 09, 2011, 02:38:04 pm
It's a known bug, and I have no idea what causes it, but I think I know how to get a fix done. maybe.

sometimes it happens, sometimes it doesn't.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Qmarx on September 09, 2011, 02:41:52 pm
Fair enough.  I might as well also comment that reloading the stonesense plugin causes the whole thing to hang, including dwarf fortress and the console window.

It's happened every time I've tried it, but I've only tried it three times, so it's entirely possible that it's just a coincidence.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on September 09, 2011, 02:46:01 pm
The main issue is that the person that needs to fix it is a total dumbass that doesn't know what he's doing.

Really, you'd have better luck from a trained monkey.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: lordnincompoop on September 09, 2011, 06:48:45 pm
Love the new tools. Keep up the good work!

Also, would auto-designation of spheres be a possible feature? 3d shapes would be of great help for, say, mining.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Greiger on September 09, 2011, 09:04:11 pm
Really, you'd have better luck from a trained monkey.

Now now Japa, you are doing a fine job, and there are some really stupid trained monkeys out there.  I think I work with some wearing human suits.

As for the crashing DF thing, did you try DFUnstuck to try to get DF running again?  Most (all?) DFHack based tools actually suspend the Dwarf Fortress process so that values don't change while it does it's thing.  When a DFHack program fails it often cannot tell Dwarf Fortress to start running again.   DFUnstuck's only purpose is to tell the Dwarf Fortress process to start running again.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on September 09, 2011, 09:25:03 pm
You have outdated info.

DFunstuck only works for the old DFhack.

the new one works completely differently.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Greiger on September 10, 2011, 09:06:28 am
Ah.  Well I tried.

I blame society.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on September 11, 2011, 04:08:28 am
Is there a way to use DFHack to change the cook/brew settings for a material, as normally controlled by the Status->Kitchen screen in DF?  I've looked for it, but not found it.  Assuming that DFHack didn't have that feature, I tried to use Cheat Engine to see what happens when I toggle those settings, but I couldn't work out what was going on - it didn't look like simple bit flags were involved.  Any help would be much appreciated.
Well, it doesn't do it. It's never so easy - it's probably a single bit in some bit field squirelled away somewhere...
When I try to run stonesense from the dfhack window, the stonesense window pops up.  It creates an image of the current DF window just fine, but after that stonesense doesn't refresh, and trying to close it results in DF crashing.
Hmm.. haven't seen that problem before.
I might as well also comment that reloading the stonesense plugin causes the whole thing to hang, including dwarf fortress and the console window.
It's happened every time I've tried it, but I've only tried it three times, so it's entirely possible that it's just a coincidence.
I thought I fixed that. It was consistently causing crashes before. What OS is that? And how many CPU cores do you have? Are you sure you're running the latest version of DFHack?
Also, would auto-designation of spheres be a possible feature? 3d shapes would be of great help for, say, mining.
Yes :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Quietust on September 11, 2011, 11:21:11 am
The following 5 vectors appear to be used for cook/brew exclusions:
0x014F0BB4 (int16) - item type (e.g. MEAT, SEEDS, PLANT, DRINK - see here (http://df.magmawiki.com/index.php/Item_token) for numeric IDs)
0x014F0BC4 (int16) - item subtype (generally -1)
0x014F0BD4 (int16) - material (19-218 for creature materials, 419-618 for plant materials)
0x014F0BE4 (int32) - submaterial (the creature/plant ID)
0x014F0BF4 (int8) - type (1 = do not cook, 2 = do not brew)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Twobeard on September 13, 2011, 08:20:57 am
Once i get my new machine in this is totally going into action. Thanks again for all your hard work. You are a beardy beardy dwarf.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rumrusher on September 14, 2011, 10:09:18 pm
so does this mean we can finally cook and brew sentient meats now and or use their bones and limbs for crafting?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Quietust on September 15, 2011, 09:52:27 am
so does this mean we can finally cook and brew sentient meats now and or use their bones and limbs for crafting?
And how exactly would you expect to be able to do that?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rumrusher on September 16, 2011, 04:50:41 am
oh yeah well you could just slap tame and slaughter(both creature flags) on a friendly/citizen and watch them get drag to the butcher workshop.
My only gripe was doing so led to unused material and rotten meat left to waste I don't think this is even connected to ethics and just hardcoded into the game.

oh and before I forget here's the Git Dfusion codes for race change by wounds and type of race so that one could set up either a zombie mod with infections that convert or magical items that change the user into a wizard and grant magical spells.

Code: [Select]
function tools.lycanressurecttest()
RaceTable=RaceTable or BuildNameTable() --slow.If loaded don't load again
--repeat --remove the "--" if you want this to run while you play
local trgs=selecthuman()
for k,v in pairs(trgs) do
--indx=GetCreatureAtPos(v)
--indx=engine.peek(v,ptr_creature.ID)
--local trgs=selectwolf()
--for t,z in pairs(trgs) do
id2=RaceTable["WIZARD"] -- this is the race the victim will turn into
engine.poke(v,ptr_Creature.race,id2)
print("Infected:"..k) --counts how many turned left in for the player to see if any one converted or not.
v2=engine.peek(v,ptr_Creature.hurt1)
for i=0,v2:size()-1 do
v2:setval(i,0)
end
v2=engine.peek(v,ptr_Creature.hurt2)
v2.type=DWORD
for i=0,v2:size()-1 do
v2:setval(i,0)
end

engine.peek(v,ptr_Creature.civ)
engine.poke(v,ptr_Creature.civ,-1) --for wizard or magical spell caster race transformations remove this and the line above it to prevent hostile demi gods
engine.poke(v,ptr_Creature.bloodlvl,60000) --give blood
engine.poke(v,ptr_Creature.bleedlvl,24) --stop some bleeding...
--end
end
--until k==100 --remove the "--" if you want this to run while you play
end
function selecthuman() -- this will create a list of creatures who been hurt a curtain way and have the same race.
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("AdvCreatureVec")
  RaceTable=RaceTable or BuildNameTable()
  vector=engine.peek(myoff,ptr_vector) --standart start
  for i=0,vector:size()-1 do --check all creatures
     local off
     off=vector:getval(i)
     local id=engine.peek(off,ptr_Creature.race)
     local v2=engine.peek(off,ptr_Creature.hurt1)
ra=RaceTable["KEEPER"] --genesis
ra2=RaceTable["HUMAN"] --normal
     if id==ra or id==ra2 and v2:getval(12)>=1 and v2:getval(8)==0 then -- this checks if the race match ra or ra2 and checks their body parts to see if they aren't dented in the right upper arm and still have their heads
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

function tools.Hurtselected() --this baby is used for modders to test which body part they want to effect the victim and to see if the code above works out.
    --repeat
myoff=offsets.getEx("AdvCreatureVec")
vector=engine.peek(myoff,ptr_vector)
indx=GetCreatureAtPos(getxyz())
if indx<0 then return end
--print(string.format("%x",vector:getval(indx)))
v2=engine.peek(vector:getval(indx),ptr_Creature.hurt1)
v3=engine.peek(vector:getval(indx),ptr_Creature.hurt2)
v3.type=DWORD
print("select body part 0=upperbody,1=lowerbody,2=head,3=right front leg,4=left front leg,5=")
r=io.stdin:read()
t=r*4
print("select infliction")
d=io.stdin:read()
v2:setval(t,d)
v3:setval(r,d) --remove zero-th limb or something... same with hurt2
end

tools.menu:add("?harm part?",tools.Hurtselected)
tools.menu:add("?nonsave animal morph?",tools.lycanressurecttest)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: toasteur on September 26, 2011, 02:43:07 pm
quick question about the qtplug test:

is it possible to make it work under vs2010?

i managed to compile everything else in the solution except this which is the one i would like to make it work, if i wish one day to try to make therapist work with dfhack.

i got opengl, i got qt for visual and the configure seems to have everything it needs, but still it seems sdl is registered nowhere and i have the following problems:
   1   IntelliSense: namespace "SDL" has no member "Mutex"   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   21   13   qtplug
   2   IntelliSense: namespace "SDL" has no member "Thread"   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   23   13   qtplug
   3   IntelliSense: identifier "SDL_CreateMutex" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   34   22   qtplug
   4   IntelliSense: identifier "SDL_mutexP" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   47   5   qtplug
   5   IntelliSense: identifier "SDL_CreateThread" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   51   20   qtplug
   6   IntelliSense: identifier "SDL_mutexV" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   57   5   qtplug
   7   IntelliSense: identifier "SDL_mutexP" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   68   5   qtplug
   8   IntelliSense: identifier "SDL_mutexV" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   70   5   qtplug

any chance SDL was a global register on you dev machine and then as it's not on mine, it can't find the sdl namespace?

also, i can be considered a complete noob in c++ as i didn't touch it in year, and since dev in c# .NET, where referencing libraries is as easy as pointing to a reference dll in the project. no linking, no .h, no mysterious compiler choice in .NET, so i'm quite lost here if i have to manually configure the project which i assume is cmake role  :-[
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on September 26, 2011, 04:24:36 pm
quick question about the qtplug test:

is it possible to make it work under vs2010?

i managed to compile everything else in the solution except this which is the one i would like to make it work, if i wish one day to try to make therapist work with dfhack.

i got opengl, i got qt for visual and the configure seems to have everything it needs, but still it seems sdl is registered nowhere and i have the following problems:
   1   IntelliSense: namespace "SDL" has no member "Mutex"   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   21   13   qtplug
   2   IntelliSense: namespace "SDL" has no member "Thread"   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   23   13   qtplug
   3   IntelliSense: identifier "SDL_CreateMutex" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   34   22   qtplug
   4   IntelliSense: identifier "SDL_mutexP" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   47   5   qtplug
   5   IntelliSense: identifier "SDL_CreateThread" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   51   20   qtplug
   6   IntelliSense: identifier "SDL_mutexV" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   57   5   qtplug
   7   IntelliSense: identifier "SDL_mutexP" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   68   5   qtplug
   8   IntelliSense: identifier "SDL_mutexV" is undefined   e:\_sources\dfhack_r2\plugins\qtplug\qtplug.cpp   70   5   qtplug

any chance SDL was a global register on you dev machine and then as it's not on mine, it can't find the sdl namespace?

also, i can be considered a complete noob in c++ as i didn't touch it in year, and since dev in c# .NET, where referencing libraries is as easy as pointing to a reference dll in the project. no linking, no .h, no mysterious compiler choice in .NET, so i'm quite lost here if i have to manually configure the project which i assume is cmake role  :-[
Hmm... what? It works only in MSVC 10.


So, I'll look into it. Stop by in #dfhack on freenode if you want to talk in real-time :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: toasteur on September 26, 2011, 04:41:50 pm
thanks for the answer.

if you say it's not such a good idea, i'll take your word for it.  :D

i will get back to my first idea which is to make a gui in c# .net and then in a first attempt use files in folders to communicate between my gui and a dfhack plugin running in a thread like stonesense or dfusion waiting for files to process.
since communications between the 2 programs should be scarse and spaced in time because a dwarf management tool is not so intensive as a stonesense, it should be a viable mean of communication for a start.

later, some kind of client/server data exchange service should allow for more "industrial" communications, but i'm not there yet and as much as i could implement it quickly in c#, i'm not so confident for the c++ part  :(, especially since i only dev web applications where communicating by webservices is only as hard as putting some attribute on class methods and letting visuall studio do al the work of creating the technical wires for both server and client...
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on September 26, 2011, 05:30:15 pm
thanks for the answer.

if you say it's not such a good idea, i'll take your word for it.  :D
It would be a great idea if Qt wasn't this silly about having a central event dispatch thing that pretty much limits all interaction with the GUI to a single thread... Anyway, I fixed the build problems. If you want to take a look at it, you should be able to do so now. It's just a gutted frontend for a ray tracer and doesn't really do much. It shows a window though :D
i will get back to my first idea which is to make a gui in c# .net and then in a first attempt use files in folders to communicate between my gui and a dfhack plugin running in a thread like stonesense or dfusion waiting for files to process.
since communications between the 2 programs should be scarse and spaced in time because a dwarf management tool is not so intensive as a stonesense, it should be a viable mean of communication for a start.
Interesting idea. It should work I guess. You can use Windows Mutex locks for syncing the files.
later, some kind of client/server data exchange service should allow for more "industrial" communications, but i'm not there yet and as much as i could implement it quickly in c#, i'm not so confident for the c++ part  :(, especially since i only dev web applications where communicating by webservices is only as hard as putting some attribute on class methods and letting visuall studio do al the work of creating the technical wires for both server and client...
In this case, it's the pipes that are missing. Anything too OS-specific will be swiftly kicked out of the dfhack project though.
Files sound nice and universal. Locking them with Mutex on Windows and a file lock on *nix makes a lot of sense too. It's actually not too different from shared memory. There are some slight differences in semantics for shared memory between OSes, but nothing that can't be handled with a few #ifdefs and maybe a cleanup function. I had something along those lines before, but kinda broken due to bad design.

My current plan in this area is using ØMQ together with Google protobuf for a cross-platform, network transparent way to talk to external apps. Some code is available on pastebin, written by a dude who's already using it for talking to DF.

See:
http://pastebin.com/hNPwfGSS
http://pastebin.com/Fdyvs9MU
http://pastebin.com/gvS81H8P

It's not complete on pastebin, but basically a client registers for updates of the local DF map and the server in DF sends them out over a ØMQ socket. The official external API for DFHack would be more of a request/response kind of thing, with the protocol extensible by plugins.

Anyway, whatever you come up with, keep me posted :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: rampaging-poet on September 26, 2011, 08:02:12 pm
What steps are involved in making a new DFHack plugin? I was thinking of making a flood-fill traffic designation utility, but I couldn't figure out where to start.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: toasteur on September 27, 2011, 05:55:26 am
My current plan in this area is using ØMQ together with Google protobuf for a cross-platform, network transparent way to talk to external apps. Some code is available on pastebin, written by a dude who's already using it for talking to DF.

well i already looked into omq myself, and it seems really nice because it exists in so much langages variant, and seems pretty powerful but yet easy to use. but it's such a big library, i though maybe it would be a little overkill for what we want, but i'm glad i wasn't the only one to get it as a viable candidate amongst all other available solutions.

i looked into google protobuf when you mentioned it a while ago, but it seems complicated enough to put together, and since i'm from a web background i tough about xml, mainly because in .NET all it takes to produce an xml from a bunch of objects is to put a one-line [Serializable] attribute, and it's done. sadly, i didn't find anything approaching it on c++ side, so i was considering looking into yaml since apis exists in lots of languages and it could be more lightweight to put in place than google protobuf.

if we can manage to put some simple framework to allow communication between df and an arbitrary external program, i guess it should be worthwile to port it as some additional service for the dfhack console, where external programs could trigger random plugin commands instead of just one particular plugin. this way, the looping thread could be shared and plugins wouldn't have to implement each it's own communication protocol and loops.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Pseudo on September 28, 2011, 07:59:44 pm
Is there (or could someone either make one or show me how to) a way to set jobs (as in for a building, not a dwarf) in DFHack?

It might be helpful for helping to make an optional add-on for Quickfort (see here (http://www.bay12forums.com/smf/index.php?topic=35931.msg2646824#msg2646824)), specifically for levers. It would be useful to be able to auto-connect levers (to say the least!), and the only other option (that I can see) is to scan through until the cursor co-ordinate is the same as the saved co-ordinate, which I think would get very slow fairly quickly...

I've been looking through the source and haven't found anything of the sort so far. Is it primarily because of missing memory vectors, or is it more complex then that?

On a side note, I can't believe that you actually managed to integrate DFHack and DF. The only other thing of the sort that I have ever encountered was TA Demo Recorder, and that was in many ways much less complex. (And yes, I do still occasionally play Total Annihilation... It may not have the best graphics, but it is a great game.)

What steps are involved in making a new DFHack plugin? I was thinking of making a flood-fill traffic designation utility, but I couldn't figure out where to start.

Flood-fill traffic designation? As in automating the first thing I always do (designating hallways as high traffic and dead-ends as low or restricted traffic depending on size)? ...yay!

Disclaimer: I have never written a plugin for DFHack, but I would imagine that it would be like writing any other C++ code. Why don't you take a look at the plugins folder of DFHack? You could start with tubefill (https://github.com/peterix/dfhack/blob/master/plugins/tubefill.cpp), as it it (I think) among the closest to what you want to do. I haven't seen any mention of traffic designations yet in DFHack however.

EDIT: I just noticed this (https://github.com/peterix/dfhack/blob/master/COMPILE.rst).
Title: Re: DFHack 0.31.25 r6 (current)
Post by: rampaging-poet on September 29, 2011, 01:26:23 am
Thanks, that should help a lot!  I'm reading tubefill right now, and the explanation of the basic architecture in the compile document was highly informative.  I'll probably get started tomorrow evening.

EDIT: So if I've got this right, plugins need to export initialization and finalization procedures, and the initialization procedure returns (well, stores in a shared location) a command name, description, and the main command method.  I might get the basic skeleton filled in tonight...
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on September 29, 2011, 04:26:05 am
What steps are involved in making a new DFHack plugin? I was thinking of making a flood-fill traffic designation utility, but I couldn't figure out where to start.
Well. Let's see. The only plugin that uses flood fills is the vein digger. You can see it here. (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/plugins/vdig.cpp)

This file is compiled into a library. DFHack then loads the library and requires some functions to be present:
plugin_name (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/plugins/vdig.cpp#L25) should always return the same name as the resulting plugin library file name. (see the bit about adding the plugin to the build system later)
plugin_init (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/plugins/vdig.cpp#L30) allows your plugin to declare which commands it exports to the dfhack console. There's an extra 'bool' parameter that declares if the command is interactive - accepts input from console. Such commands can't be used from a hotkey.
plugin_shutdown (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/plugins/vdig.cpp#L41) is called right before the plugin is unloaded by dfhack. You *must* clean up here. Any threads you might have started and are executing code from your plugin must be finished before this function returns (this applies to things like stonesense).
A command (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/plugins/vdig.cpp#L747) - in this case it's the vein digger command. It uses flood fills and shows how to use the map cache (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/library/include/dfhack/extra/MapExtras.h#L244), which is a higher-level abstraction built on top of the Maps module (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/library/include/dfhack/modules/Maps.h). Using the Maps module directly would be much harder than using the cache, because the cache basically treats the DF map as one continuous space, hiding the underlying structures to an extent. This is very good for doing flood fills :)

A plugin can optionally include a plugin_onupdate (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/plugins/reveal.cpp#L80) function. In this case, it's the one from the reveal plugin, making it impossible to unpause if hell is revealed (to my great relief, not having to handle all the problems that caused for people).

Now a bit about synchonizing with the game :)

What happens is that the game has its ows thread where it executes everything interesting. This thread calls a function in DFHack, which in turn calls all the plugin_onupdate functions. That means that you don't have to synchronize with the game in this function.
The command functions are a bit different - they are tied to the console thread. When you type a command into the console, your command function will be called. There, you must call Core::Suspend to wait for the next time DF is idle and not doing stuff. After you are done with whatever you need to do, you have to call Core::Resume. This hands off the DF thread to the next command waiting, or DF itself. A lot of thread synchronization magic is hidden behind the DFhack API - Ideally, you won't ever have to deal with it directly.

You can use the Console object (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/library/include/dfhack/Console.h) to mess with the console. A command can print to the console any time, but if you need interactivity, it has to be declared like this (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/plugins/liquids.cpp#L156) to prevent some breakage. The console implements a line editor and is thread safe. Only one thing can read from it at a time though, and only safe way to do it is with the lineedit method. The liquids tool has some examples of this.

To make it compile, you put your .cpp file in plugins/ and add it to the build system like this (https://github.com/peterix/dfhack/blob/5d54bfca96499b7a349a59d3d52933dbc87f00d2/plugins/CMakeLists.txt#L29). Then rerun cmake to generate new project files.

Where you go from this point is up to you. Ideally, it will become a part of DFHack that can be maintained. If you can, fetch the dfhack source tree with git and work on top of that, even better, fork the project on github and publish your changes there.

And stop by in #dfhack on freenode. There's plenty of friendly people there :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on September 29, 2011, 05:04:13 am
And stop by in #dfhack on freenode. There's plenty of friendly people there :)

And me!
Title: Re: DFHack 0.31.25 r6 (current)
Post by: toasteur on October 01, 2011, 05:14:33 am

Anyway, whatever you come up with, keep me posted :)

ok, so after several hours of trial and error in msvc 2008, i got libzmq 2.1.9 compiled, protobuf 2.4.1 compiled, and then i used the simple server wait and respond sample from zeromq website running both in c++. then it took me some times to generate the appropriate class helper for the sample addressbook message and got it running between c++ client and server.

to validate communication between different environments, i generated a c# class helper for addressbook, and got in a few minutes a perfectly running .NET client for the c++ server. so now i'm trying to integrate the c+ server into the dfhack project, but i have some problems gtetting the project to compile, it won't take my addressbook.h file complaining it can't find it even if i added it manually to a new plugin project which compiles fine by itself...

since it takes me like 100 times to code c++ than it take for c#, if it's not too much to ask, could you create some blank plugin project in the repository, which the basic wiring to launch a thread, wait for a kill signal like stonesense?

for now, i still have to define proper messages struct to exchange data, so i still have much work before just integrating into a dfhack plugin.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 01, 2011, 10:15:22 pm
ok, so after several hours of trial and error in msvc 2008
This won't work for dfhack. You need msvc 2010 for binary compatibility with DF.
I have some problems gtetting the project to compile, it won't take my addressbook.h file complaining it can't find it even if i added it manually to a new plugin project which compiles fine by itself...
Don't use the MSVC gui to add files. The real project files are written in CMake:

CMakeLists.txt (https://github.com/peterix/dfhack/blob/master/CMakeLists.txt) - the main one. Just a bunch of setup stuff.
library/CMakeLists.txt (https://github.com/peterix/dfhack/blob/master/library/CMakeLists.txt) - this says how the main lib is compiled.
Notice the setting of properties on lists of header files -- you can use the same for including any kinds of files and marking them as non-build (resources, images, linuxy stuff that shouldn't build on windows). I didn't really bother with this much, because I only use MSVC as a compiler button.
lua/CMakeLists.txt (https://github.com/peterix/dfhack/blob/master/lua/CMakeLists.txt) - building a static version of LUA for DFusion
plugins/CMakeLists.txt (https://github.com/peterix/dfhack/blob/master/plugins/CMakeLists.txt) - building the plugins

The syntax should be easy enough to pick up :)

The stonesense one:
plugins/stonesense/CMakeLists.txt (https://github.com/peterix/stonesense/blob/master/CMakeLists.txt)
This is a bit more crazy because I use my own precompiled static libs here... due to too many problems caused by the official build of allegro being just plain bad, or non-existent on linux.

Anyway, I guess I'll have to take zmq and protobuf and wrap them in cmake magic, just like I did with LUA for DFusion :D

since it takes me like 100 times to code c++ than it take for c#, if it's not too much to ask, could you create some blank plugin project in the repository, which the basic wiring to launch a thread, wait for a kill signal like stonesense?
Sure, I wanted to make one anyway. Just didn't have the reason to do it immediately :)
for now, i still have to define proper messages struct to exchange data, so i still have much work before just integrating into a dfhack plugin.
Hmm. I wanted to use protobuf for that... as for the protocol, I guess that will go through a few iterations before people are happy with it... I'd like to get the people that write visualizers and other tools involved.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: toasteur on October 02, 2011, 04:38:27 am
This won't work for dfhack. You need msvc 2010 for binary compatibility with DF.
that's not a problem, it's just that on my vm at work i only had vs2008. making the code in vs2008 or 2010, that's still c++ right  :D

i converted it easily in vs2010 version back to my home, no problem here.

Don't use the MSVC gui to add files. The real project files are written in CMake:
i hear you, but as a first quick and dirty version i just wanted it to compile to establish the principles. at worst other people would be able to make a clean version given the code.

Sure, I wanted to make one anyway. Just didn't have the reason to do it immediately :)
thanks, you save my life, all easy samples i found for now were using windows specific implementation...

Hmm. I wanted to use protobuf for that... as for the protocol, I guess that will go through a few iterations before people are happy with it... I'd like to get the people that write visualizers and other tools involved.

we didn't understand each other, my test used zeromq, AND protobuff with the sample message "addressbook" just to validate the principle.
so now, i have to define what i put in my messages, so define some proto files and generate corresponding classes for c++ and c#.

i'll define my own messages struct for my purpose, but it won't prevent others to do theirs also  ;D

if you want, here is the server and client code:
http://pastebin.com/r1ws8ebn

nothing fancy here, just proving how easy it is to setup communication between to applications in zmq which does all the dirty work for us.

the most time i spent was just how to manipulate the frigging strings in c++ with balancing between literal types and pointers, i though i was gonna kill myself  :o, that's why i asked you if you could do the technical wiring so my c++ coding would be limited to loops and simple dfhack objects usage.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Ieb on October 02, 2011, 05:35:07 am
Do you still take suggestions on what tools to add?
Back in 40d days, whatever was the utility again that compared to this thing had a nifty function which allowed you to change one type of stone to another. Tired of microcline? Turn it all into magnetite!

Would that be possible to add to this package?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Zeehorse on October 02, 2011, 02:17:57 pm
Is there a pre-compiled version of DFhack? I don't quite understand the intricacies of compiling fully, an the whole compiler software makes my head hurt so I figured I'd ask.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rumrusher on October 02, 2011, 02:28:08 pm
Do you still take suggestions on what tools to add?
Back in 40d days, whatever was the utility again that compared to this thing had a nifty function which allowed you to change one type of stone to another. Tired of microcline? Turn it all into magnetite!

Would that be possible to add to this package?
I think it was named Dtil
it had a wicked hex editor and tile changer.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 02, 2011, 08:10:26 pm
Is there a pre-compiled version of DFhack? I don't quite understand the intricacies of compiling fully, an the whole compiler software makes my head hurt so I figured I'd ask.
PROTIP: read the first post again ;)

Do you still take suggestions on what tools to add?
Back in 40d days, whatever was the utility again that compared to this thing had a nifty function which allowed you to change one type of stone to another. Tired of microcline? Turn it all into magnetite!

Would that be possible to add to this package?
Sure. It's quite possible to do that :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: rampaging-poet on October 02, 2011, 08:46:53 pm
* Highly useful instructions *

Thank you very much for the explanation.  There's a few more features I'd like to add, but the basic flood fill is working.

I noticed the occupancy structure has three bits reserved for "building" and that you'd noted it should be an enumeration.  The current version of my plugin just checks to see if that field is non-zero, but it would be nice to know what each of those values actually means.  Is more research required to find the meaning of each value, or has it just not come up yet?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 02, 2011, 09:23:01 pm
I noticed the occupancy structure has three bits reserved for "building" and that you'd noted it should be an enumeration.  The current version of my plugin just checks to see if that field is non-zero, but it would be nice to know what each of those values actually means.  Is more research required to find the meaning of each value, or has it just not come up yet?
I probably messed with it, wrote down some notes and then got distracted by something random... all I have is a guess: it's for pathfinding and collision detection. For example a retracting bridge could either act as 'empty space', in which case the normal map tile geometry is used, or 'floor', overriding the default. Same applies to workshops having floor/wall/empty tiles - you can cover the magma with the floor or wall tiles of a magma furnace.

A good test for this would be to set the bits on some empty space tiles and see if you can get dwarves to walk on invisible bridges :D
Title: Re: DFHack 0.31.25 r6 (current)
Post by: rampaging-poet on October 03, 2011, 01:48:30 am
I built a quick plugin to fiddle with the building bits.  I didn't have a retracting bridge or pit to test with, but I tried a number of other things.  These are the values I found:

Code: [Select]
000: No building whatsoever. Used for normal floors, walls, empty space, and constructions.
001: Not found in my tests.
010: Most passable buildings and stockpiles.  Levers, armor stands, chairs, etc. Also used for empty space drawbridges land on.
011: Gem windows, raised drawbridges, and forbidden doors.
100: Not found in my tests.
101: Used for open drawbridges, closed hatches and... the trade depot?
110: Impassible portions of workshops, statues.
111: Vertical bars, non-forbidden doors.

While it took some time to isolate dwarves (my fortress has too many possible paths), I was eventually able to block some dwarves in by painting invisible statues (110) over normal floor.  I tried to get them to path through walls by marking them as doors, trade depots, and passable buildings, but the pathfinding algorithm was not fooled.  I didn't have enough open space to perform a real test in my current fortress, but I might set up a test embark to fool around with in a couple days.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Angel Of Death on October 08, 2011, 04:20:59 pm
Where do I download the other parts, like DFmode?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: i874236951 on October 08, 2011, 05:32:40 pm
Where do I download the other parts, like DFmode?

Try the command "mode set" ;D
Title: Re: DFHack 0.31.25 r6 (current)
Post by: rampaging-poet on October 13, 2011, 09:46:11 pm
Alright, I forked the project and committed the first draft of the plugin.  The fork can be found here (https://github.com/rampaging-poet/dfhack).  The filltraffic plugin has two commands. The first is the filltraffic command, which flood-fills from the cursor and lets you decide whether to stop on buildings or not.  The second is tiletraffic, which currently just sets the entire map to one traffic level but will eventually check each tile for user-specified criteria before filling.

My quick building occupancy plugin is also included under plugin/devel, but I'm not certain it got listed as a developer plugin correctly as it doesn't seem to be in the Visual Studio project.

Also, should I send you pull requests every time I push to my fork, or only when I've completed a major feature?  I'm new to open-source coding, so I'm unsure of the etiquette involved.  I know better than to send obviously non-functional/broken code, but what other conditions apply?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: PWRFLSTRGN on October 13, 2011, 11:48:21 pm
Any chance there's a mac version of this somewhere? I just drained all the floodwater out of my fort and this mud is driving me crazy...
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 14, 2011, 08:32:55 am
Alright, I forked the project and committed the first draft of the plugin.  The fork can be found here (https://github.com/rampaging-poet/dfhack).  The filltraffic plugin has two commands. The first is the filltraffic command, which flood-fills from the cursor and lets you decide whether to stop on buildings or not.  The second is tiletraffic, which currently just sets the entire map to one traffic level but will eventually check each tile for user-specified criteria before filling.
Awesome.  :)
My quick building occupancy plugin is also included under plugin/devel, but I'm not certain it got listed as a developer plugin correctly as it doesn't seem to be in the Visual Studio project.
The devel stuff won't compile by default - you have to enable that in cmake/cmake-gui. Should be the BUILD_DEV_PLUGINS option.
Also, should I send you pull requests every time I push to my fork, or only when I've completed a major feature?  I'm new to open-source coding, so I'm unsure of the etiquette involved.  I know better than to send obviously non-functional/broken code, but what other conditions apply?
Well, do what makes sense to you. Sending pull requests when your code is ready is good, because github will show all the changes and attach an equivalent of a forum thread to each line of code. It's good for reviewing stuff.
You can tell me in any other way as well (IRC, e-mail, etc.). As long as I know that the code is ready for merging, it's fine.


Any chance there's a mac version of this somewhere? I just drained all the floodwater out of my fort and this mud is driving me crazy...
I'm fairly certain there is no working mac version around. I might consider making one, if I get my hands on a *real* mac machine. I tried building a hackintosh, but ended up with something that crashes halfway through the installation. OSX can't handle my ghetto setup :)

Another possibility is a mac developer showing up and doing all the work instead.

Main problem is getting all the memory offsets right... let's just say the dudes who tried didn't last long enough to make the mac versions usable. So, you might find some code in the github repository, but it's been all obsoleted by now.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: PWRFLSTRGN on October 14, 2011, 02:01:00 pm
Thanks for the reply!  I'm seriously starting to doubt my PC grudge. I was duped by Justin long and my own hipster tendencies. My next box is going to do a lot more than look good haha.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: mithosaurion on October 14, 2011, 09:24:06 pm
ok... I am new to this and don't really know what I am doing.  But PLEASE help me.  How do I get dfhack to work? What application do I run?  all of the folders (in the windows version anyway) are xml files png images and the like, I can find no program to actually activate.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Yoink on October 14, 2011, 10:42:47 pm
I was just wondering the same thing, funnily enough. The OP needs a guide on how to actually use it...
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 14, 2011, 11:24:56 pm
pretty sure it at least says somewhere that you're supposed to copy it all to the DF folder and then run DF.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Yoink on October 14, 2011, 11:26:23 pm
Yeah but, I tried that and it sure didn't work for me. :(
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 14, 2011, 11:28:28 pm
if you did it right, you should have had to overwrite SDL.dll, and when you open DF, a console will open.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: mithosaurion on October 14, 2011, 11:29:12 pm
ok, after copying to the Dwarf fortress file and running the program... what then?  How do I actually use it while playing?  is there a key i have to press or something?  I do not want to be annoying but some step by step instructions or some pictures would be nice.
 
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 14, 2011, 11:32:01 pm
do you see a console that opens up with DF?

if so, type help
Title: Re: DFHack 0.31.25 r6 (current)
Post by: mithosaurion on October 14, 2011, 11:32:20 pm
no console
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 14, 2011, 11:33:32 pm
then you didn't copy it right.

do you see both SDL.DLL and SDLreal.dll in the same directory as dwarf fortress?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: mithosaurion on October 14, 2011, 11:35:45 pm
um... more than just that...

SDL.dll
SDL_image.dll
SDL_ttf.dll
SDLreal.dll
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 14, 2011, 11:36:58 pm
and is this the SDL version of DF, right? not the legacy one?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: mithosaurion on October 14, 2011, 11:39:40 pm
the legacy one?  you mean the old one?  I don't think so... how would I know? If they are what should i delete?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 14, 2011, 11:41:51 pm
when you download the game, there's an option for the sdl version and the legacy version.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: mithosaurion on October 14, 2011, 11:42:32 pm
wait, you mean which version of Dwarf Fortress?  I have df_31_25. I think it's the SDL version...
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Yoink on October 14, 2011, 11:52:47 pm
Oh sweet, it works! Thanks Japa! :D
Mithosaurion, you just need to copy EVERYTHING from the hack folder into the main folder of DF.
To tell if you have the SDL version of DF, well, look in the main folder and if you have a couple of .SDL files, you should be good, I think.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mithaldu on October 15, 2011, 09:58:00 pm
peterix, do you think there's any chance of compiling the connector library with gcc or connecting to DF without needing to compile that massive thing? I'm pondering how to hook this up with Perl, but all these close ties to C++ and MSVC have seemingly made that impossible.

Also, on the very very tiny chance that that might provide some pointers: Are the python bindings i saw traces of actually functional still?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 15, 2011, 10:00:56 pm
DFhack needs to be linked with DF, so it's impossible to get it away from MSVC.

There was, however, a C bindings project a while ago, but that isn't really alive.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mithaldu on October 15, 2011, 10:08:25 pm
DFhack needs to be linked with DF, so it's impossible to get it away from MSVC.

There was, however, a C bindings project a while ago, but that isn't really alive.

I don't think it matters what DF is compiled with, for this case. In the past i've easily mixed Perl XS libraries that were compiled with MSVC and MinGW in the same program. Especially if all the library that is compiled for third-party tools only reaches into DF via memory addressing from the xml file, what is compiled with what becomes irrelevant; otherwise my Lifevis back then wouldn't have worked at all. ;)

Edit: Honestly, my main problem is that VC10 Express doesn't even seem to come with a cc.exe
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 15, 2011, 10:17:05 pm
You're welcome to get it to work, then.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mithaldu on October 15, 2011, 10:33:01 pm
You're welcome to get it to work, then.
I think i'll rather wait for peterix' input, instead of letting myself be shooed away by someone who hates the idea of a realtime 3d interface; and judging by past posts here, makes a sport of being none too pleasant. ;)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 15, 2011, 11:41:36 pm
he doesn't hate the idea of it.

He's just not interested in making one himself.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mithaldu on October 15, 2011, 11:53:05 pm
Oh, that should be the least of your worries, i already did that once before, reading df's memory straight from perl with algorithms of my own design. Dfhack was only the seed of an idea back then, but now i'm hoping to make use of it to get a serious performance gain.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 16, 2011, 12:04:50 am
Well, peterix is currently working on a way to efficiently pass data between DFhack and other programs.

Your best bet would be to hang out in #dfhack on freenode.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mithaldu on October 16, 2011, 12:07:50 am
A-HA, now that is promising new. Thank you! Will be there as soon as i can again. :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 16, 2011, 01:06:04 am
peterix, do you think there's any chance of compiling the connector library with gcc or connecting to DF without needing to compile that massive thing? I'm pondering how to hook this up with Perl, but all these close ties to C++ and MSVC have seemingly made that impossible.

Also, on the very very tiny chance that that might provide some pointers: Are the python bindings i saw traces of actually functional still?
Well. I pretty much scrapped the idea of hacking into DF sideways from an another process. DFHack is loaded into DF and impersonates the SDL library. As long as you can pull data over some channel from one process to another, it's OK. I want to use google protobufs together with zmq to create a stable versioned API independent from all the black magic in DFHack. There's even code written by other people implementing something like this:
http://pastebin.com/hNPwfGSS
http://pastebin.com/Fdyvs9MU
http://pastebin.com/gvS81H8P

So, yeah. The library in DF isn't going away and pretty much *is* DFHack - it's the server part (or what will become the server part). In it, I have to use the same compiler, the same version of the STL and the same allocator for things to NOT blow up horribly. Stuff that will talk to it over some form of IPC obviously won't be limited in such a way. Actually, it might be possible to make your own protocol plugin and optimize what you send around or pre-process stuff on the DFHack side where you have full memory access.

The python stuff is currently dead - it was written for the previous design.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mithaldu on October 16, 2011, 01:19:16 am
I'm not even talking about the server stuff. That's perfectly fine and could be in Befunge for all it impacts me. I was talking about the kind of stuff that is loaded in by Overseer and the likes. :)

Also, yes, i know the bit about wanting to use a DF-loaded dll as a go-between. If i remember right you had that idea while we poked around with lifevis. ;)

Protobuf, not sure if i like how it looks like, kind of a slightly less verbose XML. My instinct says JSON would be nicer and likely faster, but i guess that would require real world benchmarking and i might be misunderstanding. ZeroMQ is interesting, though not very Windows-friendly. Would be an excuse to sit down and make it work with Perl.

Two questions: Why not have it open a network port? What's good enough for databases should work here too, no? :)
Also: Would an implementation of the DFhack server accepting input via the process' STDIN and sending back output via STDOUT/STDERR be hard for you to do? I think that would be one of the most simple things, where any wrapping process just starts DF and ties up the filehandles.

Thanks for the note on the python stuff, won't waste time looking then.

Another question though: Can you explain just how Overseer actually DOES talk to the dfhack server at the moment?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 16, 2011, 02:44:26 am
I'm not even talking about the server stuff. That's perfectly fine and could be in Befunge for all it impacts me. I was talking about the kind of stuff that is loaded in by Overseer and the likes. :)
They are still using the old dfhack.
Protobuf, not sure if i like how it looks like, kind of a slightly less verbose XML. My instinct says JSON would be nicer and likely faster, but i guess that would require real world benchmarking and i might be misunderstanding.
More like serialization of object data into binary messages. There should be no text involved unless it's a string. The message descriptions are translated into C/C++/Java/Python/Perl/whatever code with a compiler.
ZeroMQ is interesting, though not very Windows-friendly. Would be an excuse to sit down and make it work with Perl.

Two questions: Why not have it open a network port? What's good enough for databases should work here too, no? :)
zmq uses a network port and I won't have to deal with it manually... at least that's the idea.
Also: Would an implementation of the DFhack server accepting input via the process' STDIN and sending back output via STDOUT/STDERR be hard for you to do? I think that would be one of the most simple things, where any wrapping process just starts DF and ties up the filehandles.
That would completely break DFHack on linux and DF in TEXT mode. Creating named pipes or some such IPC stuffs is certainly possible, but STDIN/STDOUT are quite crowded already :) A nice thing about the current DFHack is the fact that you can extend it with plugins - all it needs is spawning a thread and handling events instead of just implementing single commands. DF could be running any number of servers.
Another question though: Can you explain just how Overseer actually DOES talk to the dfhack server at the moment?
It doesn't. It's still using the old DFHack lib. I rewrote pretty much everything since then and the way to talk to external apps is pretty much missing - I have some bits and pieces of code though.
See:
https://github.com/peterix/dfhack/branches

'master' branch is current - the SDL impersonating stuff
'legacy' is the last version of old dfhack. I'll keep it around and possibly even update the offset file if it's still compatible with the next DF version... it won't be getting any new features though.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Box on October 17, 2011, 01:55:45 pm
Having a bit of a rough time so far using your very nice mod, here.  It's saved my plenty of times already, but I'm having some issues with my embark I'm trying to resolve.

Prospect tells me I have about 1800 tiles of "candy" (that's the new spoiler-free term, I think?) but using reveal I can't spot nearly that much myself.  I would guess I have under 200, less than 150 being safe to extract.  So I tried using tiletypes to paint myself some using the "HFS" material to artificially extend the tubes of candy, but it doesn't seem to work.  Stuff like soil and obsidian works fine, but I can't get anything else to.

Am I doing something wrong or are my files messed up or is this just a semi-functional tool?  I saw the earlier posts regarding it, but not much on its actual functionality.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Quietust on October 17, 2011, 02:11:54 pm
The tiletypes tool has some rather annoying limitations, as I discovered yesterday - if the tile you are painting onto contains a "varying" tile (e.g. floor/river), then you cannot paint a non-varying tile (i.e. anything else) onto it unless it happens to contain the "main" variant of said tile (for floors, a normal apostrophe).
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mithaldu on October 17, 2011, 02:13:44 pm
They are still using the old dfhack.
Well dang, that explains a lot! Thanks for the link, even though in that case there's not much of a point in poking at it anymore.

More like serialization of object data into binary messages.
Alright, i misunderstood it then. Just hope unpacking it won't be too slow in pure perl. :)

zmq uses a network port and I won't have to deal with it manually... at least that's the idea.
That makes sense, no real point in making your own protocol if there's one already.


That would completely break DFHack on linux and DF in TEXT mode. Creating named pipes or some such IPC stuffs is certainly possible, but STDIN/STDOUT are quite crowded already :)
Aw. :(

Guess i'll have to learn how to use named pipes sometime then.

A nice thing about the current DFHack is the fact that you can extend it with plugins
I see how that's nice, but in all honesty, my C knowledge extends about as far as that it comes after B. :)

I think it'll be easier for me to keep poking at the Perl-ZeroMQ maintainers to see if i can help them make things work on windows.

Thanks again for the answers. It means i won't be able to start implementing right now, but it helped me find some other goals to work on.

Oh, one last thing: Any plans on when the zmq stuff might be done on your side? :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 17, 2011, 09:06:39 pm
Oh, one last thing: Any plans on when the zmq stuff might be done on your side? :)
Done... I don't know. It might never be really 'done', just like DF. I'd like to have something experimental and !!fun!! after the next weekend though.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rumrusher on October 17, 2011, 09:20:08 pm
speaking about !!fun!! I was checking out the updates to Dfusion and notice some new stuff I can't get direct access to through notepad(try to patch it my self but kinda broke on me) I was wondering if there going to be a DFhack r7?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Mithaldu on October 18, 2011, 02:23:03 am
Oh, one last thing: Any plans on when the zmq stuff might be done on your side? :)
Done... I don't know. It might never be really 'done', just like DF. I'd like to have something experimental and !!fun!! after the next weekend though.
That's a lot earlier than expected. :o

I might have to try and see what the hell happens if DF runs on one machine and the 3d monitor on another.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: tryrar on October 18, 2011, 06:50:54 pm
I have a small problem...I had used reveal to properly dig my magma pump stack, and decided to take a short break, so I saved and closed. Now Reveal is stuck on! What do I do?!
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rose on October 18, 2011, 07:02:59 pm
I recall there being an unreveal function.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: tryrar on October 18, 2011, 07:08:17 pm
ummm...I tried that already, it says nothing to unreveal
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 18, 2011, 07:16:12 pm
ummm...I tried that already, it says nothing to unreveal
Point the 'k' cursor at a floor that should be visible, run 'revflood'. You can use the same to hide stuff after re-walling.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: tryrar on October 18, 2011, 07:23:36 pm
worked thanx!
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Kogut on October 23, 2011, 03:40:27 am
God bless you (cleanmap!)!

But there is problem with flows - in windows version it claims that I have 999515 tiles of water and 0 of magma what is untrue.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Cave Man on October 23, 2011, 09:24:32 am
Is there a tool for cleaning equipment from mud, blood and vomit?
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 23, 2011, 11:40:30 am
Is there a tool for cleaning equipment from mud, blood and vomit?
There will be. Quietust wrote one, but it needs a few tweaks. I'm slowly working on a new release.

Also, the 'experimental IPC after this weekend' is a fail. Not enough time >_<
Title: Re: DFHack 0.31.25 r6 (current)
Post by: gsvslto on October 24, 2011, 11:36:52 am
I've written a new plugin for DFHack, called seedwatch, which is for fortress mode.

It can watch the quantities of seeds, and change whether the seeds and the plant grown from those seeds are allowed to be cooked.  In that way, you can cook seeds and plants without worrying that you will run out of seeds for planting (except when your dwarves eat the seeds raw - can't help with that!).

Thanks to Quietust for the information http://www.bay12forums.com/smf/index.php?topic=91166.msg2605147#msg2605147

I've got a GitHub for it https://github.com/gsvslto/dfhack/blob/master/plugins/seedwatch.cpp

Unfortunately, there are problems:


However, as a general point, the cookery exclusions list in DF does allow DFHack (main program, modules, and plugins) to store information in the save game files for a particular fortress.  This is because, apart from the kinds of entries which do mean that an item is excluded from cookery, the entries in the cookery exclusions list (that is, the five co-ordinated vectors, listed in Quietust's post) have no effect upon DF, and yet are nevertheless saved in the save game files.  Therefore, by ensuring that the format of the information does not clash with legitimate cookery exclusion entries, such information can be stored in the save game via the cookery exclusions list.  This feature may be useful for other plugins and DFHack itself, as long the information does not clash with that stored by other plugins, modules, etc.

This storage facility is used by seedwatch to store which seed types the user wants to have watched and the limits for them, so that this information is automatically loaded by seedwatch when the game is loaded, and stored there when it is saved.  Therefore the user does not have to issue commands to seedwatch for a particular fortress each time that fortress is loaded.

Hopefully seedwatch will be useful for some people, or at least the basis for something useful.  I've tried to helpfully comment the code, and to make the help information clear, which can be viewed using #seedwatch info, in the DFHack console.  Of course, if there are any questions or suggestions, I'll try my best.  I don't think it's quite ready to be pulled into the main DFHack code at the moment, mostly due to the failure with Linux.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Quietust on October 24, 2011, 12:43:39 pm
Very neat.

Once peterix adds the entire PLANT definition structure (I've mapped it out on Windows, but it hasn't yet been verified on Linux), you'll be able to query the BASIC_MAT and SEED_MAT of every plant in existence (rather than only the ones you actually have at the moment) and find the appropriate offset within the plant's material list.

The current method of getting the plant/seed materials is a bit hackish (in fact, the entire Items module is extremely hackish), but right now it's the only way - the ideal way would be to call the item's virtual methods (vtable[0] = item type, vtable[1] = item subtype, vtable[2] = material type, vtable[3] = material subtype), but some Trickery would be involved in getting them to use the proper calling convention.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Gizogin on October 24, 2011, 03:22:20 pm
Is there any news on a mac version of this?  It's really frustrating not having access to it.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 24, 2011, 04:21:11 pm
Is there any news on a mac version of this?  It's really frustrating not having access to it.
I don't have a mac.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 25, 2011, 02:07:29 pm
I've written a new plugin for DFHack, called seedwatch, which is for fortress mode.

It can watch the quantities of seeds, and change whether the seeds and the plant grown from those seeds are allowed to be cooked.  In that way, you can cook seeds and plants without worrying that you will run out of seeds for planting (except when your dwarves eat the seeds raw - can't help with that!).

Thanks to Quietust for the information http://www.bay12forums.com/smf/index.php?topic=91166.msg2605147#msg2605147

I've got a GitHub for it https://github.com/gsvslto/dfhack/blob/master/plugins/seedwatch.cpp
Awesome :)
Unfortunately, there are problems:

  • It doesn't work for Linux Dwarf Fortress.  This is due to ...
  • The access to the cookery exclusions structures in DF memory is a hardcoded memory hack, rather than through a DFHack module, as currently there is no such feature.  The kludge is at line 276 of seedwatch.cpp (in the t_kitchenExclusions::start method), and also at lines 107-144 (in the t_kitchenExclusions constructor).  I don't really know how to add the memory locations to memory.xml and use them in a module (either a currently existing one, or a new one).
Yes. That can be fixed. I'll look at it today.

However, as a general point, the cookery exclusions list in DF does allow DFHack (main program, modules, and plugins) to store information in the save game files for a particular fortress.  This is because, apart from the kinds of entries which do mean that an item is excluded from cookery, the entries in the cookery exclusions list (that is, the five co-ordinated vectors, listed in Quietust's post) have no effect upon DF, and yet are nevertheless saved in the save game files.  Therefore, by ensuring that the format of the information does not clash with legitimate cookery exclusion entries, such information can be stored in the save game via the cookery exclusions list.  This feature may be useful for other plugins and DFHack itself, as long the information does not clash with that stored by other plugins, modules, etc.

This storage facility is used by seedwatch to store which seed types the user wants to have watched and the limits for them, so that this information is automatically loaded by seedwatch when the game is loaded, and stored there when it is saved.  Therefore the user does not have to issue commands to seedwatch for a particular fortress each time that fortress is loaded.
Good idea, IMHO bad implementation. It could break for newer versions of DF, leading to a kind of cat and mouse game with dfhack hiding data in other places in the game saves. A better way to do it is adding a way to store data next to the save files in the world folder. I'll leave it in until I have a generic system for storing plugin data in place.

Hopefully seedwatch will be useful for some people, or at least the basis for something useful.  I've tried to helpfully comment the code, and to make the help information clear, which can be viewed using #seedwatch info, in the DFHack console.  Of course, if there are any questions or suggestions, I'll try my best.  I don't think it's quite ready to be pulled into the main DFHack code at the moment, mostly due to the failure with Linux.
Haven't read it in full, but it seems that it does quite a lot of stuff in plugin_onupdate. Only thing plugin_onupdate guarantees is that it will never run at the same time as the game simulation - it can run more multiple times between ticks, leading to wasted CPU time. That's fine for something like reveal disabling the pause key by forcing pause state, but not for something that scans all the existing items.  The idea here would be to check if the game time has changed since the last run and only update when it did. Not the most obvious thing... I guess I should document this somewhere :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: blake77 on October 27, 2011, 12:30:09 pm
1. Is it possible to make a tool that clears occupancy flags, or at least checks them. In my current fort there is one tile that I can't build a wall in because according to DF it is being blocked by an   object. I've already channeled out that tile but to effect.


2. I've noticed that using revflood tool, the walls of frozen lakes/oceans are not shown.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: rampaging-poet on October 27, 2011, 07:57:23 pm
I played with the occupancy flags a bit.  It hasn't been merged into DFHack proper yet, but there's a plugin called buildprobe in the developer plugins section of my fork.  If you can build it yourself, my fork is here (https://github.com/rampaging-poet/dfhack).  Use the setflag command to set the building flag to 0.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Rumrusher on October 27, 2011, 09:58:48 pm
I played with the occupancy flags a bit.  It hasn't been merged into DFHack proper yet, but there's a plugin called buildprobe in the developer plugins section of my fork.  If you can build it yourself, my fork is here (https://github.com/rampaging-poet/dfhack).  Use the setflag command to set the building flag to 0.
oh man if you can set the occupancy flags to 14 you can recreate "DFlair" though I kinda want to test out setting indoor lighting for forts in adventure mode.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Sutremaine on October 27, 2011, 10:00:16 pm
Is it possible to make a spot clean tool? I want to keep my filth-encrusted entrance hall but clean off some odd pools in the middle of complicated stockpiles.

(except when your dwarves eat the seeds raw - can't help with that!)
Not a problem, dwarves don't eat raw seeds. :)
Title: Re: DFHack 0.31.25 r6 (current)
Post by: peterix on October 28, 2011, 06:14:01 am
Is it possible to make a spot clean tool? I want to keep my filth-encrusted entrance hall but clean off some odd pools in the middle of complicated stockpiles.
Done.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: peterix on October 30, 2011, 05:11:29 pm
And done.

New release is here with some pretty awesome stuff. Definitely check the first post for news.

Enjoy :)
Title: Re: DFHack 0.31.25 r7 (current)
Post by: janglur on October 30, 2011, 06:34:03 pm
Am I missing something?  I downloaded r7 and there's no executeable in it anywhere!  WTF?  How am I supposed to use this?

[I verified I have the winversion]
Title: Re: DFHack 0.31.25 r7 (current)
Post by: peterix on October 30, 2011, 06:50:04 pm
Am I missing something?  I downloaded r7 and there's no executeable in it anywhere!  WTF?  How am I supposed to use this?
Nope, not missing anything. It's all there. Install by copying the contents of the archive into a DF folder. If you do it right, it should ask you if you want to overwrite SDL.dll. Only supported version right now is 0.31.25 SDL.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: Greiger on October 30, 2011, 08:43:00 pm
spotclean makes me a very happy person.  Thank you.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: peterix on October 30, 2011, 11:13:48 pm
spotclean makes me a very happy person.  Thank you.
I'm glad to hear that :)

I just uploaded a small Linux bugfix. If the DFHack console stops responding after using stonesense, get the updated release (r7a).
Title: Re: DFHack 0.31.25 r7 (current)
Post by: Rafal99 on October 31, 2011, 12:07:33 am
Could I request a tool that automatically marks all tree saplings and uncollected webs as high movement cost?
Should prevent them from being trampled so much.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: peterix on October 31, 2011, 05:20:32 am
Could I request a tool that automatically marks all tree saplings and uncollected webs as high movement cost?
Should prevent them from being trampled so much.
Hmm... yes. I see the how that could be useful :)
Title: Re: DFHack 0.31.25 r7 (current)
Post by: Hugo_The_Dwarf on October 31, 2011, 06:17:35 am
Could I request a tool that automatically marks all tree saplings and uncollected webs as high movement cost?
Should prevent them from being trampled so much.
Hmm... yes. I see the how that could be useful :)
Could it have a selection range for saplings and shrubs? like rectange painting? that way It doesn't have to be run everytime a new batch of them grow (because everywhere other then my tree farm is littered with no-no spots,making my dwarves treat the local area as a mine field). Also it wouldn't mess up my traffic zones so much (If this gets implimented)
Title: Re: DFHack 0.31.25 r7 (current)
Post by: Rumrusher on October 31, 2011, 07:31:35 am
well I learn if you rekill a zombie too many times the game will crash trying to unload that legend data.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: uggi on October 31, 2011, 10:09:17 am
Trying to get this running in Ubuntu 10.10 and vanilla DF 0.31.25. The DF window pops up and then disappears before the main menu shows up (unless I run it in TEXT mode). Doesn't create stderr.log. This is what I can see from the console:

~/df_linux$ ./dfhack
dfhack: hooking successful
Loading bindings from data/init/interface.txt
GPU does not support non-power-of-two textures, using 512x512 catalog.
Resetting textures
GPU does not support non-power-of-two textures, using 512x512 catalog.
Loading hack/Memory.xml ... OK
Unable to retrieve version information.
Couldn't retrieve version information.
./libs/Dwarf_Fortress: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZN6DFHack7ProcessD1Ev
Title: Re: DFHack 0.31.25 r7 (current)
Post by: peterix on October 31, 2011, 02:17:24 pm
Trying to get this running in Ubuntu 10.10 and vanilla DF 0.31.25. The DF window pops up and then disappears before the main menu shows up (unless I run it in TEXT mode). Doesn't create stderr.log. This is what I can see from the console:

~/df_linux$ ./dfhack
dfhack: hooking successful
Loading bindings from data/init/interface.txt
GPU does not support non-power-of-two textures, using 512x512 catalog.
Resetting textures
GPU does not support non-power-of-two textures, using 512x512 catalog.
Loading hack/Memory.xml ... OK
Unable to retrieve version information.
Couldn't retrieve version information.
./libs/Dwarf_Fortress: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZN6DFHack7ProcessD1Ev
That is quite strange. I have it working on a ubuntu 10.10 virtual machine. Now... what happens here is that your DF can't be identified. this is done by looking up /proc/$PID/exe (full path to DF executable) and comparing DF's md5 hash with a list of known DF versions. Some of that must have failed. I'll add more checks and output to the whole thing, because I simply can't determine what happened from the limited amount of information.

I have no idea why it reports _ZN6DFHack7ProcessD1Ev as undefined though. Maybe I'll run into that when I make it fail on purpose...
Title: Re: DFHack 0.31.25 r7 (current)
Post by: uggi on October 31, 2011, 02:54:25 pm
That is quite strange. I have it working on a ubuntu 10.10 virtual machine. Now... what happens here is that your DF can't be identified. this is done by looking up /proc/$PID/exe (full path to DF executable) and comparing DF's md5 hash with a list of known DF versions.

Ok, I tried running Dwarf Fortress, got its PID and tried this:

uggi@beaver:/proc/2226$ ls -l exe
lrwxrwxrwx 1 uggi uggi 0 2011-10-31 21:41 exe -> /home/uggi/df_linux/libs/Dwarf_Fortress
uggi@beaver:/proc/2226$ md5sum exe
fc15065c4d1977ca019c6dad220413d1  exe

And that hash is found in Memory.xml, it's the last one in the list.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: peterix on October 31, 2011, 04:24:13 pm
And that hash is found in Memory.xml, it's the last one in the list.
Ok. The missing symbol problem should be fixed. I added some text output when it fails. Check it out: http://dethware.org/dfhack-0.31.25-r7b-Linux.tar.gz
Title: Re: DFHack 0.31.25 r7 (current)
Post by: uggi on October 31, 2011, 04:30:21 pm
Ok. The missing symbol problem should be fixed. I added some text output when it fails. Check it out: http://dethware.org/dfhack-0.31.25-r7b-Linux.tar.gz

This is the output now:

uggi@beaver:~/df_linux$ ./dfhack
dfhack: hooking successful
Loading bindings from data/init/interface.txt
GPU does not support non-power-of-two textures, using 512x512 catalog.
Resetting textures
GPU does not support non-power-of-two textures, using 512x512 catalog.
Loading hack/Memory.xml ... OK
Unable to retrieve version information.
File: /home/uggi/df_linux/libs/Dwarf_Fortress
MD5: ba685425844d958f8395e8a9d887ad23
working dir: /home/uggi/df_linux
Not a known DF version. DFHack will now deactivate.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: sniken on October 31, 2011, 04:35:41 pm
I have problem which you where asked about in an earlier thread, the siege has not broken even though all invaders are dead.
unfortunatly i had all my caged gobbos and trolls decapitated in the arena in an attempt to break the siege so i can't test activating the invader flag on a tame goblin and release it.

i wonder if df hack in its current state has any means for messing with the siege flag in the game?

post i got tipped about my problem:
http://www.bay12forums.com/smf/index.php?topic=58809.msg2177281;topicseen#msg2177281
Title: Re: DFHack 0.31.25 r7 (current)
Post by: uggi on October 31, 2011, 04:37:20 pm
Just noticed that the MD5 hash it reports changes with every run.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: peterix on October 31, 2011, 05:11:35 pm
Just noticed that the MD5 hash it reports changes with every run.
Yes. This is something that definitely doesn't happen on my machines - real or virtual. And it's extremely weird. Do the previous releases have the same problem?

i wonder if df hack in its current state has any means for messing with the siege flag in the game?
It is quite hard to do that, because the 'siege' state is not controlled by a single flag AFAIK. A possible solution could be turning a random animal into an invader that belongs to the goblin civilization and letting it walk into a cage trap.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: sniken on October 31, 2011, 05:45:19 pm
ok, just tried giving a badger same civ id in runesmith as the goblins and made it an active invader. killed it but no result. gonna try again but this time put up a lot of cage traps for them.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: uggi on October 31, 2011, 05:55:46 pm
Yes. This is something that definitely doesn't happen on my machines - real or virtual. And it's extremely weird. Do the previous releases have the same problem?

Sorry, haven't tried them. I tried to compile DFHack myself, but it seems my GCC doesn't like nullptr.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: uggi on October 31, 2011, 06:53:07 pm
Ah, just found out from github that there's been more than one revisions for 0.31.25 :p Tried them all. r1 gives no error, just exits. r4 to r7 all give the same undefined symbol error. But r2 and r3 works for me, yay!
Title: Re: DFHack 0.31.25 r7 (current)
Post by: peterix on October 31, 2011, 08:20:25 pm
Sorry, haven't tried them. I tried to compile DFHack myself, but it seems my GCC doesn't like nullptr.
Your GCC is too old ~_~
Ah, just found out from github that there's been more than one revisions for 0.31.25 :p Tried them all. r1 gives no error, just exits. r4 to r7 all give the same undefined symbol error. But r2 and r3 works for me, yay!
I think I actually compiled r2 and r3 under some ubuntu version. Anyway, I'll have to find a better md5 implementation than the one I'm using.

OK. Here's a possibility: the algorithm is sound (it works). Therefore, the failures come from reading the file itself - calls to fread fail for some reason. Hopefully, it's signals delivered to DF interrupting the fread() calls and not something worse.

... yay for unhandled errors I though would never show up. I'll try to get a fixed release out tomorrow.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: rampaging-poet on October 31, 2011, 10:29:12 pm
Could I request a tool that automatically marks all tree saplings and uncollected webs as high movement cost?
Should prevent them from being trampled so much.
I can probably get that done tomorrow night.

Could it have a selection range for saplings and shrubs? like rectange painting? that way It doesn't have to be run everytime a new batch of them grow (because everywhere other then my tree farm is littered with no-no spots,making my dwarves treat the local area as a mine field). Also it wouldn't mess up my traffic zones so much (If this gets implimented)
I'll see if I can make an interactive version that allows selection.  I'll definitely add the ability to specify a range in tiles to all the traffic tools.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: Nice Save on November 01, 2011, 01:22:08 pm
Could I request a tool that automatically marks all tree saplings and uncollected webs as high movement cost?
Should prevent them from being trampled so much.
I can probably get that done tomorrow night.

An option to make this work for surface water would be really useful, to stop murky pools and rivers from thawing out from under dwarves as they walk over them.
Title: Re: DFHack 0.31.25 r7 (current)
Post by: Dienes on November 01, 2011, 04:28:45 pm
Super thanks for making/upgrading/maintaining this. Things like cleanowned, prospector, and vdig make df a lot more pleasant to play.
Title: Re: DFHack 0.31.25 r7c (current)
Post by: peterix on November 01, 2011, 07:29:01 pm
I just released r7c with some fixes. Fastdwarf should now work as intended on Windows.

@uggi: can you try this version? I added a few error checks to the part where it reads the DF file.
Title: Re: DFHack 0.31.25 r7c (current)
Post by: uggi on November 01, 2011, 08:14:08 pm
@uggi: can you try this version? I added a few error checks to the part where it reads the DF file.

Still the same problem. And the hash still changes. Could it be related to the PID somehow? That's the only thing that changes, after all. You sure it's not checking the hash of the path as a string, not the file itself?

Loading hack/Memory.xml ... OK
Unable to retrieve version information.
File: /proc/self/exe
MD5: cb32492f84d29e4da6f9b219af999e19
working dir: /home/uggi/df_linux
Not a known DF version. DFHack will now deactivate.
Title: Re: DFHack 0.31.25 r7c (current)
Post by: peterix on November 01, 2011, 11:30:22 pm
Still the same problem. And the hash still changes. Could it be related to the PID somehow? That's the only thing that changes, after all. You sure it's not checking the hash of the path as a string, not the file itself?
Well. I'm puzzled. I have a fully update 32bit ubuntu 10.10 virtual machine right here and I have no such problem. The algorithm works (you'd get some garbage or crashes instead if it didn't). The file is read properly and at no point does it run into read errors (md5 sum it outputs would be replaced with an error message).

This leads me to believe that your system is just plain weird. Could be some security thing. Could be a rootkit. I have no idea.

I'll add an output for file length and a 1KB hexdump from the start of the file to make sure it's actually the DF binary and not something like /dev/urandom.
Title: Re: DFHack 0.31.25 r7c (current)
Post by: uggi on November 02, 2011, 06:43:53 am
This leads me to believe that your system is just plain weird. Could be some security thing. Could be a rootkit. I have no idea.

Well, this is an old system, originally installed as 8.04LTS.

Anyway, I just finally managed to compile DFHack (7c from github) and it works!

Although I had to use a workaround (http://stackoverflow.com/questions/2419800/can-nullptr-be-emulated-in-gcc) for the missing nullptr and had to disable vdig plugin because of these errors:

plugins/vdig.cpp:176: error: expected primary-expression before ‘[’ token
plugins/vdig.cpp:176: error: expected primary-expression before ‘]’ token
plugins/vdig.cpp:176: error: expected primary-expression before ‘x’
plugins/vdig.cpp:176: error: expected primary-expression before ‘y’
plugins/vdig.cpp:176: error: expected primary-expression before ‘z’
plugins/vdig.cpp:176: error: expected unqualified-id before ‘bool’
plugins/vdig.cpp:176: error: unable to deduce ‘auto’ from ‘<expression error>’
plugins/vdig.cpp:176: error: expected ‘,’ or ‘;’ before ‘bool’
plugins/vdig.cpp:923: error: expected ‘}’ at end of input
Title: Re: DFHack 0.31.25 r7c (current)
Post by: twalberg on November 02, 2011, 06:52:48 am
Something between 0.31.25-r5-32-gd451c6 and 0.31.25-r7c seems to have broken cleanowned. Running "cleanowned scattered" no longer seems to notice discarded clothing/etc - just foodstuffs. Haven't had a chance to dig further into it - when I have some time I can try to bisect. It's entirely possible that my particular fort is broken too, so it might be worth validating on a different fort as well. This is on Linux build, if it turns out to be a system-dependent issue - only local mods I've made are replacing 'nullptr' with 'NULL' until I get a chance to upgrade my compiler. Other than that, it builds cleanly except for the usual pile of warning messages in the stonesense submod.

Edit: quick run through git bisect shows this:

$ git bisect bad
1f0e91c3d0769c4fb3a0a77858feb12f67355622 is the first bad commit
commit 1f0e91c3d0769c4fb3a0a77858feb12f67355622
Author: Petr Mrázek <peterix@gmail.com>
Date:   Wed Oct 26 23:12:20 2011 +0200

    Add enum for item types.

:040000 040000 ae2ec87b4e835f9d75205d9277e5f4c5e58d45a8 6cd48202c2a363cc9ad65cc210469399fa0b7fde M      library
:040000 040000 0e04133f0bfdadfca835e9b542de71b969a74a98 7838d730d791deaedef7691b6593adce653f24f1 M      plugins



Not sure exactly what in there caused it to break, but the preceeding commit:
       b545de7f4308ae55d7d92f5eea091902ee26b15c Items refactor. readItem turned into copyItem, most Items methods now accept plain df_item
seems to work fine.
Title: Re: DFHack 0.31.25 r7c (current)
Post by: peterix on November 02, 2011, 09:18:57 pm
Just released an another revision - r7d.
Something between 0.31.25-r5-32-gd451c6 and 0.31.25-r7c seems to have broken cleanowned. Running "cleanowned scattered" no longer seems to notice discarded clothing/etc - just foodstuffs.
This should now be fixed regardless of OS.

Well, this is an old system, originally installed as 8.04LTS.

Anyway, I just finally managed to compile DFHack (7c from github) and it works!
Awesome! Try the r7d binary release if you can. I added even more output when stuff fails and I'd like to see it. It's such a weird problem you ran into :)

If it keeps failing, I'll try using the md5 implementation from libcrypto.
Although I had to use a workaround (http://stackoverflow.com/questions/2419800/can-nullptr-be-emulated-in-gcc) for the missing nullptr and had to disable vdig plugin because of these errors:

plugins/vdig.cpp:176: error: expected primary-expression before ‘[’ token
plugins/vdig.cpp:176: error: expected primary-expression before ‘]’ token
plugins/vdig.cpp:176: error: expected primary-expression before ‘x’
plugins/vdig.cpp:176: error: expected primary-expression before ‘y’
plugins/vdig.cpp:176: error: expected primary-expression before ‘z’
plugins/vdig.cpp:176: error: expected unqualified-id before ‘bool’
plugins/vdig.cpp:176: error: unable to deduce ‘auto’ from ‘<expression error>’
plugins/vdig.cpp:176: error: expected ‘,’ or ‘;’ before ‘bool’
plugins/vdig.cpp:923: error: expected ‘}’ at end of input
Yeah... I started using some C++11 features - auto, lambdas (abusing them in vdig, really), nullptr and a few others.
Title: Re: DFHack 0.31.25 r7c (current)
Post by: Rumrusher on November 02, 2011, 10:19:36 pm
this is my current 'folders' in my Onfunction plugin.lua
shared for those wanting to see how to cram 60 functions to auto run in DF with out the confusing process of finding out that it can only go through one(that and Addcallback doesn't work).
So far this is my Corrosion folder for my modifications to Corrosion. The actual functions will be posted separately for they tend to break the character count.
Code: [Select]
function Dfolder()
DeathMsg()
Ghost() --doesn't work
makeghost() --doesn't work
end
function Mfolder()
raceconvert() --in corrosion turns set of humans into infected skin rotten lepers and make them hostile
--ControlCiv3()
derot() -- keeps food fresh for ever
Zombieressurect()  -- this takes any one who dies and turns them into a zombie, this will stack with the Race convert and make zombie infected humans
--zombiearmy()  -- move to traits
trait()   -- this checks the race of the adventurer and run series of functions suited for that creature.
makeghost() -- doesn't work
end
function Bfolder()
Burn()  --burns all items if someone flips the switch, I haven't tested this yet and
end
function Hfolder()
DeathMsg() --default folder template
end


--onfunction.SetCallback("Die",Dfolder)
onfunction.SetCallback("Move",Mfolder)
onfunction.SetCallback("Flip",Bfolder)

Warning - while you were typing a new reply has been posted. You may wish to review your post.

so should I pick up r7d? or continue with r7
Title: Re: DFHack 0.31.25 r7c (current)
Post by: peterix on November 02, 2011, 10:29:23 pm
so should I pick up r7d? or continue with r7
r7d is r7 with bugfixes - they are functionally the same. It shouldn't be any problem to update :)
Title: Re: DFHack 0.31.25 r7d (current)
Post by: rampaging-poet on November 03, 2011, 03:15:56 am
So I tried to make the two requested traffic plugins today, but something's broken on my end.  After creating a quick test function, I rebuilt dfhack, but it gave me an error message claiming the vector iterators were incompatible when I tried to run Dwarf Fortress.  My 30-day trial of Visual Studio 2010 just ran out and I had to actually register; could that be the problem?
Title: Re: DFHack 0.31.25 r7c (current)
Post by: uggi on November 03, 2011, 04:41:55 am
Awesome! Try the r7d binary release if you can. I added even more output when stuff fails and I'd like to see it. It's such a weird problem you ran into :)

I ran it a few times. The MD5 hash is still random, but the file length and hex dump are correct with every run, they match the libs/Dwarf_Fortress file.

Loading hack/Memory.xml ... OK
Unable to retrieve version information.
File: /proc/self/exe
MD5: 8e7a74e7735f8d4296171592f70cd1eb
working dir: /home/uggi/df_linux
length:12540712
1KB hexdump follows:
7f 45 4c 46  01 01 01 00  00 00 00 00  00 00 00 00
02 00 03 00  01 00 00 00  30 c9 04 08  34 00 00 00
c8 56 bf 00  00 00 00 00  34 00 20 00  08 00 28 00
1c 00 1b 00  06 00 00 00  34 00 00 00  34 80 04 08
34 80 04 08  00 01 00 00  00 01 00 00  05 00 00 00
04 00 00 00  03 00 00 00  34 01 00 00  34 81 04 08
34 81 04 08  13 00 00 00  13 00 00 00  04 00 00 00
01 00 00 00  01 00 00 00  00 00 00 00  00 80 04 08
00 80 04 08  00 49 bf 00  00 49 bf 00  05 00 00 00
00 10 00 00  01 00 00 00  00 49 bf 00  00 d9 c3 08
00 d9 c3 08  74 06 00 00  4c e2 a3 00  06 00 00 00
00 10 00 00  02 00 00 00  50 4a bf 00  50 da c3 08
50 da c3 08  00 01 00 00  00 01 00 00  06 00 00 00
04 00 00 00  04 00 00 00  48 01 00 00  48 81 04 08
48 81 04 08  20 00 00 00  20 00 00 00  04 00 00 00
04 00 00 00  50 e5 74 64  6c 18 b5 00  6c 98 b9 08
6c 98 b9 08  6c f1 00 00  6c f1 00 00  04 00 00 00
04 00 00 00  51 e5 74 64  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  06 00 00 00
04 00 00 00  2f 6c 69 62  2f 6c 64 2d  6c 69 6e 75
78 2e 73 6f  2e 32 00 00  04 00 00 00  10 00 00 00
01 00 00 00  47 4e 55 00  00 00 00 00  02 00 00 00
06 00 00 00  08 00 00 00  c5 00 00 00  fb 00 00 00
85 00 00 00  00 00 00 00  97 00 00 00  5b 00 00 00
df 00 00 00  00 00 00 00  dd 00 00 00  d4 00 00 00
31 00 00 00  c2 00 00 00  6d 00 00 00  79 00 00 00
11 00 00 00  21 00 00 00  6f 00 00 00  b3 00 00 00
90 00 00 00  e3 00 00 00  be 00 00 00  91 00 00 00
e2 00 00 00  00 00 00 00  57 00 00 00  d3 00 00 00
00 00 00 00  b9 00 00 00  00 00 00 00  00 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
8e 00 00 00  c4 00 00 00  00 00 00 00  59 00 00 00
ec 00 00 00  00 00 00 00  00 00 00 00  9b 00 00 00
00 00 00 00  f9 00 00 00  9a 00 00 00  bc 00 00 00
cc 00 00 00  00 00 00 00  c7 00 00 00  bf 00 00 00
80 00 00 00  f0 00 00 00  b7 00 00 00  a4 00 00 00
ba 00 00 00  93 00 00 00  ca 00 00 00  00 00 00 00
8d 00 00 00  e0 00 00 00  00 00 00 00  b8 00 00 00
c5 00 00 00  c8 00 00 00  00 00 00 00  7f 00 00 00
6c 00 00 00  00 00 00 00  52 00 00 00  12 00 00 00
05 00 00 00  e8 00 00 00  f1 00 00 00  f2 00 00 00
f7 00 00 00  a5 00 00 00  00 00 00 00  00 00 00 00
28 00 00 00  3b 00 00 00  0f 00 00 00  00 00 00 00
d9 00 00 00  65 00 00 00  ce 00 00 00  68 00 00 00
00 00 00 00  70 00 00 00  55 00 00 00  00 00 00 00
00 00 00 00  7a 00 00 00  d8 00 00 00  af 00 00 00
e9 00 00 00  00 00 00 00  9d 00 00 00  00 00 00 00
32 00 00 00  c9 00 00 00  10 00 00 00  00 00 00 00
00 00 00 00  de 00 00 00  f5 00 00 00  e5 00 00 00
b5 00 00 00  04 00 00 00  00 00 00 00  eb 00 00 00
00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00
d5 00 00 00  00 00 00 00  f3 00 00 00  00 00 00 00
8b 00 00 00  00 00 00 00  00 00 00 00  63 00 00 00
00 00 00 00  00 00 00 00  ea 00 00 00  c6 00 00 00
82 00 00 00  1a 00 00 00  44 00 00 00  c1 00 00 00
ee 00 00 00  00 00 00 00  f6 00 00 00  00 00 00 00
00 00 00 00  ab 00 00 00  00 00 00 00  a3 00 00 00
da 00 00 00  00 00 00 00  00 00 00 00  7b 00 00 00
d1 00 00 00  2a 00 00 00  d2 00 00 00  00 00 00 00
77 00 00 00  db 00 00 00  83 00 00 00  76 00 00 00
00 00 00 00  cb 00 00 00  00 00 00 00  81 00 00 00
bb 00 00 00  98 00 00 00  c3 00 00 00  95 00 00 00
88 00 00 00  ef 00 00 00  00 00 00 00  e1 00 00 00
aa 00 00 00  cd 00 00 00  0b 00 00 00  00 00 00 00
Not a known DF version. DFHack will now deactivate.
Title: Re: DFHack 0.31.25 r7d (current)
Post by: nf_xp on November 03, 2011, 05:06:10 am
hi peterix,

i enhanced the tiletypes plugin to make it able to change variant, hidden, light, subterranean and skyview. so it's possible to do something like changing var_2 floor to a wall (cannot do before)... and these flags, it almost can UNDO any of your earth works without restart the game.

if you like the idea, could you add this change to dfhack? i'd like to commit the code but i dont know how to use the github.

sorry, seems i don't have permission to add attachment. i just post the code here.
<tiletypes.cpp>
Code: [Select]
//
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <cstdlib>
#include <sstream>
using std::vector;
using std::string;
using std::endl;
using std::set;

#include <dfhack/Core.h>
#include <dfhack/Console.h>
#include <dfhack/Export.h>
#include <dfhack/PluginManager.h>
#include <dfhack/modules/Vegetation.h>
#include <dfhack/modules/Maps.h>
#include <dfhack/modules/Gui.h>
#include <dfhack/TileTypes.h>
#include <dfhack/extra/MapExtras.h>
using namespace MapExtras;
using namespace DFHack;

//zilpin: These two functions were giving me compile errors in VS2008, so I cheated with the C style loop below, just to get it to build.
//Original code is commented out.
void tolower(std::string &str)
{
    //The C++ way...
    //std::transform(str.begin(), str.end(), str.begin(), std::bind2nd(std::ptr_fun(&std::tolower<char> ), std::locale("")));

    //The C way...
    for(char *c=(char *)str.c_str(); *c; ++c)
    {
        *c = tolower(*c);
    }
}

void toupper(std::string &str)
{
    //std::transform(str.begin(), str.end(), str.begin(), std::bind2nd(std::ptr_fun(&std::toupper<char>), std::locale("")));
    for(char *c=(char *)str.c_str(); *c; ++c)
    {
        *c = toupper(*c);
    }
}

int toint(const std::string &str, int failValue = 0)
{
    std::istringstream ss(str);
    int valInt;
    ss >> valInt;
    if (ss.fail())
    {
        return failValue;
    }
    return valInt;
}

struct TileType
{
    DFHack::TileShape shape;
    DFHack::TileMaterial material;
    DFHack::TileSpecial special;
    DFHack::TileVariant variant;
    int hidden;
    int light;
    int subterranean;
    int skyview;

    TileType()
    {
        shape = DFHack::tileshape_invalid;
        material = DFHack::tilematerial_invalid;
        special = DFHack::tilespecial_invalid;
        variant = DFHack::tilevariant_invalid;
        hidden = -1;
        light = -1;
        subterranean = -1;
        skyview = -1;
    }

    bool empty()
    {
        return shape == -1 && material == -1 && special == -1 && variant == -1
            && hidden == -1 && light == -1 && subterranean == -1 && skyview == -1;
    }
};

std::ostream &operator<<(std::ostream &stream, const TileType &paint)
{
    bool used = false;
    bool needSpace = false;

    if (paint.special >= 0)
    {
        stream << DFHack::TileSpecialString[paint.special];
        used = true;
        needSpace = true;
    }

    if (paint.material >= 0)
    {
        if (needSpace)
        {
            stream << " ";
            needSpace = false;
        }

        stream << DFHack::TileMaterialString[paint.material];
        used = true;
        needSpace = true;
    }

    if (paint.shape >= 0)
    {
        if (needSpace)
        {
            stream << " ";
            needSpace = false;
        }

        stream << DFHack::TileShapeString[paint.shape];
        used = true;
        needSpace = true;
    }

    if (paint.variant >= 0)
    {
        if (needSpace)
        {
            stream << " ";
            needSpace = false;
        }

        stream << "VAR_" << (paint.variant + 1);
        used = true;
        needSpace = true;
    }

    if (paint.hidden >= 0)
    {
        if (needSpace)
        {
            stream << " ";
            needSpace = false;
        }

        stream << (paint.hidden ? "HIDDEN" : "VISIBLE");
        used = true;
        needSpace = true;
    }

    if (paint.light >= 0)
    {
        if (needSpace)
        {
            stream << " ";
            needSpace = false;
        }

        stream << (paint.light ? "LIGHT" : "DARK");
        used = true;
        needSpace = true;
    }

    if (paint.subterranean >= 0)
    {
        if (needSpace)
        {
            stream << " ";
            needSpace = false;
        }

        stream << (paint.subterranean ? "SUBTERRANEAN" : "ABOVE GROUND");
        used = true;
        needSpace = true;
    }

    if (paint.skyview >= 0)
    {
        if (needSpace)
        {
            stream << " ";
            needSpace = false;
        }

        stream << (paint.skyview ? "OUTSIDE" : "INSIDE");
        used = true;
        needSpace = true;
    }

    if (!used)
    {
        stream << "any";
    }

    return stream;
}

bool processTileType(TileType &paint, const std::string &option, const std::string &value)
{
    std::string val = value;
    toupper(val);
    int valInt;
    if (val == "ANY")
    {
        valInt = -1;
    }
    else
    {
        valInt = toint(value, -2);
    }
    bool found = false;

    if (option == "shape" || option == "sh" || option == "s")
    {
        if (valInt >= -1 && valInt < DFHack::tileshape_count)
        {
            paint.shape = (DFHack::TileShape) valInt;
            found = true;
        }
        else
        {
            for (int i = 0; i < DFHack::tileshape_count; i++)
            {
                if (val == DFHack::TileShapeString[i])
                {
                    paint.shape = (DFHack::TileShape) i;
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                std::cout << "Unknown tile shape: " << value << std::endl;
            }
        }
    }
    else if (option == "material" || option == "mat" || option == "m")
    {
        if (valInt >= -1 && valInt < DFHack::tilematerial_count)
        {
            paint.material = (DFHack::TileMaterial) valInt;
            found = true;
        }
        else
        {
            for (int i = 0; i < DFHack::tilematerial_count; i++)
            {
                if (val == DFHack::TileMaterialString[i])
                {
                    paint.material = (DFHack::TileMaterial) i;
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                std::cout << "Unknown tile material: " << value << std::endl;
            }
        }
    }
    else if (option == "special" || option == "sp")
    {
        if (valInt >= -1 && valInt < DFHack::tilespecial_count)
        {
            paint.special = (DFHack::TileSpecial) valInt;
            found = true;
        }
        else
        {
            for (int i = 0; i < DFHack::tilespecial_count; i++)
            {
                if (val == DFHack::TileSpecialString[i])
                {
                    paint.special = (DFHack::TileSpecial) i;
                    found = true;
                    break;
                }
            }

            if (!found)
            {
                std::cout << "Unknown tile special: " << value << std::endl;
            }
        }
    }
    else if (option == "variant" || option == "var" || option == "v")
    {
        if (valInt >= -1 && valInt <= DFHack::VAR_4)
        {
            paint.variant = (DFHack::TileVariant) valInt;
            found = true;
        }
        else
        {
            std::cout << "Unknown tile variant: " << value << std::endl;
        }
    }
    else if (option == "hidden" || option == "h")
    {
        if (valInt >= -1 && valInt < 2)
        {
            paint.hidden = valInt;
            found = true;
        }
        else
        {
            std::cout << "Unknown hidden flag: " << value << std::endl;
        }
    }
    else if (option == "light" || option == "l")
    {
        if (valInt >= -1 && valInt < 2)
        {
            paint.light = valInt;
            found = true;
        }
        else
        {
            std::cout << "Unknown light flag: " << value << std::endl;
        }
    }
    else if (option == "subterranean" || option == "st")
    {
        if (valInt >= -1 && valInt < 2)
        {
            paint.subterranean = valInt;
            found = true;
        }
        else
        {
            std::cout << "Unknown subterranean flag: " << value << std::endl;
        }
    }
    else if (option == "skyview" || option == "sv")
    {
        if (valInt >= -1 && valInt < 2)
        {
            paint.skyview = valInt;
            found = true;
        }
        else
        {
            std::cout << "Unknown skyview flag: " << value << std::endl;
        }
    }
    else
    {
        std::cout << "Unknown option: '" << option << "'" << std::endl;
    }

    return found;
}

void help( std::ostream & out, const std::string &option)
{
    if (option.empty())
    {
        out << "Commands:" << std::endl
            << " quit / q              : quit" << std::endl
            << " filter / f [options]  : change filter options" << std::endl
            << " paint / p [options]   : change paint options" << std::endl
            << " point / p             : set point brush" << std::endl
            << " range / r             : set range brush" << std::endl
            << " block                 : set block brush" << std::endl
            << " column                : set column brush" << std::endl
            << std::endl
            << "Filter/paint options:" << std::endl
            << " Shape / sh / s: set tile shape information" << std::endl
            << " Material / mat / m: set tile material information" << std::endl
            << " Special / sp: set special tile information" << std::endl
            << " Variant / var / v: set variant tile information" << std::endl
            << " Hidden / h: set hidden flag" << std::endl
            << " Light / l: set light flag" << std::endl
            << " Subterranean / st: set subterranean flag" << std::endl
            << " Skyview / sv: set skyview flag" << std::endl
            << "See help [option] for more information" << std::endl;
    }
    else if (option == "shape" || option == "s" ||option == "sh")
    {
        out << "Available shapes:" << std::endl
            << " ANY" << std::endl;
        for (int i = 0; i < DFHack::tileshape_count; i++)
        {
            out << " " << DFHack::TileShapeString[i] << std::endl;
        }
    }
    else if (option == "material"|| option == "mat" ||option == "m")
    {
        out << "Available materials:" << std::endl
            << " ANY" << std::endl;
        for (int i = 0; i < DFHack::tilematerial_count; i++)
        {
            out << " " << DFHack::TileMaterialString[i] << std::endl;
        }
    }
    else if (option == "special" || option == "sp")
    {
        out << "Available specials:" << std::endl
            << " ANY" << std::endl;
        for (int i = 0; i < DFHack::tilespecial_count; i++)
        {
            out << " " << DFHack::TileSpecialString[i] << std::endl;
        }
    }
    else if (option == "variant" || option == "var" || option == "v")
    {
        out << "Available variants:" << std::endl
            << " ANY, 0 - " << DFHack::VAR_4 << std::endl;
    }
    else if (option == "hidden" || option == "h")
    {
        out << "Available hidden flags:" << std::endl
            << " ANY, 0, 1" << std::endl;
    }
    else if (option == "light" || option == "l")
    {
        out << "Available light flags:" << std::endl
            << " ANY, 0, 1" << std::endl;
    }
    else if (option == "subterranean" || option == "st")
    {
        out << "Available subterranean flags:" << std::endl
            << " ANY, 0, 1" << std::endl;
    }
    else if (option == "skyview" || option == "sv")
    {
        out << "Available skyview flags:" << std::endl
            << " ANY, 0, 1" << std::endl;
    }
}

typedef std::vector<DFHack::DFCoord> coord_vec;

class Brush
{
public:
    virtual ~Brush() {};
    virtual coord_vec points(MapExtras::MapCache &mc, DFHack::DFCoord start) = 0;
};
/**
 * generic 3D rectangle brush. you can specify the dimensions of
 * the rectangle and optionally which tile is its 'center'
 */
class RectangleBrush : public Brush
{
    int x_, y_, z_;
    int cx_, cy_, cz_;

public:
    RectangleBrush(int x, int y, int z = 1, int centerx = -1, int centery = -1, int centerz = -1)
    {
        if (centerx == -1)
        {
            cx_ = x/2;
        }
        else
        {
            cx_ = centerx;
        }

        if (centery == -1)
        {
            cy_ = y/2;
        }
        else
        {
            cy_ = centery;
        }

        if (centerz == -1)
        {
            cz_ = z/2;
        }
        else
        {
            cz_ = centerz;
        }

        x_ = x;
        y_ = y;
        z_ = z;
    };

    coord_vec points(MapExtras::MapCache &mc, DFHack::DFCoord start)
    {
        coord_vec v;
        DFHack::DFCoord iterstart(start.x - cx_, start.y - cy_, start.z - cz_);
        DFHack::DFCoord iter = iterstart;
        for (int xi = 0; xi < x_; xi++)
        {
            for (int yi = 0; yi < y_; yi++)
            {
                for (int zi = 0; zi < z_; zi++)
                {
                    if(mc.testCoord(iter))
                        v.push_back(iter);

                    iter.z++;
                }

                iter.z = iterstart.z;
                iter.y++;
            }

            iter.y = iterstart.y;
            iter.x ++;
        }

        return v;
    };

    ~RectangleBrush(){};
};

/**
 * stupid block brush, legacy. use when you want to apply something to a whole DF map block.
 */
class BlockBrush : public Brush
{
public:
    BlockBrush() {};
    ~BlockBrush() {};

    coord_vec points(MapExtras::MapCache &mc, DFHack::DFCoord start)
    {
        coord_vec v;
        DFHack::DFCoord blockc = start % 16;
        DFHack::DFCoord iterc = blockc * 16;
        if (!mc.testCoord(start))
            return v;

        for (int xi = 0; xi < 16; xi++)
        {
            for (int yi = 0; yi < 16; yi++)
            {
                v.push_back(iterc);
                iterc.y++;
            }
            iterc.x++;
        }

        return v;
    };
};

/**
 * Column from a position through open space tiles
 * example: create a column of magma
 */
class ColumnBrush : public Brush
{
public:
    ColumnBrush(){};

    ~ColumnBrush(){};

    coord_vec points(MapExtras::MapCache &mc, DFHack::DFCoord start)
    {
        coord_vec v;
        bool juststarted = true;
        while (mc.testCoord(start))
        {
            uint16_t tt = mc.tiletypeAt(start);
            if(DFHack::LowPassable(tt) || juststarted && DFHack::HighPassable(tt))
            {
                v.push_back(start);
                juststarted = false;
                start.z++;
            }
            else break;
        }
        return v;
    };
};

CommandHistory tiletypes_hist;

DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameters);

DFhackCExport const char * plugin_name ( void )
{
    return "tiletypes";
}

DFhackCExport command_result plugin_init ( Core * c, std::vector <PluginCommand> &commands)
{
    tiletypes_hist.load("tiletypes.history");
    commands.clear();
    commands.push_back(PluginCommand("tiletypes", "Paint map tiles freely, similar to liquids.", df_tiletypes, true));
    return CR_OK;
}

DFhackCExport command_result plugin_shutdown ( Core * c )
{
    tiletypes_hist.save("tiletypes.history");
    return CR_OK;
}

DFhackCExport command_result df_tiletypes (Core * c, vector <string> & parameters)
{
    uint32_t x_max = 0, y_max = 0, z_max = 0;
    int32_t x = 0, y = 0, z = 0;

    DFHack::Maps *maps;
    DFHack::Gui *gui;
    for(int i = 0; i < parameters.size();i++)
    {
        if(parameters[i] == "help" || parameters[i] == "?")
        {
            c->con.print("This tool allows painting tiles types with a brush, using an optional filter.\n"
                         "The tool is interactive, similarly to the liquids tool.\n"
                         "Further help is available inside.\n"
            );
            return CR_OK;
        }
    }

    TileType filter, paint;
    Brush *brush = new RectangleBrush(1,1);
    bool end = false;
    std::string brushname = "point";
    int width = 1, height = 1, z_levels = 1;
    c->con << "Welcome to the tiletype tool.\nType 'help' or '?' for a list of available commands, 'q' to quit.\nPress return after a command to confirm." << std::endl;
    c->con.printerr("THIS TOOL CAN BE DANGEROUS. YOU'VE BEEN WARNED.\n");
    while (!end)
    {
        c->con << "Filter: " << filter    << std::endl
               << "Paint: "  << paint     << std::endl
               << "Brush: "  << brushname << std::endl;

        std::string input = "";
        std::string command = "";
        std::string option = "";
        std::string value = "";

        c->con.lineedit("tiletypes> ",input,tiletypes_hist);
        tiletypes_hist.add(input);
        std::istringstream ss(input);
        ss >> command >> option >> value;
        tolower(command);
        tolower(option);

        if (command == "help" || command == "?")
        {
            help(c->con,option);
        }
        else if (command == "quit" || command == "q")
        {
            end = true;
        }
        else if (command == "filter" || command == "f")
        {
            processTileType(filter, option, value);
        }
        else if (command == "paint" || (command == "p" && !option.empty()))
        {
            processTileType(paint, option, value);
        }
        else if (command == "point" || command == "p")
        {
            delete brush;
            brushname = "point";
            brush = new RectangleBrush(1,1);
        }
        else if (command == "range" || command == "r")
        {
            std::stringstream ss;
            CommandHistory hist;
            ss << "Set range width <" << width << "> ";
            c->con.lineedit(ss.str(),command,hist);
            width = command == "" ? width : toint(command);
            if (width < 1) width = 1;

            ss.str("");
            ss << "Set range height <" << height << "> ";
            c->con.lineedit(ss.str(),command,hist);
            height = command == "" ? height : toint(command);
            if (height < 1) height = 1;

            ss.str("");
            ss << "Set range z-levels <" << z_levels << "> ";
            c->con.lineedit(ss.str(),command,hist);
            z_levels = command == "" ? z_levels : toint(command);
            if (z_levels < 1) z_levels = 1;

            delete brush;
            if (width == 1 && height == 1 && z_levels == 1)
            {
                brushname = "point";
            }
            else
            {
                brushname = "range";
            }
            brush = new RectangleBrush(width, height, z_levels, 0, 0, 0);
        }
        else if (command == "block")
        {
            delete brush;
            brushname = "block";
            brush = new BlockBrush();
        }
        else if (command == "column")
        {
            delete brush;
            brushname = "column";
            brush = new ColumnBrush();
        }
        else if (command.empty())
        {
            if (paint.empty())
            {
                c->con.printerr("Set the paint first.\n");
                continue;
            }

            c->Suspend();
            maps = c->getMaps();
            gui = c->getGui();
            if (!maps->Start())
            {
                c->con.printerr("Cannot get map info!\n");
                c->Resume();
                return CR_FAILURE;
            }
            maps->getSize(x_max, y_max, z_max);

            if (!(gui->Start() && gui->getCursorCoords(x,y,z)))
            {
                c->con.printerr("Can't get cursor coords! Make sure you have a cursor active in DF.\n");
                c->Resume();
                return CR_FAILURE;
            }
            c->con.print("Cursor coords: (%d, %d, %d)\n",x,y,z);

            DFHack::DFCoord cursor(x,y,z);
            MapExtras::MapCache map(maps);
            coord_vec all_tiles = brush->points(map, cursor);
            c->con.print("working...\n");

            for (coord_vec::iterator iter = all_tiles.begin(); iter != all_tiles.end(); ++iter)
            {
                const DFHack::TileRow *source = DFHack::getTileRow(map.tiletypeAt(*iter));

                if ((filter.shape > -1 && filter.shape != source->shape)
                 || (filter.material > -1 && filter.material != source->material)
                 || (filter.special > -1 && filter.special != source->special))
                {
                    continue;
                }

                DFHack::TileShape shape = paint.shape;
                if (shape < 0)
                {
                    shape = source->shape;
                }

                DFHack::TileMaterial material = paint.material;
                if (material < 0)
                {
                    material = source->material;
                }

                DFHack::TileSpecial special = paint.special;
                if (special < 0)
                {
                    special = source->special;
                }

                DFHack::TileVariant variant = paint.variant;
                if (variant < 0)
                {
                    variant = source->variant;
                }

                // Remove direction from directionless tiles
                DFHack::TileDirection direction = source->direction;
                if (!(shape == DFHack::RIVER_BED || shape == DFHack::BROOK_BED || shape == DFHack::WALL && (material == DFHack::CONSTRUCTED || special == DFHack::TILE_SMOOTH))) {
                    direction.whole = 0;
                }

                int32_t type = DFHack::findTileType(shape, material, variant, special, direction);
                // hack for empty space
                if (shape == DFHack::EMPTY && material == DFHack::AIR && variant == DFHack::VAR_1 && special == DFHack::TILE_NORMAL && direction.whole == 0) {
                    type = 32;
                }
                // make sure it's not invalid
                if(type != -1)
                    map.setTiletypeAt(*iter, type);

                DFHack::t_designation des = map.designationAt(*iter);

                if (paint.hidden > -1)
                {
                    des.bits.hidden = paint.hidden;
                }

                if (paint.light > -1)
                {
                    des.bits.light = paint.light;
                }

                if (paint.subterranean > -1)
                {
                    des.bits.subterranean = paint.subterranean;
                }

                if (paint.skyview > -1)
                {
                    des.bits.skyview = paint.skyview;
                }

                // Remove liquid from walls, etc
                if (type != -1 && !DFHack::FlowPassable(type))
                {
                    des.bits.flow_size = 0;
                    //des.bits.liquid_type = DFHack::liquid_water;
                    //des.bits.water_table = 0;
                    des.bits.flow_forbid = 0;
                    //des.bits.liquid_static = 0;
                    //des.bits.water_stagnant = 0;
                    //des.bits.water_salt = 0;
                }

                map.setDesignationAt(*iter, des);
            }

            if (map.WriteAll())
            {
                c->con.print("OK\n");
            }
            else
            {
                c->con.printerr("Something failed horribly! RUN!\n");
            }
            maps->Finish();
            c->Resume();
        }
    }
    return CR_OK;
}
Title: Re: DFHack 0.31.25 r7d (current)
Post by: Makbeth on November 03, 2011, 01:19:44 pm
Peterix, I have a feasibility question.

I've been wanting a way to absolutely forbid dwarves from passing through certain tiles, as if that tile were a wall, even if there's no other passage open to them, for a while now.  Is there a way to modify the passable state for a tile using DFhack, and can a burrow with a specific name like "forbidden" be used to tell DFhack which tiles to restrict?  I think an advantage of using burrows for this would be that burrows don't care if a tile is solid, hidden, or whatever, it still includes it.  So, prior to digging a magma channel, you could add the volume of the channel to the forbidden burrow, and the dwarves would stay out of it instead of using it as a walkway while it fills with magma.

Do you think this is possible?
Title: Re: DFHack 0.31.25 r7d (current)
Post by: Rose on November 03, 2011, 01:21:15 pm
I think it might be possible, maybe, by using the liquid passability flags.
Title: Re: DFHack 0.31.25 r7d (current)
Post by: Rumrusher on November 03, 2011, 01:59:18 pm
wonder if someone found away to make DF accept underwater building/and pathing for those who want merman forts
Title: Re: DFHack 0.31.25 r7d (current)
Post by: Andux on November 03, 2011, 04:00:44 pm
I think it might be possible, maybe, by using the liquid passability flags.

I've had some success doing that using the "dangerous terrain" flag (under designations, called flow_forbid in DFHack, danger_zone in my Pascal stuff, or has_liquid in Tweak); as far as I've seen, dwarves will not path through it except to escape from another dangerous tile.
Title: Re: DFHack 0.31.25 r7d (current)
Post by: T-manSim on November 03, 2011, 06:08:03 pm
I'm crashing when I try to run r7d. I'm on Windows 7, using the Lazy Newb Pack. Am I the only one? It loads, but then almost instantly crashes.
Title: Re: DFHack 0.31.25 r7d (current)
Post by: peterix on November 03, 2011, 06:29:03 pm
Peterix, I have a feasibility question.

I've been wanting a way to absolutely forbid dwarves from passing through certain tiles, as if that tile were a wall, even if there's no other passage open to them, for a while now.  Is there a way to modify the passable state for a tile using DFhack, and can a burrow with a specific name like "forbidden" be used to tell DFhack which tiles to restrict?  I think an advantage of using burrows for this would be that burrows don't care if a tile is solid, hidden, or whatever, it still includes it.  So, prior to digging a magma channel, you could add the volume of the channel to the forbidden burrow, and the dwarves would stay out of it instead of using it as a walkway while it fills with magma.

Do you think this is possible?
There are some obstacles involved: burrows aren't figured out yet and the pathing stuff isn't either... The 'flow_forbid' flag mentioned is probably something like 'stable_liquid' instead - blocking your dwarfs, but also everything that doesn't like going into water.

Certainly feasible, but could be abused as a cheat, so it's not exactly the thing you want, but something more generic.

I'm crashing when I try to run r7d. I'm on Windows 7, using the Lazy Newb Pack. Am I the only one? It loads, but then almost instantly crashes.
Well, you're the first reporting the problem :)

DF version 0.31.25?
Title: Re: DFHack 0.31.25 r7d (current)
Post by: T-manSim on November 03, 2011, 06:30:41 pm
I'm crashing when I try to run r7d. I'm on Windows 7, using the Lazy Newb Pack. Am I the only one? It loads, but then almost instantly crashes.
Well, you're the first reporting the problem :)

DF version 0.31.25?
Yes, is there a way to get a log or something?
Title: Re: DFHack 0.31.25 r7d (current)
Post by: peterix on November 03, 2011, 06:35:05 pm
I'm crashing when I try to run r7d. I'm on Windows 7, using the Lazy Newb Pack. Am I the only one? It loads, but then almost instantly crashes.
Well, you're the first reporting the problem :)

DF version 0.31.25?
Yes, is there a way to get a log or something?
Sort of. Look for stderr.log in your DF folder. Hopefully it's not empty ~_~
Title: Re: DFHack 0.31.25 r7d (current)
Post by: T-manSim on November 03, 2011, 06:50:26 pm
Quote
Sort of. Look for stderr.log in your DF folder. Hopefully it's not empty ~_~
Nope, can't find it. Nor can Windows search.  :(
Title: Re: DFHack 0.31.25 r7d (current)
Post by: peterix on November 03, 2011, 07:05:35 pm
Quote
Sort of. Look for stderr.log in your DF folder. Hopefully it's not empty ~_~
Nope, can't find it. Nor can Windows search.  :(
Ouch. looks like it doesn't even create one on Windows. I must have removed that by accident... gimme a few minutes and I should have a build where this works.

Ok. Here: http://dethware.org/dl/dfhack-0.31.25-r7e-dev1-Windows.zip

Output is fairly minimal when everything works properly.
Title: Re: DFHack 0.31.25 r6 (current)
Post by: Sutremaine on November 03, 2011, 08:46:17 pm
Is it possible to make a spot clean tool? I want to keep my filth-encrusted entrance hall but clean off some odd pools in the middle of complicated stockpiles.
Done.
Wow, that was quick. Thanks!
Title: Re: DFHack 0.31.25 r7d (current)
Post by: Madventurer on November 05, 2011, 09:38:51 am
Uh, I am using Windows but I can't seem to be able to run it...
As I can't see a program to do that.
Title: Re: DFHack 0.31.25 r7d (current)
Post by: danaris on November 05, 2011, 09:41:12 am
Uh, I am using Windows but I can't seem to be able to run it...
As I can't see a program to do that.

There is no separate program. If you install it properly, it runs as part of DF.
Title: Re: DFHack 0.31.25 r7d (current)
Post by: Madventurer on November 05, 2011, 09:44:12 am
Last time I used this it was WAY different...
Well thanks anyways........


Damn weird....
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 06, 2011, 12:32:52 am
Ok, new release, again!

Among the cool new things is the minecraft world converter. It's a bit rough around the edges, sometimes crashes and takes forever to finish. But it's there :) Make sure you backup your fort before you run it.

Other than that, there's a bunch of various improvements (see first post).

Damn weird....
It's just better this way. No problems with manipulating DF through a middle-man. Windows is a decent middle-man, don't get me wrong, but direct memory access is just better.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on November 06, 2011, 02:35:36 am
hmm so r8 for those who paid for Minecraft right?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: janglur on November 06, 2011, 02:50:28 am
Hmm, seems the site's down.  Getting this error:

Error 202 (net::ERR_CERT_AUTHORITY_INVALID): Unknown error.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on November 06, 2011, 03:29:49 am
hmm so r8 for those who paid for Minecraft right?

pretty much.

free minecraft doesn't let you load and save levels.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: uggi on November 06, 2011, 08:51:07 am
Ok, new release, again!

Good news: DFHack now detects my Linux DF, so the MD5 problem seems to be fixed.
Bad news: Half of the plugins crashes the game instantly. Tried with multiple old saves and also with a new world. Stderr.log shows nothing special.

Broken: vdig, vdigx, expdig, digcircle, probe, prospect, grow, immolate, extirpate, stonesense, tiletypes, revflood, df2minecraft, filltraffic, tiletraffic, liquids

Working: deramp, tubefill, fastdwarf, cprobe, clean, spotclean, cleanowned, flows, seedwatch, getplants, reveal, unreveal, revtoggle, nopause, weather, mode, drybuckets, colonies

Liquids and tiletypes plugins do work until I actually try to place a tile. Stonesense crashes with "Illegal instruction" error.

When seedwatch is turned on, keyboard repeat rate turns totally off, which is really annoying.

Haven't actually tried all of the plugins with earlier versions, but I know that at least vdig, vdigx, expdig, digcircle, probe, prospect and liquids have worked before.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 06, 2011, 10:19:16 am
Ok, new release, again!
Liquids and tiletypes plugins do work until I actually try to place a tile. Stonesense crashes with "Illegal instruction" error.
What kind of CPU do you have?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: uggi on November 06, 2011, 10:29:33 am
What kind of CPU do you have?

AMD Athlon XP 3000+. Yes, it's old.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 06, 2011, 10:47:26 am
What kind of CPU do you have?

AMD Athlon XP 3000+. Yes, it's old.
I guess we finally tracked down the problem. I checked what flags does my build system pass to gcc, and among them are these:
Code: [Select]
'-m32 -march=x86_64'This is a problem, because it enables the use of various instructions you CPU doesn't have... and it crashes horribly when it runs into them.

So. I'll track down where this comes from and make a new linux build for older CPUs.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: arclance on November 06, 2011, 01:20:58 pm
Among the cool new things is the minecraft world converter. It's a bit rough around the edges, sometimes crashes and takes forever to finish. But it's there :) Make sure you backup your fort before you run it.
It ran fine and made a world but it hilariously killed most of the grass (in chunks) as it did so.
Before
Spoiler (click to show/hide)
After
Spoiler (click to show/hide)
I will try and test if the generated world works in the next few days when I have access to a paid version of minecraft.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Greiger on November 06, 2011, 02:01:49 pm
Posting to confirm that DF2MC seems to work fine on the MC end.  Just takes a little bit to do it's converting when first loaded.


I didn't get the grass dying issue reported though.  Maybe something is off with only certain versions?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 06, 2011, 03:44:30 pm
It ran fine and made a world but it hilariously killed most of the grass (in chunks) as it did so.

That's ... weird. Really weird.
AMD Athlon XP 3000+. Yes, it's old.
I updated the Linux build (revision 8a now). It's now built for i686 CPUs and should work fine.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: uggi on November 06, 2011, 04:28:32 pm
I updated the Linux build (revision 8a now). It's now built for i686 CPUs and should work fine.

Nice! Tested all the plugins, only a few problems left. Digcircle and stonesense crashes with illegal instruction. Df2minecraft says "Loading Minecraft Materials..." and then crashes.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 06, 2011, 05:08:04 pm
I updated the Linux build (revision 8a now). It's now built for i686 CPUs and should work fine.

Nice! Tested all the plugins, only a few problems left. Digcircle and stonesense crashes with illegal instruction. Df2minecraft says "Loading Minecraft Materials..." and then crashes.
More weirdness...

Ok. Take this piece of code and save it as test.cpp:
Code: [Select]
#include <stdio.h>
int main ()
{
printf("Hello world!\n");
return 0;
}
Then run 'g++ --save-temps -fverbose-asm test.cpp'. This will produce a bunch of files. Post 'test.s'.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: uggi on November 07, 2011, 01:09:33 am
Then run 'g++ --save-temps -fverbose-asm test.cpp'. This will produce a bunch of files. Post 'test.s'.

Here you go:

Code: [Select]
.file "test.cpp"
# GNU C++ (Ubuntu/Linaro 4.4.4-14ubuntu5) version 4.4.5 (i686-linux-gnu)
# compiled by GNU C version 4.4.5, GMP version 4.3.2, MPFR version 3.0.0-p3.
# GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128212
# options passed:  -fpreprocessed test.ii -mtune=generic -march=i686
# -fverbose-asm -fstack-protector
# options enabled:  -falign-loops -fargument-alias -fauto-inc-dec
# -fbranch-count-reg -fcommon -fdwarf2-cfi-asm -fearly-inlining
# -feliminate-unused-debug-types -fexceptions -ffunction-cse -fgcse-lm
# -fident -finline-functions-called-once -fira-share-save-slots
# -fira-share-spill-slots -fivopts -fkeep-static-consts
# -fleading-underscore -fmath-errno -fmerge-debug-strings
# -fmove-loop-invariants -fpcc-struct-return -fpeephole -fsched-interblock
# -fsched-spec -fsched-stalled-insns-dep -fsigned-zeros
# -fsplit-ivs-in-unroller -fstack-protector -ftrapping-math -ftree-cselim
# -ftree-loop-im -ftree-loop-ivcanon -ftree-loop-optimize
# -ftree-parallelize-loops= -ftree-reassoc -ftree-scev-cprop
# -ftree-vect-loop-version -funit-at-a-time -fvect-cost-model -fverbose-asm
# -fzero-initialized-in-bss -m32 -m80387 -m96bit-long-double
# -maccumulate-outgoing-args -malign-stringops -mfancy-math-387
# -mfp-ret-in-387 -mfused-madd -mglibc -mieee-fp -mno-red-zone -mno-sse4
# -mpush-args -msahf -mtls-direct-seg-refs

# Compiler executable checksum: 1fe36891f4a5f71e4a498e712867261c

.section .rodata
.LC0:
.string "Hello world!"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
.cfi_personality 0x0,__gxx_personality_v0
pushl %ebp #
.cfi_def_cfa_offset 8
movl %esp, %ebp #,
.cfi_offset 5, -8
.cfi_def_cfa_register 5
andl $-16, %esp #,
subl $16, %esp #,
movl $.LC0, (%esp) #,
call puts #
movl $0, %eax #, D.2242
leave
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5"
.section .note.GNU-stack,"",@progbits
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Korva on November 07, 2011, 07:25:57 am
First off, great work. :)

Second, does anyone else have a problem with reveal? It works fine until the third cavern layer and below, where I get big, partly overlapping rectangles that stay unrevealed.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: tmrt on November 07, 2011, 07:42:38 am
First off, great work. :)

Second, does anyone else have a problem with reveal? It works fine until the third cavern layer and below, where I get big, partly overlapping rectangles that stay unrevealed.

This is an intentional feature. Everything related to fun stuff is left intact and in order to reveal the entire map you should use "reveal hell",
Title: Re: DFHack 0.31.25 r8 (current)
Post by: proxn_punkd on November 07, 2011, 10:45:03 am
First off, great work. :)

Second, does anyone else have a problem with reveal? It works fine until the third cavern layer and below, where I get big, partly overlapping rectangles that stay unrevealed.

This is an intentional feature. Everything related to fun stuff is left intact and in order to reveal the entire map you should use "reveal hell",

For future reference, there is a Readme file.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: arclance on November 07, 2011, 02:58:50 pm
Among the cool new things is the minecraft world converter. It's a bit rough around the edges, sometimes crashes and takes forever to finish. But it's there :) Make sure you backup your fort before you run it.
I will try and test if the generated world works in the next few days when I have access to a paid version of minecraft.
Here are the results of running the world in minecraft.
I spawned off the edge of the map.
Spoiler (click to show/hide)
Respawned underground inside the barracks complex.  The darkness and size made take a while to get outside.
But eventually with a bit of digging I made it outside.
Spoiler (click to show/hide)
I emerged near the magma aqueduct that keeps the decontamination showers from freezing in the winter so I walked over it to the hill were the main fortress entrance is.
I should be walking on gold but I am not.
Spoiler (click to show/hide)
If found the main entrance it is strangely also not made of gold.
Spoiler (click to show/hide)
I did find one solitary piece of gold that should be gold near the entrance to the barracks.
Spoiler (click to show/hide)
I then decided to find the brook to see what it looked like and because I had used magma to thaw it in the winter.
Instead I found the edge to the map from Dwarf Fortress.  The brook should be just beyond here.
Spoiler (click to show/hide)
I then decided to check out the green glass tower I was building.
Spoiler (click to show/hide)
It's big.
Spoiler (click to show/hide)
Really big.
Spoiler (click to show/hide)
Also really hard to navigate.
Spoiler (click to show/hide)
I reached the top of the tower.  It has quite a view.
Spoiler (click to show/hide)
A view of the volcano.
Spoiler (click to show/hide)
Wait a second why is there land to the left of the volcano thats where the map ends?
Spoiler (click to show/hide)
I looks like (most) of the missing part of the map containing the brook.
Spoiler (click to show/hide)
Yep thats what it is but about half of the brook is missing!
Spoiler (click to show/hide)
Also the volcano does not contain magma!
Spoiler (click to show/hide)
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Greiger on November 07, 2011, 05:19:51 pm
If I recall correctly DF2MC reads DF roads as half block tiles no matter what it's made of.  If that was a gold road it won't show up golden sadly.  Also I vaguely remember something always being funny with magma during the conversions, sometimes it would show, sometimes it wouldn't.


That translocating of large chunks of terrain though is new, or at least something I never encountered before.  Is the map rectangular or something? That seems to throw off a lot of DFhack tools for some reason.  My map converted almost exactly how I remember them converting, so it doesn't seem to be an all the time thing.   Only difference I saw between now and then is that they used to get all the way down to the Slade layer, now it seemed to only make it about halfway.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: arclance on November 07, 2011, 05:38:48 pm
If I recall correctly DF2MC reads DF roads as half block tiles no matter what it's made of.  If that was a gold road it won't show up golden sadly.
It is not a road the walls are gold and the gold floors are floors not roads.  I had a picture of one small section of the gold walls that is gold (at least to the eye) in there.
Also I vaguely remember something always being funny with magma during the conversions, sometimes it would show, sometimes it wouldn't.


That translocating of large chunks of terrain though is new, or at least something I never encountered before.  Is the map rectangular or something? That seems to throw off a lot of DFhack tools for some reason.  My map converted almost exactly how I remember them converting, so it doesn't seem to be an all the time thing.   Only difference I saw between now and then is that they used to get all the way down to the Slade layer, now it seemed to only make it about halfway.
Yes it is a rectangular map (4x3).
I assumed that if the map conversion was screwed up with chunks in the wrong place the same bug probably screwed up the magma.
I don't think mine goes down very far, 3 floors below my entrance the tunnels stop and there is a layer of something black I can't dig through (I lose the free diamond equipment due to spawing off the map edge).
Spoiler (click to show/hide)
Also everything (walls, floors, ramps) in this picture is made of gold blocks and does not appear gold.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 07, 2011, 06:08:03 pm
If I recall correctly DF2MC reads DF roads as half block tiles no matter what it's made of.  If that was a gold road it won't show up golden sadly.
It is not a road the walls are gold and the gold floors are floors not roads.  I had a picture of one small section of the gold walls that is gold (at least to the eye) in there.
Also I vaguely remember something always being funny with magma during the conversions, sometimes it would show, sometimes it wouldn't.


That translocating of large chunks of terrain though is new, or at least something I never encountered before.  Is the map rectangular or something? That seems to throw off a lot of DFhack tools for some reason.  My map converted almost exactly how I remember them converting, so it doesn't seem to be an all the time thing.   Only difference I saw between now and then is that they used to get all the way down to the Slade layer, now it seemed to only make it about halfway.
Yes it is a rectangular map (4x3).
I assumed that if the map conversion was screwed up with chunks in the wrong place the same bug probably screwed up the magma.
I don't think mine goes down very far, 3 floors below my entrance the tunnels stop and there is a layer of something black I can't dig through (I lose the free diamond equipment due to spawing off the map edge).
Spoiler (click to show/hide)
Also everything (walls, floors, ramps) in this picture is made of gold blocks and does not appear gold.
It can only convert 42 DF z-levels. So it got your glass tower and chopped off some other stuff. It's definitely not perfect. I released it as part of DFhack mainly to get some feedback. And that black stuff is either the bottom of the world or some slade.

Is the map rectangular or something? That seems to throw off a lot of DFhack tools for some reason.
Care to elaborate? Unreported bugs don't get fixed.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Greiger on November 07, 2011, 06:22:32 pm
That black rock is bedrock, or Adminite. Or adminium or whatever fan name you want to go with.  It marks the edges of the map, it is essentially indestructible (I hear repeated applications of large amounts of dynamite can break through, but that could be a myth, and there is nothing but void under it anyway). 

But I think I figured out the cause of that.  Minecraft maps aren't as tall as DF maps.  While you have sheer vertical cliffs on the edges of your map, I have sheer vertical drops.  It seems the converter errs on the side of surface constructions.  In getting your entire green glass tower to render the ground level of your map is actually significantly lower than the normal minecraft ground level. (why you have cliff faces on the map edges, the top of those are normal minecraft ground level height.)  Your green glass tower is taking up a significant portion of Minecraft's vertical budget.


It could be reading the walls and floor as smooth stone instead of gold, which could explain them showing up as stacked half blocks.  Though it doesn't seem like it's supposed to do that.  Sorry I must have missed that screeny the first time.  The one bit of gold dosn't look to be standard wall though, that may be why it read as it's proper materiel.

Is the map rectangular or something? That seems to throw off a lot of DFhack tools for some reason.
Care to elaborate? Unreported bugs don't get fixed.

No personal experience, rectangular embarks bug me in some odd OCD way so I rarely use them.  I just seem to have seen a number of reports for various tools over time when the culprit seemed to be rectangular embarks.  Mostly the visualizers, like Overseer and Stonesense.   I can't find the report I'm thinking of for Overseer, but this (http://www.bay12forums.com/smf/index.php?topic=43260.msg2724519#msg2724519) is a recent one in stonesense.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: arclance on November 07, 2011, 07:43:15 pm
But I think I figured out the cause of that.  Minecraft maps aren't as tall as DF maps.  While you have sheer vertical cliffs on the edges of your map, I have sheer vertical drops.  It seems the converter errs on the side of surface constructions.  In getting your entire green glass tower to render the ground level of your map is actually significantly lower than the normal minecraft ground level. (why you have cliff faces on the map edges, the top of those are normal minecraft ground level height.)  Your green glass tower is taking up a significant portion of Minecraft's vertical budget.
I tried it with a pre green glass tower save (ten years in the dwarven past!) and got the same result.
I still seem to be spawning under the map in the void.
Respawn Screenshot (Look No Tower)
Spoiler (click to show/hide)
Here is a screenshot standing in the same spot in both worlds (pre and post tower)
Pre Tower
Spoiler (click to show/hide)
Post Tower
Spoiler (click to show/hide)
The volcano is 9 Z-Levels taller than my tower (there are 15 more Z-Levels to the sky ceiling) so that is likely the real source of my problem.
There are 51 Z-Levels from the top of the volcano to the bottom of the valley (52 to the bottom of the brook and 67 from the sky ceiling to the bottom of the brook).

It could be reading the walls and floor as smooth stone instead of gold, which could explain them showing up as stacked half blocks.  Though it doesn't seem like it's supposed to do that.  Sorry I must have missed that screeny the first time.  The one bit of gold dosn't look to be standard wall though, that may be why it read as it's proper materiel.
Turns out I screwed up and made that one wall from gold bars instead of gold blocks. 
It looks weird in the first screenshot because I damaged it trying to identify what it was made out of.
Here it is undamaged.
Spoiler (click to show/hide)

Also a squid fell from here.
Spoiler (click to show/hide)
It died on impact.
Spoiler (click to show/hide)

Is the map rectangular or something? That seems to throw off a lot of DFhack tools for some reason.
Care to elaborate? Unreported bugs don't get fixed.
No personal experience, rectangular embarks bug me in some odd OCD way so I rarely use them.  I just seem to have seen a number of reports for various tools over time when the culprit seemed to be rectangular embarks.  Mostly the visualizers, like Overseer and Stonesense.   I can't find the report I'm thinking of for Overseer, but this (http://www.bay12forums.com/smf/index.php?topic=43260.msg2724519#msg2724519) is a recent one in stonesense.
That report is from the same fortress.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 07, 2011, 08:25:01 pm
This forum doesn't work so well with huge screenshots.

Anyway, if you want to set your spawn point, just point the DF cursor at it before you run df2minecraft. Obviously needs to be an unobstructed tile.... maybe you're setting the spawn point to some ridiculous place that way?

I don't know what's going on in those screenshots really. Can you post your DF save?

EDIT:
Oh, idea here. Maybe at the point where the spawn is placed, there's no adminium floor yet and it puts you in the void.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on November 07, 2011, 09:34:25 pm
Right now, DF2minecraft just assumes any and all block walls are stone blocks, but you can change that by changing some stuff in the df2mc.xml file. just open it with notepad. it's not quite self explanatory, but there's plenty of comments there to help you out. If you do make any fixes to that file, let us know, so we can put them into the next release.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on November 07, 2011, 10:55:17 pm
so does Dwarf fortress have books? Do I need to use a custom item.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on November 07, 2011, 11:32:34 pm
it doesn't currently have books, but the next version will.

A number of buildings have bookshelves, though, in this converter.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: arclance on November 08, 2011, 12:45:04 am
Right now, DF2minecraft just assumes any and all block walls are stone blocks, but you can change that by changing some stuff in the df2mc.xml file. just open it with notepad. it's not quite self explanatory, but there's plenty of comments there to help you out. If you do make any fixes to that file, let us know, so we can put them into the next release.
I added this
Code: [Select]
<constructed.blocks-gold mat="gold block,gold block,gold block;gold block,gold block,gold block;gold block,gold block,gold block|gold block,snow,gold block;snow,gold block,snow;gold block,snow,gold block|gold block,gold block,gold block;gold block,gold block,gold block;gold block,gold block,gold block" />
and got this.
Spoiler (click to show/hide)

Anyway, if you want to set your spawn point, just point the DF cursor at it before you run df2minecraft. Obviously needs to be an unobstructed tile.... maybe you're setting the spawn point to some ridiculous place that way?

I don't know what's going on in those screenshots really. Can you post your DF save?

EDIT:
Oh, idea here. Maybe at the point where the spawn is placed, there's no adminium floor yet and it puts you in the void.
I tried moving the cursor to different points.  I always die and have to respawn (at a different random point for each world).
The weirdest respawn I got had me on fire in what appeared to be the void and then I died and was on fire again.

I put the save here (http://dffd.wimbli.com/file.php?id=5160) if you want to look at it.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: thistleknot on November 08, 2011, 12:22:57 pm
Anyway I can add my own offset's?  I used cheat engine 6.1 to find 1 byte values that specify dwarf embark points (there's 7 dorfs) that are spent on skills, or is this something more for dfusion?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on November 08, 2011, 02:59:48 pm
I used cheat engine 6.1 to find 1 byte values that specify dwarf embark points (there's 7 dorfs) that are spent on skills, or is this something more for dfusion?
1. I'm pretty sure the number of embark points is a 32-bit (4 byte) value
2. Embark points can be increased during worldgen, so there's no need to add it to dfhack
3. I get the impression that the main purpose of dfhack is to enhance the game and work around bugs; then again, there are plugins like "reveal" and "fastdwarf", so maybe I'm wrong.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: danaris on November 08, 2011, 03:16:39 pm
3. I get the impression that the main purpose of dfhack is to enhance the game and work around bugs; then again, there are plugins like "reveal" and "fastdwarf", so maybe I'm wrong.

My understanding was that DFHack also sought to facilitate building a particular setup you want to try.  Reveal is particularly useful for this, for instance.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Kogut on November 08, 2011, 03:18:24 pm
And reveal may be used as workaround to certain reclaim bugs.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 08, 2011, 03:24:50 pm
I used cheat engine 6.1 to find 1 byte values that specify dwarf embark points (there's 7 dorfs) that are spent on skills, or is this something more for dfusion?
1. I'm pretty sure the number of embark points is a 32-bit (4 byte) value
2. Embark points can be increased during worldgen, so there's no need to add it to dfhack
3. I get the impression that the main purpose of dfhack is to enhance the game and work around bugs; then again, there are plugins like "reveal" and "fastdwarf", so maybe I'm wrong.
I add whatever is cool and stable enough to be used and leave the decision of what is a cheat to the users. You think using some DFHack command is cheating? Feel free to not use it. Hell, you can go and delete its plugin file (.plug.so or .plug.dll) and get rid of it if you can't resist the temptation.

Even reveal and liquids can be used without 'cheating' - to fix the cases of the magma sea leaking into hell. You think fixing things like that is cheating because you'll see hell? Let a friend do it and give you the fixed, unrevealed map.

Point is: In singleplayer cheating is entirely subjective. If you need to interact in a group, then you should agree on what cheating is and not do it.

I'm not your judge ;)
Title: Re: DFHack 0.31.25 r8 (current)
Post by: thistleknot on November 08, 2011, 03:41:22 pm
1. I'm pretty sure the number of embark points is a 32-bit (4 byte) value

It wasn't working correctly when I had the value set to 4 bytes, so I had to set it to 1 byte before it ready correctly (meaning there's values beyond the 1 byte offset that made a 4 byte offset obviously not the number I was looking for).

I don't know why Toady would want to make it a 4 byte offset, as the maximum value of 4 bytes is far too excessive for the skills.  a Single byte value gives 255, and the default is 10.  I don't know if you assumed it was 4 bytes because the game's variables are all generally 4 bytes, but I'm sure it's not 4 bytes.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on November 08, 2011, 04:52:43 pm
I was referring to the embark points, not the skill assignments for each dwarf, and you typically have a lot more than 255 embark points.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Kogut on November 09, 2011, 03:31:46 am
I wanted to inspect my construction, unfortunately lower levels are hidden - why? 
(http://www.img.ie/images/9a7b6.png) (http://www.img.ie/)

Problem persists after changing cube size

Code: [Select]
[SEGMENTSIZE_XY:70]
[SEGMENTSIZE_Z:4]
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 09, 2011, 03:41:18 am
I wanted to inspect my construction, unfortunately lower levels are hidden - why? 
(http://www.img.ie/images/9a7b6.png) (http://www.img.ie/)

Problem persists after changing cube size

Code: [Select]
[SEGMENTSIZE_XY:70]
[SEGMENTSIZE_Z:4]
Too eager occlusion culling algorithm (culling tiles that aren't occluded ~_~)

Hit the 'o' key:
https://github.com/peterix/stonesense/blob/master/README.txt#L64
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on November 09, 2011, 05:02:57 am
sorry about that.

really gotta fix that, but never have time.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: twalberg on November 09, 2011, 11:00:11 am
Just noticed that the Z-levels reported by "prospect" for the locations of a particular substance don't match up with the Z-level reported by DF onscreen. Wondering if that would be an easy fix, but guessing it's not exactly simple - the offset probably varies per worldgen and maybe even per embark location, but maybe there's enough info available in the various map structures to correct it without going through too much work. Alternatively, adding a correction factor argument to prospect (and potentially some of the other tools if necessary) might be an option.

Also, just a couple minor wish-list things - all related to digging for some odd reason...
* rotations/mirrors of the expdig patterns - sometimes a diagonal dig from NW to SE fits the terrain better than the SW to NE ones
* port the old digger tool from legacy - ability to read a dig pattern from a file and apply it
* diagonal line digging - not just the diagonal expdig patterns - I'm thinking something like 'diagdig 4 3 5' for a diagonal hallway that has a 4:3 slope and is 5 tiles wide - maybe also specifying a length
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on November 09, 2011, 11:03:41 am
that actually is a pretty easy fix. DFhack does have access to the height offset.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Kogut on November 09, 2011, 03:59:41 pm
2 requests
- Is it possible to add plugin to control SIEGE status? I want to attempt hermite challenge, without killing migrants
- Is t possible to modify hardcoded job priorities to avoid "disable all labors on broker" ceremony etc
Title: Re: DFHack 0.31.25 r8 (current)
Post by: danaris on November 09, 2011, 04:17:05 pm
- Is t possible to modify hardcoded job priorities to avoid "disable all labors on broker" ceremony etc

Stick 'im in a burrow.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: thistleknot on November 09, 2011, 05:58:25 pm
I was referring to the embark points, not the skill assignments for each dwarf, and you typically have a lot more than 255 embark points.

Apparently I got embark points confused with something else which relates to skill points for each dorf upon embark.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: jasonwill2 on November 12, 2011, 05:38:10 am
i want to report a bug.

i had the 'reveal map' on to reveal all layers of the land, and i used the 'die' command to suddenly end the program, and now i cant unreveal the map at all, even when i reveal then unreveal it its stuck like this for my fortress

is there a way to get around this?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: tmrt on November 12, 2011, 07:44:47 am
i want to report a bug.

i had the 'reveal map' on to reveal all layers of the land, and i used the 'die' command to suddenly end the program, and now i cant unreveal the map at all, even when i reveal then unreveal it its stuck like this for my fortress

is there a way to get around this?

Position your in-game cursor within your fortress and use "revflood" command.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: BigFatStupidHead on November 16, 2011, 06:56:09 pm
First off, thanks for the wonderful tool, and extra thanks for keeping on with the development! I've found the recent addition of fastdwarf particularily useful, as it makes playable some of my more FPS burdened forts. Would it be possible to make a scaled mode for fastdwarf, such that instead of being just a toggle between speed 0 on and speed 0 off, it moniters the current FPS and assigns a speed value based off of this? For example, at 100 FPS, dwarves are speed 900. If it dropped to 10 FPS, speeddwarf would turn on speed 90?

Even better would be doing the above to all creatures, not just dwarves. Of course, it may need a new name at that point.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Sutremaine on November 19, 2011, 04:05:56 pm
How do you make tiletypes do anything? I'm trying to turn a down staircase into plain floor but it keeps asking me to 'set the paint first'. 'paint ?' doesn't do anything, and while I can get the option lists up I can't do anything with them. I've tried 'set paint', 'paint FLOOR', 'paint [combination]', 'set paint [combination]' and the cursor is pointing at the correct tile.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on November 19, 2011, 04:44:26 pm
How do you make tiletypes do anything? I'm trying to turn a down staircase into plain floor but it keeps asking me to 'set the paint first'. 'paint ?' doesn't do anything, and while I can get the option lists up I can't do anything with them. I've tried 'set paint', 'paint FLOOR', 'paint [combination]', 'set paint [combination]' and the cursor is pointing at the correct tile.
It's probably the single one dfhack tool that would benefit from having a GUI the most.

Basically, you have three sets of tile properties: what's extracted from the original tile, a filter and a mask. The tool takes the existing properties, checks if they match the filter and then applies the mask.

So: 'paint shape FLOOR' will set the shape of the mask to FLOOR and make the tool change any kind of tile into the equivalent floor tile, if there is such a tile. You can as well do this with filters and the range brush. For example, use 'filter shape STAIR_DOWN', 'paint shape FLOOR' and then you can use the range brush to turn all stairs in a range into floors.

Would it be possible to make a scaled mode for fastdwarf, such that instead of being just a toggle between speed 0 on and speed 0 off, it moniters the current FPS and assigns a speed value based off of this?
Yes, although this would be a bit more complex... and there's the potential for a feedback loop in that. Making creatures faster makes them think more and lowers your FPS, lowering FPS makes the tool speed up creatures, etc. I'd have to work out the math so that kind of stuff couldn't happen.
For example, at 100 FPS, dwarves are speed 900. If it dropped to 10 FPS, speeddwarf would turn on speed 90?
Here's the thing: it doesn't tweak some kind of speed value. It lowers the time it takes to finish the current creature action to 0. Different actions take different amount of time, so again, this would have to remember that it set the time for that particular action and that particular creature and decide when to set the time again. That's much more complex and requires the ability to determine the identity of an action.
Even better would be doing the above to all creatures, not just dwarves. Of course, it may need a new name at that point.
I agree that this would be awesome. I just don't see it happening for a while. I added this to my TODO list though ;)
Title: Re: DFHack 0.31.25 r8 (current)
Post by: BigFatStupidHead on November 19, 2011, 06:13:56 pm
Cool, and thanks for looking at that. I thought Fastdwarf was using a method similar to adding 'Speed 0' to your dwarves. A possibly much easier, yet still potentially awesome method would be, rather than monitoring FPS and auto-throttling, to have a user input string on the command line and just let the user set a speed they're comfortable with.
Thanks again for the awesome tools!
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Crandal on November 22, 2011, 08:46:42 pm
The Vdig function of this is pretty cool.  Is there a way to make it work on layer stone though?  I'd love to have my dwarves mine away at the layer stone and avoid stuff like Microcline unless I actually want it.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Aerval on November 24, 2011, 10:00:32 am
Want to report a bug in "tiletypes":
It's not possible to created empty air with it. If I try to do so (therefore converting a stone wall into air) all works fine but the point that it doesn't look in game like a normal air tile but a black spot. When comparing it with "probe", I found out that I created a tile of type 0(empty space) instead of 32(free air).
I know that dfhack is capable of creating air since i can created Ramp_Tops with "tiletypes" and then convert them with "deramp" into air, so I report it as a (minor) bug.

One thing I'd like to request would be a combination of the "probe" and "tiletypes" tool for an easier tile duplication.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on November 24, 2011, 10:42:28 am
I'd say that's a bug, because all of the "undefined" tile types are marked as shape EMPTY, material AIR, and variant VAR_1, and so is "empty space" - all of those other tiles should be changed to a new material "void" or "invalid" so they don't get used accidentally.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Hypotheses on November 25, 2011, 07:44:29 pm
Food coma greetings!  Thank peterix a spoonful of turkey-flavored gratitude for this awesome tool set.  I've used older versions with success, though had to quit when the anti-virus kept bugging me about it.  (I know there's no problem with dfhack, just got tired of the warnings)  So, I upgraded a couple days ago and can't. figure. it. out.  Perhaps I'm going cross eyed from so much text, but I can't open the console, in any form.  What should I be looking for here, and what buttons cause the magic?

Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on November 25, 2011, 11:00:44 pm
The console should open automatically when you start Dwarf Fortress, assuming you installed DFHack correctly.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Hypotheses on November 26, 2011, 03:17:10 pm
Mmk, I *think* I installed it right.  copied the new sdl.dll into the main df folder and now when I run df, I get an error msg: 'Can't load SDLreal.dll'
Care to point out what I missed?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on November 26, 2011, 03:39:44 pm
Yes - you forgot to extract SDLreal.dll.

You need to extract the entire archive into the DF main folder, which will overwrite SDL.dll and place SDLreal.dll right next to it (and create the "hack" subfolder which contains memory.xml and the plugins folder).
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Hypotheses on November 26, 2011, 04:16:34 pm
aha!  I copied the plugin folder into my DF main, not the hacks folder.  Thanks!  ... Can't believe it was so simple :-[
Title: Re: DFHack 0.31.25 r8 (current)
Post by: graniteadam on December 01, 2011, 06:34:24 pm
First, dfhack is awesome.

Second, I've been having fun messing around with writing plugins, but I wanted to try to get something that can add jobs to workshops. I get how to access Buildings, but having trouble figuring out how to affect Jobs. Based on a couple comments in the code ("no jobs for now..."), looks like we don't know where jobs info is kept? Anyone have any insight?

Also been trying to work with Cheat Engine to find job stuff but with no success.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Ghills on December 01, 2011, 06:51:51 pm
Dwarf Foreman adds jobs to the manager screen, you might be able to figure out something from it.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: LucasUP on December 04, 2011, 09:02:40 pm
Heya,

So I'm going about adding this to the Lazy Newb Pack. But one thing, is that it contains a redundant version of Stonesense. I'd rather keep the version accessible from the LNP GUI and delete the version included with DFHack. I can just delete the Stonesense folder, but this crashes the game if you try running it through DFHack. Could you fix that crash (detect when the folder is deleted?) or do you have another suggestion for me?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on December 04, 2011, 09:23:39 pm
This isn't redundant, it's far faster and much improved (though also more buggy. my bad)

To get rid of it, you need to get rid of stonesense.plug.dll from the dfhack folder. but please compare the two before you do.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: LucasUP on December 04, 2011, 10:21:59 pm
This isn't redundant, it's far faster and much improved (though also more buggy. my bad)

To get rid of it, you need to get rid of stonesense.plug.dll from the dfhack folder. but please compare the two before you do.

Oh, okay. It wasn't initially clear it was actually an improved (or officially supported) version. Will all/future Stonesense development eventually be merged with DFHack?

My problem is that it's not obvious to your average Newb that you can run Stonesense or how to do it. Its sort of hidden amongst the list/commands of all the other plugins.
What I'll do is include both versions for now. Its only a few extra MB. I'll just make a note of it and tell people how to run it.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on December 04, 2011, 10:27:29 pm
This isn't redundant, it's far faster and much improved (though also more buggy. my bad)

To get rid of it, you need to get rid of stonesense.plug.dll from the dfhack folder. but please compare the two before you do.

Oh, okay. It wasn't initially clear it was actually an improved (or officially supported) version. Will all/future Stonesense development eventually be merged with DFHack?

My problem is that it's not obvious to your average Newb that you can run Stonesense or how to do it. Its sort of hidden amongst the list/commands of all the other plugins.
What I'll do is include both versions for now. Its only a few extra MB. I'll just make a note of it and tell people how to run it.
hmm isn't it just typing in Stonesense would work? I haven't try due to fears of it killing Dfusion on my new pc.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: LucasUP on December 04, 2011, 10:46:01 pm
Yeah, you type "stonesense" or "ssense". I wasn't asking how, just noting that it's less obvious you can do it. I think its EASIER to do once you know though.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on December 04, 2011, 10:51:02 pm
The other stonesense branch is officially dead, buried, and unsupported.

This is the only branch that will be updated to future versions.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: LucasUP on December 05, 2011, 08:06:36 am
The other stonesense branch is officially dead, buried, and unsupported.

This is the only branch that will be updated to future versions.
Its cool to see projects combine. Can I suggest that the OP of this thread and of the old StoneSense should be more explanatory of this merge and new direction? There was no way I could know this from the StoneSense thread without digging way into it.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on December 05, 2011, 02:28:58 pm
I'll try to get in contact with Jonask and tell him to log on and change the OP.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on December 06, 2011, 01:29:36 am
I'll try to get in contact with Jonask and tell him to log on and change the OP.
Done.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Warmist on December 07, 2011, 04:18:10 pm
peterix: i was about to make something like graphics module :) Really cool.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Grax on December 10, 2011, 06:45:38 am
0.31.25 r8:
Windows version (with Stonesense and DFusion) (https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r8-Windows.zip)
Is there somewhere a compiled version of this?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: danaris on December 10, 2011, 09:25:09 am
0.31.25 r8:
Windows version (with Stonesense and DFusion) (https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r8-Windows.zip)
Is there somewhere a compiled version of this?

That is the compiled version.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Grax on December 10, 2011, 09:30:12 am
0.31.25 r8:
Windows version (with Stonesense and DFusion) (https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r8-Windows.zip)
Is there somewhere a compiled version of this?

That is the compiled version.
The strange thing there are no .exe, only .lua .xml .dll.
How do i launch it?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: danaris on December 10, 2011, 09:57:21 am
0.31.25 r8:
Windows version (with Stonesense and DFusion) (https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r8-Windows.zip)
Is there somewhere a compiled version of this?

That is the compiled version.
The strange thing there are no .exe, only .lua .xml .dll.
How do i launch it?

From the first post in the thread:

How to install DFHack:
  • First, get the archive meant for your system. Extract the contents into your DF folder.
  • On Windows, you're ready to use DFHack
  • On Linux, use the 'dfhack' script to run DF with DFHack. If you have stonesense problems, you might have to get your own allegro 5 libraries and delete the ones in stonesense/deplibs.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: splinteredmind on December 10, 2011, 10:22:18 am
Just run DwarfFortress.exe

A DFHack terminal window will also appear.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Grax on December 10, 2011, 10:26:02 am
Just run DwarfFortress.exe

A DFHack terminal window will also appear.
Oh, i'm stupid. Sorry.  :D
Title: Re: DFHack 0.31.25 r8 (current)
Post by: moisesjns on December 10, 2011, 09:43:56 pm
so is there anything on dfhack thats like the hellhole chasm?? i mean i see you made digging a hole, can i make it dig straight to magma? cause i really want magma forges right away and sadly hellhole chasm no work on new versions. you should contact that guy. but yeah is there a fast way to get to magma using dfhack? i know i can make magma but i need to discover it to make magma forges.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Valience on December 12, 2011, 02:08:24 am
Back in ye olde days, there was a "just dig it" or similarly named tool that stopped the game form cancelling designations due to wetness and warmness. Is it possible to add such a toggle-able tool to dfhack? It gets pretty annoying trying to dig out stuff over top of the lava sea when I have to re-designate the darn thing 100+ times.

Apologies if it was asked somewhere in the 23 pages, I admit to not reading all of them.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Samaliel on December 12, 2011, 02:47:25 am
Regarding the DF to Minecraft export, I'm encountering some problems. It seems that having a non square embark region creates lots of problems upon conversion: the spawn point gets placed where there's no ground to stand on, there are very weird looking cliffs, open sky magma seas... I never managed to find the entrance of my fort bacK.

Will post some screenies and link a save as soon as I can.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on December 12, 2011, 04:36:59 am
Okay I just updated Dfusion thread with a lever function that pulls any non civ member into a statue if someone flips a switch.
though I haven't tried anything crazy like making it auto tame the wilds or make teleport spots.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Caldfir on December 12, 2011, 11:28:26 pm
SWEET MOTHER OF GOD

Stonesense is FLYING.  Brilliant to have dfhack living inside the SDL process now.  Been busy with classes and only getting to see this now.  Dang, this is running great. 
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on December 13, 2011, 01:21:06 am
So is it possible to lay down a train track of teleportation stones in a line from one fort so that one could if fort is endanger could just flip over to adventure mode and walk over to the Transport station and be warp to a safe place?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Lothiack Drake on December 14, 2011, 10:18:23 pm
This patch modifies the skeleton plugin and some core stuff to make the screen scrollable via middle mouse drag, but it's just to test the propagation of SDL::Event to the plugins.
It works but I don't know if it is the proper way to propagate the events.

@peterix
I would really appreciate it if you reviewed that propagation code as I still learning C/CPP and there might be some problems.

Patch from commit b36e5ac248d8fb972335d351d7acc30691c313ab
Spoiler (click to show/hide)

PS: Is a patch the best way to share this without forking your rep?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Sudius on December 15, 2011, 02:01:26 am
Hopefully someone can help?

I ran DFcleanowned with the arguments -lxX to pick up stuff on the floor and auto-dump anything that was deteriorated.

ALL my dwarves in my 100 year old fort were all wearing items that were deteriorated.  I spent hours setting up a cloth industry and making a full arrangement of items to wear, then I dumped all their old clothes.

No one's wearing any of the new clothing, it's a literal nudist colony now. :(

Any ideas?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: rampaging-poet on December 15, 2011, 02:14:11 am
That's a known bug.  Ordinary dwarves don't equip new clothing in this version.  The only known way to get them to wear clothes right now is to put them in the military with the clothes assigned as a uniform.  There's some recent science on the subject in this thread (http://www.bay12forums.com/smf/index.php?topic=97405.0); it's suspected that dwarves maintain some kind of link to their owned clothing even after that clothing is destroyed or no longer marked as owned.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Grax on December 15, 2011, 02:29:00 am
No one's wearing any of the new clothing, it's a literal nudist colony now. :(

Any ideas?
Save your fort, wait for the full graphic release in 2055, load. PROFIT!
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on December 15, 2011, 05:30:26 am
So has anyone solve the issue with adventurers body swapping(or switching into adventure mode from fort mode) not being able to retire?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Artanis00 on December 15, 2011, 06:09:35 am
No one's wearing any of the new clothing, it's a literal nudist colony now. :(

Any ideas?
Save your fort, wait for the full graphic release in 2055, load. PROFIT!

Be careful what you wish for. You might get a fort full of ugly.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Grax on December 15, 2011, 06:12:46 am
No one's wearing any of the new clothing, it's a literal nudist colony now. :(

Any ideas?
Save your fort, wait for the full graphic release in 2055, load. PROFIT!
Be careful what you wish for. You might get a fort full of ugly.
DOUBLEPROFIT!
Title: Re: DFHack 0.31.25 r8 (current)
Post by: lopocozo on December 15, 2011, 05:20:36 pm
How does df2minecraft even WORK? how can I play my beautiful fortress?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on December 15, 2011, 07:31:34 pm
This patch modifies the skeleton plugin and some core stuff to make the screen scrollable via middle mouse drag, but it's just to test the propagation of SDL::Event to the plugins.
It works but I don't know if it is the proper way to propagate the events.

@peterix
I would really appreciate it if you reviewed that propagation code as I still learning C/CPP and there might be some problems.

CODE

PS: Is a patch the best way to share this without forking your rep?
Alright. I'll look at it. Got some free time :)

How does df2minecraft even WORK? how can I play my beautiful fortress?
It creates a folder (Usuall named 'World #', where # is a number) in your DF folder that has to be copied into the minecraft saves folder.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on December 16, 2011, 12:08:28 am
okay I somehow in my research made insensitive citizens that will dismantle someone's workshop for their material while someone's working in the middle of it.
I think I know why one of my functions seem to remove the building item safety flag on all items causing them free to be taken apart with out orders.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Lothiack Drake on December 16, 2011, 08:51:53 am
Alright. I'll look at it. Got some free time :)

I just debugged that crash and it happens in the graphics example that writes the version to the side of the screen.

Code: [Select]
bool Graphic::Unregister(DFTileSurface* (*func)(int,int))
{
if ( d->funcs.empty() ) return false;

vector<DFTileSurface* (*)(int,int)>::iterator it = d->funcs.begin();
while ( it != d->funcs.end() )
{
if ( *it == func )
{
d->funcs.erase(it);
return true;
}
it++;
}

return false;
}
Seems like "d" points nowhere.

And there is a bunch of stuff named Private, everywhere. Why did you name them like that?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on December 16, 2011, 08:55:53 am
Yeah, it is. It's a known bug. At least known to me. dunno if peterix knows what's up.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Grax on December 16, 2011, 09:03:02 am
I'm pretty sure there is something wrong because the game crashes when closed. It might be trying to process events while it's quitting.
The same happens when you have too much saved games. (More than 40-50 for me)
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Lothiack Drake on December 16, 2011, 06:38:38 pm
The same happens when you have too much saved games. (More than 40-50 for me)

I think you missed the point there. It's not a regular DF bug we're talking about.  ;)
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Lamphare on December 19, 2011, 04:41:57 pm
I let the command line window print all  plug commands
and then I typed in "prospector", with returning message saying it's not a recognised command
It got me thinking, and suddenly I realised it was said in the top post as example, I should be using "prospect" instead of "prospector".

What a big confusion.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: globofglob on December 19, 2011, 06:39:01 pm
Got this error when trying to use this with another mod, forlorn realms specifically.

FirstCall()
Initized HOOKS!
Identifying DF version.
Loading hack\Memory.xml ... failed!
Error while reading Memory.xml:
error 2: Failed to open file, at row 0 col 0
DFHack will now deactivate.

does this happen because i'm using a mod instead of base dwarf fortress? if so, is there a way I can alter it to make it work?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: danaris on December 19, 2011, 07:10:12 pm
Got this error when trying to use this with another mod, forlorn realms specifically.

FirstCall()
Initized HOOKS!
Identifying DF version.
Loading hack\Memory.xml ... failed!
Error while reading Memory.xml:
error 2: Failed to open file, at row 0 col 0
DFHack will now deactivate.

does this happen because i'm using a mod instead of base dwarf fortress? if so, is there a way I can alter it to make it work?

That sounds an awful lot like your Memory.xml file is either missing, corrupted, or unreadable.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Lothiack Drake on December 19, 2011, 08:05:31 pm
Got this error when trying to use this with another mod, forlorn realms specifically.

FirstCall()
Initized HOOKS!
Identifying DF version.
Loading hack\Memory.xml ... failed!
Error while reading Memory.xml:
error 2: Failed to open file, at row 0 col 0
DFHack will now deactivate.

does this happen because i'm using a mod instead of base dwarf fortress? if so, is there a way I can alter it to make it work?

Your 'memory.xml' file should be in the hack directory, inside DF main directory: "C:\DF\hack\memory.xml"
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Samaliel on December 23, 2011, 02:20:28 pm
Okay, regarding the DF to Minecraft thing with non-square embarks, here's some info. Hopefully, it will help you solve this bug.

First of all, here's what the map is supposed to look like (http://mkv25.net/dfma/poi-28504). Notice the obsidian pillars, pointing towards the entrance of the Fort.

Running df2minecraft while the DF cursor is in between those three pillars. I creates the save, but tells me there is no space for spawning where the DF cursor is.

I copy the MC save into the appropriate folder and start Minecraft. Conversion is okay, but spawn is in the middle of Nothing. There's not even magma down there. I fall, but do not die upon impact. But death comes soon enough.

Respawn: time to look for them pillars. I find them, but something's wrong (http://img.ie/b27bb.png). They're not on the same level. One of them is even on a slope. According to my map, the front door is 7 tiles away from the northern pillar: 21 Minecraft blocks. I dig a trench in the dirt, so I can count the blocks. 21 blocks further: no entrance, nothing (http://img.ie/2267b.png). I found the other obsidian pillars in apparently correct relative positions, but can't find the entrance to my fort.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Caldfir on December 23, 2011, 03:51:04 pm
Hey, I'm noticing some oddness in Memory.xml. 

The first thing is that profession#59 is "TRADER" but skill#59 is "Wound Dressing".  Is this an error in the file, or something strange with DF itself?

The second thing is that all but a few of the professions are listed in all caps.  Again, is this to deal with some DF eccentricities, or just an oversight with regard to the format of the text?

Spoiler (click to show/hide)
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on December 23, 2011, 04:48:22 pm
Skills and professions are not the same thing - skills are what you use when doing jobs, while professions are what you get from having certain skills (and there are several category professions such as "Stoneworker", "Engineer", "Metalworker", etc.), so it's perfectly normal for them to not match up. You'll also notice that while there are 116 skills, there are only 106 professions.

As for the professions that aren't in all-caps, that's just an error in the XML. The actual names in there are completely arbitrary - they just happen to match the token values used in the raws.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on December 23, 2011, 11:52:31 pm
Hmm had any one figure out how to get full adventure mode access to Non Adventure mode playable characters(example any one who use Mode set to change into adventure mode or use Dfusion to body swap to a different character.)
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Caldfir on December 24, 2011, 12:18:22 pm
Well then it appears that the wound dressing profession is missing somehow I guess? 
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on December 24, 2011, 01:00:32 pm
Well then it appears that the wound dressing profession is missing somehow I guess?
There is no profession for wound dressing - a dwarf whose highest skill is Wound Dressing will be a "Peasant".

If you want to check if the profession/skill/labor lists in memory.xml are correct, compare them to the lists on the wiki, since I know for a fact that they're correct:

http://df.magmawiki.com/index.php/DF2010:Unit_type_token
http://df.magmawiki.com/index.php/DF2010:Skill_token
http://df.magmawiki.com/index.php/DF2010:Labor_token
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Logrin on December 31, 2011, 06:27:11 am
Alright. This is going to make me sound like some sort of invalid but how do I actually use this?

I can't quite wrap my head around the read me. Is there a specific button that I need to press to bring up the console while running df?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on December 31, 2011, 07:10:26 am
If you've installed it right, it should come up automatically.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: IamanElfCollaborator on December 31, 2011, 09:03:06 pm
Did you install ALL the files into the DF file? Or replace the SDL file in the DF directory with the SDL in the download? That might do it.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Logrin on January 01, 2012, 01:57:03 am
Re-installed an the problem fixed itself. Don't know what I did wrong the first time.


All for naught though, there were only a few reasons I wanted to fiddle around with it. Things that either can not be done, or I lack the know-how to do.

-From adventure mode summon friendly ((to me)) mud men into a village. While playing the Mighty Morphin' Power Rangers Theme and making the classic putty noise. ((limb flailing optional))
-Create and control IRON MAN or BATMAN in adventure mode. Then go about solving crime and fighting mysteries.
-Play around with a lead or possibly platinum maul. Without having to cross my fingers on strange moods.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: IamanElfCollaborator on January 01, 2012, 02:02:13 am
1. Use Runesmith.

2.Use the dfusion plugin.

3.Enable them for the desired entity.

i'm working on the assumption you know how to do these. Right?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Logrin on January 01, 2012, 02:14:37 am
Not even remotely. It's a small miricale I can from coherent sentances half of the time.

Walk me through it, as if I were a simpering moron with my shirt on inside out and backwards. ((yet still buttoned up))
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on January 01, 2012, 04:46:15 am
Re-installed an the problem fixed itself. Don't know what I did wrong the first time.


All for naught though, there were only a few reasons I wanted to fiddle around with it. Things that either can not be done, or I lack the know-how to do.

-From adventure mode summon friendly ((to me)) mud men into a village. While playing the Mighty Morphin' Power Rangers Theme and making the classic putty noise. ((limb flailing optional))
-Create and control IRON MAN or BATMAN in adventure mode. Then go about solving crime and fighting mysteries.
-Play around with a lead or possibly platinum maul. Without having to cross my fingers on strange moods.

first can be done through making Mudmen either bogeymen and you standing in the middle of night alone to summon them.
second depends on if you want a drunk guy with heart problems in a suit of armor that allows him to murder every one, and a guy who just had his parents killed and lives in a huge mansion.
tony takes time writing a function that tracks if the adventurer had attached all pieces of the armor then race changing him/her to an identical creature race that just adds on new abilities and material breathe attacks. Bruce just takes time setting up his parents death, which could be as easy as body swapping some random mook and killing some royal guy and his wife while living his son alive, or recreating the entire scene right down to crime alley, Gotham, Arkham, and Wayne manor.
third you just need to use dfusion's item edit and change the material to platinum or lead if you really want to do this with out adventure reactions reply and I can give you my version item edit where all you need to do to is type in the RAW name in caps and hit enter.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: IamanElfCollaborator on January 01, 2012, 05:01:44 am
Or maybe he was talking about those iron men and batmen..

-points at a wheezy man made of iron coughing poisonous clouds and a weird, hairy looking man with wings-
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Logrin on January 01, 2012, 05:16:17 am
Wow.

Rumrusher.

You always blow my mind when you talk some serious techno-smack.

I just meant the bat and iron men that pre-exist...

Now I can't stop thinking of "The repulser ray hits the peasant in the lower body. He is propelled backwards from the impact."

Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on January 05, 2012, 11:13:05 am
I just notice r7 doesn't allow folks to change "modes in menu" which kinda leads to being unable to change modes if you are in Reclaim mode.
Since false positives took away my DFmode I can't research in other ways to play around with mode switching.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: UristMcHuman on January 05, 2012, 09:55:49 pm
How do I get at the tools for this hack? I just freshly downloaded it.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on January 05, 2012, 10:06:53 pm
Did you follow the included instructions for installing it?

Did you read any of the included documentation?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: UristMcHuman on January 05, 2012, 10:27:51 pm
Did you follow the included instructions for installing it?

Did you read any of the included documentation?
Yes and yes.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on January 05, 2012, 10:49:19 pm
Did you extract the entire DFhack folder into your DFv folder, and then run DF?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Samaliel on January 07, 2012, 09:30:24 am
Hi there,

I was tinkering with the DF2MC.xml file in order to see if I could make stairs use some stair blocks, and noticed the bed blocks are not defined in any of the two 'Minecraft material' sections.

I added them, but when I tried to run DF2minecraft, it crashed. I haven't found any useful log to see whether it is related to the addition of bed or to my attempt to use stair blocks for stairs.

Could any one help me with this ?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on January 07, 2012, 09:37:48 am
You sure there's no bed? I remember putting one in there. Might not have been released.

Best thing to do is to change one thing at a time, and try it out each time, so see what causes it to die.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Blailus on January 08, 2012, 11:29:39 am
I'm not sure if anyone else has noticed this, but if I run seedwatch on my fort, my FPS frops from 70-90 down to 25 (and as soon as I type "seedwatch stop" it goes right back to the previous FPS)

Any ideas on why/how I can fix this?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Cardinal on January 08, 2012, 05:06:24 pm
I just noticed the Modes option in DFHack.  If I switch modes from Fortress to Adventurer, does this mean the Fortress will stay in the world and I can start another one?  If not, is there a way via DFHack that I can just leave a fortress with all its dwarves and stuff without abandoning it?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Samaliel on January 08, 2012, 07:02:12 pm
You sure there's no bed? I remember putting one in there. Might not have been released.

Best thing to do is to change one thing at a time, and try it out each time, so see what causes it to die.

Yup. Positive. According to MC wiki, bed block id is 26, and there's nothing in between 20 and 35 in the DF2MC.xml, either in the minecraftmaterials or in the minecraftmaterialsalpha elements (just checked the file on peterix github repository).

However,  there is a building definition for beds. It just calls for the previously undefined bed blocks:
Code: [Select]
<bed mat="torch,air,torch;air,air,air;air,air,air|bookshelf,bed,bookshelf;air,bed,air;air,air,air|air,air,air;air,air,air;air,air,air" data="5,0,5;0,0,0;0,0,0|0,9,0;0,1,0;0,0,0|0,0,0;0,0,0;0,0,0" />
<bed.-2 mat="torch,air,torch;air,air,air;air,air,air|bookshelf,bed,bookshelf;air,bed,air;air,air,air|air,air,air;air,air,air;air,air,air" data="5,0,5;0,0,0;0,0,0|0,9,0;0,1,0;0,0,0|0,0,0;0,0,0;0,0,0"  />
<bed.-4 mat="torch,air,air;air,air,air;torch,air,air|bookshelf,air,air;bed,bed,air;bookshelf,air,air|air,air,air;air,air,air;air,air,air" data="5,0,0;0,0,0;5,0,0|0,0,0;8,0,0;0,0,0|0,0,0;0,0,0;0,0,0" />
<bed.-6 mat="air,air,torch;air,air,air;air,air,torch|air,air,bookshelf;air,bed,bed;air,air,bookshelf|air,air,air;air,air,air;air,air,air" data="0,0,5;0,0,0;0,0,5|0,0,0;0,2,10;0,0,0|0,0,0;0,0,0;0,0,0" />
<bed.-8 mat="air,air,air;air,air,air;torch,air,torch|air,air,air;air,bed,air;bookshelf,bed,bookshelf|air,air,air;air,air,air;air,air,air" data="0,0,0;0,0,0;5,0,5|0,0,0;0,3,0;0,11,0|0,0,0;0,0,0;0,0,0" />
<bed.-246 mat="torch,air,torch;air,air,air;air,air,air|bookshelf,bed,bookshelf;air,bed,air;air,air,air|air,air,air;air,air,air;air,air,air" data="5,0,5;0,0,0;0,0,0|0,9,0;0,1,0;0,0,0|0,0,0;0,0,0;0,0,0"  />
<bed.-248 mat="torch,air,air;air,air,air;torch,air,air|bookshelf,air,air;bed,bed,air;bookshelf,air,air|air,air,air;air,air,air;air,air,air" data="5,0,0;0,0,0;5,0,0|0,0,0;8,0,0;0,0,0|0,0,0;0,0,0;0,0,0" />
<bed.-268 mat="air,air,torch;air,air,air;air,air,torch|air,air,bookshelf;air,bed,bed;air,air,bookshelf|air,air,air;air,air,air;air,air,air" data="0,0,5;0,0,0;0,0,5|0,0,0;0,2,10;0,0,0|0,0,0;0,0,0;0,0,0" />
<bed.-468 mat="air,air,air;air,air,air;torch,air,torch|air,air,air;air,bed,air;bookshelf,bed,bookshelf|air,air,air;air,air,air;air,air,air" data="0,0,0;0,0,0;5,0,5|0,0,0;0,3,0;0,11,0|0,0,0;0,0,0;0,0,0" />
<bed.-24 mat="torch,air,torch;air,air,air;air,air,air|bookshelf,bed,bookshelf;air,bed,air;air,air,air|air,air,air;air,air,air;air,air,air" data="5,0,5;0,0,0;0,0,0|0,9,0;0,1,0;0,0,0|0,0,0;0,0,0;0,0,0"  />
<bed.-26 mat="torch,air,torch;air,air,air;air,air,air|bookshelf,bed,bookshelf;air,bed,air;air,air,air|air,air,air;air,air,air;air,air,air" data="5,0,5;0,0,0;0,0,0|0,9,0;0,1,0;0,0,0|0,0,0;0,0,0;0,0,0"  />
<bed.-48 mat="air,air,air;air,air,air;torch,air,torch|air,air,air;air,bed,air;bookshelf,bed,bookshelf|air,air,air;air,air,air;air,air,air" data="0,0,0;0,0,0;5,0,5|0,0,0;0,3,0;0,11,0|0,0,0;0,0,0;0,0,0" />
<bed.-68 mat="air,air,air;air,air,air;torch,air,torch|air,air,air;air,bed,air;bookshelf,bed,bookshelf|air,air,air;air,air,air;air,air,air" data="0,0,0;0,0,0;5,0,5|0,0,0;0,3,0;0,11,0|0,0,0;0,0,0;0,0,0" />
Bookshelves and torches appear alright, but not the bed.


Anyway, I'll take your advice and try modding one thing at a time. Baby steps, right ?

Ninja edit: added the followong lines in both Minecraft materials section:
Code: [Select]
<material val="26" opacity="15" partlit="1">bed</material>and the bed appeared at the expected location.

Now to try and make stairs that actually have stairs in them.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Samaliel on January 08, 2012, 08:21:55 pm
Double posting because of a different problem. When loading the exported world for the first time, my character is spawned halfway inside the ground (http://tnypic.net/8954c.png.html). I have to jump before I can move at all. Not very annoying, but unreported bugs don't get corrected, so there: reported.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Iceco on January 09, 2012, 04:55:07 pm
Suggestion:
A new mode in dfreveal that reveals all tiles adjacent to currently dug out tiles (or in other words makes the tiles above and below dug out tiles visible - as the tiles adjacent in the xy-plane are already revealed).
It makes some sense to know what's above and below you when you're digging (the dwarf either scratches the layer above/below and sees the material or hears it's hollow) and avoids you having to dig up/down stairs to follow veins or spoil the entire map with a full reveal.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on January 09, 2012, 07:32:34 pm
I just noticed the Modes option in DFHack.  If I switch modes from Fortress to Adventurer, does this mean the Fortress will stay in the world and I can start another one?  If not, is there a way via DFHack that I can just leave a fortress with all its dwarves and stuff without abandoning it?
Well. I guess you could do that, but this pretty much enters the 'undefined behavior' area. If you want to take an adventurer out of a fort, you have to go through arena mode so you can 'assume control' of him. Also don't move the adventurer until you switch from arena to adventure mode. Otherwise all the dwarves will start attaking each other. Switching back to dwarf mode should be done similarly, but in reverse.

Double posting because of a different problem. When loading the exported world for the first time, my character is spawned halfway inside the ground (http://tnypic.net/8954c.png.html). I have to jump before I can move at all. Not very annoying, but unreported bugs don't get corrected, so there: reported.
Yay, one more bug. The tool sure has plenty of them :) I guess I should look at it before I make a new release.

I'm not sure if anyone else has noticed this, but if I run seedwatch on my fort, my FPS frops from 70-90 down to 25 (and as soon as I type "seedwatch stop" it goes right back to the previous FPS)

Any ideas on why/how I can fix this?
You could, but someone else was quicker. The issue is that it runs too often and just hogs the CPU (each run scanning through all items). Should be fixed in next release (and is already fixed in current code).

Oh, and a bit of info for everyone:
DFHack now has more active developers than just me. This is awesome.

Internally, things are changing and you can expect a lot more from the future. Instead of using Memory.xml, dfhack will be switching to a better way of describing the game's data structures and generating code out of that. This means a lot more of DF can be exposed to plugins and greatly reducing the maintenance needed. It's already in place and working properly. For future releases, expect Memory.xml to be gone or at least reduced in size :)

If you are interested in how the internals of DF work, check out the new XML code here: https://github.com/angavrilov/df-structures

As for the approaching DF release, I think I'll release DFHack for 0.31.25 with the new system in place first and wait until the new DF stabilizes a bit. It might take some time to update DFHack for the new version anyway, because the amount of details exposed is HUGE in comparison to what the Memory.xml based system allowed. Still a lot better to work with.

There are exciting times ahead :)

Suggestion:
A new mode in dfreveal that reveals all tiles adjacent to currently dug out tiles (or in other words makes the tiles above and below dug out tiles visible - as the tiles adjacent in the xy-plane are already revealed).
It makes some sense to know what's above and below you when you're digging (the dwarf either scratches the layer above/below and sees the material or hears it's hollow) and avoids you having to dig up/down stairs to follow veins or spoil the entire map with a full reveal.
That's a very nice idea.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Cardinal on January 09, 2012, 10:07:35 pm
Well. I guess you could do that, but this pretty much enters the 'undefined behavior' area. If you want to take an adventurer out of a fort, you have to go through arena mode so you can 'assume control' of him. Also don't move the adventurer until you switch from arena to adventure mode. Otherwise all the dwarves will start attaking each other. Switching back to dwarf mode should be done similarly, but in reverse.

I'll give it a try tomorrow.  Being able to step away from a fortress without abandoning it (even if it's not "really" functioning) and start new fortresses or adventure in a world with your forts still containing their occupants has always been a feature I wanted in DF.  I have a feeling based on the DFusion thread that there needs to be more resolved (like declaring the site to be something other than an active player fortress) but if there was ever a simple option to do that, I'd sort of think that was awesome.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: kanaak666 on January 10, 2012, 05:28:23 pm
@Cardinal
Maybe you should write somewhere that hack command window should open automatically if everything is working correctly. I know it sounds silly, but I was re-installing DF, adding new mods etc. and in the end I haven't noticed that some of the files were overwritten. Then I spent whole 20 minutes trying to get this .dll files working :P
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on January 10, 2012, 08:03:56 pm
@Cardinal
Maybe you should write somewhere that hack command window should open automatically if everything is working correctly. I know it sounds silly, but I was re-installing DF, adding new mods etc. and in the end I haven't noticed that some of the files were overwritten. Then I spent whole 20 minutes trying to get this .dll files working :P
I assume you meant to direct that statement to peterix.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Lothiack Drake on January 10, 2012, 09:17:05 pm
Oh, and a bit of info for everyone:
DFHack now has more active developers than just me. This is awesome.

Internally, things are changing and you can expect a lot more from the future. Instead of using Memory.xml, dfhack will be switching to a better way of describing the game's data structures and generating code out of that. This means a lot more of DF can be exposed to plugins and greatly reducing the maintenance needed. It's already in place and working properly. For future releases, expect Memory.xml to be gone or at least reduced in size :)

If you are interested in how the internals of DF work, check out the new XML code here: https://github.com/angavrilov/df-structures

As for the approaching DF release, I think I'll release DFHack for 0.31.25 with the new system in place first and wait until the new DF stabilizes a bit. It might take some time to update DFHack for the new version anyway, because the amount of details exposed is HUGE in comparison to what the Memory.xml based system allowed. Still a lot better to work with.

There are exciting times ahead :)

Awesome! Will check the new code asap.
Any progress on the DFHack Client/Server with ZMQ and Proto?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on January 11, 2012, 12:22:12 am
Awesome! Will check the new code asap.
Any progress on the DFHack Client/Server with ZMQ and Proto?
No, not really. But I'd say the same approach of code generation should be applied. I'll see what can be done about that once I'm done with the semester's exams :P
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Wiro on January 12, 2012, 01:13:46 pm
How would I paint an open space (like the ones above rivers...I'm trying to make one) with tiletypes? Empty and air don't seem to re-create that tile type.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Cardinal on January 12, 2012, 03:12:10 pm
Is there a way to change a unit on the map from Friendly to a member of your Fortress?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: jerank on January 13, 2012, 02:51:38 pm
Hi, I posted in general but was told this would be a better place to ask. I'm wondering if there was anyone who could direct me how to modify DFhack to work with Deon's Genesis, as I'd quite like to use the dfusion options for multi-racial embarks.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Theropod Watcher on January 13, 2012, 06:42:48 pm
I seem to be having an issue here, on startup and in stderr.log it prints:
Loading hack\Memory.xml ... failed!
Error while reading Memory.xml:
error 2: Failed to open file, at row 0 col 0
DFHack will now deactivate.

What exactly can I do to fix whatever is going wrong?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on January 13, 2012, 09:12:53 pm
Hi, I posted in general but was told this would be a better place to ask. I'm wondering if there was anyone who could direct me how to modify DFhack to work with Deon's Genesis, as I'd quite like to use the dfusion options for multi-racial embarks.

Unless Deon changed the DF binary in some way (he didn't) there's no way for it not to work.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on January 13, 2012, 11:44:42 pm
I seem to be having an issue here, on startup and in stderr.log it prints:
Loading hack\Memory.xml ... failed!
Error while reading Memory.xml:
error 2: Failed to open file, at row 0 col 0
DFHack will now deactivate.

What exactly can I do to fix whatever is going wrong?
Is memory.xml actually in the "hack" subfolder? If not, you didn't install DFHack correctly.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: jerank on January 14, 2012, 03:06:17 pm
Hi, I posted in general but was told this would be a better place to ask. I'm wondering if there was anyone who could direct me how to modify DFhack to work with Deon's Genesis, as I'd quite like to use the dfusion options for multi-racial embarks.

Unless Deon changed the DF binary in some way (he didn't) there's no way for it not to work.

Okay, the issue I get is this. When running 'migrant', the following message occurs.

Loaded module @:3ca2498
Failure, DWARF not found!
Found @:1476331

I suppose my question is; how does this work. I ran these scripts from the embark screen, before choosing a site to embark on. Should I do this first? Also, the Embark Anywhere feature immediately crashes the game. When does 'migrant' and 'friendship' take effect? Do you get multirace immigrants or do you start out with them? As when I use 'friendship', I start out with regular dwarven castes.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Aerval on January 14, 2012, 06:02:22 pm
How would I paint an open space (like the ones above rivers...I'm trying to make one) with tiletypes? Empty and air don't seem to re-create that tile type.
I had problems with that one too.
What you can do is creating tiles of shape: ramp_top, material: air and then fix it with dfderamp (you might have to change skyview and so on as well.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: albatross on January 17, 2012, 01:54:41 pm
Any chance of ever getting a cheat for unassigning war/hunting dogs?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Telekinesis on January 21, 2012, 10:02:06 pm
I'm running Genesis mod and trying to spawn a tile of magma, or anything for that matter it just will not recognize the cursor (loo(k), finally found out which cursor it's not even told which one of the myriad of cursors available to use) it says it cannot find cursor coordinates, so I'm thinking perhaps it's not compatible with Genesis?  But the thing is it auto opens whith Deon's launching tool so someone must think it works with it.  or I could just be getting something wrong, I have it (k) on an open tile.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on January 21, 2012, 10:04:10 pm
Actually all cursors are the same cursor.

Anything that has a blinking yellow X is supposed to work. There's really no difference between them.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Telekinesis on January 21, 2012, 10:08:14 pm
"Anything that has a blinking yellow X is supposed to work."

k is solid, same with designate, which one blinks, I don;t remember seeing a blinking cursor.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rose on January 21, 2012, 10:11:59 pm
I'm a zombie, my brain is rotten, and I haven't fired up DF in yearsmonths.

It's the solid yellow X
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Telekinesis on January 21, 2012, 10:18:29 pm
"Anything that has a blinking yellow X is supposed to work."

k is solid, same with designate, which one blinks, I don;t remember seeing a blinking cursor.

-_-'  There was 2 Dwarf fortresses open somehow. Ive been transferring the folder of what soundsense uses and transferring over from LNP to Deon's launcher, somehow 2 got opened, I closed one and it seems to work now with the k command.  Even though the version of DF that was opened with Deon's launcher and DFhack was opened together DFhack still tried to use the one that was already opened I guess.  Thank you for the help though.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Yoink on January 26, 2012, 06:20:22 pm
Right... I know I've probably asked this before, but how do I change modes? :-\
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on January 27, 2012, 12:47:58 am
Right... I know I've probably asked this before, but how do I change modes? :-\
Run 'mode set' in the console when you have either a fortress or an adventurer active. Pick a mode from the list. Note that switching modes can be weird. The game doesn't really expect you to do so. Anyway, a sure way to switch from fortress mode is to pause, switch to arena mode, take control over a creature and then switch to adventure mode.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on January 27, 2012, 03:16:03 pm
Right... I know I've probably asked this before, but how do I change modes? :-\
Run 'mode set' in the console when you have either a fortress or an adventurer active. Pick a mode from the list. Note that switching modes can be weird. The game doesn't really expect you to do so. Anyway, a sure way to switch from fortress mode is to pause, switch to arena mode, take control over a creature and then switch to adventure mode.
or for an alternative way to switch from Fortress mode use Dfusion first set up the main adventurer(tools menu in dfusion should have something to help on that front), pause in the Esc menu, switch to adventurer mode, save. Coming back to the save you will be in Adventure mode(you may need to walk around to shake off the darkness) with the character you selected.
Though reclaim mode is bugged and you will not be able to switch modes in this for Dfhack think's it is in a menu state and won't grant you access.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Zanara on January 30, 2012, 01:55:02 pm
So, I just updated to this new version of DF hack, and stupidly deleated the old one without backing it up. I have overpopulated, starving fort right now, but a very well organized one (I blame a wave of 30(?!) migrants) Please, please tell me there is a function similar to DF Lair still included, so I don't have to spend 2 game years re-gathering all the items that will be scattered on abandoning the fort...
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on January 30, 2012, 05:11:47 pm
So, I just updated to this new version of DF hack, and stupidly deleated the old one without backing it up. I have overpopulated, starving fort right now, but a very well organized one (I blame a wave of 30(?!) migrants) Please, please tell me there is a function similar to DF Lair still included, so I don't have to spend 2 game years re-gathering all the items that will be scattered on abandoning the fort...
it's in DFusion under the Tools section.
to navigate through Dfusion you need to type the Number of the menu you want to go to.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Zanara on January 30, 2012, 07:13:16 pm
Very much appreciated, thank you!
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Aerval on February 04, 2012, 10:14:26 am
Just read on github:
Quote from: angavrilov
Implement pre-embark estimate in prospector.
Would it make it possible to prospect the minerals in an embark area before actually embarking? That would be awesome (I know that this has been in the normal version before the new vein maps)
Can't wait for the next release, will come with new df version?
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Quietust on February 04, 2012, 10:50:05 am
Just read on github:
Quote from: angavrilov
Implement pre-embark estimate in prospector.
Would it make it possible to prospect the minerals in an embark area before actually embarking? That would be awesome
That's exactly what it does - the game keeps track of what minerals are present in each biome (the material, the inclusion type, and some sort of frequency that isn't fully known), so prospect uses that information to make an educated guess as to how much of each mineral is present (and it's a pretty good guess, too).
Title: Re: DFHack 0.31.25 r8 (current)
Post by: squishynoob on February 04, 2012, 06:35:49 pm
Just tried the tool - very cool it looks.

But now a question - switching modes - in Adv. mode I may want to temporarily switch to another character - say, a follower. What I do is set mode to "Arena, controlling creature" (3), then ctrl-a to the main screen, "assume control" (k-a) of the follower, then set mode to "adventurer" (1). Then pick up armor, weapons and what not, and return to my main character in the same way.

But after I do, and want to save the game, the menu is messed up - it's that of Arena mode. Which doesn't let me save.
Is that due to a bug, the dreaded "unknown behavior" or just my plain n00bness? Is there a workaround?

I'm using the linux version, by the way.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: Rumrusher on February 05, 2012, 02:28:25 am
Just tried the tool - very cool it looks.

But now a question - switching modes - in Adv. mode I may want to temporarily switch to another character - say, a follower. What I do is set mode to "Arena, controlling creature" (3), then ctrl-a to the main screen, "assume control" (k-a) of the follower, then set mode to "adventurer" (1). Then pick up armor, weapons and what not, and return to my main character in the same way.

But after I do, and want to save the game, the menu is messed up - it's that of Arena mode. Which doesn't let me save.
Is that due to a bug, the dreaded "unknown behavior" or just my plain n00bness? Is there a workaround?

I'm using the linux version, by the way.
or you could just use Dfusion go to the Tools menu.
old(non dfhack) Dfusion has a better risk free adventurer change which only uses the ingame pointer. In fact you should not use arena mode for anything serious(be it for switching to adventure mode or switching bodies or anything else really.) until we get saving fixed and access to arena mode creature spawning.
Title: Re: DFHack 0.31.25 r8 (current)
Post by: peterix on February 05, 2012, 09:03:22 pm
Just tried the tool - very cool it looks.

But now a question - switching modes - in Adv. mode I may want to temporarily switch to another character - say, a follower. What I do is set mode to "Arena, controlling creature" (3), then ctrl-a to the main screen, "assume control" (k-a) of the follower, then set mode to "adventurer" (1). Then pick up armor, weapons and what not, and return to my main character in the same way.

But after I do, and want to save the game, the menu is messed up - it's that of Arena mode. Which doesn't let me save.
Is that due to a bug, the dreaded "unknown behavior" or just my plain n00bness? Is there a workaround?

I'm using the linux version, by the way.
or you could just use Dfusion go to the Tools menu.
old(non dfhack) Dfusion has a better risk free adventurer change which only uses the ingame pointer. In fact you should not use arena mode for anything serious(be it for switching to adventure mode or switching bodies or anything else really.) until we get saving fixed and access to arena mode creature spawning.
Unfortunately, DFusion doesn't work on linux all too well. It's not part of the linux releases either... I'd love to change that, but it's not a trivial task.


Anyway. There's a new release with a LOT of new and awesome stuff. Including automated job management tools, embark screen prospector and plenty others. Seriously, check it out :D

Next release will be probably targetted at the new DF version.
Title: Re: DFHack 0.31.25 r9
Post by: Silophant on February 05, 2012, 09:07:23 pm
Wow. These new tools are amazing.
Title: Re: DFHack 0.31.25 r9
Post by: Malt_Hitman on February 05, 2012, 09:07:29 pm
◦keybinding - allows binding any command to any key combo. For example, you can bind 'revtoggle' to a key and not bother with the console for reveal.

Thank you.  I can't recall how many times I've had to kill Dwarf Fortress because I'd forgotten to toggle reveal searching for a new site with specific mineral requirements.
Title: Re: DFHack 0.31.25 r9
Post by: peterix on February 05, 2012, 09:13:56 pm
Thank you.  I can't recall how many times I've had to kill Dwarf Fortress because I'd forgotten to toggle reveal searching for a new site with specific mineral requirements.
Well, now you can use prospector in the embark screen, so you know what's there even before you embark. No more problems with reveal :)

And really, you should be thanking Quietust and angavrilov, because this release wouldn't be possible without them. The massive internal changes I mentioned? All their work. This time I just fixed bugs and integrated changes. I was too busy with my math courses ;)
Title: Re: DFHack 0.31.25 r9
Post by: Jay on February 05, 2012, 10:01:18 pm
Just updated to r9.  Tried to use the dfusion command.
Code: [Select]
Error: Cannot convert non 'number' value to number
stack traceback:
  [C]: in function 'setPermissions'
  dfusion/common.lua:82: in function 'unlockDF'
  dfusion/init.lua:47: in main chunk
  [C]: in function 'setPermissions'
  dfusion/common.lua:82: in function 'unlockDF'
  dfusion/init.lua:47: in main chunk
  [C]: in function 'setPermissions'
  dfusion/common.lua:82: in function 'unlockDF'
  dfusion/init.lua:47: in main chunk
  [C]: in function 'setPermissions'
  dfusion/common.lua:82: in function 'unlockDF'
  dfusion/init.lua:47: in main chunk
Title: Re: DFHack 0.31.25 r9
Post by: peterix on February 05, 2012, 10:53:37 pm
Just updated to r9.  Tried to use the dfusion command.
Code: [Select]
Error: Cannot convert non 'number' value to number
stack traceback:
  [C]: in function 'setPermissions'
  dfusion/common.lua:82: in function 'unlockDF'
  dfusion/init.lua:47: in main chunk
  [C]: in function 'setPermissions'
  dfusion/common.lua:82: in function 'unlockDF'
  dfusion/init.lua:47: in main chunk
  [C]: in function 'setPermissions'
  dfusion/common.lua:82: in function 'unlockDF'
  dfusion/init.lua:47: in main chunk
  [C]: in function 'setPermissions'
  dfusion/common.lua:82: in function 'unlockDF'
  dfusion/init.lua:47: in main chunk

Try this:
https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r9a-Windows.zip

Nasty errors crept in when I was ripping out some old code... There's still some problem in the offset search dfusion plugin, but it shouldn't affect function of anything else...
Title: Re: DFHack 0.31.25 r9a
Post by: Greiger on February 05, 2012, 11:10:30 pm
Wait...fix wagons?  Fix elven diplomats?  Do those do what I think they do?

If so Eeeeeeeeeeeeeeee!
Title: Re: DFHack 0.31.25 r9a
Post by: uggi on February 06, 2012, 01:09:56 am
Reporting from Linux build, I had some troubles with previous versions of DfHack, but this one is excellent! Even stonesense and df2minecraft are working. Only one plugin is acting up: tidlers. With first run it moves the idlers display to the bottom of the screen, with second run it disappears completely, and after a few runs it goes really weird:

Code: [Select]
[DFHack]# help tidlers
tidlers: Toggle display of idlers.
[DFHack]# tidlers
Toggled the display of idlers to BOTTOM
[DFHack]# tidlers
Toggled the display of idlers to ?
[DFHack]# tidlers
Toggled the display of idlers to ?
[DFHack]# tidlers
Toggled the display of idlers to ?
[DFHack]# tidlers
Toggled the display of idlers to ?
[DFHack]# tidlers
Toggled the display of idlers to ?
[DFHack]# tidlers
Toggled the display of idlers to TEMPERATURE
[DFHack]# tidlers
Toggled the display of idlers to WEATHER
[DFHack]# tidlers
Toggled the display of idlers to ECONOMY
[DFHack]# tidlers
Toggled the display of idlers to ZERO_RENT
[DFHack]# tidlers
Toggled the display of idlers to AUTOSAVE_SEASONAL
[DFHack]# tidlers
Toggled the display of idlers to AUTOSAVE_YEARLY
[DFHack]# tidlers
Toggled the display of idlers to AUTOSAVE_PAUSE
[DFHack]# tidlers

Fixwagons, fixdiplomats and fixmerchants: do these work with existing worlds and fortresses?
Title: Re: DFHack 0.31.25 r9a
Post by: Rose on February 06, 2012, 01:12:35 am
Fixwagons, fixdiplomats and fixmerchants: do these work with existing worlds and fortresses?

Yes, that's what they're there for.
Title: Re: DFHack 0.31.25 r9a
Post by: peterix on February 06, 2012, 05:00:19 am
Only one plugin is acting up: tidlers. With first run it moves the idlers display to the bottom of the screen, with second run it disappears completely, and after a few runs it goes really weird...
Should be fixed now, in r9b.
Title: Re: DFHack 0.31.25 r9a
Post by: Rumrusher on February 06, 2012, 05:19:18 am
So any news on Fixed dwarf fortresses, Fixed elven fields, Fixed goblin towers?
Title: Re: DFHack 0.31.25 r9a
Post by: peterix on February 06, 2012, 05:30:08 am
So any news on Fixed dwarf fortresses, Fixed elven fields, Fixed goblin towers?
You mean proper map generation for sites? I'd say wait for the next DF release.
Title: Re: DFHack 0.31.25 r9a
Post by: Grax on February 06, 2012, 05:34:08 am
So any news on Fixed dwarf fortresses, Fixed elven fields, Fixed goblin towers?
I'd say wait for the next DF release.

...how many days?  ;D
Title: Re: DFHack 0.31.25 r9b
Post by: Radtoo on February 06, 2012, 05:35:20 am
Tiletypes is confusing me. A lot. Maybe not just me, seeing some messages in this thread.

What I noticed so far:
It does not seem to report invalid commands. Even every invalid command just reports the current settings.

There is a "help" feature, but not for the main commands "help filter" or "filter", just for the options. That help is available for the options would probably be better indicated in the title, like "Filter/paint options (see help [option] for details about individual options):" - not at the bottom.

The main command synopsis also is wrong. "filter / f [options]" really is like "filter / f [option] [option argument]", passing multiple options does not work.

I also do not seem able to paint into open space, or manage to place a material from a mod (mithril wall from masterwork df, for instance)? Maybe I missed something, or perhaps this is a tool to "change tiles" rather than "paint map tiles freely"?
Title: Re: DFHack 0.31.25 r9b
Post by: peterix on February 06, 2012, 06:08:11 am
Tiletypes is confusing me. A lot. Maybe not just me, seeing some messages in this thread.

What I noticed so far:
It does not seem to report invalid commands. Even every invalid command just reports the current settings.

There is a "help" feature, but not for the main commands "help filter" or "filter", just for the options. That help is available for the options would probably be better indicated in the title, like "Filter/paint options (see help [option] for details about individual options):" - not at the bottom.

The main command synopsis also is wrong. "filter / f [options]" really is like "filter / f [option] [option argument]", passing multiple options does not work.

I also do not seem able to paint into open space, or manage to place a material from a mod (mithril wall from masterwork df, for instance)? Maybe I missed something, or perhaps this is a tool to "change tiles" rather than "paint map tiles freely"?
The problem is that the way this works in DF is pretty confusing and the tool doesn't even try to hide that.

here's some examples:
Code: [Select]
paint sh wall
paint m soil
This will turn tiles into soil walls.

Code: [Select]
filter sh floor
paint sh ramp
This will turn floors into ramps of the same material (not fixing ramp tops. You have to add those too on the z-level above)

You can nullify any setting by using the value ANY:
Code: [Select]
filter sh ANY
Now, let's do something interesting:
Code: [Select]
filter sh SAPLING_OK
paint sh TREE_OK
Turning saplings into trees!

Tiles in the game are really represented by a number. The attributes used in tiletypes just try to make sense of what the number represents and turn it into something a bit more logical. Shape determines the general shape of the tile. Material the general material (not specific!). Variants add different look to tiles that would be otherwise uniform - there's 4 variants for every type of grass material, 4 variants for stone floors, etc. The special attribute is things that didn't fit the scheme.

Now, this has some limits and non-obvious problems. You can't use a specific material. Stone is fine. Soil is fine. Grass is fine for a subset of shapes. The final material is determined by local geology, the mineral veins present and map features (like hell and adamantine tubes). All materials it can use can be listed by using 'help mat'. All shapes by 'help sh'.

Your mod material isn't part of the tile type - you'd either have to have it as a layer stone or part of an already existing vein for it to be placeable by tiletypes... and then you'd only be able to replace already mined tiles, for example like this:
Code: [Select]
filter mat VEIN
filter sh FLOOR
paint sh WALL
Replace mined out veins with walls.

You definitely can paint tiles over empty space. It just has to exist first. The game divides its map into blocks of 16x16 tiles. If the block would be entirely empty (every tile is empty space), it doesn't even get created. You can see this with the 'k' cursor while looking above the terrain. If you get no description for a tile that should be empty space, its block isn't created. Tiletypes can't create such blocks. You'll have to build constructions up there first - build stairs into the sky for example.

Every other problem you have with it can be considered a bug.
Title: Re: DFHack 0.31.25 r9
Post by: orius on February 06, 2012, 07:32:26 am
Well, now you can use prospector in the embark screen, so you know what's there even before you embark. No more problems with reveal :)

And really, you should be thanking Quietust and angavrilov, because this release wouldn't be possible without them. The massive internal changes I mentioned? All their work. This time I just fixed bugs and integrated changes. I was too busy with my math courses ;)

Oh.  Now that is useful.  Instead of a cheat, I'm picturing it as the home civ sending out lone dwarf prospectors with a mule loaded down with tools and barrels and barrels of ale to look for excellent spots to colonize.

I see a copystock command listed in the readme.  Is that new?  I don't remeber seeing that on the command list before. That looks like a very useful function for stockpiles.  The job management functions look helpful as well.
Title: Re: DFHack 0.31.25 r9b
Post by: Aerval on February 06, 2012, 08:20:10 am
Thanks a lot for the new updates, some seem very useful for me.
Still have some questions:
What is the document format of the file exported by mapexport. Tried to open it with normal win editor but just got some weird stuff.
Can job-material also change the items needed in moods (since show-mood can display them), why is it only able of inorganic material (but recognizes organic materials too), still very nice tool
Feature request: save an reimport the job list of workflow
Title: Re: DFHack 0.31.25 r9b
Post by: ag on February 06, 2012, 08:31:01 am
Can job-material also change the items needed in moods (since show-mood can display them), why is it only able of inorganic material (but recognizes organic materials too), still very nice tool

'job item-material' can change any material; it is your responsibility to ensure that it makes sense when you use it. The job-material command on the other hand is intended for hotkeys, and thus very conservative not to break anything. It recognizes any material for use in its other feature, namely instant seek in the building material selection list.
Title: Re: DFHack 0.31.25 r9b
Post by: Ghills on February 06, 2012, 08:46:56 am
I love you all. This makes playing DF so much more fun it's incredible.

Since the new release is coming out sometime soon, do you have an idea how much work will need to be done to upgrade DFHack? I'm really, really reluctant to upgrade until DFHack works with the new version.
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 06, 2012, 08:56:52 am
It might take a few weeks to map out all of the new data structures (and fix the existing ones that changed). There's also the fact that the first few builds of the next DF release will probably be extremely buggy (case in point: 0.31 wasn't really "stable" until build 12), so we might just decide to wait several builds before starting work on it.
Title: Re: DFHack 0.31.25 r9b
Post by: Aerval on February 06, 2012, 09:10:21 am
Can job-material also change the items needed in moods (since show-mood can display them), why is it only able of inorganic material (but recognizes organic materials too), still very nice tool

'job item-material' can change any material; it is your responsibility to ensure that it makes sense when you use it. The job-material command on the other hand is intended for hotkeys, and thus very conservative not to break anything. It recognizes any material for use in its other feature, namely instant seek in the building material selection list.
Thanks for the response. Still I found no way to figure out how to, for example, make beds using stone boulders. I changed item-type 1 to BOULDER and item-material 1 to DIORITE but got a failure message in DF (not in the hack console) that there was no Diorite whereas my masons do not have this problem.
Also how can I make them using Logs for the reaction. I set item-material 1 (in the aforementioned bed creation) to CYPRESS and it would use cypress plant instead of logs. Where is my failure?
Title: Re: DFHack 0.31.25 r9b
Post by: ag on February 06, 2012, 09:22:39 am
Thanks for the response. Still I found no way to figure out how to, for example, make beds using stone boulders. I changed item-type 1 to BOULDER and item-material 1 to DIORITE but got a failure message in DF (not in the hack console) that there was no Diorite whereas my masons do not have this problem.
Also how can I make them using Logs for the reaction. I set item-material 1 (in the aforementioned bed creation) to CYPRESS and it would use cypress plant instead of logs. Where is my failure?

You can't expect to make the reaction take in whatever materials you want - this stuff is intended for tightening up the reagent filter where the built-in UI doesn't allow specifying the input materials with enough precision, e.g. for rock furniture & crafts. Everything else is at your own risk and dependent on the quirks of the implementation.

Cypress wood is "CYPRESS:WOOD"; "CYPRESS" is a shorthand for "CYPRESS:STRUCTURAL" in the raw syntax.

Also note that there is a bug in DF code that makes it ignore the precise subtype of creature or plant material unless the item type is also set.

P.S. Another example of a limitation: when an input reagent is intrinsically stored in a container, e.g. booze, leaves or flour for cooking, the technical reagent is the container, so you can't alter the selection of the contents at all. I.e. if you want to have booze or leaves cooked, you can set some reagents to require BARREL or BOX, and that's it.
Title: Re: DFHack 0.31.25 r9b
Post by: thewonderidiot on February 06, 2012, 11:57:52 am
What is the document format of the file exported by mapexport. Tried to open it with normal win editor but just got some weird stuff.

All of the weird stuff is because it's compressed with zlib, but even if you were to unzip it you wouldn't get much because it's a custom binary file format.  ;) Mapexport uses Google's Protocol Buffers (http://code.google.com/p/protobuf/) to save its data (as a precursor to the interprocess API that will eventually use protobufs as well).

The messages I'm using can be found here in the DFHack repository (https://github.com/peterix/dfhack/tree/master/plugins/mapexport/proto). The method for writing them is as follows:


All of that is into a coded output stream with an underlying GzipOutputStream. I decided to zip it because DF map information is highly repetitive and simple zip gave me a compression ratio of 1/50.  :)

Reading it works almost exactly the same way. For some sample reading code, this is how I implemented mapexport file reading in my visualizer (http://code.google.com/p/fortressoverseer/source/browse/Overseer/LoadingState.cpp).

All that said, mapexport doesn't yet put out buildings, items, creatures, grass types, contaminants, and probably some other things, so it's still a work in progress. I don't foresee having to change the basic format (most of that information should fit happily inside either the map messages or the tile messages), but I can't quite guarantee that yet.  ::)
Title: Re: DFHack 0.31.25 r9b
Post by: squishynoob on February 06, 2012, 02:18:02 pm
For curiosity, what was used to get the addresses in Linux?

Is there a console command I can use to display the value of, or in general play with, the memory locations in offsets.log?
Title: Re: DFHack 0.31.25 r9b
Post by: BigFatStupidHead on February 06, 2012, 04:48:07 pm
This new stuff is fantastic! A few questions, though.
With 'fixwagons, fixdiplomats, and fixmerchants', are these changes persistent or would they have to be run each time you load your world?

Using workflow, does it understand that wood can be made into charcoal? There is no coal on my current map, and workflow has not given any jobs to my woodburner. It just kicked in. What is the name setting large pot production?

And do I need to redo my workflow settings each time I start DFhack or are the settings saved somehow? Thanks!


Title: Re: DFHack 0.31.25 r9b
Post by: Aerval on February 06, 2012, 05:35:57 pm
Spoiler (click to show/hide)
Thanks for the detailed answer. Just had a quick view into the unziped file now and got at least some less weird results ;)
Will have a look into it again when my exams are over
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 06, 2012, 10:20:21 pm
With 'fixwagons, fixdiplomats, and fixmerchants', are these changes persistent or would they have to be run each time you load your world?
They are permanent - you can run them in one fortress, and they will continue to be effective even after that fortress is destroyed/abandoned and you reclaim it or embark somewhere else (in the same world).
Title: Re: DFHack 0.31.25 r9b
Post by: peterix on February 07, 2012, 03:26:34 am
For curiosity, what was used to get the addresses in Linux?
Tools like IDA Pro, evan's debugger, gdb and a few others.
Is there a console command I can use to display the value of, or in general play with, the memory locations in offsets.log?
Nope. And you shouldn't do that because looking at invalid memory from the same process = crash :) offsets.log is almost the same thing as memory.xml, and that is now largely obsolete (and likely won't be even there in the next release). Everything is now generated from xml files from here: https://github.com/angavrilov/df-structures
To use the xml files for looking at DF data, you should use angavrilov's super cool GUI.

First, grab the DFHack sources using git, along with the submodules:
Code: [Select]
git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update
Then go into library/xml/ and:
Code: [Select]
git clone git://github.com/angavrilov/cl-linux-debug.git
wget https://github.com/downloads/angavrilov/cl-linux-debug/sbcl-runtime.bz2
bzip2 -d sbcl-runtime.bz2

Now run DF in a second terminal and use something like htop or top in a third terminal to determine DF's PID.
Run ./start.sh from library/xml/, feed the program the PID number you got.

Now you can look at DF data, in a very awesome way, powered by LISP, which is totally hardcore ;) If you run into problems, visit us in the IRC channel.
/me hopes he didn't miss anything

And do I need to redo my workflow settings each time I start DFhack or are the settings saved somehow? Thanks!
The settings and on/off state should be saved as part of your world (it creates fake historical figures to store its data).  You may have to reset the settings manually when your fortress crumbles and you start a new one though.
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 07, 2012, 09:05:23 am
/me hopes he didn't miss anything
Technically, you don't need to get all of DFHack - you just need df-structures:
Code: [Select]
git clone git://github.com/angavrilov/df-structures.git
cd df-structures
git clone git://github.com/angavrilov/cl-linux-debug.git
wget https://github.com/downloads/angavrilov/cl-linux-debug/sbcl-runtime.bz2
bzip2 -d sbcl-runtime.bz2
You'll also need to do `chmod +x sbcl-runtime`, otherwise it probably won't run.

Getting Dwarf Fortress's PID can also be done with `ps x` (with an optional ` | grep Dwarf` to filter out other stuff from your window manager).
Title: Re: DFHack 0.31.25 r9b
Post by: EngineerFromHell on February 07, 2012, 09:08:40 am
I still don't get how to actually paint tiles with tiletypes. After I enter something like paint sh wall; paint m soil, what should I do next?
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 07, 2012, 11:07:53 am
Select the "k" cursor in-game, move it over the tile you want to update, then go to the DFHack console and just press Enter (just like with the Liquids tool).
Title: Re: DFHack 0.31.25 r9b
Post by: Silophant on February 07, 2012, 05:24:17 pm
Maybe I'm just dumb, but I can't get the jobs plugin to work. Can someone give me the exact syntax for, say changing a stone statue's material to marble?
Title: Re: DFHack 0.31.25 r9b
Post by: Steelweaver on February 08, 2012, 12:32:00 am
Where i can find marerials id ? For example to change a log material from mapple to oak. Searching the dfhack sourcecode gives nothing  :(.
Title: Re: DFHack 0.31.25 r9a
Post by: Putnam on February 08, 2012, 12:35:19 am
So any news on Fixed dwarf fortresses, Fixed elven fields, Fixed goblin towers?
You mean proper map generation for sites? I'd say wait for the next DF release.

Those sites have been confirmed to not be fixed in the next version. If they're not fixed, that means that proper map generation for them is even LESS possible for DFhack to do than it is in the current version.
Title: Re: DFHack 0.31.25 r9b
Post by: ag on February 08, 2012, 01:42:53 am
Where i can find marerials id ? For example to change a log material from mapple to oak. Searching the dfhack sourcecode gives nothing  :(.

How do you mean 'change a log material'? There is no command to change the material of an existing item, you can only change the input material constraints in jobs, e.g. to make beds only of oak.

Regarding the material and item tokens, dfhack uses the raw syntax:

http://df.magmawiki.com/index.php/Item_token (http://df.magmawiki.com/index.php/Item_token)
http://df.magmawiki.com/index.php/DF2010:Material_token (http://df.magmawiki.com/index.php/DF2010:Material_token)

Except for the following modifications:


Consequently, the oak wood material would be PLANT_MAT:OAK:WOOD, or just OAK:WOOD.
Title: Re: DFHack 0.31.25 r9b
Post by: Steelweaver on February 08, 2012, 03:37:49 am
Where i can find marerials id ? For example to change a log material from mapple to oak. Searching the dfhack sourcecode gives nothing  :(.

How do you mean 'change a log material'? There is no command to change the material of an existing item, you can only change the input material constraints in jobs, e.g. to make beds only of oak.

Regarding the material and item tokens, dfhack uses the raw syntax:

http://df.magmawiki.com/index.php/Item_token (http://df.magmawiki.com/index.php/Item_token)
http://df.magmawiki.com/index.php/DF2010:Material_token (http://df.magmawiki.com/index.php/DF2010:Material_token)

Except for the following modifications:

  • Instead of writing NONE as the subtype, you omit it.
  • You may omit the INORGANIC, CREATURE_MAT and PLANT_MAT prefixes if it doesn't result in ambiguity (e.g. due to there being a plant and creature with the same ID)
  • PLANT_MAT:FOO:STRUCTURAL may be abbreviated to just FOO
  • Currently there is no support for subtypes of COAL, METAL & STONE aliases for INORGANIC, USE_LAVA_STONE, etc.

Consequently, the oak wood material would be PLANT_MAT:OAK:WOOD, or just OAK:WOOD.

Thanks for reply, actually i mean a tool in dfusion wich allow item material editing, it says that for example a log lying on the ground has material id=420 (MAPPLE) when i change it to 421 i get log of "unknown frozen material substance". So actually i want an enum number for material.
Title: Re: DFHack 0.31.25 r9b
Post by: ag on February 08, 2012, 05:17:21 am
Thanks for reply, actually i mean a tool in dfusion wich allow item material editing, it says that for example a log lying on the ground has material id=420 (MAPPLE) when i change it to 421 i get log of "unknown frozen material substance". So actually i want an enum number for material.

There isn't any such thing - it's a pair of numbers, and their meaning depends on what is in the raws, and in what order. In particular, 420 just means plant submaterial #2 (counting from 1). MAPLE obviously has only 2 submaterials, so 421 is naturally undefined. Look at MaterialInfo::decode(int16_t type, int32_t index) in the source to see exactly how the numbers work.
Title: Re: DFHack 0.31.25 r9b
Post by: Steelweaver on February 08, 2012, 11:58:35 am
Ohoho, is there a simple way to recieve human readable name for item material via dfhack?

Code: [Select]
std::string description;
item->getItemDescription(&description, 0);
c->con.print("0x%x %s (wear %d)",
item,
description.c_str(),
item->getWear()
);

Am i right?
Title: Re: DFHack 0.31.25 r9b
Post by: nomad_delta on February 08, 2012, 01:06:32 pm
hooray! thank you dfhack devs, I am super excited about this new version!

in particular:

copystock - copies the parameters of the currently selected stockpile to the custom stockpile settings. Copy&paste those stockpiles!

holy crap this is awesome! this is going to be so useful!  one thing I hope DF will eventually integrate is the ability to save custom stockpile settings as templates *permanently* between worlds and forts, sort of like we already can with macros.  I tend to use the same custom stockpile types in every fort, but it's a pain setting them up every time.  This will help hold me over 'til that happens.  :)

dwarfexport - export dwarves to RuneSmith-compatible XML (for use with dwarf guidance counsellor).

I use Dwarven Guidance Counselor pretty extensively, and this will save me so much time!  Way better than having to open RuneSmith, go through the export menu, and select the custom export settings for Race, Attributes, and Traits and specify an export file path every time around.

Thanks!

--nomad_delta



Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 08, 2012, 01:27:25 pm
Ohoho, is there a simple way to recieve human readable name for item material via dfhack?

Code: [Select]
std::string description;
item->getItemDescription(&description, 0);
c->con.print("0x%x %s (wear %d)",
item,
description.c_str(),
item->getWear()
);

Am i right?

That code will give you the name of the item itself (e.g. "Plant barrel (acacia)") - if all you want is the material, then do this:
Code: [Select]
MaterialInfo info;
info.decode(item);
c->con.print("Item is made of %s\n", info.toString().c_str());
Title: Re: DFHack 0.31.25 r9b
Post by: Neowulf on February 08, 2012, 06:09:22 pm
Just a heads up, I just had a fortress act a bit weird. A new fortress genned yesterday using the my little pony mod and the latest dwarfhack.
Grass/shrubs/trees did not grow in my mined out soil layers until I breached the 3rd cavern, 1 and 2 did nothing (both were overgrown with plant life).
And now I just lost an master lumberjack/herbalist to a failed mood, even though he had every item showmood reported and I had an abundance of all the mood materials leftover (as reported by both showmood and the workshop (q)uery). Mood construction just never started. The workshop he took was a magma forge with a repeat lead bins job workflow had suspended.


BTW, what is the correct item ID for workflow to keep a reserve of large pots?
Title: Re: DFHack 0.31.25 r9b
Post by: Yaotzin on February 08, 2012, 06:25:44 pm
Quote
prospector tool now works in the embark screen
misunderstood this. It's sweet!

How do the Z levels in the prospector work?
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 08, 2012, 08:24:14 pm
And now I just lost an master lumberjack/herbalist to a failed mood, even though he had every item showmood reported and I had an abundance of all the mood materials leftover (as reported by both showmood and the workshop (q)uery). Mood construction just never started. The workshop he took was a magma forge with a repeat lead bins job workflow had suspended.
Are you sure that the mysterious construction never started? It has been observed on several occasions that if, after construction has started, you forbid the primary material for the mood (in this case, the metal bars), then the artifact will never be completed and the dwarf will go insane.

BTW, what is the correct item ID for workflow to keep a reserve of large pots?
TOOL:ITEM_TOOL_LARGE_POT
Title: Re: DFHack 0.31.25 r9b
Post by: Rumrusher on February 09, 2012, 04:05:06 am
Thanks for reply, actually i mean a tool in dfusion wich allow item material editing, it says that for example a log lying on the ground has material id=420 (MAPPLE) when i change it to 421 i get log of "unknown frozen material substance". So actually i want an enum number for material.

There isn't any such thing - it's a pair of numbers, and their meaning depends on what is in the raws, and in what order. In particular, 420 just means plant submaterial #2 (counting from 1). MAPLE obviously has only 2 submaterials, so 421 is naturally undefined. Look at MaterialInfo::decode(int16_t type, int32_t index) in the source to see exactly how the numbers work.
well I have a series of code for dfusion that searches for a material through name, though I only have it set up for looking up submat2 based items and I haven't tested it on wood.

Code: [Select]
function editMaterial(offset)
mattbl=mattbl or BuildMaterialTable() -- could be slow so if there is a table don't do it again
print("Mat id 0 to 18 is in normal materials (inorganic, amber etc...) after that creature mat (with submat2 being race)")
print("from 219 with submat2=0xffffffff (type not a number) it reads legends id, from 419  submat2 means plant id")
print("Probably submat is not used :? ")
mat=engine.peek(offset,ptr_item.mat)
submat=engine.peek(offset,ptr_item.submat)
submat2=engine.peek(offset,ptr_item.submat2)
lid=engine.peek(offset,ptr_item.legendid)
print(string.format("Now is mat=%d, submat=%d submat2=%d legend id=%d",mat,submat,submat2,lid))
--print("Enter mat:")
print("Enter submat2:")
id=io.stdin:read()
--q=mattbl[id]
--if q==nil then return end
--print("Enter submat:")
--v=mattbl[id]
--if v==nil then v=0xffff end
z=mattbl[id]
if z==nil then z=0xffffffff end
--print("Enter legendid:")
--y=tonumber(io.stdin:read())
--if y==nil then y=0xffffffff end
--engine.poke(offset,ptr_item.mat,q)
--engine.poke(offset,ptr_item.submat,v)
--engine.poke(offset,ptr_item.legendid,y)
engine.poke(offset,ptr_item.submat2,z)
print("Done")
end
Title: Re: DFHack 0.31.25 r9b
Post by: ag on February 09, 2012, 06:30:43 am
well I have a series of code for dfusion that searches for a material through name, though I only have it set up for looking up submat2 based items and I haven't tested it on wood.

Hm, there are no universal mat_type/mat_index fields in items either - the only way to read or write them for all items is by calling virtual methods:

https://github.com/angavrilov/df-structures/blob/master/df.items.xml (https://github.com/angavrilov/df-structures/blob/master/df.items.xml)
Title: Re: DFHack 0.31.25 r9b
Post by: EngineerFromHell on February 09, 2012, 09:28:51 am
If I use "friendship" option from dfusion or any other allowing non-dwarves to act like dwarves how to get an appropriate armor for them? Will human armorsmith forge *Large* armor pieces?
Title: Re: DFHack 0.31.25 r9b
Post by: Neowulf on February 09, 2012, 11:17:21 am
Are you sure that the mysterious construction never started? It has been observed on several occasions that if, after construction has started, you forbid the primary material for the mood (in this case, the metal bars), then the artifact will never be completed and the dwarf will go insane.
Yeah, I watched it happen. t over the shop showed he had 2 bars of silver, 1 piece of silk cloth, 1 cut milk quartz, 2 logs, and a marble boulder. Exactly what showmood reported and what the query said was needed (the boulder was the final demand before looping back to metal bars again). None of it was forbidden, and I had extras of all those (about 20 extra silver bars, a lot more metal, atleast 10 more silk, lots of other cloth, a dozen cut gems, and over two thousand extra stone and wood).

TOOL:ITEM_TOOL_LARGE_POT
Odd, I tried that. I'll try again. Thanks.
Title: Re: DFHack 0.31.25 r9b
Post by: ag on February 09, 2012, 02:40:58 pm
TOOL:ITEM_TOOL_LARGE_POT
Odd, I tried that. I'll try again. Thanks.

If the report produced by 'workflow' says "(no jobs)" opposite this entry, it might not be able to detect the jobs that produce the pots. Come to think of it, I haven't actually tested it with tools. Although I did test ammo, and it shouldn't be much different.
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 09, 2012, 02:55:23 pm
I just tested it, and it works fine - I added a job for "Make rock Pot" and set it to repeat, and "job 98: MakeTool [rock]" showed up in the list (and a repeat job for "Make rock Hive" did not show up).
Title: Re: DFHack 0.31.25 r9b
Post by: Dwemeral on February 10, 2012, 11:09:51 pm
I have a queston for the tiletypes function. I have this spot that I want use as my storage place but the problem is that there are rock materials there preventing me from using piles function. How would I go about erasing the rocks and material I dung up there so I can but piles there?

edit: I also want to put some copper ores around.
Title: Re: DFHack 0.31.25 r9b
Post by: junius on February 11, 2012, 02:18:05 am
When I type spot clean into the DF Hack I get a message "Could not invoke spotclean: unsuitable UI state".

I'm assuming that in DF game i have the incorrect curser over the area i want to be cleaned. I have tryed "k" look around and "v" view.

So the question is how to I indicate the tile to be cleaned for DFHack?


Alternatively if someone is aware of a crashing issue for "clean map" that can be fixed.

thanks Junius

Title: Re: DFHack 0.31.25 r9b
Post by: Caldfir on February 11, 2012, 02:52:18 am
Aww yeah, baby. 

Finally figured out why cmake was screeching unintelligible warble-garble errors at me.  Now all is right with the world. 
Title: Re: DFHack 0.31.25 r9b
Post by: peterix on February 11, 2012, 08:44:07 pm
I have a queston for the tiletypes function. I have this spot that I want use as my storage place but the problem is that there are rock materials there preventing me from using piles function. How would I go about erasing the rocks and material I dung up there so I can but piles there?
If you don't want to cheat, dump the rocks on a pile elsewhere. If you do want to cheat, just use autodump (mark items for dumping, put cursor over a tile, autodump).
edit: I also want to put some copper ores around.
Nope. Not possible. Not with the current plugins.
When I type spot clean into the DF Hack I get a message "Could not invoke spotclean: unsuitable UI state".

I'm assuming that in DF game i have the incorrect curser over the area i want to be cleaned. I have tryed "k" look around and "v" view.
So the question is how to I indicate the tile to be cleaned for DFHack?
'k' should work.
Alternatively if someone is aware of a crashing issue for "clean map" that can be fixed.
Hmm? Oh.

Do this: go into your DF folder and delete the 'hack' folder. Then reinstall the current version of DFHack. You probably have old, incompatible plugins in there...
Title: Re: DFHack 0.31.25 r9b
Post by: Girlinhat on February 11, 2012, 11:00:20 pm
I absolutely love the workflow tools.  Changes everything.  Only issue is that the readme doesn't have much info on exactly how to use it.  Had some issues getting job item-material to work, the purpose of <item-idx> wasn't readily apparent.  An example or two would be very nice.

EDIT: Also, for my wish-list, I want a flood tool that designates.  Specifically, I'm mining marble for my fort and building it into blocks to apply to construction.  vdig is amazing, but ignores layer stone.  I'd like a tool where you put the cursor somewhere, and type "flood-dig MARBLE" and it spreads a flood out, and any MARBLE it touches is then marked to be dug out.  Of course this could apply to any material, so any layer stone could be excavated away and hoarded.  Building material and flux stocking are very valid uses for this.

DOUBLE-EDIT: How do I set up a workflow to dye thread?
Title: Re: DFHack 0.31.25 r9b
Post by: ag on February 12, 2012, 01:17:31 am
DOUBLE-EDIT: How do I set up a workflow to dye thread?

You can't. Decorations aren't tracked by it in any way. You can make it keep a stash of cloth, thread and dye, set workshop orders to use only dyed cloth, and add a repeat dye job (it'll protect it from disappearing for free). Then enable the dye job when you see it announce that it resumes making cloth.
Title: Re: DFHack 0.31.25 r9b
Post by: Girlinhat on February 12, 2012, 02:08:27 am
Yet clearly the trick of "is it dyed or not" is tracked somewhere, because workshop orders allow you to distinguish "use dyed cloth only".  Perhaps a memory-light way would be to check for thread with any decorations, not specifically dyes.  Thread will only ever naturally be decorated via dye, any other decorations would have to be modded in.  So, instead of checking, "Does this have red, blue, black, silver, or green dye?" it could instead check "Does this have anything?"  That's ultimately the only thing I found missing, otherwise a streamlined textile production would be very easy and powerful.

Although I must say, using the job item-material tool and repeating job orders is fun.  Can specifically order to keep honey-coated goat liver with ale in stock, by setting a kitchen's order to change the materials requested, and then setting a workflow to keep meals stocked.  It also makes very high-value food production easier, just order a kitchen to use dwarven syrup, rock nut leaves, and whatever else you need to balance value vs. stack size to make valuable meals and boost dwarven morale or conduct hilariously lucrative trade.
Title: Re: DFHack 0.31.25 r9b
Post by: ag on February 12, 2012, 03:02:32 am
Yet clearly the trick of "is it dyed or not" is tracked somewhere, because workshop orders allow you to distinguish "use dyed cloth only".  Perhaps a memory-light way would be to check for thread with any decorations, not specifically dyes.  Thread will only ever naturally be decorated via dye, any other decorations would have to be modded in.  So, instead of checking, "Does this have red, blue, black, silver, or green dye?" it could instead check "Does this have anything?"  That's ultimately the only thing I found missing, otherwise a streamlined textile production would be very easy and powerful.

I mean that decorations don't fit in the constraint model of workflow, because instead of destroying a set of items, and creating some items of a different type like ordinary manufacturing jobs do, they modify existing items - and this is mostly just a cosmetic modification too.

Although I must say, using the job item-material tool and repeating job orders is fun.  Can specifically order to keep honey-coated goat liver with ale in stock, by setting a kitchen's order to change the materials requested, and then setting a workflow to keep meals stocked.  It also makes very high-value food production easier, just order a kitchen to use dwarven syrup, rock nut leaves, and whatever else you need to balance value vs. stack size to make valuable meals and boost dwarven morale or conduct hilariously lucrative trade.

You can't change it to use specific booze or leaves, though - you can only require that the stuff be in BARRELs, or BOXes. And if you set the material, it'll be checked against the container, e.g. "cancelled: no cookable frozen dwarven wine barrel". The only way I can think of is to tweak the jobs producing the ingredients to store them in containers of specific material, and use that as a proxy.
Title: Re: DFHack 0.31.25 r9b
Post by: etgfrog on February 14, 2012, 08:51:28 pm
its probably still too early to know...but does it still work with the current version or will it require an update?

yea...figured i'd just try it anyways...doesn't work, so i guess i'll have to wait for an update...
Title: Re: DFHack 0.31.25 r9b
Post by: NecroRebel on February 14, 2012, 09:17:05 pm
its probably still too early to know...but does it still work with the current version or will it require an update?

yea...figured i'd just try it anyways...doesn't work, so i guess i'll have to wait for an update...
The assorted data points that DFHack and other utilities use to do what they do change from version to version. It usually takes a few days to a week or so to identify how they've changed enough to make the utilities functional again whenever a new version is released, though sometimes it's quite a bit quicker. Eventually, somebody will probably find and post some of the offsets, which one could then put into one of the program's .xml files to make the existing versions of DFHack at least partially work, and a while after that a full new release of DFHack will happen.

This process is sometimes interrupted if it turns out that the latest version of Dwarf Fortress is extremely buggy and likely to be updated quickly anyway, but it'll probably be a priority for peterix and crew to get a 34.x version out, so there probably will be an official release for 34.01.
Title: Re: DFHack 0.31.25 r9b
Post by: Rose on February 14, 2012, 09:20:29 pm
Unfortunately, the really long time since the release before this one was spent removing any and all usage of the memory.xml file, so that no longer holds true. The guys are still finding the offsets, but it's no longer just a matter of replacing one file to make it work. You need to update the entire DFhack.
Title: Re: DFHack 0.31.25 r9b
Post by: peterix on February 14, 2012, 11:16:09 pm
Unfortunately, the really long time since the release before this one was spent removing any and all usage of the memory.xml file, so that no longer holds true. The guys are still finding the offsets, but it's no longer just a matter of replacing one file to make it work. You need to update the entire DFhack.
Or rather, we went from having a few pointers into DF's memory and hand written code to describing DF's memory structures in a different language, generating code needed to access the data. The difference in stuff available is an order of magnitude, the maintenance required is yet to be determined. On one hand it adds a lot of things that need checking for correctness, on the other, it makes updating the code trivial.
Title: Re: DFHack 0.31.25 r9b
Post by: MonkeyHead on February 15, 2012, 04:02:58 am
PTF for new version...  :)
Title: Re: DFHack 0.31.25 r9b
Post by: Babylon on February 15, 2012, 04:42:43 am
PTF for new version...  :)

me too.
Title: Re: DFHack 0.31.25 r9b
Post by: LoSboccacc on February 15, 2012, 09:57:52 am
is there any starting point on how to develop a dfhack plugin?
Title: Re: DFHack 0.31.25 r9b
Post by: zanchito on February 15, 2012, 04:24:58 pm
is there any starting point on how to develop a dfhack plugin?
This, please!
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 15, 2012, 04:50:27 pm
Yes - it's called the "skeleton plugin", and it can be found in a subdirectory of the plugins source directory.
Title: Re: DFHack 0.31.25 r9b
Post by: zanchito on February 15, 2012, 05:08:44 pm
Thanks!
Title: Re: DFHack 0.31.25 r9b
Post by: LoSboccacc on February 15, 2012, 05:09:23 pm
Yes - it's called the "skeleton plugin", and it can be found in a subdirectory of the plugins source directory.

ty
Title: Re: DFHack 0.31.25 r9b
Post by: Naros on February 15, 2012, 10:12:34 pm
I just dropped in to say; <3
Title: Re: DFHack 0.31.25 r9b
Post by: terkiey on February 16, 2012, 10:48:10 am
I love DFHack and all, but my virus scanner found 6 plugins that had trojans in them.. that needs to be fixed.
Title: Re: DFHack 0.31.25 r9b
Post by: Yaotzin on February 16, 2012, 10:50:33 am
Memory editing tools have a rather strong tendency to cause false positives in virus scanners.
Title: Re: DFHack 0.31.25 r9b
Post by: Rumrusher on February 16, 2012, 11:31:47 am
well was it the old dfhack or new one?
Title: Re: DFHack 0.31.25 r9b
Post by: Caldfir on February 16, 2012, 01:17:55 pm
Memory editing tools have a rather strong tendency to cause false positives in virus scanners.
To be perfectly fair, in general, programs shouldn't be messing with eachother's memory.  This is what viruses frequently exploit to do bad things.  Virus scanners look for access patterns like these and report them as viruses. 

On the other hand, the new version of dfhack should be accessing the memory from inside a memory library linked to the process, so as time goes on these false positives might reduce in frequency.  It isn't likely something that can ever go away though, without dwarf fortress explicitly supporting memory editing, and that doesn't seem likely. 

In some sense, dfhack is a memory hack, so your virus scanner is completely correct.  It is going to screw around with some piece of memory that doesn't belong to it.  The virus scanner, however, doesn't realize that this access is non-malicious, and in fact intentional on the part of the user. 
Title: Re: DFHack 0.31.25 r9b
Post by: Girlinhat on February 16, 2012, 01:23:14 pm
In some sense, dfhack is a memory hack, so your virus scanner is completely correct.

In every way, actually.  It's "DFHack" and the "Hack" is not for show.  The purpose of this program is to break open active memory and fiddle with data values.  It's a hacking tool and it acts just like a virus.  In that regard it's always going to throw flags with antivirus, because antivirus isn't smart on intentions.  Your antivirus isn't aware that "this program is working as intended and the user wants this to happen".  All you can do is ignore it or flag it as safe (if your antivirus allows you to do that) because in order to do what it's supposed to do, DFHack will paint itself as a Hack.
Title: Re: DFHack 0.31.25 r9b
Post by: Rumrusher on February 16, 2012, 01:55:45 pm
But was it the old Dfhack or the new one? Because peterix had fix the issue with false positives by having the program act like a part of DF.
If your having troubles with Neo Dfhack getting flagged then their some problems if we update Neo DFhack.
Title: Re: DFHack 0.31.25 r9b
Post by: Yaotzin on February 16, 2012, 03:17:25 pm
Will DFHack take a while to be updated or is it easy and should be done shortly?
Title: Re: DFHack 0.31.25 r9b
Post by: Askot Bokbondeler on February 16, 2012, 03:20:05 pm
i suppose it will be on a plugin by plugin basis. some of them should update quickly, some others might take months, or even be lost to time
Title: Re: DFHack 0.31.25 r9b
Post by: tahujdt on February 16, 2012, 04:19:25 pm
NOOOOOOOOOOOOOOOOOOOOOO!!!!!!!!!!!!!! I can't use Dfhack for the new version! NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO(Pauses to take breath)OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Title: Re: DFHack 0.31.25 r9b
Post by: Babylon on February 16, 2012, 10:37:59 pm
posting to watch for update to .34
Title: Re: DFHack 0.31.25 r9b
Post by: peterix on February 16, 2012, 11:41:10 pm
There will be an update when the 'Untouched' list is empty (or at least when the more useful stuff from it is updated/looks fine): https://github.com/peterix/df-structures/blob/master/ToUpdate-v0.34.01.txt

Some of the simpler plugins already work.
Title: Re: DFHack 0.31.25 r9b
Post by: simonthedwarf on February 17, 2012, 03:55:03 am
can you update the map reveal?
Title: Re: DFHack 0.31.25 r9b
Post by: Rumrusher on February 17, 2012, 06:26:36 am
here is a rough guide to explain how to change from adventure mode to fort mode and vice versa
Spoiler (click to show/hide)
Title: Re: DFHack 0.31.25 r9b
Post by: Weaselcake on February 17, 2012, 06:22:08 pm
Wishing this would work.

I need my prospect. :(
Title: Re: DFHack 0.31.25 r9b
Post by: Meph on February 17, 2012, 06:29:46 pm
ABSOLUTELY UNRELATED TO THE NEW DF VERSION:

Big question: Can the program linked to read out the gamelog, similar to soundsense ? What I thought of is this: Make the hacks a part of a mod. For example: Make a research lab that can, for a high amount of resources, run a prospect for example. This way it is not cheating, but dwarven science. Through incredible science (like the bookkkeeper who knows every stock, even for the future) you can predict what resources you have on the map.

Of course that would require a custom edition of dfhack, where the "normal" option to start a script is disabled.

In detail:
Make a custom building
Make a custom reaction that has a low chance to produce an item call: prospect papers. This needs a lot of reagents.
The gamelog will now write: Dwarf X has created a "prospect paper"
The gamelog is read by dfhack (similar to how soundsense works for the right sound effects)
Dfhack automatically runs: prospect
Done.

All this could be explained by science or religion. "View of Armok" = unreveal for 30 seconds. "Blessing of Speed" = fastdwarf for 30 seconds. "Dirty elven magic" = grow... and so on.

Would this be possible ? And if it is way too much work for you guys, could you please point me in the right direction for modding dfhack myself ? I have no programming experience, but I managed to re-write the LazyNewbPack to suit my needs, and is now my Settings-program for my mod. Deon (from Genesis) uses this idea now as well, for his Modloader.
Title: Re: DFHack 0.31.25 r9b
Post by: NecroRebel on February 17, 2012, 07:04:51 pm
Wishing this would work.

I need my prospect. :(
You don't have to play without it, you know. I'm so particular about what my embarks are like that I practically need Reveal to figure out whether an embark is suitable or not, but I haven't had to play a single second of the new version of DF without having it available. I get around the lack of DFHack compatibility with the latest version by not playing the latest version. I've waited nearly a year to play a new version, another week isn't going to kill me.

Whining about it won't help.
Title: Re: DFHack 0.31.25 r9b
Post by: SalmonGod on February 17, 2012, 07:07:37 pm
Wishing this would work.

I need my prospect. :(
You don't have to play without it, you know. I'm so particular about what my embarks are like that I practically need Reveal to figure out whether an embark is suitable or not, but I haven't had to play a single second of the new version of DF without having it available. I get around the lack of DFHack compatibility with the latest version by not playing the latest version. I've waited nearly a year to play a new version, another week isn't going to kill me.

Whining about it won't help.

BUT IT'S SO SHINY
Title: Re: DFHack 0.31.25 r9b
Post by: NecroRebel on February 17, 2012, 07:14:35 pm
BUT IT'S SO SHINY
True, and just looking at thread titles in the gameplay questions and dwarf mode threads gets me more excited about DF than I've been in months, but yet I continue to restrain myself. It's entirely possible to accomplish ::)
Title: Re: DFHack 0.31.25 r9b
Post by: SalmonGod on February 17, 2012, 07:20:21 pm
I know.  Just having some fun :)
Title: Re: DFHack 0.31.25 r9b
Post by: Rumrusher on February 17, 2012, 07:44:22 pm
I wonder if the zombie and skeleton flags are still in the game but use only for new creatures?
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 17, 2012, 09:01:51 pm
Big question: Can the program linked to read out the gamelog, similar to soundsense ?
DFHack has direct access to the Announcements and Reports lists - not only can it read entries from them, but it can even write to them and display messages at the bottom of the screen (or even popup messages like when you discover caverns).
Title: Re: DFHack 0.31.25 r9b
Post by: Cardinal on February 17, 2012, 09:34:43 pm
There will be an update when the 'Untouched' list is empty (or at least when the more useful stuff from it is updated/looks fine): https://github.com/peterix/df-structures/blob/master/ToUpdate-v0.34.01.txt

But it's so long...
Title: Re: DFHack 0.31.25 r9b
Post by: Old Bones on February 17, 2012, 09:59:24 pm
I miss vdig so much.
Title: Re: DFHack 0.31.25 r9b
Post by: Cardinal on February 17, 2012, 10:27:38 pm
here is a rough guide to explain how to change from adventure mode to fort mode and vice versa
Spoiler (click to show/hide)

What do you mean when you say "undesignate the whole map" and how do you remove the resident tag?
Title: Re: DFHack 0.31.25 r9b
Post by: EngineerFromHell on February 18, 2012, 06:47:14 am
Is there a tool to remove aquifiers? Maybe through tiletypes somehow?
Title: Re: DFHack 0.31.25 r9b
Post by: Rumrusher on February 18, 2012, 07:48:23 am
here is a rough guide to explain how to change from adventure mode to fort mode and vice versa
Spoiler (click to show/hide)

What do you mean when you say "undesignate the whole map" and how do you remove the resident tag?
When you switch from adventure mode to fort mode, the adventure's field of view will change into Designations in fort mode(or is designations from fort mode that toady recoded to do something different), if left uncheck you might end up with telling your dwarves to smooth mud( which leads to engraving the mud), dig up walls, make ramps in the ground, pretty much chaos. to remove the resident flag you need to know which number it resides in, for starters having runesmith would help. I have a function that does this for me that I could repost
Code: [Select]
function rum_tools.returnfort()
local trgs=selectciv()
for k,v in pairs(trgs) do
print("members:"..k)
local flags=engine.peek(v,ptr_Creature.flags)
flags:set(51,false) -- alive!
--flags:set(13,true)
--flags:set(12,false) no zombie
engine.poke(v,ptr_Creature.flags,flags)
end
local trgs=selectciv1()
for w,q in pairs(trgs) do
print("pets:"..w)
local flags=engine.peek(q,ptr_Creature.flags)
flags:set(26,true) -- alive!
--flags:set(13,true)
--flags:set(12,false) no zombie
engine.poke(q,ptr_Creature.flags,flags)
end
end
function selectciv()
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("AdvCreatureVec")
  vector=engine.peek(myoff,ptr_vector) --standart start
  for i=0,vector:size()-1 do --check all creatures
     local off
     off=vector:getval(i)
     local crciv=engine.peek(off,ptr_Creature.civ)
     local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if curciv==crciv then
     --[[local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==false then]]--  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end
function selectciv1()
  local retvec={} --return vector (or a list)
  myoff=offsets.getEx("AdvCreatureVec")
  vector=engine.peek(myoff,ptr_vector) --standart start
  for i=0,vector:size()-1 do --check all creatures
     local off
     off=vector:getval(i)
     local crciv=engine.peek(off,ptr_Creature.civ)
     --local curciv=engine.peek(vector:getval(0),ptr_Creature.civ)
     if crciv==1  then
     --[[local flags=engine.peek(off,ptr_Creature.flags)
     if flags:get(1)==false then]]--  --if dead ...
        table.insert(retvec,off)--... add it to return vector
     end
  end
  return retvec --return the "return vector" :)
end

Title: Re: DFHack 0.31.25 r9b
Post by: ciadude2 on February 18, 2012, 07:50:47 am
The Lazy Noob Pack program has an option to do that(basically a script that removes the aquifer tags from the raws).

My attempts to co-opt the program into the new version have ended unsuccessfully however, but it might work if you're just using it to change the aquifers. Best bet is to just go in and remove the tags yourself. I'm quite novice at DF modding(I can install mods and make minor changes to raws to suit my preferences but that's about all) and I had no trouble once I found out exactly which files had the tags I needed to remove in them.

Hope that helps a bit.
Title: Re: DFHack 0.31.25 r9b
Post by: Blah on February 18, 2012, 08:32:24 am
I dislike this new DFhack. I much preferred the older one that worked straight out of the box.
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 18, 2012, 11:23:06 am
I dislike this new DFhack. I much preferred the older one that worked straight out of the box.
What's that supposed to mean?
Title: Re: DFHack 0.31.25 r9b
Post by: Meph on February 18, 2012, 11:25:50 am
@quietust: That means that my idea would theoratically be possible ? Adding a reaction that creates a custom item, the dfhack notices it in the gamelog, then runs a command, disabling it after a set time.
Title: Re: DFHack 0.31.25 r9b
Post by: Rose on February 18, 2012, 11:33:04 am
That would indeed be possible. And then you give your own messages in the game log.

Actually, you wouldn't even need the game log for that. You would be able to access the item list directly, and then when it's done, you can have the item destroyed.
Title: Re: DFHack 0.31.25 r9b
Post by: Yaotzin on February 18, 2012, 11:59:53 am
I offer my undying love to anyone who gets DFHack up and running with Prospector, clean, and cleanowned!

Finding crap minerals and rubbish being strewn all over the place makes me so sad =(
Title: Re: DFHack 0.31.25 r9b
Post by: Truec on February 18, 2012, 03:56:05 pm
Is there a tool to remove aquifiers? Maybe through tiletypes somehow?
If you just want to generate worlds with no aquifers anywhere than you can change the raws Inorganic_Stone_Layer and Inorganic_Stone_Soil, just have to remove the [AQUIFER] tags.
Title: Re: DFHack 0.31.25 r9b
Post by: Foxbyte on February 19, 2012, 02:15:48 am
I dislike this new DFhack. I much preferred the older one that worked straight out of the box.
What's that supposed to mean?

The old version you just ran raw batch files alongside DF, this one seems more integrated. Though it doesn't seem to work for me.

maybe he's talking about the compiling stuff, which I assumed I had to do before re-reading instructions.
Title: Re: DFHack 0.31.25 r9b
Post by: Blah on February 19, 2012, 03:25:59 am
I dislike this new DFhack. I much preferred the older one that worked straight out of the box.
What's that supposed to mean?

That I dislike having to compile it.
Title: Re: DFHack 0.31.25 r9b
Post by: Rose on February 19, 2012, 03:45:52 am
Um... you don't have to compile it.

You copy it into your DF folder and run it.
Title: Re: DFHack 0.31.25 r9b
Post by: SalmonGod on February 19, 2012, 03:47:23 am
Big question: Can the program linked to read out the gamelog, similar to soundsense ?
DFHack has direct access to the Announcements and Reports lists - not only can it read entries from them, but it can even write to them and display messages at the bottom of the screen (or even popup messages like when you discover caverns).

The #1 convenience tool I've wanted for DF since learning how to play is a better combat report log.  I can't stand the way it's organized right now.
Title: Re: DFHack 0.31.25 r9b
Post by: outofpractice on February 19, 2012, 04:09:23 am
.. sorry to bug. but any chance of a small release or guide on how to... mainly only after reveal / unreveal at this stage.. everything else I'm happy to wait for.
Title: Re: DFHack 0.31.25 r9b
Post by: Rose on February 19, 2012, 04:13:07 am
we'll be releasing a mini version in the next couple days or so.
Title: Re: DFHack 0.31.25 r9b
Post by: Grax on February 19, 2012, 04:20:38 am
we'll be releasing a mini version in the next couple days or so.

Ok. I'm hibernating till then.  :D
Title: Re: DFHack 0.31.25 r9b
Post by: Blah on February 19, 2012, 04:31:49 am
Um... you don't have to compile it.

You copy it into your DF folder and run it.

Run what? There is no executable.
Title: Re: DFHack 0.31.25 r9b
Post by: Rose on February 19, 2012, 04:32:51 am
run DF.

Then a window will pop up beside it where you enter commands.
Title: Re: DFHack 0.31.25 r9b
Post by: Blah on February 19, 2012, 04:33:51 am
run DF.

Then a window will pop up beside it where you enter commands.

Not for me.
Title: Re: DFHack 0.31.25 r9b
Post by: Rose on February 19, 2012, 04:34:40 am
Then you didn't install it right.
Title: Re: DFHack 0.31.25 r9b
Post by: Grax on February 19, 2012, 04:55:08 am
run DF.

Run, DF, run!


Sorry  ;D
Title: Re: DFHack 0.31.25 r9b
Post by: Foxbyte on February 19, 2012, 10:55:42 am
Then you didn't install it right.

Or they're using the most recent version of DF, which r9 doesn't work with.
Title: Re: DFHack 0.31.25 r9b
Post by: miauw62 on February 19, 2012, 11:37:49 am
Then you didn't install it right.

Or they're using the most recent version of DF, which r9 doesn't work with.
Then it pops up an error.
Title: Re: DFHack 0.31.25 r9b
Post by: magistrate101 on February 19, 2012, 02:45:00 pm
I'm a sad panda, and will remain sad until it's updated, in its entirety, for 0.34.02  :'(
Title: Re: DFHack 0.31.25 r9b
Post by: The Master on February 19, 2012, 09:55:50 pm
run DF.

Then a window will pop up beside it where you enter commands.

Not for me.
You apparently are too lazy to read instructions, otherwise you wouldn't be having issues right now.
Title: Re: DFHack 0.31.25 r9b
Post by: orius on February 20, 2012, 01:14:39 am
we'll be releasing a mini version in the next couple days or so.

Sounds cool.  What's going to be in this mini version?
Title: Re: DFHack 0.31.25 r9b
Post by: peterix on February 20, 2012, 03:14:43 am
we'll be releasing a mini version in the next couple days or so.

Sounds cool.  What's going to be in this mini version?
Whatever happens to actually run... it might even be quite complete. Obviously, the bugfix plugins that are no longer needed will be gone :)

DFusion needs some updating to be ready. At least some hackery to keep the current stuff running, possibly even integration with the new memory layout generation thing we have. The hacked up version could be there. Doing things properly will need quite a bit of effort :)

df2minecraft needs a rewrite from the ground up I'm afraid. It will have to wait for 1.2 minecraft and the new map format, because that will actually make it usable for DF maps. Right now it can only show 42 DF z-levels. With the new map format, it should be 85. (it's also horribly slow and doesn't handle non-square maps right. the rewrite should address that)

Stonesense works, so that should be there for sure, along with all the other map tools.

There's a bunch of other plugins I can't really comment on now, because I don't know :)
Title: Re: DFHack 0.31.25 r9b
Post by: Girlinhat on February 20, 2012, 11:52:39 am
I'm mostly after Vdig, Workflow, and Job Materials.  Any kind of comment on these?
Title: Re: DFHack 0.31.25 r9b
Post by: Warmist on February 20, 2012, 12:55:41 pm
DFusion needs some updating to be ready. At least some hackery to keep the current stuff running, possibly even integration with the new memory layout generation thing we have. The hacked up version could be there. Doing things properly will need quite a bit of effort :)

Yeah i would love to throw away every bit that is custom made. I currently have importers from memory.xml (but it's not complete) and those data xml's. It needs some work especially with finding everything that could be used from those structures. Also wanted to ask if there are any constant addresses in those xml's or are they only structures?
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 20, 2012, 03:12:27 pm
Memory.xml is gone - its replacement, symbols.xml, just has pointers to global variables, most of which are large structures (but some of which are structures or possibly arrays). The various df.*.xml files contain only data structure definitions (for classes with vtables, this includes virtual method definitions).
Title: Re: DFHack 0.31.25 r9b
Post by: Argonnek on February 21, 2012, 12:06:30 am
I can't wait for cleanowned. I can't handle all of the crap my dwarves are accumulating... *starts shaking uncontrollably*
Title: Re: DFHack 0.31.25 r9b
Post by: Dante on February 21, 2012, 03:06:02 am
Posting to follow, and to express my thanks for everyone working on DFHack. Thanks.
Title: Re: DFHack 0.31.25 r9b
Post by: King Doom on February 21, 2012, 11:54:08 am
Oh god hurry! I need the clean map hack! The blood! The ravens wont stop coming, and they explode everywhere! So much blood! HELP!
Title: Re: DFHack 0.31.25 r9b
Post by: Greiger on February 21, 2012, 11:59:39 am
Why did I just get an odd mental image that includes Alfred Hitchcock, ravens, and cherry bombs?
Title: Re: DFHack 0.31.25 r9b
Post by: peterix on February 21, 2012, 12:00:44 pm
Oh god hurry! I need the clean map hack! The blood! The ravens wont stop coming, and they explode everywhere! So much blood! HELP!
Almost there. Things just need a few tweaks and testing :)
Title: Re: DFHack 0.31.25 r9b
Post by: xordae on February 21, 2012, 01:44:41 pm
If I had a lamb, I'd sacrifice it on the shrine of DFHack.
Title: Re: DFHack 0.31.25 r9b
Post by: NecroRebel on February 21, 2012, 03:25:56 pm
Almost there. Things just need a few tweaks and testing :)
Looking forward to it! Any chance on an ETA?
Title: Re: DFHack 0.31.25 r9b
Post by: MagmaSolutionsInc on February 21, 2012, 07:59:12 pm
Almost there. Things just need a few tweaks and testing :)

Yay autodump! Single best way to clean all that stone up without unnecessary, time consuming hauling.
Title: Re: DFHack 0.31.25 r9b
Post by: xaldin on February 21, 2012, 09:32:03 pm
Since DF hack is basically using a plugin model have you thought about setting it up so that individual components could be compiled and ready for download as soon as they are tested and flagged ok for a particular version?  I think most people use a subset of the overall whole and it might make it easier to say for example "prospect works, its available" and folks could download that module and use it if that was what they were waiting for.  If nothing else it compartmentalizes the code so that the testing cycle can ok something and toss it out for people while things that need more attention get it.
Title: Re: DFHack 0.31.25 r9b
Post by: CaptainBadwheel on February 22, 2012, 06:03:32 am
All I really want now is the die command.
Title: Re: DFHack 0.31.25 r9b
Post by: Yaotzin on February 22, 2012, 06:32:34 am
2000 microline, blood everywhere, hundreds upon hundreds of useless pieces of goblinite, owned clothes strewn all over my fortress.

DFHack save me!
Title: Re: DFHack 0.31.25 r9b
Post by: Llamageddon on February 22, 2012, 06:45:35 am
Hi, I have a feeling this has been asked before but I can't find the post. Is there any chance that DFHack has/will have an option to de-stagnify water? I don't know what I did with my elaborate cistern/well/farming system, was very careful not to link my brook to a murky pool but I have turned all the freshwater on my map stagnant and it would be fantastic if DFHack came out with a simple fix for this. Thanks for working so hard on the update.
Title: Re: DFHack 0.31.25 r9b
Post by: FFLaguna on February 22, 2012, 08:58:06 am
2000 microline, blood everywhere, hundreds upon hundreds of useless pieces of goblinite, owned clothes strewn all over my fortress.

DFHack save me!

Change microcline color to the same as "kaolinite" (don't choose cobalt, this is better). Then rejoice as you want to build EVERYTHING out of microcline due to its soothing kaolinite color!!
Title: Re: DFHack 0.31.25 r9b
Post by: peterix on February 22, 2012, 09:02:12 am
Hi, I have a feeling this has been asked before but I can't find the post. Is there any chance that DFHack has/will have an option to de-stagnify water? I don't know what I did with my elaborate cistern/well/farming system, was very careful not to link my brook to a murky pool but I have turned all the freshwater on my map stagnant and it would be fantastic if DFHack came out with a simple fix for this. Thanks for working so hard on the update.
Not a bad idea :) I think there's something like this in the liquids tool already, but only for 'salty' flags. I'll have to check.
All I really want now is the die command.
It IS the command I use the most ;)
Since DF hack is basically using a plugin model have you thought about setting it up so that individual components could be compiled and ready for download as soon as they are tested and flagged ok for a particular version?  I think most people use a subset of the overall whole and it might make it easier to say for example "prospect works, its available" and folks could download that module and use it if that was what they were waiting for.  If nothing else it compartmentalizes the code so that the testing cycle can ok something and toss it out for people while things that need more attention get it.
The problem: the plugins need to be compatible with the stuff they plug into... that's a bit of a problem when that changes as much as it does in DFHack. It's just not that easy.

Anyway, continuing with more dfhack work...
Title: Re: DFHack 0.31.25 r9b
Post by: Yaotzin on February 22, 2012, 09:06:45 am
2000 microline, blood everywhere, hundreds upon hundreds of useless pieces of goblinite, owned clothes strewn all over my fortress.

DFHack save me!

Change microcline color to the same as "kaolinite" (don't choose cobalt, this is better). Then rejoice as you want to build EVERYTHING out of microcline due to its soothing kaolinite color!!
It's not that I particularly dislike microline, it's that it's just sitting there preventing me making a tree farm, and hauling it is just impossible.
Title: Re: DFHack 0.31.25 r9b
Post by: FFLaguna on February 22, 2012, 11:11:00 am
2000 microline, blood everywhere, hundreds upon hundreds of useless pieces of goblinite, owned clothes strewn all over my fortress.

DFHack save me!

Change microcline color to the same as "kaolinite" (don't choose cobalt, this is better). Then rejoice as you want to build EVERYTHING out of microcline due to its soothing kaolinite color!!
It's not that I particularly dislike microline, it's that it's just sitting there preventing me making a tree farm, and hauling it is just impossible.

God, I hate cyan. And I mean I hate cyan.
Title: Re: DFHack 0.31.25 r9b
Post by: Quietust on February 22, 2012, 11:17:44 am
hauling it is just impossible.
No it isn't - you're just not trying hard enough.
Title: Re: DFHack 0.31.25 r9b
Post by: Yaotzin on February 22, 2012, 02:00:14 pm
hauling it is just impossible.
No it isn't - you're just not trying hard enough.
I play with a 40 dwarf pop cap. So no, not impossible, but I'd be terrified to even do the maths on how long it would take.

If I had 200 cap, sure, done that before, got plenty of hauling power then.

Anyway the blood and the owned clothing is what's really making me mad! Not a damn thing I can do :(
Title: Re: DFHack 0.31.25 r9b
Post by: Caldfir on February 22, 2012, 03:23:20 pm
hauling it is just impossible.
No it isn't - you're just not trying hard enough.
I play with a 40 dwarf pop cap. So no, not impossible, but I'd be terrified to even do the maths on how long it would take.

If I had 200 cap, sure, done that before, got plenty of hauling power then.

Anyway the blood and the owned clothing is what's really making me mad! Not a damn thing I can do :(
(while I am aware this is dreadfully off topic)

I ran a fort like this a while back.  The solution I cam up with was:
It can be somewhat involved, but it speeds up the job an amazing amount. 

(back on topic)

DFHack seems most of the way to a new release now.  Compiled this morning and is running stonesense pretty much perfectly, cleanowned is working (I think) and I am now in possession of the all-important die command >:D
Title: Re: DFHack 0.31.25 r9b
Post by: janglur on February 22, 2012, 04:38:52 pm
POSTPOSTPOSTPOSTPOST!  XD

I only use DFHack lightly, mostly for Die and a few other tweaks, but they really help.
Title: Re: DFHack 0.31.25 r9b
Post by: Flying Dice on February 22, 2012, 10:49:19 pm
Yeah, looking forward to the updated version quite a bit. Only a few days and I already miss prospector, not to mention the wagon and guild fixes.
Title: Re: DFHack 0.31.25 r9b
Post by: agatharchides on February 22, 2012, 11:10:51 pm
Wagon fix is already in the latest version. :)

Quote
Compiled this morning and is running stonesense pretty much perfectly, cleanowned is working (I think) and I am now in possession of the all-important die command >:D
You just love teasing the impatient, don't you?  :P
Title: Re: DFHack 0.31.25 r9b
Post by: xaldin on February 23, 2012, 12:46:47 am

DFHack seems most of the way to a new release now.  Compiled this morning and is running stonesense pretty much perfectly, cleanowned is working (I think) and I am now in possession of the all-important die command >:D

Yeah I rebuilt my programming environment and loaded it all up tonight.  I don't use stonesense, exporters or some of the more esoteric stuff. The ones I do use (reveal, prospect and a handful of other commands) all seem to work just fine. It was a pain setting up my coding environment again but worth it to get those commands back.
Title: Re: DFHack 0.31.25 r9b
Post by: miauw62 on February 23, 2012, 03:35:25 am
Almost there. Things just need a few tweaks and testing :)

Yay autodump! Single best way to clean all that stone up without unnecessary, time consuming hauling.
For my main food stockpile and my other stockpiles in the stone layer, that usually are dug out whit half-legendary miners, its a pain to have to haul everything out there.
Title: Re: DFHack 0.31.25 r9b
Post by: outofpractice on February 23, 2012, 03:45:56 am
Just a big shout out.

Thank you Peterix and crew, you people do an awesome job.

Title: Re: DFHack 0.34.02 r1
Post by: peterix on February 23, 2012, 04:03:11 am
OK. It's out.

I had to leave out DFusion unfortunately. It's just not ready.

DF2Minecraft will be back eventually, after a rewrite (and once MC 1.2 is released).

Good news is that there's a new 'follow' command/plugin that makes the screen always centered on a creature of your choosing :)
Title: Re: DFHack 0.34.02 r1
Post by: MagmaSolutionsInc on February 23, 2012, 04:30:36 am
looking good, thanks!  :D
Title: Re: DFHack 0.34.02 r1
Post by: orius on February 23, 2012, 04:37:27 am
Oh yeah!  I've been checking some spots on my world map that look like nice embark spots, and I've been waiting to prospect and reveal them.
Title: Re: DFHack 0.34.02 r1
Post by: xordae on February 23, 2012, 05:02:20 am
Hey, it looks like your new release breaks VBO mode and I think the other GPU assisted modes as well. 2D works fine.
Title: Re: DFHack 0.34.02 r1
Post by: peterix on February 23, 2012, 05:35:53 am
Hey, it looks like your new release breaks VBO mode and I think the other GPU assisted modes as well. 2D works fine.
VBO seems to work fine here... how exactly is it broken?
Title: Re: DFHack 0.34.02 r1
Post by: Yaotzin on February 23, 2012, 05:36:36 am
I love you in a totally manly way.
Title: Re: DFHack 0.34.02 r1
Post by: xordae on February 23, 2012, 05:42:57 am
Nevermind, found the culprit. It's not DFHack, ARB_SYNC just doesn't work anymore with the latest NVIDIA release.
Title: Re: DFHack 0.34.02 r1
Post by: Qiu on February 23, 2012, 10:33:25 am
Many many thanks to the dfHack team.  :D
Title: Re: DFHack 0.34.02 r1
Post by: Meph on February 23, 2012, 10:36:02 am
Yes, thanks for the update :)
Title: Re: DFHack 0.34.02 r1
Post by: janglur on February 23, 2012, 11:13:19 am
Nevermind, found the culprit. It's not DFHack, ARB_SYNC just doesn't work anymore with the latest NVIDIA release.

ARB_SYNC ever worked with nVidia products!?
Title: Re: DFHack 0.34.02 r1
Post by: xordae on February 23, 2012, 11:26:41 am
It worked really nice up 'till now, yeah. If you have any WHQL earlier than the most recent one, you can probably switch it on.
Title: Re: DFHack 0.34.02 r1
Post by: Phibes on February 23, 2012, 11:34:59 am
Good news is that there's a new 'follow' command/plugin that makes the screen always centered on a creature of your choosing :)

Would it be possible in the future to select units to 'Follow' with 'k' instead of only through the unit list?
Also, is there a way to prevent certain announcements (Moods, Artifacts, etc) from breaking Follow mode?

Thanks for the new release. I can finally play DF2012 without rage quitting ;D


Title: Re: DFHack 0.34.02 r1
Post by: thewonderidiot on February 23, 2012, 11:38:28 am
Good news is that there's a new 'follow' command/plugin that makes the screen always centered on a creature of your choosing :)

Would it be possible in the future to select units to 'Follow' with 'k' instead of only through the unit list?
Also, is there a way to prevent certain announcements (Moods, Artifacts, etc) from breaking Follow mode?

Thanks for the new release. I can finally play DF2012 without rage quitting ;D

Selecting units with 'v' works as well.  ;)

I forgot that popups move the camera on you. I'll see if I can detect and fix that for next time.
Title: Re: DFHack 0.34.02 r1
Post by: peskyninja on February 23, 2012, 11:38:52 am
Thanks for the new release. I can finally play DF2012 without rage quitting ;D
Same here.
Autodump onyl dumping unforbidden items is a feature or a bug?
Title: Re: DFHack 0.34.02 r1
Post by: Phibes on February 23, 2012, 11:44:46 am
Selecting units with 'v' works as well.  ;)

Good catch, serves me right for skipping coffee this morning  :P

I forgot that popups move the camera on you. I'll see if I can detect and fix that for next time.

Thanks. Follow mode is quite fun. It's a great way to get a "day in the life" of your dorfs.
Title: Re: DFHack 0.34.02 r1
Post by: Girlinhat on February 23, 2012, 11:55:25 am
Very thankful for this.  Vdig is what I use most, and having it back is amazing~

Any ideas on my "flood dig" command that could be used to quarry layer stone?  Example: "fdig MARBLE" would start at the cursor and flood out, marking any visible MARBLE material for digging designation.
Title: Re: DFHack 0.34.02 r1
Post by: Flying Dice on February 23, 2012, 05:13:19 pm
Thank yoooou~
Title: Re: DFHack 0.34.02 r1
Post by: Gabeux on February 23, 2012, 05:20:15 pm
Hey guys, I'm trying to "fix" a brook that doesn't let me go inside a town's sewer on adventure..
I can swap to arena control mode to edit things, but I can't find any plugin to "edit" tiles..is there any?

I'm trying to turn a brook into a river, more or less.
Title: Re: DFHack 0.34.02 r1
Post by: Quietust on February 23, 2012, 05:23:12 pm
I can swap to arena control mode to edit things, but I can't find any plugin to "edit" tiles..is there any?
Try "tiletypes".
Title: Re: DFHack 0.34.02 r1
Post by: Gabeux on February 23, 2012, 05:47:26 pm
I can swap to arena control mode to edit things, but I can't find any plugin to "edit" tiles..is there any?
Try "tiletypes".

Hmm the only thing that seem to work, is to paint things into fire/grass and maybe something else...
I can't paint trees or rivers, am I doing something wrong?
(sorry if this is not the place to ask, btw)
Title: Re: DFHack 0.34.02 r1
Post by: telamon on February 23, 2012, 05:51:11 pm
PRAISE ARMOK! dfhack has returned! thank you to peterix and the team =] if you'll excuse me ladies and gentlemen, my fortress calls
Title: Re: DFHack 0.34.02 r1
Post by: Rumrusher on February 23, 2012, 05:54:45 pm
Looks like the basic retire fortress, and switching between fort and adventure mode can be done now.
Oh and if you type out "mode abuse" you get a less restrictive version of the mode command.
Title: Re: DFHack 0.34.02 r1
Post by: Gigmaster on February 23, 2012, 05:57:21 pm
Thaaaaank yoooooou.

*Gives all the magmas*
Title: Re: DFHack 0.34.02 r1
Post by: narhiril on February 23, 2012, 05:57:55 pm
PRAISE ARMOK! dfhack has returned! thank you to peterix and the team =] if you'll excuse me ladies and gentlemen, my fortress calls

QFT.

It's good to have vdig and cleanowned back :D
Title: Re: DFHack 0.34.02 r1
Post by: Gabeux on February 23, 2012, 06:26:50 pm
I still can't turn brooks into rivers..tried many things and it doesn't work.
Any ideas?  :(

--
Actually, I can edit brooks now..still, can't find a way to "remove" them.
--
Finally.
Set filters to "BROOK BROOK_TOP" and paint to "AIR EMPTY", and the brooks are removed.

It's a bit complicated, but this is going to allow me to kill some very well hidden (and stuck) beasts.
Thanks a lot for the release! :D
Title: Re: DFHack 0.34.02 r1
Post by: mnjiman on February 23, 2012, 07:17:36 pm
This is awesome and amazing. Glad the DF2Minecraft is being worked into this, that is very epic.

Thank you for your hard work with this mod.

Cheers!
Title: Re: DFHack 0.34.02 r1
Post by: isitanos on February 23, 2012, 09:28:03 pm
Thanks for the new version. With all the awesome options, I'm kinda surprised there's no command to insta-dig an area, or on the contrary, revert empty space back to stone (would be useful to safely experiment then revert). Is that not possible, or not included for another reason?
Title: Re: DFHack 0.34.02 r1
Post by: SlimyMarmot on February 23, 2012, 09:29:16 pm
Just came back to DF after a while, and boy has DFHack evolved. Fantastic job all around!
Title: Re: DFHack 0.34.02 r1
Post by: ctoan on February 23, 2012, 09:34:04 pm
So I'm trying to start using workflow, and I'm trying to maintain a stock of mechanisms.  I can't seem to figure out what the actual name that workflow expects.  I delved into the raws for the first time and couldn't even figure out where all of the furniture is.  Could anybody help with that?

Also, thanks a billion for the new version.
Title: Re: DFHack 0.34.02 r1
Post by: voodooattack on February 23, 2012, 11:24:16 pm
I'm almost certain that something is causing a memory leak.. DF crashed on me twice after I installed this, memory usage slowly creeps into gigabyte figures.

The only features I use are drybucket and occasionally fastdwarf, not sure what's going on since I can't attach the VS debugger and see for myself. At that point of memory usage, VS is practically impossible to deal with with all the page swapping going on, not that I'm going to spot the source of the problem that way in the first place.

Any ideas?
Title: Re: DFHack 0.34.02 r1
Post by: BigD145 on February 23, 2012, 11:41:51 pm
I've been running for a few hours with no troubles. This is with a win7(32) laptop and limited RAM.
Title: Re: DFHack 0.34.02 r1
Post by: peterix on February 24, 2012, 02:53:14 am
Any ideas?
I've been running for a few hours with no troubles. This is with a laptop and limited RAM.

Always say which OS you are on. There are differences between Windows and Linux DFHack :)
Title: Re: DFHack 0.34.02 r1
Post by: peterix on February 24, 2012, 02:54:07 am
Very thankful for this.  Vdig is what I use most, and having it back is amazing~

Any ideas on my "flood dig" command that could be used to quarry layer stone?  Example: "fdig MARBLE" would start at the cursor and flood out, marking any visible MARBLE material for digging designation.
Noted, will be there in the future :)
Title: Re: DFHack 0.34.02 r1
Post by: voodooattack on February 24, 2012, 07:20:05 am
Always say which OS you are on. There are differences between Windows and Linux DFHack :)

Windows 7 SP1 (x86), 4GB RAM.

Edit: This is what it looks like:

(http://dl.dropbox.com/u/27714141/df_memory.png)

I just had the main menu open and nothing going on, memory usage was increasing by ~300kb per update cycle on that graph.

Edit 2:

Disregard this whole ordeal, after fiddling around for a while trying to locate the source of problem I tracked it down to the VBO renderer. fastdwarf was merely accelerating screen updates and hurling it towards the inevitable crash.

No more memory problems once I switched to 2DASYNC.

That's kinda nasty though.
Title: Re: DFHack 0.34.02 r1
Post by: tahujdt on February 24, 2012, 10:48:44 am
ThankyouthankyouthankyouTHANKYOUUUUUUUUUUUU!!!!!!!!!!!!!!!!!!! I was about ready to go into a fell mood and port it to 34.02 myself!
tahujdt cancels Do Homework: interrupted by Dwarf Fortress
Title: Re: DFHack 0.34.02 r1
Post by: Meph on February 24, 2012, 06:13:53 pm
Wrote you a PM, but might have been overlooked.

I wanted to ask if it is possible to write a custom version for a mod I am writing, OR, if you would be so kind to give me the permission to mod it myself. I would just need to know what program/language I need, and the source code. The rest I can figure out for myself.

My goal is to have a workshop to run a reaction, lets say: Blessing of Speed.
Then the gamelog shows that this has been done.
Dfhack would read the gamelog, and automatically start fastdwarf for 30 seconds.
After 30 secs, goes back to normal.

Essentially I want to use some features of dfhack as gamefeatures and make them aviable just by dwarfen labor.

I already converted the LNP to become a optional Settings program for both my mod, and genesis.

greets,
Meph
Title: Re: DFHack 0.34.02 r1
Post by: peterix on February 24, 2012, 06:19:23 pm
Wrote you a PM, but might have been overlooked.

Essentially I want to use some features of dfhack as gamefeatures and make them aviable just by dwarfen labor.

I already converted the LNP to become a optional Settings program for both my mod, and genesis.
Yep. Already replied. It's an interesting idea and should be possible to do.
Title: Re: DFHack 0.34.02 r1
Post by: voodooattack on February 25, 2012, 04:13:47 am
I'd like to write a plugin to convert artificial walls (player-constructed ones) into natural smoothed walls, thus allowing the player to engrave them again.

Would this be possible with the current API?

And if so, how should I go about it? is there a guide somewhere?
Title: Re: DFHack 0.34.02 r1
Post by: Rose on February 25, 2012, 04:40:00 am
it's.... iffy.

far more easy to do is to move engravings from natural walls onto the artificial ones. then you can stick engravings anywhere.
Title: Re: DFHack 0.34.02 r1
Post by: voodooattack on February 25, 2012, 07:17:51 am
it's.... iffy.

far more easy to do is to move engravings from natural walls onto the artificial ones. then you can stick engravings anywhere.

Hm, wouldn't it be possible to deconstruct the wall, place normal stone then smooth it?

I mean, even if it's not possible with memory editing, can't it be done by resetting the job timer to make the change instant or something?
Title: Re: DFHack 0.34.02 r1
Post by: Rose on February 25, 2012, 08:36:14 am
you can only put a smooth stone wall there if there was normal stone there origionally, which isn't always the case.

far easier is to just move the engraving onto the constructed wall... or onto dirt... or onto a tree.

yes, you can have engraved trees, and the game treats them as such.
Title: Re: DFHack 0.34.02 r1
Post by: Aerval on February 25, 2012, 11:47:01 am
Hey, nobody mentioned that tiletypes has slightly changed. Wanted to paint m vein and there was no VEIN material. Had to look into help to get it working ;D. Are there any other changes I should expect? Follow works brilliant.
Nice to see the hack back :)
Title: Re: DFHack 0.34.02 r1
Post by: Meph on February 25, 2012, 11:49:03 am
I want engraved trees ^^ A bit elvish, but hey.

EDIT: Thanks peterix, just found the PM. After looking at the code I might say that this is a bit beyond me, and would rather rely on someone with knowledge of the program to help me set up about 3 reactions to test.

Hope I can find someone. :)

So here we go: I need a volunteer that can make a dfhack script that automatically runs by reading out the gamelog.
Title: Re: DFHack 0.34.02 r1
Post by: Tubal on February 25, 2012, 07:22:31 pm
yes, you can have engraved trees, and the game treats them as such.
If you cut them down, is the lumber engraved? :)
Title: Re: DFHack 0.34.02 r1
Post by: Rose on February 25, 2012, 09:10:14 pm
yes, you can have engraved trees, and the game treats them as such.
If you cut them down, is the lumber engraved? :)

no. Actually, I'm not sure hat happens
Title: Re: DFHack 0.34.02 r1
Post by: orius on February 25, 2012, 09:35:31 pm
I want engraved trees ^^ A bit elvish, but hey.

Why does it have to be elvish?  It could be the dorfs grabbing a knife and crudely carving, "Suck it elves!" into every single tree they see and don't log.
Title: Re: DFHack 0.34.02 r1
Post by: KhaaL on February 26, 2012, 03:27:45 am
Is it possible to use DFhack to edit specific dwarfs personality, attributes and skills? I know of Runesmith could do that in earlier versions, can DFhack be used for that? is so, with which commands?
Title: Re: DFHack 0.34.02 r1
Post by: robertheinrich on February 26, 2012, 04:51:52 am
I didn´t bother to read all 41 pages so maybe that was already mentioned...

I stumbled upon a problem with obsidian walls: I cheated some magma onto my map (using the newest version of DFHack for 0.34.02) and then used a screw pump to pump it over a water basin. The water directly below the pump´s output became an obsidian wall, naturally. Currently it looks like this:

(cross section of 3 z levels)

FPPF
OWM
WWW

F=open space
O=obsidian wall
M=magma
W=wall/floor

Now I have the problem that I can´t dig out the obsidian wall (set destination to mine, but none of my dwarves goes there and actually digs it out) and I also can´t operate the pump anymore (dwarf goes there and starts to pump, but no magma flow - I would expect the magma being pumped onto the obsidian floor, but that doesn´t happen).

It looks like part of the game (responsible for showing the map) knows about the new obsidian wall, and another part of the game (responsible for handling interaction like magma flow and dig operations) doesn´t know about the wall... just like after digging on a revealed map then unrevealing it afterwards the dug out sections need to be discovered by dwarves again (by digging near them).
Title: Re: DFHack 0.34.02 r1
Post by: Aerval on February 26, 2012, 08:39:39 am
Maybe there isn't enough magma below the pump:
Quote from: wiki
The liquid in a pump's intake tile must have a depth of at least 2/7 for the pump to be able to remove any amount of liquid from it.

As for the refuse of digging the obsidian I can just say that i have never experienced such a bug, but that was in 31.25. Tiles cast with tiletypes are digable for me in 34.02 though. Maybe the dwarves just can't find a way to it?
Title: Re: DFHack 0.34.02 r1
Post by: Mazonas on February 26, 2012, 10:40:06 am
Okay, so the new version of DFhack is really, really confusing.  But, right now, I don't want to learn everything about it (I will, very shortly).  Right now I have a fortress emergency.  My miners dug themselves into a hole and are now so starving hungry they are refusing to dig themselves out.  Can anyone tell me how to use DFhack to create an open path back to the stairwell for them?
Title: Re: DFHack 0.34.02 r1
Post by: Aerval on February 26, 2012, 10:57:26 am
Okay, so the new version of DFhack is really, really confusing.  But, right now, I don't want to learn everything about it (I will, very shortly).  Right now I have a fortress emergency.  My miners dug themselves into a hole and are now so starving hungry they are refusing to dig themselves out.  Can anyone tell me how to use DFhack to create an open path back to the stairwell for them?
You could do try to rescue them without hacking, just dump some food into the hole: http://dwarffortresswiki.org/index.php/DF2012:Activity_zone
Other ways include tiletypes(definitely more complicate) or autodump (mark some food with "d" for dumping, place the cursor in the hole and type autodump in the hack-console, and unforbid the food) but I am not sure whether they work in seconds because it sometimes takes some time until hacks in the game get recognized by the dwarves.
Title: Re: DFHack 0.34.02 r1
Post by: Mazonas on February 26, 2012, 11:39:19 am
I,ve done that in the past, but this isn't a straight-down hole.  It's a multi-z level mess of channels and holes and floors with no direct way to get food down.  Believe me, I tried that
Title: Re: DFHack 0.34.02 r1
Post by: peterix on February 26, 2012, 01:43:29 pm
I,ve done that in the past, but this isn't a straight-down hole.  It's a multi-z level mess of channels and holes and floors with no direct way to get food down.  Believe me, I tried that
Then use autodump. It's like teleporting items.
Title: Re: DFHack 0.34.02 r1
Post by: Mazonas on February 26, 2012, 01:49:20 pm
Ooh autodump!  I'll give that a try, thank you, you may have just saved my miners!
Title: Re: DFHack 0.34.02 r1
Post by: Yaotzin on February 27, 2012, 06:24:26 am
Is it just me or does clean all sometimes remove mud as well? I've had my irrigated farms get messed up by it. And no, I never do clean all mud, or clean mud or whatever.
Title: Re: DFHack 0.34.02 r1
Post by: Quietust on February 27, 2012, 09:03:06 am
The "clean all" command shouldn't remove mud from floors unless you actually tell it to. Or if it's somehow non-solid mud (killing mud beasts will give you a "pool of " which is made of liquid mud). It's possible that DF is now creating mud in the "powder", "paste", or "pressed" states - if it is, that'd explain why cleanmap was removing it.
Title: Re: DFHack 0.34.02 r1
Post by: robertheinrich on February 27, 2012, 09:39:32 am
Umm, I have a slight problem. I peeked onto the first dozen layers of my fresh embark with "reveal". Then I guess I had it still active when I saved the game because when I load it now (even after completely restarting DF) the map stays revealed, "unreveal" doesn´t work anymore. Is there any way around this?
Title: Re: DFHack 0.34.02 r1
Post by: Di on February 27, 2012, 09:44:08 am
try 'revflood' command
Title: Re: DFHack 0.34.02 r1
Post by: robertheinrich on February 27, 2012, 10:10:39 am
try 'revflood' command

That worked - thanks a lot!
Title: Re: DFHack 0.34.02 r1
Post by: Laggy on February 27, 2012, 01:07:58 pm
Quick question on the workflow plugin:

How can I add like rock doors to my workflow?  An example, or an explanation of where to look would be all I need, hopefully.


I noticed that one of the Readme examples was AMMO:ITEM_AMMO_BOLT/METAL, so I checked the item_ammo raw, and saw where the entry came from.  I then searched for door in all of the other raws, and came up empty (well, I got language results, but thats not really helpful :P).  Anyways, I tried DOOR, and DOOR/STONE...but neither worked.
Title: Re: DFHack 0.34.02 r1
Post by: SammyLiimex on February 27, 2012, 01:20:11 pm
How do I dig out veins with this new command prompt version? The old one I just clicked the exe
Title: Re: DFHack 0.34.02 r1
Post by: Rose on February 27, 2012, 01:26:17 pm
type the name

ls gives you a full list.
Title: Re: DFHack 0.34.02 r1
Post by: ag on February 27, 2012, 01:31:25 pm
I noticed that one of the Readme examples was AMMO:ITEM_AMMO_BOLT/METAL, so I checked the item_ammo raw, and saw where the entry came from.  I then searched for door in all of the other raws, and came up empty (well, I got language results, but thats not really helpful :P).  Anyways, I tried DOOR, and DOOR/STONE...but neither worked.

Item names come from this list:

http://dwarffortresswiki.org/index.php/Item_token (http://dwarffortresswiki.org/index.php/Item_token)

The stone bit should work too, but since I first made the job-material command that allows changing the jobs to use specific stone, I never actually tested workflow with the default generic rock. :) It might be that if you modify the job to use any specific rock, it would match that DOOR/STONE pattern.
Title: Re: DFHack 0.34.02 r1
Post by: Laggy on February 27, 2012, 01:44:36 pm

Item names come from this list:

http://dwarffortresswiki.org/index.php/Item_token (http://dwarffortresswiki.org/index.php/Item_token)

The stone bit should work too, but since I first made the job-material command that allows changing the jobs to use specific stone, I never actually tested workflow with the default generic rock. :) It might be that if you modify the job to use any specific rock, it would match that DOOR/STONE pattern.

Ah, I think that worked.  Just to be sure I did what you mean, I manually set a Door job in my Masonry Workshop, then did 'job-material DIORITE'.  Then I used 'workflow count DOOR/STONE 20'

It didn't throw any errors, so I think thats what you meant. 


For information: previously, when I did 'workflow count DOOR/STONE 20', it counted the number of doors I had correctly, but then threw a "Cannot create stone door" error in DF.
Title: Re: DFHack 0.34.02 r1
Post by: Greiger on February 27, 2012, 03:40:14 pm
How do I dig out veins with this new command prompt version? The old one I just clicked the exe

Click the command prompt window (the mostly black screen that opens with DF) and then type vdig with the ingame cursor over a vein.

to get a full list of all the commands you can enter type "ls" without the quotes.  It will list off all the commands DFHack currently understands.  To use a program you generally just type it's name from that list.
Title: Re: DFHack 0.34.02 r1
Post by: Sartorius on February 27, 2012, 04:47:06 pm
Are there any tools for editing the statistics and abilities of adventurers within DFHack, or is this more of a Runesmith thing?
Title: Re: DFHack 0.34.02 r1
Post by: Tabithda on February 27, 2012, 08:33:37 pm
Would it be possible to make a plugin that would cause a creature to become pregnant? If so, how difficult would it be to make such a plugin?
Title: Re: DFHack 0.34.02 r1
Post by: Quietust on February 27, 2012, 09:00:46 pm
Ah, I think that worked.  Just to be sure I did what you mean, I manually set a Door job in my Masonry Workshop, then did 'job-material DIORITE'.  Then I used 'workflow count DOOR/STONE 20'

It didn't throw any errors, so I think thats what you meant. 


For information: previously, when I did 'workflow count DOOR/STONE 20', it counted the number of doors I had correctly, but then threw a "Cannot create stone door" error in DF.
Try specifying INORGANIC or INORGANIC:NONE for the material - that's how the game itself keeps track of generic "rock" items.
Title: Re: DFHack 0.34.02 r1
Post by: Rumrusher on February 27, 2012, 09:38:00 pm
Would it be possible to make a plugin that would cause a creature to become pregnant? If so, how difficult would it be to make such a plugin?
Are there any tools for editing the statistics and abilities of adventurers within DFHack, or is this more of a Runesmith thing?

Dfusion, though it's down at the moment and was removed from Dfhack.
Title: Re: DFHack 0.34.02 r1
Post by: HraTaika on February 27, 2012, 10:47:19 pm
So, any DFHack for Mac?
Title: Re: DFHack 0.34.02 r1
Post by: Rose on February 27, 2012, 10:57:31 pm
not currently. It's possible to do, but none of the DFhack devs have macs.

we'd welcome any help, though.
Title: Re: DFHack 0.34.02 r1
Post by: the_game_hunt on February 28, 2012, 12:43:02 pm
GAHHH!!!

Doesnt work with 34.03

Now, 3 days without dfhacks   :(  Imagine how long it would take to update runesmith
Title: Re: DFHack 0.34.02 r1
Post by: Quietust on February 28, 2012, 05:01:06 pm
GAHHH!!!

Doesnt work with 34.03

Now, 3 days without dfhacks   :(  Imagine how long it would take to update runesmith
A new version should be available within an hour. Be patient.

[edit] and there it is.
Title: Re: DFHack 0.34.03 r1
Post by: peterix on February 28, 2012, 05:26:10 pm
34.03 support release is OUT, and with some nice new tools too! Check the first post (http://www.bay12forums.com/smf/index.php?topic=91166.0)/readme (https://github.com/peterix/dfhack/blob/master/README.rst)/console help for new things :)

/me begins a mysterious construction.
Title: Re: DFHack 0.34.03 r1
Post by: Yaotzin on February 28, 2012, 05:33:10 pm
Yippeee!

DF without DFHack is just...wrong..
Title: Re: DFHack 0.34.03 r1
Post by: slink on February 28, 2012, 05:50:52 pm
Thank you for this amazing utility.  I had not used it since you changed it into its present form, and I was confused and dismayed by the lack of the little utilities to which I was accustomed.  I finally resorted to reading the instructions (gasp!) and ran DF with the new form.  It is terribly addictive now, being always available as it is.  I can actually still play without Dwarf Therapist, although it is tedious.  I'm not sure I can play now without DFHack!   :D
Title: Re: DFHack 0.34.03 r1
Post by: Meph on February 28, 2012, 06:00:23 pm
That was quick, thanks a lot :)
Title: Re: DFHack 0.34.03 r1
Post by: peterix on February 28, 2012, 06:04:03 pm
Oh, one more thing. I know stonesense was crashing for people before. I've made some changes to how it loads data from DF (using a less complicated locking scheme). Any input on possible cause of those crashes is welcome (including saves if it happens often in one world/fort and not other).

Thank you for this amazing utility. I'm not sure I can play now without DFHack!   :D
You'll love the mysterious construction then :)
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.03 r1
Post by: the_game_hunt on February 28, 2012, 06:15:17 pm
Oh, one more thing. I know stonesense was crashing for people before. I've made some changes to how it loads data from DF (using a less complicated locking scheme). Any input on possible cause of those crashes is welcome (including saves if it happens often in one world/fort and not other).

Thank you for this amazing utility. I'm not sure I can play now without DFHack!   :D
You'll love the mysterious construction then :)
Spoiler (click to show/hide)

Very nice indeed, but it would be extremely awesome if you,press a key, and then the console will come down,occupying 1/3 of the screen. I will edit this post when i find one example.

Its a waste of time when i am on fullscreen and i want to clean something with dfhacks

EDIT:(Large Image)
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.03 r1
Post by: notfood on February 28, 2012, 08:03:49 pm
For some reason building from git fails with this error:
Code: [Select]
make[2]: *** No rule to make target `../../library/xml/codegen.pl', needed by `../../library/include/df/static.inc'.  Stop.
make[1]: *** [library/CMakeFiles/generate_headers.dir/all] Error 2
make: *** [all] Error 2

There is no codegen.pl in the library/xml folder.

library/include/df/static.inc This file is missing too.

My cmake line.
Code: [Select]
cmake ../.. -DCMAKE_BUILD_TYPE="Release" -DDFHACK_INSTALL="debian" -DBUILD_DFHACK_C_BINDINGS=ON -DBUILD_DFHACK_DEVEL=ON -DBUILD_DFHACK_DOXYGEN=OFF -DBUILD_DFHACK_EXAMPLES=OFF -DBUILD_DFHACK_PLAYGROUND=ON -DBUILD_DFHACK_MINE=ON -DBUILD_DFHACK_PYTHON_BINDINGS=ON
Title: Re: DFHack 0.34.03 r1
Post by: Quietust on February 28, 2012, 08:19:17 pm
You didn't follow the build instructions properly - in particular, you forgot to run "git submodule init" and "git submodule update".
Title: Re: DFHack 0.34.03 r1
Post by: notfood on February 28, 2012, 08:40:59 pm
Sorry about that.

I was so used to just put make and watch it build.
Title: Re: DFHack 0.34.03 r1
Post by: peterix on February 28, 2012, 08:43:26 pm
For some reason building from git fails with this error:
Code: [Select]
make[2]: *** No rule to make target `../../library/xml/codegen.pl', needed by `../../library/include/df/static.inc'.  Stop.
make[1]: *** [library/CMakeFiles/generate_headers.dir/all] Error 2
make: *** [all] Error 2
You don't have all the code. Use this first:
Code: [Select]
git submodule init
git submodule update
This will pull in a bunch of things dfhack depends on or includes (like the memory layout or stonesense). When you pull new code from the main dfhack repo, make sure to run 'git submodule update' too. Again, to pull any new changes to the other stuff.
My cmake line.
Code: [Select]
cmake ../.. -DCMAKE_BUILD_TYPE="Release" -DDFHACK_INSTALL="debian" -DBUILD_DFHACK_C_BINDINGS=ON -DBUILD_DFHACK_DEVEL=ON -DBUILD_DFHACK_DOXYGEN=OFF -DBUILD_DFHACK_EXAMPLES=OFF -DBUILD_DFHACK_PLAYGROUND=ON -DBUILD_DFHACK_MINE=ON -DBUILD_DFHACK_PYTHON_BINDINGS=ON
This is ... just plain wrong. With the exception of "CMAKE_BUILD_TYPE", every single setting in this line was phased out many months, or even years ago. Please, read the Compile document (https://github.com/peterix/dfhack/blob/master/COMPILE.rst) first. Use ccmake too, because that actually shows the available options.
Title: Re: DFHack 0.34.03 r1
Post by: Girlinhat on February 28, 2012, 09:53:06 pm
How do you utilize keybinding?  When I try
Code: [Select]
keybinding A job-material ORTHOCLASEthen request a list, it puts 'job-material' and 'ORTHOCLASE' on different lines.  Adding ':' seems to change it, but not make it work.  What do?
Title: Re: DFHack 0.34.03 r1
Post by: orius on February 28, 2012, 10:28:01 pm
Changevein, huh? 

So basically I could take those big ass clusters of orthoclase or mica and turn them into something like magnetite, coal, native platinum, or diamonds?

As kickass as that sounds, I'll probably try to refrain from using it, where's the challenge in letting yourself pump out massive bling without any trouble at all?
Title: Re: DFHack 0.34.03 r1
Post by: Girlinhat on February 28, 2012, 10:30:22 pm
I'll probably end up converting microcline into orthoclase here in specific.  Same value, different color, keeps the above-ground fort consistent.
Title: Re: DFHack 0.34.03 r1
Post by: orius on February 28, 2012, 10:35:15 pm
That's an interesting idea, but I like blue and yellow makes me want to puke, so I'd do it the other way around.
Title: Re: DFHack 0.34.03 r1
Post by: Quietust on February 28, 2012, 10:37:36 pm
Be aware that "changevein" only works within 16x16 blocks, so changing an entire vein or large clusters will require multiple uses.
Title: Re: DFHack 0.34.03 r1
Post by: peterix on February 28, 2012, 10:38:48 pm
How do you utilize keybinding?  When I try
Code: [Select]
keybinding A job-material ORTHOCLASEthen request a list, it puts 'job-material' and 'ORTHOCLASE' on different lines.  Adding ':' seems to change it, but not make it work.  What do?
Like this:
Code: [Select]
keybinding set A "job-material ORTHOCLASE"
Now, the problem with this is, that 'A' is a single, and commonly used key. So you'll probably want to do this right after that:
Code: [Select]
keybinding clear AAnd then bind the command to something else. Like for example 'Shift-A', 'Alt-A' or 'Ctrl-A'.

Even better, you can use the 'dfhack.init' file to hold a bunch of keybinds and see some examples of how they can be defined. The example file dfhack.init-example should be in your DF folder. Just rename it to dfhack.init. DFHack will execute the commands in it when it starts.

Changevein, huh? 

So basically I could take those big ass clusters of orthoclase or mica and turn them into something like magnetite, coal, native platinum, or diamonds?

As kickass as that sounds, I'll probably try to refrain from using it, where's the challenge in letting yourself pump out massive bling without any trouble at all?
If it's too much of a temptation, you can always go into DF/hack/plugins and delete whatever you want in there. Or you could change those big blobs of orthoclase and microcline to some boring old rock that blends in with the layer ;)
Title: Re: DFHack 0.34.03 r1
Post by: orius on February 28, 2012, 10:47:29 pm
It's not a problem.  I know I can delete the plugin and I (probably) have enough self-control to not use it.

I like Girlinhat's idea though.  Change the stones around to make the fort more colorful.  Instead of drab greys all the time (though that's not a big problem), I can change to stuff like olivine or pitchblende or kimberlite or bauxite and have some nice splashes of color in the fort.
Title: Re: DFHack 0.34.03 r1
Post by: Girlinhat on February 28, 2012, 10:48:57 pm
The included help could use some sprucing up.  Basically, every time someone asks a question like "how do I use keybinding" then it means "the keybinding section of the help needs more info".  "A" is not the same as "Shift-A" and "SHIFT-A" is not the same as "Shift-A" either.

Works now, so it's all good, but could preempt these questions with a more detailed help file.
Title: Re: DFHack 0.34.03 r1
Post by: orius on February 28, 2012, 11:20:15 pm
Something else I've been meaning to ask.

The fixdiplomats funtion, does it give the player trade agreements with the elves, or do they just annoy with logging quotas?
Title: Re: DFHack 0.34.03 r1
Post by: Quietust on February 28, 2012, 11:27:35 pm
Something else I've been meaning to ask.

The fixdiplomats funtion, does it give the player trade agreements with the elves, or do they just annoy with logging quotas?
Just logging quotas. It would certainly be possible to have "fixmerchants" work on Elves, but I only wrote it to work on Humans because they're the only ones that are supposed to have that.
Title: Re: DFHack 0.34.03 r1
Post by: thatkid on February 28, 2012, 11:30:03 pm
I can't seem to find the answer in the readme, so I guess I'll ask here...

I'm running Ubuntu, so I can't utilize DFLair. Is there any other tool with the same functionality? For some reason I remember there used to be, but now I feel like I imagined it.
Title: Re: DFHack 0.34.03 r1
Post by: thistleknot on February 28, 2012, 11:30:58 pm
I have a request.

1. a hack that allows the defaults uniforms for militia to be copied.
2. a hack that allows the base materials for the uniforms to be modified.

Reason being.  I can't copy/backup original uniforms to modify them.  I have to recreate them.
I can't change the material of Leather headwear.  If I want all leather uniforms, and want to modify leather.  And I want to say Metal Headwear, I have to specify Metal Helms, or Metal Caps, etc.  It would be nice to have a hack for that.
Title: Re: DFHack 0.34.03 r1
Post by: orius on February 28, 2012, 11:40:02 pm
Something else I've been meaning to ask.

The fixdiplomats funtion, does it give the player trade agreements with the elves, or do they just annoy with logging quotas?
Just logging quotas. It would certainly be possible to have "fixmerchants" work on Elves, but I only wrote it to work on Humans because they're the only ones that are supposed to have that.

I think I'll leave that off then.  Don't need to have them bug me about trees if I can't tell them to bring me more bears in return.   :P
Title: Re: DFHack 0.34.03 r1
Post by: Quietust on February 28, 2012, 11:57:43 pm
Something else I've been meaning to ask.

The fixdiplomats funtion, does it give the player trade agreements with the elves, or do they just annoy with logging quotas?
Just logging quotas. It would certainly be possible to have "fixmerchants" work on Elves, but I only wrote it to work on Humans because they're the only ones that are supposed to have that.

I think I'll leave that off then.  Don't need to have them bug me about trees if I can't tell them to bring me more bears in return.   :P

If you don't give them diplomats, then you won't be able to refuse their quotas (or just outright murder the diplomat) and get them to start a war.
Title: Re: DFHack 0.34.03 r1
Post by: orius on February 29, 2012, 12:32:17 am
That's ok, I don't feel like picking a fight with the elves.  The one time I did fight them, it felt like I was kicking a baby around.  :P
Title: Re: DFHack 0.34.03 r1
Post by: Blah on February 29, 2012, 03:29:33 am
I have a request.

1. a hack that allows the defaults uniforms for militia to be copied.
2. a hack that allows the base materials for the uniforms to be modified.

Reason being.  I can't copy/backup original uniforms to modify them.  I have to recreate them.
I can't change the material of Leather headwear.  If I want all leather uniforms, and want to modify leather.  And I want to say Metal Headwear, I have to specify Metal Helms, or Metal Caps, etc.  It would be nice to have a hack for that.

You can make a macro that sets up all the uniforms you want.
Title: Re: DFHack 0.34.03 r1
Post by: Alexander86 on February 29, 2012, 03:41:18 am
I am having one problem with the liquids function. It is probably not a bug just me not knowing how to use it properly. Whenever i go to make an obsidian wall area that should go up multiple Z levels it will do one (sometimes 2) then only a piece of it will have further walls on it kind of like a wedding cake...only square. What I would like to ideally is make a tower on wherever i designate that is 100x100 and 15 levels tall. I have checked the world gen and there is enough free levels above me to do this. Also if i try to just go to the next level up and make a similar area of obsidian walls it wont do anything.

Also is there anyway to delete a river source? I managed to dig myself a river but i put the river source too high and its starting to flood my embark.
Title: Re: DFHack 0.34.03 r1
Post by: celebrinborn on February 29, 2012, 04:02:53 am
The minecraft plugin does not appear to work, I get the message df2minecraft is not a reconized command. Am I typing something in wrong? Did I forget to do something? Or is this bugged? Thanks
PS: I'm new to using this program, sorry if this seems like a stupid question.
Title: Re: DFHack 0.34.03 r1
Post by: Mover#005 on February 29, 2012, 06:12:09 am
I can't get it to work on gentoo x64 either with 34.03 or 34.02:

ERROR: ld.so: object './hack/libdfhack.so' from LD_PRELOAD cannot be preloaded: ignored.
Loading bindings from data/init/interface.txt
New window size: 1280x640
Font size: 16x16
Resizing grid to 80x40
Resizing font to 16x16

Game proceeds to load up normally then. Any pointers?
Title: Re: DFHack 0.34.03 r1
Post by: ag on February 29, 2012, 06:33:34 am
Game proceeds to load up normally then. Any pointers?

You don't get the following lines anywhere?

Code: [Select]
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]#

If not, do you get anything in a file called stderr.log?

I get that ERROR line too, but it still works; I suspect the error comes from the setarch command, which isn't really supposed to load that library anyway - and can't on a 64-bit system.

P.S. Also, there isn't a dfhack build that would work with both 34.03 and 34.02 - one of the major data structures changed slightly, so they are incompatible. 34.04 data structures on the other hand are identical to 34.03.
Title: Re: DFHack 0.34.03 r1
Post by: robertheinrich on February 29, 2012, 07:06:11 am
34.04 data structures on the other hand are identical to 34.03.

I was just about to ask that. So I can safely upgrade to 34.04 (because it finally fixes archery training) and DFHack will still work? Nice.
Title: Re: DFHack 0.34.03 r1
Post by: peterix on February 29, 2012, 07:20:38 am
34.04 data structures on the other hand are identical to 34.03.

I was just about to ask that. So I can safely upgrade to 34.04 (because it finally fixes archery training) and DFHack will still work? Nice.
You'll need an updated symbol file : https://raw.github.com/angavrilov/df-structures/a20d8fb6720e13393ba4133bb579612e7bdfe500/symbols.xml
Right click, save as, overwrite the one in the 'hack' folder.
Title: Re: DFHack 0.34.03 r1
Post by: Mover#005 on February 29, 2012, 07:42:56 am
Game proceeds to load up normally then. Any pointers?

You don't get the following lines anywhere?

Code: [Select]
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]#

If not, do you get anything in a file called stderr.log?

I get that ERROR line too, but it still works; I suspect the error comes from the setarch command, which isn't really supposed to load that library anyway - and can't on a 64-bit system.

P.S. Also, there isn't a dfhack build that would work with both 34.03 and 34.02 - one of the major data structures changed slightly, so they are incompatible. 34.04 data structures on the other hand are identical to 34.03.

I should've been more clear, I tried the different versions of dfhack on both versions of dwarf fortress, sorry.

Also nope, I don't get those lines. Upon further observation I'm dumb and unpacked dfhack in the respective wrong folders. :D

Disregard this please. Thanks anyways!

Title: Re: DFHack 0.34.03 r1
Post by: splinterz on February 29, 2012, 09:35:14 am
i noticed when exporting dwarves that the mental attributes ordering has changed. the new order is (by order of offsets):
analytical ability, focus, willpower, creativity, intuition, patience, memory, linguistic ability, spatial sense, musicality, kinesthetic sense, empathy, social awareness

on a side note, tell me your secret to finding the cur_year offset! :D
Title: Re: DFHack 0.34.03 r1
Post by: Quietust on February 29, 2012, 10:16:39 am
on a side note, tell me your secret to finding the cur_year offset! :D
That one's actually quite easy: find the vtable for history_event_collectionst and check the 2nd-last method in it (the last one is the destructor) - it sets one field to the current year and another field to the current time.
Title: Re: DFHack 0.34.03 r1
Post by: Rumrusher on February 29, 2012, 11:04:13 am
okay with the new adv-bodyswap you can switch to your companions... or force switch into someone you talk to.
bad news you can't switch into someone unless you learn their name first.
even worst is that you can't amass an army of peasants even when it seems you're previous character is following you.

so just as a warning this is a companion body swap to solve the issue of switching items around.
Not a basic Dfusion bodyswap where you can jump into a body of an random elephant.
Title: Re: DFHack 0.34.03 r1
Post by: narhiril on February 29, 2012, 12:10:55 pm
So I logged on this morning to find a new version of DF.  I was excited, but worried about having to wait to update mods and utilities, so I got to work updating my own mod.  When I was done with that, I shrugged my shoulders depressingly as I knew that I would have to wait for DFhack and DwarfTherapist to be updated so that I could play again.  I decided to get on the forums for a while...

...Only to find that both DFhack and DT had already been updated.

TL;DR - I fuckin' love you guys.
Title: Re: DFHack 0.34.03 r1
Post by: Girlinhat on February 29, 2012, 12:35:24 pm
From Toady's explanation, .04 appears to be a very small tweak concerning woldgen and image exports.  I would imagine that the entire "get DFHack to work" would be to update the version number and let it loose.
Title: Re: DFHack 0.34.04 r1
Post by: peterix on February 29, 2012, 04:04:13 pm
/me just updated the first post with a build that has 0.34.04 support included.

No more need for downloading xml files :)

From Toady's explanation, .04 appears to be a very small tweak concerning woldgen and image exports.  I would imagine that the entire "get DFHack to work" would be to update the version number and let it loose.
Yes. Only a tiny bit of code changed. The memory layout was not affected.
Title: Re: DFHack 0.34.04 r1
Post by: Caldfir on February 29, 2012, 05:04:01 pm
From Toady's explanation, .04 appears to be a very small tweak concerning woldgen and image exports.  I would imagine that the entire "get DFHack to work" would be to update the version number and let it loose.
Yes. Only a tiny bit of code changed. The memory layout was not affected.
Dude, shut up!  You should be milking this!

YES, KIND FORUMDWELLERS!  GATHER ROUND AND HEAR THE TALE OF MIGHTY PETERIX AND HIS LEGION OF DFHACK BRETHREN! TIRELESSLY THEY TOIL FOR LONG HOURS INTO THE NIGHT TO BRING YOU THIS LATEST AND GREATEST OF UPDATES!  THOUSANDS OF HOURS AND TRILLIONS OF DOLLARS SPENT TO BRING YOU THIS INCONCEIVABLE FEAT OF SOFTWARE MANIPULATION!
Title: Re: DFHack 0.34.04 r1
Post by: peterix on February 29, 2012, 07:42:27 pm
From Toady's explanation, .04 appears to be a very small tweak concerning woldgen and image exports.  I would imagine that the entire "get DFHack to work" would be to update the version number and let it loose.
Yes. Only a tiny bit of code changed. The memory layout was not affected.
Dude, shut up!  You should be milking this!

YES, KIND FORUMDWELLERS!  GATHER ROUND AND HEAR THE TALE OF MIGHTY PETERIX AND HIS LEGION OF DFHACK BRETHREN! TIRELESSLY THEY TOIL FOR LONG HOURS INTO THE NIGHT TO BRING YOU THIS LATEST AND GREATEST OF UPDATES!  THOUSANDS OF HOURS AND TRILLIONS OF DOLLARS SPENT TO BRING YOU THIS INCONCEIVABLE FEAT OF SOFTWARE MANIPULATION!
I wish this forum had an animated smiley face for :ROFL:  :D
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 01, 2012, 01:14:25 am
trying job-material SILVER for an iron mail shirt returns
Job Item 0 has different material: coal
Title: Re: DFHack 0.34.04 r1
Post by: Alexander86 on March 01, 2012, 06:09:20 am
Can someone do a better guide of the tyletypes command? I saw peterixs examples way back in september but this thing is really confusing.
Title: Re: DFHack 0.34.04 r1
Post by: Girlinhat on March 01, 2012, 09:18:24 am
trying job-material SILVER for an iron mail shirt returns
Job Item 0 has different material: coal
"job item-material 1 SILVER" will work though.  Forging is a bit different from most reactions, it's easier to perform a "manual" hack using the "job" plugin.  I successfully queued an iron helm to be made, though I prefer steel so I'm going to cancel the task.
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 01, 2012, 09:46:10 am
that did something, but the job disappears as soon as I look away from the shop.
Title: Re: DFHack 0.34.04 r1
Post by: Girlinhat on March 01, 2012, 09:50:14 am
No idea then, as I said forging jobs follow a slightly different method.  You can easily go into the raws and add [ITEMS_ARMOR] to the silver entry and allow you to forge silver armor at the forge.  This modification does not require a new world (I think).
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 01, 2012, 11:38:35 am
Maybe it needs a coal and 2 silver?
Title: Re: DFHack 0.34.04 r1
Post by: Sutremaine on March 01, 2012, 02:17:21 pm
Mail shirts do take two bars of metal. Also greaves take two, and breastplates take three.
Title: Re: DFHack 0.34.04 r1
Post by: Yaotzin on March 01, 2012, 03:51:36 pm
OK so somehow my reservoir turned stagnant. It's a simple design, a hole with a 1x1 tunnel out, in which lies a pump. Other side of the pump is an open space into which the river flows. The river is stagnant, hence the pump.

Upon finding it stagnant, I used the liquids->vclean command. Voila, unstagnant reservoir. Until I unpause, at which point half of it (from a specific line onwards) becomes stagnant again.

Am I misunderstanding how the command works, or am I missing something about how stagnancy spreads? Shouldn't the reservoir be fine after a vclean (should've been fine to start anyway, no idea why it went stagnant)? Why would only part of it become stagnant?
Title: Re: DFHack 0.34.04 r1
Post by: Sutremaine on March 01, 2012, 04:49:50 pm
I think what might be happening with the rivers is that the game places the rivers and pools at separate times, and where a tile is set to contain both river and murky pool the game doesn't make sure the stagnancy flag for the tile is set for the tile being part of a river. It would account for the uneven placing of the stagnant tiles in the river, the stagnant wall tiles, and the river overwriting the pool would perhaps be the reason that murky pools sometimes lack ramps on walls that are close to a river. The ground on the wall between pool and river can sometimes be a little strange too. My current map has a loamy sand tile atop a peat wall.

I tried a 1000x1000 area wclean and then reduced the water level in one of the formerly murky pools. The water didn't turn stagnant again. Maybe you're missing a tile somewhere?
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 01, 2012, 05:49:32 pm
From Blah

"You can make a macro that sets up all the uniforms you want."

My hack requests for uniforms was so I could mix and match Leather Headwear and Metal Leggings for example.

You can't specify Headwear when doing Helm's.  you have to specify caps, helms, or whatever.

The Leather Headwear covers Helm's, Caps, etc.

It would be nice if dhack would allow me to create a uniform that would allow me to import this non selectable Headware option.

I posted a followup post here regarding the issue specifically

http://www.bay12forums.com/smf/index.php?topic=103136.msg3048995#msg3048995
Title: Re: DFHack 0.31.25 r8 (current)
Post by: DVeL on March 01, 2012, 06:00:24 pm
I'm not sure if anyone else has noticed this, but if I run seedwatch on my fort, my FPS frops from 70-90 down to 25 (and as soon as I type "seedwatch stop" it goes right back to the previous FPS)

Any ideas on why/how I can fix this?
You could, but someone else was quicker. The issue is that it runs too often and just hogs the CPU (each run scanning through all items). Should be fixed in next release (and is already fixed in current code).

I am sure i am talking about the very same problem, which i encountered intensively using workflow - each added job in workflow substracted about 5 FPS, so now the game is very slow... and i DEFINITELY do not want to give up on such a useful feature =)
And because this jobs are mostly of low priority ("Urist, we need this stone doors NOW! Don`t waste precious time, begin construction IMMIDEATLY!!"  :D), this slowing scans can also be reduced a great deal.
Thank you!
Title: Re: DFHack 0.34.04 r1
Post by: Girlinhat on March 01, 2012, 06:11:17 pm
Your request for enabling "headgear" on uniforms is more specific, but I'd think this would be more of a proper DF suggestion rather than a Hack suggestion.
Title: Re: DFHack 0.34.04 r1
Post by: Sutremaine on March 01, 2012, 07:21:26 pm
Would it be possible to have 'reveal caverns' and 'reveal magma' features, plus an unreveal to go with each of them?
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 01, 2012, 08:33:57 pm
Your request for enabling "headgear" on uniforms is more specific, but I'd think this would be more of a proper DF suggestion rather than a Hack suggestion.

I agree wholeheartedly, but I find it hard to believe that my suggestions are gonna make it to final product.  It is nice to see some of them listed in the development area, but if it went into dfhack, I'm sure Toady would take note eventually.  Besides, a dfhack might get it implemented quicker without needing a release update which would require all sorts of chaos amongst the modders.
Title: Re: DFHack 0.34.04 r1
Post by: Moogie on March 01, 2012, 09:51:13 pm
Can someone do a better guide of the tyletypes command? I saw peterixs examples way back in september but this thing is really confusing.

Allow me!

Okay, so you've got DF and DFHack running. In your DFHack console, the first thing to do is enter the tiletypes mode by entering tiletypes [Press Enter]
Now type Help. [Press Enter]

You see two lists here: the Commands and the Options. Whenever you use this program, you always begin a sentence with a Command, followed by an Option, and then finally you specify the value of the Option.

When you enter a full command, you're simply changing the setup of the tool: actually executing the tool occurs by tabbing into DF, using the 'k' menu to hover over a tile, and then tabbing back to DFHack and hitting [Enter]. Or, if you already have a square targetted in DF, you just hit [Enter] again to commit the changes.

So let's make an example to show you how this works.

Your miners just hit an aquifer. Water is gushing down the passageways of your newly dug fort, and you face the prospect of losing hours of hard designation and digging work. You need to plug this hole.

Command:
paint shape wall [Enter]
You've just told the tool that you want to paint tiles of type 'wall'. Do you see how DFHack is displaying your current settings? It says "Filter: any / Paint: WALL / brush: point".
You head over to DF, 'k' over the leaking space, and then hit [Enter] in DFHack. The tile has become a pillar. Whoops. What went wrong?

Command:
paint special normal [Enter]
Now it says "Paint: Normal Wall". That's better. So 'shape' appears to be a broad category of tile types, and 'special' changes some specific properties. 'material' will let you specify what kind of wall it is.

Command:
paint material stone [Enter]
Now it says "Paint: Normal Stone Wall". See how this works? If you're still 'k' over the target square, all you need to do is hit [Enter] again to apply the change. Now look at DF: the tile has become an undug wall of stone. If you didn't specify a material type, it will revert to being an undug wall of whatever it's original type is.

To 'unselect' any option you didn't want to change, change that option's value to "None".

All those other options work in the same way:
paint hidden 0 -- 1 is hidden, 0 is unhidden
Output: "Paint: Normal Stone Wall Visible"

Etc.

The Filter command works using the same syntax as above. It's useful if you're using DFHack to change a big area of tiles, rather than 1 at a time. Filtering types of tiles will stop your painting commands from affecting those tiles.

Change a big area? How? With these commands: Point, Range, Block and Column. Range works a bit differently from the others. Simply type Range and hit [Enter], and DFHack will ask you the necessary dimensions. Do note, however, that the affected area doesn't spread outwards from the targetted tile- rather, it will spread down and right. So just make sure you 'k' target the top-leftmost tile of the range you wish to see affected. I have not tested what Block and Column do, so I can't offer an explanation of those at this time. Sorry!

Hope this helps a bit. That example was a personal one, btw. ;)
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 01, 2012, 10:22:35 pm
so if I wanted to paint adamantine?
Title: Re: DFHack 0.34.03 r1
Post by: quintilius on March 01, 2012, 10:31:56 pm
Something that put ghost to rest or discover missing dead people so that I can put them to rest with engraved slabs would be nice.

This would be remarkably useful. I'm not confident toady will resolve this anytime soon - and lacking runesmith i have no other method of exorcising the unslabbable.
Title: Re: DFHack 0.34.04 r1
Post by: Quietust on March 01, 2012, 10:43:41 pm
so if I wanted to paint adamantine?
I don't believe that's fully possible with the current tiletypes tool - raw adamantine is a "map feature" stone, so it can only be placed where an appropriate map feature (i.e. adamantine tube) is already present. You could certainly paint adamantine tiles within an existing tube e.g. after mining out part of it (just as the "tubefill" tool does), but you can't go placing it wherever you want on the map or you'll just get "Unknown material" walls.
Title: Re: DFHack 0.34.04 r1
Post by: Girlinhat on March 01, 2012, 10:59:06 pm
Actually, could veinchange be used to change a mineral deposit into adamantine?
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 01, 2012, 11:02:31 pm
I don't know if it matters, but adamantine isn't recognized under a vdig command, or vein dig command.
Title: Re: DFHack 0.34.04 r1
Post by: agatharchides on March 01, 2012, 11:27:06 pm
Probably because it would be a little too easy to avoid breaching if you could.  :P
Title: Re: DFHack 0.34.04 r1
Post by: orius on March 02, 2012, 01:10:52 am
I don't know if it matters, but adamantine isn't recognized under a vdig command, or vein dig command.

Yeah, I would say changevein can't change to adamantine since vdig doesn't recognize it as a vein material, it seems to function differently that other veins (particularly the whole multi z-level thing that no other vein in the game does yet).
Title: Re: DFHack 0.34.04 r1
Post by: Alexander86 on March 02, 2012, 01:37:27 am
TYVM Moogie. Could you give me one more example? What if i wanted to change an area to cave floor or grass/dirt floor what would I input for those 2? I basically want to dig down to a a cave level and mine it out and make the entire level one giant forest underground but once i mine out the rocks the cave grass or whatever never grows back. Again ty for the help. I understand the functions pretty well It's just I don't know what materials I can enter into it.

 I've been using the liquids function a lot lately and it works perfectly EXCEPT when you designate an area of obsidian walls to be formed in water. For some reason I can dig down to them and carve staircases but the area I have designated to mine doesnt seem to be a valid area for my dwarves to work on. I really don't think I'm overlooking something but it could be, it took me a while to wrap my head around the stair/floor/carving dynamics
Title: Re: DFHack 0.34.04 r1
Post by: Nice Save on March 02, 2012, 01:40:22 am
Not sure if this is relevant, but if you put something like:

[ENVIRONMENT:ALL_STONE:CLUSTER_ONE:10]

into the raw entry for Raw Adamantine, you can get it in the "normal stone" way as well as in the tubes.
Title: Re: DFHack 0.34.04 r1
Post by: Andux on March 02, 2012, 02:37:25 am
I've been using the liquids function a lot lately and it works perfectly EXCEPT when you designate an area of obsidian walls to be formed in water. For some reason I can dig down to them and carve staircases but the area I have designated to mine doesnt seem to be a valid area for my dwarves to work on.

It looks like liquids doesn't clear the "dangerous terrain" flag (called "flow_forbid" in DFHack) when it removes the water from the tiles, so DF continues to treat the area as off-limits.
Title: Re: DFHack 0.34.04 r1
Post by: celebrinborn on March 02, 2012, 03:36:23 am
I do not know if I should post this here or in your bug reports thread, however the df2minecraft function does not work. Is this a legacy feature that has been removed?
When ever I try and use it, I get the message "df2minecraft is not a recognized command". I have downloaded the file multiple times so it is not an issue of a bugged download.
I'm running windows 7x64.
Title: Re: DFHack 0.34.04 r1
Post by: Rose on March 02, 2012, 04:06:55 am
DFHack for DF 0.34.03 and 0.34.04 (Current):
Windows version (with Stonesense) (https://github.com/downloads/peterix/dfhack/dfhack-0.34.04-r1-Windows.zip)
Linux version (with Stonesense) (https://github.com/downloads/peterix/dfhack/dfhack-0.34.04-r1-Linux.tar.gz)

What's new:
  • Support for 34.04 and 34.03. DO NOT USE WITH 34.02!
  • Still no DFusion and DF2Minecraft.
  • Some new, exciting plugins:
    • Changing mineral vein materials(changevein)
    • Listing party equip in adventure mode (advtools)
    • Taking control over your companions as if they were you (adv-bodyswap).
  • Random minor fixes...
Title: Re: DFHack 0.31.25 r8 (current)
Post by: ag on March 02, 2012, 10:38:46 am
I am sure i am talking about the very same problem, which i encountered intensively using workflow - each added job in workflow substracted about 5 FPS, so now the game is very slow... and i DEFINITELY do not want to give up on such a useful feature =)

The computation in workflow is already supposed to happen only twice per in-game DAY, i.e. once per 600 frames. Please check if 'workflow disable' actually help anything, and if so, upload a savegame so that I can test it with your exact set of jobs. If disabling doesn't help, then this must be something else.
Title: Re: DFHack 0.34.04 r1
Post by: Quietust on March 02, 2012, 10:42:13 am
Actually, could veinchange be used to change a mineral deposit into adamantine?
Certainly - just specify RAW_ADAMANTINE as the material. You can even change mineral veins into layer stones if you want - all it cares is that it's not soil, metal, or something with [NO_STONE_STOCKPILE] (to filter out plaster and glazes) - I probably need to add an extra bit to filter out evil clouds/rains.

I don't know if it matters, but adamantine isn't recognized under a vdig command, or vein dig command.
That's because natural adamantine tubes aren't veins (block_square_event_mineralst) - they're local map features (feature_deep_special_tubest).
Title: Re: DFHack 0.34.04 r1
Post by: Moogie on March 02, 2012, 01:39:31 pm
TYVM Moogie. Could you give me one more example? What if i wanted to change an area to cave floor or grass/dirt floor what would I input for those 2? I basically want to dig down to a a cave level and mine it out and make the entire level one giant forest underground but once i mine out the rocks the cave grass or whatever never grows back. Again ty for the help. I understand the functions pretty well It's just I don't know what materials I can enter into it.

 I've been using the liquids function a lot lately and it works perfectly EXCEPT when you designate an area of obsidian walls to be formed in water. For some reason I can dig down to them and carve staircases but the area I have designated to mine doesnt seem to be a valid area for my dwarves to work on. I really don't think I'm overlooking something but it could be, it took me a while to wrap my head around the stair/floor/carving dynamics

I'm not sure if it will set the appropriate flags for the area to allow tree growth, but try:

paint shape floor [Enter]
paint material grass_dark [Enter] (or soil)

You may also want to try:

paint special wet [Enter] (I don't know if wet will help fertility)

You should end up with: "Paint: Wet Grass_Dark Floor"

When you've setup the brush with these settings, 'k' over your target tile and hit [Enter] again.

I don't have a cave embark right now, but doing this I was able to change quartzite walls into dark subterranean grassy floors.
Title: Re: DFHack 0.34.04 r1
Post by: Quietust on March 02, 2012, 01:49:56 pm
You may also want to try:

paint special wet [Enter] (I don't know if wet will help fertility)
The "wet" special is only effective for soil floors, and its sole use is to distinguish between regular soil and the "wet" soil you find on beaches.
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 02, 2012, 11:05:45 pm
dwarfexport exports to an xml file, but I'm guessing until runesmith works with 34.04 it's pointless?
Title: Re: DFHack 0.34.04 r1
Post by: Girlinhat on March 03, 2012, 12:11:02 am
Presumably you can use that xml however you want.  A .xml is just a formatted .txt right?  Any suitable program can pick and choose the info off it, or you could read it by hand.
Title: Re: DFHack 0.34.04 r1
Post by: Kregoth on March 03, 2012, 02:30:30 am
Arg! I am having a particular stressful issue, and I would like to confirm if Pre-Embark "Prospect all" is accurate or not? I am discovering that I am finding Flux where Embark says None, I am also seeing prospector not showing a single piece if adamantine ever.

If this has been reported before I am sorry :(
EDIT: I think it prospects a single tile of the highlighted biome in the region square but it most likely isn't where my embark zone is???
Title: Re: DFHack 0.34.04 r1
Post by: ag on March 03, 2012, 04:55:00 am
Arg! I am having a particular stressful issue, and I would like to confirm if Pre-Embark "Prospect all" is accurate or not?

Pre-embark prospect doesn't know anything at all about: surface erosion, caves, magma sea depth, adamantine, HFS. It cannot possibly give a precise value anyway because vein placement is random and happens at the time of embark, so it can only estimate the order of magnitude (and something as low as 5 tiles can easily become 0). An ordinary vein or layer material it doesn't report at all won't be present. The lowest layer is stretched all the way to the magma sea if it is deep, so materials in it can be severely underreported; or if the sea is very near, the lowest layers might be obliterated.

If no biome is blinking, it reports for the whole selected embark rectangle. Otherwise, it computes for one tile of selected biome; to the extent of our present knowledge, all such tiles are statistically identical. It is impossible to highlight a biome not present in the embark rectangle.
Title: Re: DFHack 0.34.04 r1
Post by: Nimrod on March 03, 2012, 05:16:19 am
Hey guys.
 
I found DFHack to be an exceptional tool so far.
I would like to know if it can be used to manipulate/remove creatures (in my case a vampiric ghost) in any way?

cprobe gives me some info, but i see no way how i can use it (since runesmith isnt working atm)

cheers!
Title: Re: DFHack 0.34.04 r1
Post by: Rose on March 03, 2012, 05:20:39 am
normally I'd say use liquids to magma the creature, but since this is a ghost, I don't know.
Title: Re: DFHack 0.34.04 r1
Post by: Nimrod on March 03, 2012, 05:34:31 am
normally I'd say use liquids to magma the creature, but since this is a ghost, I don't know.

Oh, i tried that, doesnt work  ;)

Since the ghost doesnt show up on the slab menue (to put him to rest) I need to get rid of him by hacking somehow ...
Title: Re: DFHack 0.34.04 r1
Post by: Kanil on March 03, 2012, 06:55:36 am
I'm trying to use Tiletypes to make some Fire Clay for stoneware, rather than use regular clay and earthenware -- the prospect of building my entire fort out of brown is not so appealing.

But... I can't figure it out. paint material FIRE_CLAY does nothing. paint material soil just gives me existing regular clay.

Can't use the vein changer to transmute something into fire clay. Is there another tool I could use? Or am I using Tiletypes wrong?
Title: Re: DFHack 0.34.04 r1
Post by: SkulkingFilth on March 03, 2012, 08:56:41 am
I'm also trying to use the tiletypes tool, but to make a sand floor. I can't get it to work. I managed to paint some random soil, using paint material soil, but any attempt to make a sand soil floor was unsuccessful. I'm trying to mess blindly with the variant and special commands but, until now, fruitlessly.

Any idea ?
Thanks.
Title: Re: DFHack 0.34.04 r1
Post by: Goncyn on March 03, 2012, 09:16:50 am
I just started digging into this tool, and it's great! Thanks! I particularly like the "workflow" command. It takes away a ton of the tedium of keeping a fort running, and for that I love you.  :D

Where does workflow save its list of constraints? I am building some standard ones I want to use in future games, so I want to know how to move them around.

Also, I see people talking about changing the job input items to control what the automated jobs produce. Is there any kind of intro guide to doing that anywhere?

Lastly, is it possible to use workflow to keep a certain number of rock crafts stockpiled? The job produces a variety of items, so I'm not sure how to set up the constraint.

Thanks again!
Title: Re: DFHack 0.34.04 r1
Post by: peterix on March 03, 2012, 09:38:13 am
I'm trying to use Tiletypes to make some Fire Clay for stoneware, rather than use regular clay and earthenware -- the prospect of building my entire fort out of brown is not so appealing.

But... I can't figure it out. paint material FIRE_CLAY does nothing. paint material soil just gives me existing regular clay.
Can't use the vein changer to transmute something into fire clay. Is there another tool I could use? Or am I using Tiletypes wrong?
I'm also trying to use the tiletypes tool, but to make a sand floor. I can't get it to work. I managed to paint some random soil, using paint material soil, but any attempt to make a sand soil floor was unsuccessful. I'm trying to mess blindly with the variant and special commands but, until now, fruitlessly.

Any idea ?
Thanks.

It's the same problem. The tool can only work with tile types, not the materials themselves. In case of layer stones, the material is pulled from the geology of the region. So when the region has a layer of sand, you will have sand when you paint a SOIL tile on that layer. Changing the material would require changing it for the whole region. It's certainly a good idea for a new tool. Layerchange? Maybe! :-)

normally I'd say use liquids to magma the creature, but since this is a ghost, I don't know.

Oh, i tried that, doesnt work  ;)

Since the ghost doesnt show up on the slab menue (to put him to rest) I need to get rid of him by hacking somehow ...
The tool was there for 31.xx, but wasn't ported to 34.xx. It's likely that it would be much cleaner to fix those ghosts now... (see code here) (https://github.com/peterix/dfhack/blob/master/needs_porting/fix-3708.cpp)
Title: Re: DFHack 0.34.04 r1
Post by: ag on March 03, 2012, 09:41:33 am
Since the ghost doesnt show up on the slab menue (to put him to rest) I need to get rid of him by hacking somehow ...
The tool was there for 31.xx, but wasn't ported to 34.xx. It's likely that it would be much cleaner to fix those ghosts now... (see code here) (https://github.com/peterix/dfhack/blob/master/needs_porting/fix-3708.cpp)

Could you upload a save with your ghost so we can try finding the best fix for the current version?

EDIT: Is your ghost missing? If not, are you sure it isn't on the slab menu - I've tested with a vampire ghost save from a bug, and it seems that vampires appear by their true names in the list. To be sure, you can try setting a nickname using 'rename unit' in dfhack: unlike the in-game ui, it doesn't care what type of unit it is.
Title: Re: DFHack 0.34.04 r1
Post by: Kanil on March 03, 2012, 09:42:15 am
Well... at least I have some sand on this map too, so I can make a fort out of green instead.

Thank you for the answer, and for Hack itself as well!
Title: Re: DFHack 0.34.04 r1
Post by: Nimrod on March 03, 2012, 11:55:50 am
Since the ghost doesnt show up on the slab menue (to put him to rest) I need to get rid of him by hacking somehow ...
The tool was there for 31.xx, but wasn't ported to 34.xx. It's likely that it would be much cleaner to fix those ghosts now... (see code here) (https://github.com/peterix/dfhack/blob/master/needs_porting/fix-3708.cpp)

Could you upload a save with your ghost so we can try finding the best fix for the current version?

EDIT: Is your ghost missing? If not, are you sure it isn't on the slab menu - I've tested with a vampire ghost save from a bug, and it seems that vampires appear by their true names in the list. To be sure, you can try setting a nickname using 'rename unit' in dfhack: unlike the in-game ui, it doesn't care what type of unit it is.

hey! Thanks for the reply.

The vampire itself was atom smashed - so no body or parts
I am abolutely sure, it isnt on the slab menue.
I tried renaming (nick and profession) via dfhack (about 30 times by now) but it still wont show up. A second vampire ghost that didnt show cama up after the renaming - he is put to rest
When i export to xml the ghost is in the dwarf list - he seems to be somewhere in limbo

where should i put the save? compressed or not?

cheers

P.S.: I'll rename the ghost to something less offensive before i post the save though ... :D
Title: Re: DFHack 0.34.04 r1
Post by: ag on March 03, 2012, 12:22:44 pm
where should i put the save? compressed or not?

You could just zip it and put on DFFD like bug reports. However - is the vampire ghost Missing or Deceased in the unit list? If it is Missing, then it would not show up in the slab list - I tested it with this save: http://dffd.wimbli.com/file.php?id=5623 (http://dffd.wimbli.com/file.php?id=5623). I know exactly how to remove or set the missing status, but there is no plugin for that yet.
Title: Re: DFHack 0.34.04 r1
Post by: Nimrod on March 03, 2012, 12:33:35 pm
where should i put the save? compressed or not?

You could just zip it and put on DFFD like bug reports. However - is the vampire ghost Missing or Deceased in the unit list? If it is Missing, then it would not show up in the slab list - I tested it with this save: http://dffd.wimbli.com/file.php?id=5623 (http://dffd.wimbli.com/file.php?id=5623). I know exactly how to remove or set the missing status, but there is no plugin for that yet.

Ah i see.
The ghost is MISSING on the list. so thats that.
Well I am no programmer or anything but i CAN use an editor okay (when you show me what to do) ;)
I would be much obliged if you could tell me how to set this sucker to dead so i can engrave his slab and only have to worry about my king vampire ...

cheers!
Title: Re: DFHack 0.34.04 r1
Post by: Ihmemies on March 03, 2012, 02:25:07 pm
It's been a while since I last played DF. I got stonesense but it looks really weird:

http://hakkarainen.kuvat.fi/tempo/spam2/ss.png

How I can center the view? Currently it is partly out of the window for no apparent reason... Also is there some way to make the displayed area larger?

Another annoying thing is the fog which shrouds the view when I increase Z depth. Can I disable it somehow?
Title: Re: DFHack 0.34.04 r1
Post by: Girlinhat on March 03, 2012, 02:33:38 pm
There's a stonesense help file included in DFHack.
Title: Re: DFHack 0.34.04 r1
Post by: Ihmemies on March 03, 2012, 02:40:01 pm
Well the help file told absolutely nothing of use, but looking at the other hidden txt files I realized that from init.txt you can adjust lots of useful stuff. Seems that stonesense doesn't like at all if you resize the window yourself, it must be done from init.
Title: Re: DFHack 0.34.04 r1
Post by: Lysabild on March 03, 2012, 02:54:08 pm
What does the r1 in the title stand for?  ???
Title: Re: DFHack 0.34.04 r1
Post by: ShoesandHats on March 03, 2012, 03:05:11 pm
My game crashes every time I try to accept a world I designed with advanced parameters when I use this. Is there any way to fix this?
Title: Re: DFHack 0.34.04 r1
Post by: Quietust on March 03, 2012, 03:31:06 pm
What does the r1 in the title stand for?  ???
It means "release 1" - if DFHack gets some major bugfixes or new features before the next DF version, then "DFHack 0.34.04 r2" might get released.
Title: Re: DFHack 0.34.04 r1
Post by: robertheinrich on March 03, 2012, 04:08:00 pm
I tried to make one of my z levels uniform as much as possible (found a BIG granite layer and since it is nicely white I decided to change every veins and clusters etc to GRANITE using changevein). That worked fine except for horn silver, which according to DFHack is not a veign or mineral. Problem with DFHack or rather a DF thingy?

Minor nuisance, since the clusters are tiny, but I thought I might report it. And yeah, I only read the last few pages... if that issue was already mentioned then just ignore my post.
Title: Re: DFHack 0.34.04 r1
Post by: Quietust on March 03, 2012, 05:11:50 pm
Horn silver is most definitely a mineral, so it ought to be detecting it. What's the exact error message you're getting?
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 03, 2012, 05:22:05 pm
so using dfhack, could i create hematite walls somehow?

Update:
When I specify a wall.  I can choose stone or mineral (for this specific example).  And the wall comes out gabro.  Prolly because of where it's at.  Unfortunately I have a site that has low minerals other than silver.  I had picked it because it had shallow and/or deep metals.  Now I'm stuck with next to nothing for iron source.  So I'm hoping to generate some iron (i.e. cheat).  I was hoping dfhack could do that for me.
Title: Re: DFHack 0.34.04 r1
Post by: Goncyn on March 03, 2012, 07:01:59 pm
Any tips on how to use workflow to automatically process pig tails (spin) and sweet pods (syrup)?
Title: Re: DFHack 0.34.04 r1
Post by: Quietust on March 03, 2012, 07:15:24 pm
so using dfhack, could i create hematite walls somehow?

Update:
When I specify a wall.  I can choose stone or mineral (for this specific example).  And the wall comes out gabro.  Prolly because of where it's at.  Unfortunately I have a site that has low minerals other than silver.  I had picked it because it had shallow and/or deep metals.  Now I'm stuck with next to nothing for iron source.  So I'm hoping to generate some iron (i.e. cheat).  I was hoping dfhack could do that for me.
It is currently not possible to create walls made of arbitrary materials - the best you can do is use changevein to change a specific mineral inclusion into hematite/limonite/magnetite.
Title: Re: DFHack 0.34.04 r1
Post by: ShoesandHats on March 03, 2012, 07:25:21 pm
My game crashes every time I try to accept a world I designed with advanced parameters when I use this. Is there any way to fix this?

Why does no one answer my question?

 :'( :( :'( :( :'(

I guess I'll just go jump off of a bridge into a bathtub filled with razors and guns and pills and water and toasters...
Title: Re: DFHack 0.34.04 r1
Post by: Rumrusher on March 03, 2012, 07:37:37 pm
My game crashes every time I try to accept a world I designed with advanced parameters when I use this. Is there any way to fix this?

Why does no one answer my question?

 :'( :( :'( :( :'(

I guess I'll just go jump off of a bridge into a bathtub filled with razors and guns and pills and water and toasters...
Your question is a Dwarf fortress bug. Bug that I don't even think can be solved with Dfhack(for your question is to vauge). You might want to go through your errorlogs and see what's wrong.
Title: Re: DFHack 0.34.04 r1
Post by: thistleknot on March 04, 2012, 12:44:31 am
I don't suppose there's a way to fill a vein again then is there?

I guess tiletypes can do something like that, but I got some hematite going, thanks
Title: Re: DFHack 0.34.04 r1
Post by: ctoan on March 04, 2012, 03:47:55 am
After an unfortunate bout of flooding, I feel it should be made clear in the readme that nopause not only disables pausing, but disable the job cancellations, too.
Title: Re: DFHack 0.34.04 r1
Post by: peterix on March 04, 2012, 04:41:47 am
After an unfortunate bout of flooding, I feel it should be made clear in the readme that nopause not only disables pausing, but disable the job cancellations, too.
It doesn't disable job cancellations. Just tested it with digging tunnels under murky pools... So, you have some other problem there. For example, if those damp tiles are already revealed, you won't get any cancellations.
I don't suppose there's a way to fill a vein again then is there?

I guess tiletypes can do something like that, but I got some hematite going, thanks
tiletypes, yes.
Code: [Select]
paint sh wall
filter sh floor
filter mat mineral
Then paint over the vein.
Title: Re: DFHack 0.34.04 r1
Post by: ctoan on March 04, 2012, 04:57:39 am
After an unfortunate bout of flooding, I feel it should be made clear in the readme that nopause not only disables pausing, but disable the job cancellations, too.
It doesn't disable job cancellations. Just tested it with digging tunnels under murky pools... So, you have some other problem there. For example, if those damp tiles are already revealed, you won't get any cancellations.

Huh.  Ok.  Sorry to blame, then.  All I know is that I was mining out the face of an aquifer and turned on nopause and suddenly everything was flooding.
Title: Re: DFHack 0.34.04 r1
Post by: Goncyn on March 04, 2012, 09:07:16 am
Any tips on how to use workflow to automatically process pig tails (spin) and sweet pods (syrup)?

To answer my own question...  8)

Code: [Select]
workflow amount THREAD//GRASS_TAIL_PIG:THREAD 5
workflow count LIQUID_MISC//POD_SWEET:EXTRACT 5

and then on the workshop jobs, respectively,

Code: [Select]
job item-material 1 GRASS_TAIL_PIG
job item-material 1 POD_SWEET

Can anyone clarify for me why you have to alter the job to specify the input material? Why doesn't it work automatically like most other constraints? Also, what exactly does the double '//' mean in the constraint spec?
Title: Re: DFHack 0.34.04 r1
Post by: ag on March 04, 2012, 10:06:43 am
Can anyone clarify for me why you have to alter the job to specify the input material? Why doesn't it work automatically like most other constraints? Also, what exactly does the double '//' mean in the constraint spec?

Because it doesn't care to go through all the plants in the raws, and check which of them can be used with this job and which are available on the map. Anyway, I think that the game ui should allow specifying precise materials there; with milling you actually need it if you want sensible constraints for flour and dyes.

"//" happens because there is an omitted generic material specifier, i.e. you could write THREAD/CLOTH/GRASS_TAIL_PIG:THREAD, or BAR/METAL/COPPER, but that is pointless.
Title: Re: DFHack 0.34.04 r1
Post by: Goncyn on March 04, 2012, 11:00:29 am
Thanks, ag, that helps a lot.
Title: Re: DFHack 0.34.04 r1
Post by: Girlinhat on March 04, 2012, 01:01:06 pm
Also a trick I picked up, you CAN paint specific wall tiles in natural stone, at least in previous DFHack releases, but it's a little finicky.  Save your game, open the raws, find obsidian, and rename it to HEMATITE.  Now find hematite, and rename it OBSIDIAN.  Now open your game (preferably keep it still paused) and use the Liquids tool.  It looks for any raw entry with the title OBSIDIAN, which is now iron ore, so when you paint obsidian tiles it will instead paint hematite titles.  This can have some moderately funky consequences, so preferably don't unpause while you've done this.  Paint the tiles, save, and then reverse the raw names.

Although it does beg the question, if Liquids can do this, why can't another tool?

Or... actually I may be mistaken.  I think it was removing the [LAVA] tag and placing it on hematite instead.  I can't remember, it's been a while since I did this and I didn't document it very well.
Title: Re: DFHack 0.34.04 r1
Post by: Quietust on March 04, 2012, 02:45:43 pm
Or... actually I may be mistaken.  I think it was removing the [LAVA] tag and placing it on hematite instead.  I can't remember, it's been a while since I did this and I didn't document it very well.
You are indeed mistaken - when you paint "obsidian", you're actually painting "lava stone", and if you have multiple types of [LAVA] stones in the game at once, it'll use a different one for each biome.
Title: Re: DFHack 0.34.04 r1
Post by: darkfoxprime on March 04, 2012, 02:49:46 pm
I'm sorry if this has already been asked/answered, but I was unable to find it:

Is there a way to get a list of the item types / material names / etc. that can be used with workflow?

I love the workflow tool, but I've given up on using it for some things because for the life of me I cannot figure out what to use for the item name.

Thanks!
- dfp
Title: Re: DFHack 0.34.04 r1
Post by: Girlinhat on March 04, 2012, 03:23:32 pm
Wiki helps.  http://dwarffortresswiki.org/index.php/Item_token has been a great source of info for workflow.  For instance, TOOL:ITEM_TOOL_LARGE_POT/CLAY defines "make clay pots" job.  Biggest issue for me is forgetting to use the TOOL: or AMMO: prefix there.
Title: Re: DFHack 0.34.04 r1
Post by: Grax on March 04, 2012, 03:31:52 pm
Or... actually I may be mistaken.  I think it was removing the [LAVA] tag and placing it on hematite instead.  I can't remember, it's been a while since I did this and I didn't document it very well.
You are indeed mistaken - when you paint "obsidian", you're actually painting "lava stone", and if you have multiple types of [LAVA] stones in the game at once, it'll use a different one for each biome.
As for 31.25 it seems not for each biome but for the whole embark.
Title: Re: DFHack 0.34.04 r1
Post by: TroZ_shack on March 04, 2012, 03:57:43 pm
Hi,
I'm trying to compile DFHack on windows using Visual Studio 2010.  The project has changed a lot since the list time I attempted to do this.  I'm currently running into an issue when running the generate-MSCV-all.bat file.  I get an error about not being able to open xml/list.pl, and then two errors about not being able to open the subdirectories stonesense and df2mc.
Spoiler (click to show/hide)


I'm not sure of the cause of the xml/list.pl error (I am not using strawberry perl, I have Active Perl but it does have XML-LibXML and XML-XSLT according to PPM), but the other two errors are apparently because of the plugins directory for those two projects are empty. I pulled the code from a newly made fork of the dfhack project. Github shows that those directories are actually links to other projects, but I'm not sure how to have git correctly pull those directories as well.



I'm attempting to get this working so that I can update and improve DF2MC.  I haven't worked on it in over a year, but with the new version of DF out, and Minecraft 1.2 with increased build height there are big enough changes that a new version should be worked on.  Additionally, I've have a few bug reports that should be fixed, both through git, and from this thread.

I didn't realize that DF2MC was now included in DFHack. (I also didn't realize that DFHack was no longer an external program).  I think it is great that it has been kept somewhat alive.

The biggest planned feature is support for the larger height limit for Minecraft, which should allow for fortresses with 84 z-levels without any of the 'compression' hacks that DF2MC had to use before to fit into the space Minecraft had. The second is support for the newer blocks added to Minecraft (everything since the Halloween update, including beds (although from this thread it seems like someone tried to add them), grass/shrubs, etc.  I'll definitely remove the the use of ice in blue colored stone and use Lapis Lazuli instead.
Title: Re: DFHack 0.34.04 r1
Post by: peterix on March 04, 2012, 04:14:45 pm
Hi,
Hello! Haven't seen you here for a while :)

I'm trying to compile DFHack on windows using Visual Studio 2010.  The project has changed a lot since the list time I attempted to do this.  I'm currently running into an issue when running the generate-MSCV-all.bat file.  I get an error about not being able to open xml/list.pl, and then two errors about not being able to open the subdirectories stonesense and df2mc.
Spoiler (click to show/hide)
Github shows that those directories are actually links to other projects, but I'm not sure how to have git correctly pull those directories as well.
Yes. Those are called submodules in git speak. So you need to 'init' and 'update' them. Init once, update every time you pull from repo.

I'm attempting to get this working so that I can update and improve DF2MC.  I haven't worked on it in over a year, but with the new version of DF out, and Minecraft 1.2 with increased build height there are big enough changes that a new version should be worked on.  Additionally, I've have a few bug reports that should be fixed, both through git, and from this thread.

I didn't realize that DF2MC was now included in DFHack. (I also didn't realize that DFHack was no longer an external program).  I think it is great that it has been kept somewhat alive.

The biggest planned feature is support for the larger height limit for Minecraft, which should allow for fortresses with 84 z-levels without any of the 'compression' hacks that DF2MC had to use before to fit into the space Minecraft had. The second is support for the newer blocks added to Minecraft (everything since the Halloween update, including beds (although from this thread it seems like someone tried to add them), grass/shrubs, etc.  I'll definitely remove the the use of ice in blue colored stone and use Lapis Lazuli instead.
Yep. Ideally, hop on irc: #dfhack on freenode. The plugin is currently disabled - there were too many changes in dfhack just before 0.34 came out and it had some long standing bugs (couldn't handle non-square embarks properly). It really needs updating :)

EDIT: I'll try to get it compiling and working with the new stuff.
Title: Re: DFHack 0.34.04 r1
Post by: TroZ_shack on March 04, 2012, 07:04:36 pm
I not a Linux guy, and I'm still having some issues setting up the project. 
I renamed the directory that has my other perl installation in (used by another linux utility I occasionally use), and installed Strawberry Perl.  I then added c:\strawberry\perl\bin to my path.

Attempting to then setup LibXML give me this error:
Spoiler (click to show/hide)

I'm assuming that I don't have something setup correctly, or that I need to reboot after installing Strawberry Perl (the install didn't say anything about rebooting).  I'll reboot in a little while, I'm downloading somethign in the background right now, but in case it is a config issue and won't be fixed by rebooting, I'm posting in the hopes that you can help me out.

Thanks.
Title: Re: DFHack 0.34.04 r1
Post by: peterix on March 04, 2012, 07:49:34 pm
I'm not sure what's happening there... could be some path issue, could be something completely different interfering. If you had an existing perl install, it should've worked just fine. Anyway, join us on IRC: http://webchat.freenode.net/?channels=dfhack&uio=d4
Title: Re: DFHack 0.34.04 r1
Post by: DVeL on March 05, 2012, 09:01:06 am
From Blah

"You can make a macro that sets up all the uniforms you want."
My hack requests for uniforms was so I could mix and match Leather Headwear and Metal Leggings for example.
It would be nice if dhack would allow me to create a uniform that would allow me to import this non selectable Headware option.


Any word from DFHack developers about getting access to "headgear", "armor", "footgear" and etc. except for default uniform templates?
Or some way to save and keep uniform templates from one fort to another?
Because i couldn`t find uniform profile (like "embark profile" or something), and it seems they are hidden and stored somewhere deeper than i can reach personally =(
Title: Re: DFHack 0.34.04 r1
Post by: acetech09 on March 05, 2012, 08:58:58 pm
I know there isn't a command for it - but is there some obscure way to detect vampires with DFhack? I'm trying to do a megabuild with superdwarves and hate losing a good laborer to a vampire.
Title: Re: DFHack 0.34.04 r1
Post by: robertheinrich on March 05, 2012, 09:58:01 pm
(topic: changevein does not affect horn silver)

Horn silver is most definitely a mineral, so it ought to be detecting it. What's the exact error message you're getting?

I am getting no error message at all. I set a cursor at a veign with horn silver. Then type  changeveign GRANITE  (actually I set it to a key with keybinding set F9 "changeveign GRANITE"  but I tried it manually, too. DFHack accepts the input without an error, but ingame the veign/cluster stays horn silver.
Title: Re: DFHack 0.34.04 r1
Post by: Azure on March 06, 2012, 12:04:24 am
Searched the last couple pages and didn't see anything regarding the reinclusion of DFlair. Does anyone know when DFlair will be re-included so we can avoid cluttered reclaims?
Title: Re: DFHack 0.34.04 r1
Post by: thatkid on March 06, 2012, 12:08:03 am
Searched the last couple pages and didn't see anything regarding the reinclusion of DFlair. Does anyone know when DFlair will be re-included so we can avoid cluttered reclaims?
I actually asked basically the same question a few pages back. No answer.

We're left to assume that it simply isn't going to happen. Good luck.
Title: Re: DFHack 0.34.04 r1
Post by: Azure on March 06, 2012, 12:42:27 am
Spoiler (click to show/hide)

Well I hope they notice how useful it is and put it back in. It made embarking to those really crazy site bearable. Not having to spend 4 years hauling all my crap back to where it should be cause a Tribe of Elk Birds Raid my fort for all my Masterwork Steel Breastplate and Lapis Lazuli stores would be apreciated.
Title: Re: DFHack 0.34.04 r1
Post by: danaris on March 06, 2012, 09:00:15 am
I know there isn't a command for it - but is there some obscure way to detect vampires with DFhack? I'm trying to do a megabuild with superdwarves and hate losing a good laborer to a vampire.

I don't know of one with DFHack, but with Dwarf Therapist, you can check for the name of a particular dwarf, and see if it's there. If you have a dwarf in DF whose name doesn't show up in DT, that's a vampire.

You can pre-screen in DF by checking for dwarves who have high starting social skills, and who are "former members" of a couple dozen different sites.
Title: Re: DFHack 0.34.04 r1
Post by: MagmaSolutionsInc on March 06, 2012, 09:01:28 am
I know there isn't a command for it - but is there some obscure way to detect vampires with DFhack? I'm trying to do a megabuild with superdwarves and hate losing a good laborer to a vampire.
[/quote

Would be nice to have a few options for vampires and lycanthropes. Some kind of magic bullet as an option.
Title: Re: DFHack 0.34.04 r1
Post by: Rumrusher on March 06, 2012, 09:15:16 am
I know there isn't a command for it - but is there some obscure way to detect vampires with DFhack? I'm trying to do a megabuild with superdwarves and hate losing a good laborer to a vampire.
use Dwarf therapist for detecting vampires,
Disposing them... well their more useful alive than dead.
"The best is to isolate them and use DFliquids to seal them up, or use them for removal of unwanted guess in secret"
Title: Re: DFHack 0.34.04 r1
Post by: janglur on March 06, 2012, 11:34:59 am
New DF is out.  Time for update!
Title: Re: DFHack 0.34.04 r1
Post by: Terratoch on March 06, 2012, 11:39:57 am
Massive memory leak and a potential resolution:

I've been playing using DF Hack and noticed a massive climb in memory usage by the program when I've been using fastdwarf.

Interestingly, the memory spike is removed when turning fastdwarf off and then back on again.

Just a tidbit in case anyone else has this issue.
Title: Re: DFHack 0.34.04 r1
Post by: Rumrusher on March 06, 2012, 11:41:29 am
New DF is out.  Time for update!
But it's a(fun exciting features someone reported as) bug fix patch.
Title: Re: DFHack 0.34.04 r1
Post by: NecroRebel on March 06, 2012, 12:03:42 pm
I know there isn't a command for it - but is there some obscure way to detect vampires with DFhack? I'm trying to do a megabuild with superdwarves and hate losing a good laborer to a vampire.
Save, load, go down to the lowest z-level of your map, liquids, w, range (big enough to get everything, everywhere), ENTER. Fills the whole fort with water. Anyone who doesn't immediately start drowning is a vampire. Then, once most of your people have drowned to death, pause again, check the last few survivors for vampirism, then kill DF. It's not exactly a direct method of using DFHack for vampire detection, but it seems reliable.
Title: Re: DFHack 0.34.04 r1
Post by: Greiger on March 06, 2012, 01:37:27 pm
....only in DF.
Title: Re: DFHack 0.34.04 r1
Post by: NecroRebel on March 06, 2012, 01:43:39 pm
....only in DF.
Nah, "there is no kill like overkill" predates DF 8)
Title: Re: DFHack 0.34.04 r1
Post by: BigD145 on March 06, 2012, 01:51:55 pm
I made a quick and dirty 2 high room with a special burrow. It takes time, but lots of people get there. Then I drop water 1 level of 7/7 and make it 1/7 after verifying drowners. Does spawned water still make tiles unavailable? I usually spawn water a z level or two above ground.
Title: Re: DFHack 0.34.04 r1
Post by: ToadChild on March 06, 2012, 02:25:21 pm
Is there any interest/activity in making a Mac version of DF Hack?  I've been primarily playing on my laptop, and would prefer to avoid the hassle of having to copy my fort to my PC just to survey what stones are on my map.

I am a programmer by trade and might be able to make some headway on this, but haven't grabbed the DF Hack sources off of github yet.  I don't necessarily want to start mucking around if someone else has already done the work.
Title: Re: DFHack 0.34.04 r1
Post by: Azure on March 06, 2012, 02:37:36 pm
I know there isn't a command for it - but is there some obscure way to detect vampires with DFhack? I'm trying to do a megabuild with superdwarves and hate losing a good laborer to a vampire.

If you don't mind having no vampires anywhere you can Change the vampire types to 0 in adv world gen. Otherwise its the border control with all its nasty locked rooms and burrows to starve people in.
Title: Re: DFHack 0.34.04 r1
Post by: thewonderidiot on March 06, 2012, 02:45:01 pm
Is there any interest/activity in making a Mac version of DF Hack?  I've been primarily playing on my laptop, and would prefer to avoid the hassle of having to copy my fort to my PC just to survey what stones are on my map.

I am a programmer by trade and might be able to make some headway on this, but haven't grabbed the DF Hack sources off of github yet.  I don't necessarily want to start mucking around if someone else has already done the work.

DFHack for Mac is possible, it's just that none of the DFHack developers have Macs. Peterix tried to get a hackintosh going a while back, and it failed spectacularly. As far as I know, all of the attempts to port DFHack to Mac were back before the major rewrite, so I don't think there's been any work done at all on it. Any help to get it working would be very much appreciated!  :D
Title: Re: DFHack 0.34.04 r1
Post by: ToadChild on March 06, 2012, 03:13:03 pm
Ok, perhaps I will check it out in the next week or two if I find myself with some extra time on my hands.  I'm sure I'll be back with plenty of questions when I do.
Title: Re: DFHack 0.34.04 r1
Post by: acetech09 on March 06, 2012, 03:33:13 pm
Is there any interest/activity in making a Mac version of DF Hack?  I've been primarily playing on my laptop, and would prefer to avoid the hassle of having to copy my fort to my PC just to survey what stones are on my map.

I am a programmer by trade and might be able to make some headway on this, but haven't grabbed the DF Hack sources off of github yet.  I don't necessarily want to start mucking around if someone else has already done the work.

DFHack for Mac is possible, it's just that none of the DFHack developers have Macs. Peterix tried to get a hackintosh going a while back, and it failed spectacularly. As far as I know, all of the attempts to port DFHack to Mac were back before the major rewrite, so I don't think there's been any work done at all on it. Any help to get it working would be very much appreciated!  :D

I was looking for a solution. Then I decided to try wine. Really easy tutorial on wiki. Also works with DFHack. (http://dwarffortresswiki.org/index.php/Utility#Dwarf_Therapist_and_Dwarf_Fortress_on_Mac_using_Wine)

It works fine, runs without a terminal window, and is just as fast, it looks like. That's what I do now.
Title: Re: DFHack 0.34.04 r1
Post by: nenjin on March 06, 2012, 08:13:54 pm
I started having problems with StoneSense. Worked fine with only the occasional crash for quite a while. Then, it started crashing as soon as I would change z-level view even one level. In that time I did reveal a significant portion of the caverns but....I'd pretty much maxed out the z-level view after the caverns had been discovered and had no issues.
Title: Re: DFHack 0.34.04 r1
Post by: Girlinhat on March 06, 2012, 09:39:37 pm
Just an fyi, one of the branch versions of Therapist has a vampire filter so you can spot them easily.  Seems enough people opposed vamps that they coded in a flag check.
Title: Re: DFHack 0.34.04 r1
Post by: MagmaSolutionsInc on March 06, 2012, 11:42:03 pm
Will DFHack need an updated build for 34.05, or just an updated xml file?

I miss it already  :(
Title: Re: DFHack 0.34.04 r1
Post by: Flying Dice on March 07, 2012, 12:15:43 pm
Will DFHack need an updated build for 34.05, or just an updated xml file?

I miss it already  :(
Title: Re: DFHack 0.34.04 r1
Post by: narhiril on March 07, 2012, 12:17:56 pm
Will DFHack need an updated build for 34.05, or just an updated xml file?

I miss it already  :(

0.34.05's changes were a lot more extensive than 0.34.04's, so I'd imagine it will take a little bit longer this time around.
Title: Re: DFHack 0.34.04 r1
Post by: Quietust on March 07, 2012, 03:29:38 pm
One of the major data structures changed slightly (an extra pointer got added to what we call 'world'), so an updated XML won't be enough.
Title: Re: DFHack 0.34.04 r1
Post by: janglur on March 07, 2012, 03:46:13 pm
BLARGH!  x.x

I needs me some prospect!  That's the tool I use most.  Lets me ensure a site has all the big things:  Iron, flux, clay, sand, and no aquifers.
Title: Re: DFHack 0.34.04 r1
Post by: celebrinborn on March 07, 2012, 04:17:37 pm
On the front page it lists df2minecraft as one of the example commands however apparently that command has been disabled. Could you please consider either removing that example or appending something to the effect of "not currently working" next to that example? This would save some people a lot of confusion. Thanks.
Title: Re: DFHack 0.34.04 r1
Post by: peterix on March 07, 2012, 04:22:02 pm
On the front page it lists df2minecraft as one of the example commands however apparently that command has been disabled. Could you please consider either removing that example or appending something to the effect of "not currently working" next to that example? This would save some people a lot of confusion. Thanks.
Actually, I fixed it to the point that it runs now. It will be back, with a big red warning sign that you use it at your own risk :)
Title: Re: DFHack 0.34.04 r1
Post by: celebrinborn on March 07, 2012, 04:26:15 pm
On the front page it lists df2minecraft as one of the example commands however apparently that command has been disabled. Could you please consider either removing that example or appending something to the effect of "not currently working" next to that example? This would save some people a lot of confusion. Thanks.
Actually, I fixed it to the point that it runs now. It will be back, with a big red warning sign that you use it at your own risk :)
SWEET!!! thanks man!
BTW, the original version of DFHack only exports to the indev version of minecraft, will this patched version allow me to generate levels that are compatible with the current version of minecraft or is it still indev only? Thanks
Title: Re: DFHack 0.34.04 r1
Post by: telamon on March 07, 2012, 05:25:59 pm
Quote
One of the major data structures changed slightly (an extra pointer got added to what we call 'world'), so an updated XML won't be enough.

sounds cool. Thankfully we didn't lose save compatibility, so I will be chillin in 34.04 in the meantime.

quick question: was there ever a command that instakilled a creature in dfhack? I can't remember if this had such a thing, or if runesmith had such a thing, and now I'm just curious.
Title: Re: DFHack 0.34.04 r1
Post by: celebrinborn on March 07, 2012, 05:30:20 pm
Quote
One of the major data structures changed slightly (an extra pointer got added to what we call 'world'), so an updated XML won't be enough.

sounds cool. Thankfully we didn't lose save compatibility, so I will be chillin in 34.04 in the meantime.

quick question: was there ever a command that instakilled a creature in dfhack? I can't remember if this had such a thing, or if runesmith had such a thing, and now I'm just curious.
did you try die?
jk jk (don't try it, it will shut down you game and not save)

Although it isn't instant, I think I've used runesmith to either add the tag can't breath, or having trouble breathing to the creature. It doesn't kill them right away, however it will quickly wind them and often will allow you to get away. Other than that, I don't know
Title: Re: DFHack 0.34.04 r1
Post by: peterix on March 07, 2012, 05:34:11 pm
SWEET!!! thanks man!
BTW, the original version of DFHack only exports to the indev version of minecraft, will this patched version allow me to generate levels that are compatible with the current version of minecraft or is it still indev only? Thanks
indev only, an it's horribly broken. It was written with 40d and 0.31 DF in mind, not really conforming to either, while the understanding of DF's material system was still pretty much minimal. And dfhack changed a lot since then.

Anyway. It will be there, but it needs a rewrite. Badly. When I say 'at your own risk', I really do mean it. Using non-square DF maps = corrupted minecraft map. And some of the tile shapes and materials changed, so what it gets from DFHack is no longer what it expects.
Title: Re: DFHack 0.34.04 r1
Post by: Nameless Archon on March 07, 2012, 06:17:06 pm
quick question: was there ever a command that instakilled a creature in dfhack? I can't remember if this had such a thing, or if runesmith had such a thing, and now I'm just curious.
Don't recall ever seeing one, but using DFliquids to apply magma, or to create obsidian on a spot might work.
Title: Re: DFHack 0.34.04 r1
Post by: peterix on March 07, 2012, 06:29:09 pm
quick question: was there ever a command that instakilled a creature in dfhack? I can't remember if this had such a thing, or if runesmith had such a thing, and now I'm just curious.
Don't recall ever seeing one, but using DFliquids to apply magma, or to create obsidian on a spot might work.
One tile of magma under its feet, one tile of water over its head...
Title: Re: DFHack 0.34.04 r1
Post by: MagmaSolutionsInc on March 07, 2012, 07:33:35 pm
One of the major data structures changed slightly (an extra pointer got added to what we call 'world'), so an updated XML won't be enough.

fair enough. thx.
Title: Re: DFHack 0.34.04 r1
Post by: peterix on March 07, 2012, 08:11:54 pm
One of the major data structures changed slightly (an extra pointer got added to what we call 'world'), so an updated XML won't be enough.

fair enough. thx.

BTW. Release is out already. See first post ;)

Includes df2minecraft with an added warning, a new plugin you can use to force creatures to not be 'missing' and some stonesense fixes.
Title: Re: DFHack 0.34.04 r1
Post by: TroZ_shack on March 07, 2012, 11:49:42 pm
Anyway. It will be there, but it needs a rewrite. Badly. When I say 'at your own risk', I really do mean it. Using non-square DF maps = corrupted minecraft map. And some of the tile shapes and materials changed, so what it gets from DFHack is no longer what it expects.

Hey, cool!  I'll start taking a look at it tomorrow.  Hopefully I can get it working much better and fix some of the bugs.
I was originally going to try to use a library for writing the minecraft map instead of my own code as a lot has changed in the map format, but the only non-java one that I could find is in C# which probably won't port to Linux that easily. I guess I'll have to figure out how to implement the new region format and update the code.
Title: Re: DFHack 0.34.04 r1
Post by: Courtesy Arloban on March 07, 2012, 11:57:26 pm
Quote
One of the major data structures changed slightly (an extra pointer got added to what we call 'world'), so an updated XML won't be enough.

sounds cool. Thankfully we didn't lose save compatibility, so I will be chillin in 34.04 in the meantime.

quick question: was there ever a command that instakilled a creature in dfhack? I can't remember if this had such a thing, or if runesmith had such a thing, and now I'm just curious.
Runesmith had a Genocide button that would instantly kill every creature of the race selected and there were two tags for dead and killed that when used together would kill a specific creature, or if unchecked bring them back from the dead.  Only used it to bring companions back as zombies and skeletons, backfired when they attacked me.

Old versions of DfHack had a ressurect function that when used on a living subject had the opposite effect, it killed them, but luckily could still be used if you killed yourself. I used it to try to make myself a ghost then figured out I was using the wrong tool for that, and runesmith wasn't compatable for that version DF.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 08, 2012, 12:15:13 am
That no longer works because there's more that just a dead flag. There are ways to instantly kill somebody, but they are slightly more involved, like draining all his blood, or whatever.
Title: Re: DFHack 0.34.05 r1
Post by: Rumrusher on March 08, 2012, 07:15:57 am
That no longer works because there's more that just a dead flag. There are ways to instantly kill somebody, but they are slightly more involved, like draining all his blood, or whatever.
shoot and here I thought I could revive souls by turning off the dead, killed flags once Dfusion/runesmith comes out.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 08, 2012, 07:25:45 am
Yeah, you also will have to heal all his wounds and so on, which is more involved.
Title: Re: DFHack 0.34.05 r1
Post by: rooth on March 08, 2012, 07:55:01 am
thanks alot for the new version. I have a question regarding dfhack; I've been trying to get a perfect embark with a volcano for ages now and wasted days trying. Suddenly it hit me; can't i just create my own free fuel babyvolcano with dfhacks liquids?

Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 08, 2012, 08:06:03 am
can't i just create my own free fuel babyvolcano with dfhacks liquids?

Yes you can. You can use the simple and cheaty approach and put one single magma tile under each furnace/forge. Or you could place a huge chunk of magma somewhere near your fortress and have some fun digging it out. The only problem is that you can´t build magma furnaces and forges BEFORE you have discovered the "real" magma sea, so you still need to dig down there, too.
Title: Re: DFHack 0.34.05 r1
Post by: Valdrax on March 08, 2012, 08:48:02 am
Two questions -- one technical, one feature request:

1.  Out of curiosity, why does the Linux version of DFHack use LD_PRELOAD instead of bundling with a version of SDL or some other library like on Windows?  (I ask because my distro's version of glibc disables LD_PRELOAD for security purposes.)

2.  Would it be possible to extend dfprospect to guess at magma levels in the embark screen (or at least where the volcanism hits 100%)?
Title: Re: DFHack 0.34.05 r1
Post by: Antalia on March 08, 2012, 09:14:57 am
Hi Peterix & DFHack experts,

I have been looking at using the "dwarfexport" plugin of DFHack, to replace a function I was previously doing with Runesmith. The description of my project is in another thread if you are interested: http://www.bay12forums.com/smf/index.php?topic=103900.0 (http://www.bay12forums.com/smf/index.php?topic=103900.0)

Basically the dwarfexport plugin almost does what I need, but the XML file it generates does not include some data that my utility was using. The missing details are dwarf ages, currently enabled labors, and skill levels.

I am exploring several options for accessing this data with my program in DF2012 (since Runesmith won't be updated for at least a while). So one thing I did is, I looked at your dwarfexport.cpp on GitHub, and modules/units.cpp. It looks like the dwarf ages (line 145 in units.cpp, I think) and enabled labors (line 143 in units.cpp) are currently accessible in the creature object used by dwarfexport. I didn't see the skill levels, though.

I wouldn't like to ask you to do any work for me--my project is at least a little bit silly :) But I thought it might be worth asking--do you have plans to expand the dwarfexport plugin to write this data to XML, like Runesmith did? I have a feeling based on what I've seen browsing the code, that the ages and enabled labors might not be very difficult to export, but the skill levels could take more effort.

Thank you for your time and have a nice day :)
Title: Re: DFHack 0.34.05 r1
Post by: zilpin on March 08, 2012, 11:17:34 am
Antalia, you could always fork the DFHack source, and expand the XML export tool to contain all the information you want.
Peterix is really good at merging forks into his source trunk.
Runesmith uses DFHack to get it's data, so it's all there.
Title: Re: DFHack 0.34.05 r1
Post by: Intrinsic on March 08, 2012, 11:21:24 am
PTW
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 08, 2012, 11:32:03 am
Out of curiosity, why does the Linux version of DFHack use LD_PRELOAD instead of bundling with a version of SDL or some other library like on Windows?  (I ask because my distro's version of glibc disables LD_PRELOAD for security purposes.)
Probably because the "replace SDL" trick was only done on Windows because that's the only way it could reasonably be done - if LD_PRELOAD was possible on Windows, we'd be using it.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 08, 2012, 11:48:23 am
actually, there is an experimental build that does the equivilant of replacing the dll, unless I mis-understand the purpose of the eggy branch.
Title: Re: DFHack 0.34.05 r1
Post by: Flying Dice on March 08, 2012, 11:59:31 am
Thank you for the update!  :)
Title: Re: DFHack 0.34.05 r1
Post by: ag on March 08, 2012, 12:43:03 pm
actually, there is an experimental build that does the equivilant of replacing the dll, unless I mis-understand the purpose of the eggy branch.

Only it's libgraphics.so, i.e. a part of Dwarf Fortress that is linked into the exe on windows, but separate and open-source on linux. It basically hooks directly into the rendering code of the game in order to do some more fancy stuff.
Title: Re: DFHack 0.34.05 r1
Post by: rooth on March 08, 2012, 01:36:49 pm
can't i just create my own free fuel babyvolcano with dfhacks liquids?

Yes you can. You can use the simple and cheaty approach and put one single magma tile under each furnace/forge. Or you could place a huge chunk of magma somewhere near your fortress and have some fun digging it out. The only problem is that you can´t build magma furnaces and forges BEFORE you have discovered the "real" magma sea, so you still need to dig down there, too.

hmm. good point on the enabling of magma buildings. But wait; I'm pretty sure I discovered the magma sea on my volcano fort when a magma crab threw one of my furnace operators off the ridge, yet I could still make furnaces before this ocurance

Is it not so much the magma sea but more that you need to ''discover'' natural lava? And are there any ways around this? I really like deep maps and intend to keep fps at max so having to go down all the way would kinda ruin it.

The reason i'm looking for a ''fix'' is because all the volcano's i've worked with in 0.34+ have been 20-60 z levels high mountains instead of flat bubbling wells of lava.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 08, 2012, 01:38:37 pm
I suppose it would work if you put down some lava into a hidden part of a cavern and then discovered it.
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 08, 2012, 01:43:02 pm
The trigger isn't "discovering magma in a newly revealed area" - the trigger is discovering the appropriate map feature, specifically either a volcano, a magma pool, or a magma sea. If you're particularly tricky, you might be able to grab a suitably ordinary map block, set its global feature index to that of the magma sea (there might actually be more than one), then set the "is global feature" flag on a particular tile and dig to it to trigger the "You have discovered the magma sea" message and enable the magma workshops.
Title: Re: DFHack 0.34.05 r1
Post by: Courtesy Arloban on March 08, 2012, 02:31:42 pm
Thanks for the grow plants and immolate all functions being usable when dead, that's one bandit leader roasted.

What Format is the exported maps in, and can I transfer them to the arena?
Title: Re: DFHack 0.34.05 r1
Post by: idgarad on March 08, 2012, 04:00:36 pm
for the workload module I am writing a script I intend to cut and paste when I build a fortress as shown below:
Code: [Select]
#FOOD & DRINK STOCKS
#Food 200 Drink 500 +- 50
workflow count FOOD 200 50
workflow count DRINK 500 50

#STEEL Production
workflow count BAR//COAL 100
workflow count BAR//IRON 100
workflow count BAR//PIG_IRON 50
workflow count BAR//STEEL 100

#PROCESS BASIC PLANT GOODS
#Quarry Bush
  # PlantProcess (via Farmer's Workshop)
workflow
  # Milling (via Millstone or Quern)
  # Brewing (via Still)
  # Cooking (Via Kitchen)

#Cave Wheat
  # PlantProcess
  # Milling
workflow
  # Brewing
workflow
  # Cooking

#Plump Helmets
  # PlantProcess
  # Milling
  # Brewing
  # Cooking

#Pig Tail
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Sweet Pod
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Dimple Cup
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Whip Vine
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Sun Berry
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Fisher Berry
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Bloated Tuber
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Prickle Berry
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Muck Root
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Wild Strawberry
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Rope Read
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Rat Weed
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Silver Barb
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Valley Herb
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Kobold Bulb
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Hide Root
  # PlantProcess
  # Milling
  # Brewing
  # Cooking
#Blade Weed



My question is is there a way to remove all constraints such as a "workload unlimit all" I've tested workload unlimit * and all which do not work. I would like to have it at the beginning of the script to clear any existing settings if possible. Also I am starting a thread to store this script so others can use it for quick reference. Any suggestions in that thread for specific examples are welcome.
Title: Re: DFHack 0.34.05 r1
Post by: telamon on March 08, 2012, 04:39:51 pm
Quote
The trigger isn't "discovering magma in a newly revealed area" - the trigger is discovering the appropriate map feature, specifically either a volcano, a magma pool, or a magma sea. If you're particularly tricky, you might be able to grab a suitably ordinary map block, set its global feature index to that of the magma sea (there might actually be more than one), then set the "is global feature" flag on a particular tile and dig to it to trigger the "You have discovered the magma sea" message and enable the magma workshops.

OOH. that has my attention. Can those flags be found and manipulated with tiletypes? I will absolutely try it if anybody proposes a method (I'm getting sick of using hacked reactions to generate charcoal, although it does keep my haulers busy), and report back.
Title: Re: DFHack 0.34.05 r1
Post by: Antalia on March 08, 2012, 04:45:50 pm
Antalia, you could always fork the DFHack source, and expand the XML export tool to contain all the information you want.
Yes, I wouldn't mind doing that, but my computer (Windows XP 32) is ancient enemies with MSVC 2010 Express. Whenever I try to build C++ stuff on this, I get the dreaded error message, "Invalid license data. Reinstall is required." I've tried every "solution" and "workaround" I can find, including a few hours of uninstalls->complete reinstalls again tonight. The only option I haven't tried this evening is to reinstall Windows. I really doubt that will help, since I've done it before over this very same problem, and look where it got me :) That's why I asked if there were any plans to expand the plugin--I can't get into it myself without a new computer for now. Thanks for trying to help me though :)
Title: Re: DFHack 0.34.05 r1
Post by: Valdrax on March 08, 2012, 07:59:36 pm
actually, there is an experimental build that does the equivilant of replacing the dll, unless I mis-understand the purpose of the eggy branch.
Only it's libgraphics.so, i.e. a part of Dwarf Fortress that is linked into the exe on windows, but separate and open-source on linux. It basically hooks directly into the rendering code of the game in order to do some more fancy stuff.
I'm very interested in testing this to see if it would allow me to use DFHack on a hardened system with some tinkering (turning off PaX flags, etc.).  Where can I find this?

(EDIT:  Ah, I forgot to thank Quietust for answering my question above.  Thanks.)
Title: Re: DFHack 0.34.05 r1
Post by: Antalia on March 08, 2012, 09:04:51 pm
Well, scratch what I said above...I [made a sacrifice to Armok and] was rewarded with access to a working copy of MSVC 2010. I've been looking at how rough it would be to manage the small additions to dwarfexport and submit them, and I've run into a couple problems. Where is the best place to ask these type of questions?

1 - I'm having a problem building. Cmake is complaining (accurately, it seems) about a missing /library/xml/codegen.pl, or a missing global_objects.h, or a problem with an empty Include variable in generate_headers.vcxproj, depending what I include in the build. Just building dwarfexport by itself (and most of the other stuff, I notice) is error-free. But building dwarfexport alone doesn't produce anything useful--I would think it needs the library and/or plugins as well (?). That's where the problems come. If something installed or copied incorrectly, it didn't complain. I think I'm at a loss here.

2 - It was mentioned that dwarves' skill levels are read from memory someplace in DFHack, but I haven't found this. In the units file I found some promising looking stuff, but it's commented out... Could it be labeled something besides 'skills', or 'jobs', or 'labor'?

I'm sorry if these are dumb questions or in the wrong place. Point me in the right direction if so :) This is getting to be quite some effort for something so small, but it's interesting.
Title: Re: DFHack 0.34.05 r1
Post by: Kogut on March 08, 2012, 09:10:39 pm
Small suggestion - add function "keep mayor X" to avoid replacing him every single year.
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 08, 2012, 09:55:01 pm
Counter suggestion - Add an ability to tie rooms to a noble position, instead of a dwarf.  Hit q, make the furniture into a room, assign to dwarf.  With q still open, open DFHack and select "roomlock noble" to make it refresh the room to the currently selected noble - as in, if you've made a room for your captain of the guard, he dies, and you reassign him, then DFHack will reassign the room to the current captain of the guard, or exchange dwarves when a new mayor is selected.

I feel this would solve more than locking the mayor position, though that's still a valid option, if I had to pick I'd go with my suggestion.  It helps in more areas (like when your militia commander dies), and probably solves your problem as well.  It'd let you make a mayoral suite and leave it alone.

ALSO: little trick for magma forges - apparently it's recorded as civ data.  Embark, dig down to the sea, and abandon.  Make a new embark anywhere, and magma forges will be enabled.  Seems once dwarves know about magma, they remember it!
Title: Re: DFHack 0.34.05 r1
Post by: peterix on March 08, 2012, 11:48:40 pm
Well, scratch what I said above...I [made a sacrifice to Armok and] was rewarded with access to a working copy of MSVC 2010. I've been looking at how rough it would be to manage the small additions to dwarfexport and submit them, and I've run into a couple problems. Where is the best place to ask these type of questions?
#dfhack IRC channel on freenode.
1 - I'm having a problem building. Cmake is complaining (accurately, it seems) about a missing /library/xml/codegen.pl, or a missing global_objects.h, or a problem with an empty Include variable in generate_headers.vcxproj, depending what I include in the build. Just building dwarfexport by itself (and most of the other stuff, I notice) is error-free. But building dwarfexport alone doesn't produce anything useful--I would think it needs the library and/or plugins as well (?). That's where the problems come. If something installed or copied incorrectly, it didn't complain. I think I'm at a loss here.
You don't have all of the code :)

Read this first:
https://github.com/peterix/dfhack/blob/master/COMPILE.rst

2 - It was mentioned that dwarves' skill levels are read from memory someplace in DFHack, but I haven't found this. In the units file I found some promising looking stuff, but it's commented out... Could it be labeled something besides 'skills', or 'jobs', or 'labor'?
I don't know how complete is your build environment... but once you have everything and can make a build, it creates a lot more files:
library/include/df/unit.h
library/include/df/unit_soul.h
library/include/df/unit_skill.h
library/include/df/job_skill.h
... and many, many others. Those headers are relevant though. Skills are part of the creature's soul.

You can see this xml files from which those headers are generated:
https://github.com/peterix/df-structures/blob/master/df.units.xml#L853 - soul
https://github.com/peterix/df-structures/blob/master/df.units.xml#L899 - skills
https://github.com/peterix/df-structures/blob/master/df.skills.xml - skill types
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 09, 2012, 12:01:20 am
Counter suggestion - Add an ability to tie rooms to a noble position, instead of a dwarf.  Hit q, make the furniture into a room, assign to dwarf.  With q still open, open DFHack and select "roomlock noble" to make it refresh the room to the currently selected noble - as in, if you've made a room for your captain of the guard, he dies, and you reassign him, then DFHack will reassign the room to the current captain of the guard, or exchange dwarves when a new mayor is selected.

I feel this would solve more than locking the mayor position, though that's still a valid option, if I had to pick I'd go with my suggestion.  It helps in more areas (like when your militia commander dies), and probably solves your problem as well.  It'd let you make a mayoral suite and leave it alone.

Uh, I think that might be a bit beyond the scope of DFHack since it deals with room assignments etc. Also it´s not really *that* necessary since you don´t have to keep track of too many nobles. Just design a room for the position. When the person dies it is freed automatically. When the person changes just kick the old guy out - an ex-mayor doesn´t need any better room than a peasant. You can also minimize the chance of your nobles getting killed by not using them for military, hauling and labor outside of the fortress. For some positions this is wise anyway... I was wondering why my bookie would skill up his record keeping so slowly, then I noticed that he spent most of his day as furnace operator.

Quote
ALSO: little trick for magma forges - apparently it's recorded as civ data.  Embark, dig down to the sea, and abandon.  Make a new embark anywhere, and magma forges will be enabled.  Seems once dwarves know about magma, they remember it!

Oh, now that´s really good to know. Thanks for that info.
Title: Re: DFHack 0.34.05 r1
Post by: Antalia on March 09, 2012, 06:35:43 am
Quote
You don't have all of the code :)
Thanks, the problem was something I did in Tortoisegit. I recloned with the command line and now (there is a lot more code here and) I am able to build. I'll check IRC if I have any more problems :)
Title: Re: DFHack 0.34.05 r1
Post by: CheatingChicken on March 09, 2012, 08:34:20 am
I've got a suggestion for you: Can you remake the job duplication plugin to work with the job manager screen? It would really help a lot if you could just duplicate jobs there instead of always typing in everything yet again or making a macro for it.
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 09, 2012, 09:41:14 am
Quote
The trigger isn't "discovering magma in a newly revealed area" - the trigger is discovering the appropriate map feature, specifically either a volcano, a magma pool, or a magma sea. If you're particularly tricky, you might be able to grab a suitably ordinary map block, set its global feature index to that of the magma sea (there might actually be more than one), then set the "is global feature" flag on a particular tile and dig to it to trigger the "You have discovered the magma sea" message and enable the magma workshops.

OOH. that has my attention. Can those flags be found and manipulated with tiletypes? I will absolutely try it if anybody proposes a method (I'm getting sick of using hacked reactions to generate charcoal, although it does keep my haulers busy), and report back.
I actually looked a bit closer at the code for populating the Build menus and it seems that there's a list that presumably contains all of the features in your current embark, so it might be necessary to choose a specific feature ID in order for it to work (since if it's not native to your embark, it might not be in that list and thus wouldn't be able to enable magma workshops).
Title: Re: DFHack 0.34.05 r1
Post by: thistleknot on March 09, 2012, 12:38:11 pm
I made a weighted formula for close combat dwarfs for dwarf therapist.  I was hoping I could somehow learn how dwarfexport gets these attribute values (i.e. memory address locations) and plug them into this formula so I can create a sortable list.

I'm hoping I can create a script that exports these values to notepad or something.  I've posted it on dwarf therapist in hopes that they might catch on and import it as well, there's talk on Dwarf Therapist, as well as Dwarven Guidance Counselor of getting such things to work.  DGC wants to use dfhack as well.

The formula consists of:

Basically it's ((attribute x factor) - 1380) x weight

For information on factor, you can see how I derived it from this post http://www.bay12forums.com/smf/index.php?topic=66525.msg3077752#msg3077752

but in essence, it's to get all the attributes on the same center range before subtracting it from the 1380, which is the averaged center of all dwarven attributes.

Weight is an importance for the said attribute for the profession (this case it's close combat dwarfs).

here's the formula as it works in Dwarf Therapist:

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 09, 2012, 12:41:02 pm
Spoiler is your friend.  Also code blocks, you've got a fair amount of cool looking faces there.
Title: Re: DFHack 0.34.05 r1
Post by: thistleknot on March 09, 2012, 12:42:36 pm
Spoiler is your friend.  Also code blocks, you've got a fair amount of cool looking faces there.

yeah, the smileys are x.8 for some reason.  I don't know how to use spoilers.  I guess I could quote someone, and see how it shows up.
Title: Re: DFHack 0.34.05 r1
Post by: Rumrusher on March 09, 2012, 12:46:45 pm
I made a weighted formula for close combat dwarfs for dwarf therapist.  I was hoping I could somehow learn how dwarfexport gets these attribute values (i.e. memory address locations) and plug them into this formula so I can create a sortable list.

I'm hoping I can create a script that exports these values to notepad or something.  I've posted it on dwarf therapist in hopes that they might catch on and import it as well, there's talk on Dwarf Therapist, as well as Dwarven Guidance Counselor of getting such things to work.  DGC wants to use dfhack as well.

The formula consists of:
Spoiler (click to show/hide)
you are better off using the Code function.
it's easy it's the # button, and to use it just highlight the long series of code and hit that button, same goes for spoiling it.
Title: Re: DFHack 0.34.05 r1
Post by: thistleknot on March 09, 2012, 12:51:27 pm
thanks, did all that.  Now what you guys think.  Where can I learn to do some dfhack plugins/scripts.  I know how to program in C++, but I'm really green.
Title: Re: DFHack 0.34.05 r1
Post by: Qmarx on March 09, 2012, 12:55:42 pm
Thanks for updating this so quickly!  I really appreciate your hard work.
Title: Re: DFHack 0.34.05 r1
Post by: thistleknot on March 09, 2012, 03:10:23 pm
Apparently my formula was off, I had the factor's backwards

Spoiler (click to show/hide)

Update 2:
I have my center's off, have to redo formula.  Apparently there was gaps in numbers on the attributes page.  I didn't see that the "center" was actually not on the chart.

Updated Formula
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.05 r1
Post by: telamon on March 09, 2012, 07:07:57 pm
Quote
The trigger isn't "discovering magma in a newly revealed area" - the trigger is discovering the appropriate map feature, specifically either a volcano, a magma pool, or a magma sea. If you're particularly tricky, you might be able to grab a suitably ordinary map block, set its global feature index to that of the magma sea (there might actually be more than one), then set the "is global feature" flag on a particular tile and dig to it to trigger the "You have discovered the magma sea" message and enable the magma workshops.

OOH. that has my attention. Can those flags be found and manipulated with tiletypes? I will absolutely try it if anybody proposes a method (I'm getting sick of using hacked reactions to generate charcoal, although it does keep my haulers busy), and report back.
I actually looked a bit closer at the code for populating the Build menus and it seems that there's a list that presumably contains all of the features in your current embark, so it might be necessary to choose a specific feature ID in order for it to work (since if it's not native to your embark, it might not be in that list and thus wouldn't be able to enable magma workshops).

The probe command has shown me the feature ID. for my magma sea, for example, the global feature ID on my current embark is 980 (followed by an 8 in brackets; not sure what that means but I'm pretty sure it's not part of the ID). So that part works out fine. I can also successfully find feature IDs for other major features like caverns and rivers. But now I'm not sure how to apply this ID to tiles. tiletypes doesn't seem to have this functionality. Is there a tool that can manipulate this data?

Also, another question: what exactly do fixdiplomats, fixmerchants and fixveins do to my raw files? I've got some modifications, including a human liaison (fixing that problem already) so are there any specifics? I don't want to mess up any of my changes by using a function I don't need too badly right now.
Title: Re: DFHack 0.34.05 r1
Post by: peterix on March 09, 2012, 08:10:36 pm
thanks, did all that.  Now what you guys think.  Where can I learn to do some dfhack plugins/scripts.  I know how to program in C++, but I'm really green.
Well, there are just a few things I can tell you:
Title: Re: DFHack 0.34.05 r1
Post by: thistleknot on March 10, 2012, 12:49:31 am
thx! I was hoping to disect dwarfexport.  It had statements I'm not too familiar w. Basically when it was using element( call stuff I knew it was writing those xml blocks of data to the file, I hope to intercept that data and just pull the attributes.  However I'm not sure what object its referencing to get that data. I figured it must be some dfhack library object.  I also saw a statement I've never seen before: ->

I think I can figure it tho.  Do I have to compile this stuff a certain way to get it to run?. I mean once its coded using the skeletal stuff you gave me, I have everything I need to compile?
Title: Re: DFHack 0.34.05 r1
Post by: King Mir on March 10, 2012, 02:23:18 am
The latest version of this seems to make DF allways-on-top on Windows. This is rather annoying, and I hope it can be fixed.
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 10, 2012, 03:11:56 am
I think that's an init issue.  Check your init.txt for your graphical options.
Title: Re: DFHack 0.34.05 r1
Post by: Xeron on March 10, 2012, 07:45:22 am
Damn i want DFusion :(.
Isn't there a way to manually update it ?
Title: Re: DFHack 0.34.05 r1
Post by: Aerval on March 10, 2012, 07:58:45 am
thanks, did all that.  Now what you guys think.  Where can I learn to do some dfhack plugins/scripts.  I know how to program in C++, but I'm really green.
Well, there are just a few things I can tell you:
  • the documentation is non-existent, because nobody has the time to write some.
  • Even thought there's no documentation, there's an example plugin that 'does nothing'. So you can start by looking at it. (https://github.com/peterix/dfhack/tree/master/plugins/skeleton) There's a source file, an empty header and a CMake file which is set up for a much bigger plugin than the skeleton one to show how things can be done with the build system.
  • You can look at the other plugins (https://github.com/peterix/dfhack/tree/master/plugins).
  • When you have the DFHack build environment set up, it generates a lot of files in library/include/df/. Those describe many of the game's data structures and are referenced by the plugins.
  • Look at the modular API stuff (https://github.com/peterix/dfhack/tree/master/library/include/modules) - sometimes it makes things easier to do or discover.
Not sure whether this belongs here, but I've questioned once again myself if it might be recommended to write a more complex "official" hack manual (not about the programming but the playing with hack in df), since some questions (like about tiletypes) come up rather often. With some help of other active dfhack users, we might be able to get something quiet decent, so that people not that experienced with the console can use it and newbies don't have to fiddle out everything on there own (For example I did not now for a long time that i could paint every mineral with changes of the magma tags in the raws). Could, if someone gets to it, as well include some tips on how to contribute to dfhack.
Title: Re: DFHack 0.34.05 r1
Post by: King Mir on March 10, 2012, 08:44:22 am
I think that's an init issue.  Check your init.txt for your graphical options.
It wasn't touched. Simply swapping out SDL.dll changes the game back to normal.
Title: Re: DFHack 0.34.05 r1
Post by: rooth on March 10, 2012, 10:10:08 am
ALSO: little trick for magma forges - apparently it's recorded as civ data.  Embark, dig down to the sea, and abandon.  Make a new embark anywhere, and magma forges will be enabled.  Seems once dwarves know about magma, they remember it!

I've put this to the test and if your magma was a volcano then it definitly doesn't work. Might have been that I didn't throw a dwarf down there to get the popup but i'm hesistant to do so as that would create a possible ghost immigrant situation.

Will have to dig down and then block it all up I guess.
Title: Re: DFHack 0.34.05 r1
Post by: danaris on March 10, 2012, 10:32:43 am
ALSO: little trick for magma forges - apparently it's recorded as civ data.  Embark, dig down to the sea, and abandon.  Make a new embark anywhere, and magma forges will be enabled.  Seems once dwarves know about magma, they remember it!

I've put this to the test and if your magma was a volcano then it definitly doesn't work. Might have been that I didn't throw a dwarf down there to get the popup but i'm hesistant to do so as that would create a possible ghost immigrant situation.

Why not just throw a cat down there? I'm pretty sure it should work the same...

Quote
Will have to dig down and then block it all up I guess.

This is what I do to get cavern trees and grass.
Title: Re: DFHack 0.34.05 r1
Post by: rooth on March 10, 2012, 11:16:06 am
I prefer to keep ''path-able'' space as limited as possible and I want to create my own volcano to avoid fps issues. Should've indeed thrown a cat down but already abandoned. by the way; 3 kobolds settled in my old fort, how cute!
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 10, 2012, 12:52:05 pm
Is there some way to reset dfhack without having to restart DF? When I abandon a fortress, then embark onto a new spot I can´t use the reveal feature because dfhack tells me "map is already revealed or this is a different map".
Title: Re: DFHack 0.34.05 r1
Post by: BigD145 on March 10, 2012, 02:10:10 pm
Did you leave things revealed? I think that used to break things. You could just shut down DF and restart and see what happens.
Title: Re: DFHack 0.34.05 r1
Post by: Danarca on March 10, 2012, 02:13:17 pm
Hey guys, I really like the workflow command, but I'm having troubles with it, and is looking for help.
Specifically, lye, ash, milled products and the like are what I'm having issues with.

Lye for example, I've concluded is a LIQUID_MISC, but LIQUID_MISC/LYE (And LIQUID_MISC:LYE) doesn't work for me..

What I'm looking for is documentation on the syntaxes, and something that can help me understand what categories items are in. Right now I'm using the wiki and trying to search through the RAWs, but it's not helpful.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 10, 2012, 02:45:52 pm
Did you leave things revealed? I think that used to break things. You could just shut down DF and restart and see what happens.

Yeah, I did leave things revealed. And restarting DF works, I was just trying to avoid that. Guess next time I´ll try to remember to unreveal the map if I abandon a fortress.

I assume that dfhack stores the state of the map before it was revealed to be able to unreveal it. This can (obviously) lead to the problem I have (not being able to reveal new embarks until dfhack is completely restarted) as well as to problems when you dig a bit on a revealed map, then unreveal it again (the dug out areas are not revealed, which will lead to job cancellations and in the worst case to dwarves being stuck in the previously revealed sections because they are not able to path back).

For the latter maybe automatically calling revflood from a "really" revealed tile after unrevealing the map should help - but I can think of cases where that would be undesired.
Title: Re: DFHack 0.34.05 r1
Post by: peterix on March 10, 2012, 04:25:53 pm
Did you leave things revealed? I think that used to break things. You could just shut down DF and restart and see what happens.

Yeah, I did leave things revealed. And restarting DF works, I was just trying to avoid that. Guess next time I´ll try to remember to unreveal the map if I abandon a fortress.

I assume that dfhack stores the state of the map before it was revealed to be able to unreveal it. This can (obviously) lead to the problem I have (not being able to reveal new embarks until dfhack is completely restarted) as well as to problems when you dig a bit on a revealed map, then unreveal it again (the dug out areas are not revealed, which will lead to job cancellations and in the worst case to dwarves being stuck in the previously revealed sections because they are not able to path back).

For the latter maybe automatically calling revflood from a "really" revealed tile after unrevealing the map should help - but I can think of cases where that would be undesired.
Yeah. When you reveal the map, the information is stored and reused when you hide the map again. I didn't expect that people would actually play the game with the map revealed, because I thought it was rather impractical - compared to the normal state, it introduces a lot of noise to the underground that is IMHO distracting and takes away from the experience of DF. I have no way to detect if you abandon or save+exit, so I'll add some sort of 'revflush' command that throws away that saved data.
Title: Re: DFHack 0.34.05 r1
Post by: lukesleftleg on March 11, 2012, 02:09:13 am
Hi.

Thanks very much for DFhack, but I was just wondering if regrass was likely to make a reappearance?

It seems to have been missing from the last couple of versions.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 11, 2012, 03:00:19 am
Yeah. When you reveal the map, the information is stored and reused when you hide the map again. I didn't expect that people would actually play the game with the map revealed

It´s not so much about playing with a revealed map all the time. I like to have it revealed when planning rooms so I can make halfways sure that I don´t end up making peasant bedrooms with platinum walls, for example.

And the main issue is/was that I like to peek to check how deep and exactly where magma and underground water and whatever is, then abandon a fort because I don´t like the look of the caverns or whatever and then need to restart DF to be able to use the reveal feature of dfhack again. Now if it´s not too much hassle for you adding a command to throw away the old map information would be really great.
Title: Re: DFHack 0.34.05 r1
Post by: DVeL on March 11, 2012, 08:06:12 am
Hey guys, I really like the workflow command, but I'm having troubles with it, and is looking for help.
Specifically, lye, ash, milled products and the like are what I'm having issues with.

Lye for example, I've concluded is a LIQUID_MISC, but LIQUID_MISC/LYE (And LIQUID_MISC:LYE) doesn't work for me..

What I'm looking for is documentation on the syntaxes, and something that can help me understand what categories items are in. Right now I'm using the wiki and trying to search through the RAWs, but it's not helpful.

You can use "/" and "//" in such cases, and they have different meaning.
"/" refers to object and material, from which the object is made. Example: "DOOR/STONE"
"//" refers to category and object. Like in your case - "LIQUID_MISC//LYE", because it is not "liquid, made of lye", but rather "specific liquid - lye"
And (just in case) ":" refers to separate file of item tokens. You can look them in http://dwarffortresswiki.org/index.php/Item_token (http://dwarffortresswiki.org/index.php/Item_token). That would look like "ARMOR:ITEM_ARMOR_BREASTPLATE/STEEL"
Title: Re: DFHack 0.34.05 r1
Post by: telarin on March 11, 2012, 10:14:20 am
Has anyone worked out a way to get workflow to manage crafts? It won't take the ANY_CRAFT item type, and if you specify a specific craft, it doesn't see the MakeCraft jobs at all.

Also, it would be nice if there was a way to tell it to enable any jobs that use X as a reagent until there is only n of that reagent left.
Title: Re: DFHack 0.34.05 r1
Post by: ag on March 11, 2012, 10:32:53 am
Has anyone worked out a way to get workflow to manage crafts? It won't take the ANY_CRAFT item type, and if you specify a specific craft, it doesn't see the MakeCraft jobs at all.

There isnt any such way. It'll need a special case for that, which shouldn't actually be too hard.

Also, it would be nice if there was a way to tell it to enable any jobs that use X as a reagent until there is only n of that reagent left.

...unlike this. Any meaningful way of doing this would have to correctly emulate job material selection, including stuff like burrow checks and other pathfinding issues.
Title: Re: DFHack 0.34.05 r1
Post by: Danarca on March 11, 2012, 01:14:18 pm
Hey guys, I really like the workflow command, but I'm having troubles with it, and is looking for help.
Specifically, lye, ash, milled products and the like are what I'm having issues with.

Lye for example, I've concluded is a LIQUID_MISC, but LIQUID_MISC/LYE (And LIQUID_MISC:LYE) doesn't work for me..

What I'm looking for is documentation on the syntaxes, and something that can help me understand what categories items are in. Right now I'm using the wiki and trying to search through the RAWs, but it's not helpful.

You can use "/" and "//" in such cases, and they have different meaning.
"/" refers to object and material, from which the object is made. Example: "DOOR/STONE"
"//" refers to category and object. Like in your case - "LIQUID_MISC//LYE", because it is not "liquid, made of lye", but rather "specific liquid - lye"
And (just in case) ":" refers to separate file of item tokens. You can look them in http://dwarffortresswiki.org/index.php/Item_token (http://dwarffortresswiki.org/index.php/Item_token). That would look like "ARMOR:ITEM_ARMOR_BREASTPLATE/STEEL"
Thank you so much! Makes much more sense to me now :)
Title: Re: DFHack 0.34.05 r1
Post by: Kaos on March 11, 2012, 03:41:02 pm
Sorry if this sounds a bit noobish, but how do you get this to work?


I went over the .html readme, I backed up my SDL.dll and my save game, then I copied the contents of dfhack over my df folder, it replaced my SDL.dll, I loaded up DF and I got an error about the versions...


I was running 34.02, so that must be it, I'm downloading 34.05 now...


Anyway the versions sorted out, how do you use the commands? do you have to run a cmd.exe window? if so what do you type? I'm wondering since there is no .exe or .bat file only the .dll, and that isn't executable...


or the commands are now typed in-game? if so how exactly?


The last time I used DFHack was in 31.25, with the lazy pack, that all you had to do was run some .bat files that would open a new cmd window and do the trick...
Title: Re: DFHack 0.34.05 r1
Post by: BigD145 on March 11, 2012, 04:18:38 pm
Running DF opens a second window. For me it sits right in front of DF. Find it and type in 'help' or 'ls'. Go from there.
Title: Re: DFHack 0.34.05 r1
Post by: Kaos on March 11, 2012, 04:29:49 pm
Running DF opens a second window. For me it sits right in front of DF. Find it and type in 'help' or 'ls'. Go from there.
oh... it triggers a command window automatically now... there we type the commands... isn't there a way to create "shortcuts": pre-enter the commands and run them like the old .bat files?


edit: upgraded my version, now it's working...
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 11, 2012, 04:42:48 pm
certain commands can be set to hotkeys that you use within DF, but the other stuff needs to have a program made that'll run the commands from a button or something. That hasn't been done yet.
Title: Re: DFHack 0.34.05 r1
Post by: CheatingChicken on March 11, 2012, 10:31:04 pm
I have some issues getting workflow to work. I tried it with food and Drinks, there it works just fine, but with bins, barrels, Coal bars and bolts it just says it can't produce the items. I copied the commands exactly from the readme file. Is the plugin currently broken or am i doing something wrong here?
Title: Re: DFHack 0.34.05 r1
Post by: ag on March 11, 2012, 11:11:49 pm
I have some issues getting workflow to work. I tried it with food and Drinks, there it works just fine, but with bins, barrels, Coal bars and bolts it just says it can't produce the items. I copied the commands exactly from the readme file. Is the plugin currently broken or am i doing something wrong here?

You have to create the repeat jobs yourself - it can only suspend or unsuspend them.
Title: Re: DFHack 0.34.05 r1
Post by: Dragoon209 on March 12, 2012, 12:44:00 am
Hopefully, I have an easy question, but I have been beating my head against a wall.

I have a dwarf in a mood (Possessed) that is asking for materials that I don't have.  He wants Thread/Cloth of Yarn, but I only have silk and Pig Tail fibers.

I have been trying for a few hours to use the job item-type and item-material commands, but to no avail.  I'm having trouble searching for good results too.

What can I do to change it to... say, a Maple Log?  or just any log in general?  I seem to have gotten far enough that the job requires Wood, and Wood flags2:yarn, which doesn't sound to me like he is ever going to get! haha

Can somebody shed some light on this?  or tell me what to type to make him use something else?  I would love a link to a more detailed example of what the job command is capable of...

Thanks in advance!
Title: Re: DFHack 0.34.05 r1
Post by: Naryar on March 13, 2012, 11:40:12 am
So where is the old tool for allowing magma buildings ? I accidentally revealed the whole map, now unreveal doesn't work and as I had no volcano I couldn't start with magma buildings.

Now that I have breached the magma sea i have no message, and no unlocking of magma buildings.
Title: Re: DFHack 0.34.05 r1
Post by: Dragoon209 on March 13, 2012, 11:42:46 am
So where is the old tool for allowing magma buildings ? I accidentally revealed the whole map, now unreveal doesn't work and as I had no volcano I couldn't start with magma buildings.

Now that I have breached the magma sea i have no message, and no unlocking of magma buildings.

I think 'revflood' is what you want to fix the reveal issue...  I'm not sure how the status messages for revealing the magma sea are counted, but that should hide anything that you can't path to.
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 13, 2012, 12:01:42 pm
So where is the old tool for allowing magma buildings ? I accidentally revealed the whole map, now unreveal doesn't work and as I had no volcano I couldn't start with magma buildings.

Now that I have breached the magma sea i have no message, and no unlocking of magma buildings.
The next release will have a "feature" command which will allow you to selectively discover/undiscover individual map features such as the magma sea and the cavern layers - mark the magma sea as discovered and you can build magma workshops (and it will persist across save/load). You'll even be able to use it to halt subterranean plant growth (trees, shrubs, and even grass) within your fortress by "undiscovering" the cavern layers.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 13, 2012, 01:55:28 pm
Thanks very much for DFhack, but I was just wondering if regrass was likely to make a reappearance?
It seems to have been missing from the last couple of versions.

Yeah, I just noticed myself that regrass is missing from the 34.05 version of dfhack. Is there any particular reason for that? I took a look at the sources and noticed that you changed all other plugins a bit ("Make plugins accept explicit output stream references.") but that change looks trivial.

I think I´ll try to compile my own fork for the time being since I use regrass quite often. Could somebody hint me to the file where the plugins are actually registered/loaded? Updating regrass.cpp looks pretty straight forward. Simply copying the old regrass.dll to the plugin folder didn´t work - obviously, since it needs some changes, but it was not even even recognized by dfhack. So I´m assuming dfhack has an internal list of which plugins to load at all...
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 13, 2012, 01:57:48 pm
DFhack does not have a plugin list, but it does have a sort of code syntax for plugins to be recognize.

take a look at the skeleton plugin to see what's needed.
Title: Re: DFHack 0.34.05 r1
Post by: peterix on March 13, 2012, 02:10:12 pm
I think I´ll try to compile my own fork for the time being since I use regrass quite often. Could somebody hint me to the file where the plugins are actually registered/loaded? Updating regrass.cpp looks pretty straight forward. Simply copying the old regrass.dll to the plugin folder didn´t work - obviously, since it needs some changes, but it was not even even recognized by dfhack. So I´m assuming dfhack has an internal list of which plugins to load at all...
No registration. It just tries to load the plugins and if they aren't for the same version of DFHack, it ignores them.
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 13, 2012, 02:41:29 pm
For the record, I got rid of regrass because it was only meant to be used with fortresses created prior to 0.31.19, since those ones didn't have any grass types, resulting in grass never growing back.

Simply readding it to 0.34.05 would not be meaningful, since all it does is change the tile type to "grass" - it doesn't specify which type of grass exists in each tile. In order to do it properly, you'd have to iterate across all events in the particular block, find the "grass" ones, then randomly pick one and set the density for the tile in question (and if there is no "grass" event in that block, then you'd have to create one, except DFHack doesn't really support doing that at the moment).
Title: Re: DFHack 0.34.05 r1
Post by: telamon on March 13, 2012, 03:06:29 pm
For the record, using tiletypes to change tiles to grass_dark floor has never failed me when I want to regrass. I just grab a big rectangular range brush, set the filtering to soil floors, and paint dark grass flooring over them. Not quite sure about the finer technical points, but in terms of feeding those pastured animals it seems to work well.

Also, feature command sounds awesome. Finally I can throw down random magma forges wherever I like. Screw coal, I got magma!
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 13, 2012, 03:06:30 pm
So you are saying that simply adding the "old" regrass to 34.05 would not work? It was working fine up to 34.04.

I´ll try to wrap my head around your answer and have a deeper look at the sources of dfhack. Regrass was pretty useful when you pasture grazers like yaks on a rather small area to avoid them starving before they can be butchered. And if you think that´s cheating - refilling adamantine spires is cheating, too.

----

And there´s another issue I should bring to your attention: I have a 34.05 embark which REALLY suffers from revealing the map fps wise. I filed a bug report since it also seems to be affected by the setting INVADERS:YES in the d_init.txt

The map goes down to 25 fps when being revealed (instead of 150 or so unrevealed). First time I have that happen. And there is nothing special going on in the caves, I took a look. Here´s the link to mantis: http://www.bay12games.com/dwarves/mantisbt/view.php?id=5629 (http://www.bay12games.com/dwarves/mantisbt/view.php?id=5629)
Title: Re: DFHack 0.34.05 r1
Post by: Rumrusher on March 13, 2012, 03:37:19 pm
Any adventurer out there you can use reveal as a cellphone and talk to people from long distances.
Combine this with adv bodyswap and interactions you can switch to people past your vision and curse/ignite people miles away.
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 13, 2012, 08:12:26 pm
So you are saying that simply adding the "old" regrass to 34.05 would not work? It was working fine up to 34.04.

I´ll try to wrap my head around your answer and have a deeper look at the sources of dfhack. Regrass was pretty useful when you pasture grazers like yaks on a rather small area to avoid them starving before they can be butchered.
All it was doing was creating "generic" grass that would likely disappear after a single bite and probably not provide any significant nourishment.
Title: Re: DFHack 0.34.05 r1
Post by: thistleknot on March 13, 2012, 11:29:48 pm
I'm having a problem with dfhack, which is causing problems for the wiki

I did a dwarfexport command, which gives me a list of awesome dwarves that I was able to import into a spreadsheet.

I used advanced xml converter to move the data into a spreadsheet.

Upon doing so, I found different means for some variables, so I pointed it out in the attribute wiki.

But upon noticing this, I also noticed that some dwarfexports had different populuation sizes than what I currently had, I attributed this to the dead/missing.

However, with my most recent 1500 dorf fort, this was not the case.  1500 simple_embark resulted in a 1500 dwarfexport.

So...

To make a long story short.

Creativity according to my dwarfexport (as well as others who have submitted responses to my requests) is around 1000.

Yet...

In Dwarf Therapist, sorting by 1250 (the reported wiki mean) results in a filter of 50/50%, depending on whether you're below or above.

So something is going on, the dwarfexport does export values from Dwarf Fortress, but what I'm finding is it's not exporting everything.  I'm finding I have more dwarves in dwarf therapist, than I do in my exported spreadsheets (of the non original 1500).

Something is going on between dwarfexport and the dwarf therapist that is creating an issue in trying to establish means and standard deviations for people who wish to base formula's on these results.

Updated: Verified (thank you Splinterz!) that the issue is with dwarfexport's ordering of attribute's.
Title: Re: DFHack 0.34.05 r1
Post by: splinterz on March 14, 2012, 06:15:00 am
yeah the order of mental attributes is still mixed on the export. i mentioned it here previously. (http://www.bay12forums.com/smf/index.php?topic=91166.msg3048339#msg3048339)
Title: Re: DFHack 0.34.05 r1
Post by: peterix on March 14, 2012, 07:01:35 am
yeah the order of mental attributes is still mixed on the export. i mentioned it here previously. (http://www.bay12forums.com/smf/index.php?topic=91166.msg3048339#msg3048339)
Fixed in master. It will be in the next release.
Title: Re: DFHack 0.34.05 r1
Post by: KainInt on March 14, 2012, 11:02:23 am
Is there any way to get rid of a ghost with this if the body is inaccessible, won't autodump, and doesn't show up in game anywhere but the stocks screen?

The clear missing tweak won't let me engrave a slab either.
Title: DFHack Utility Request
Post by: telarin on March 15, 2012, 07:33:36 am
I have a request for a DFHack utility, if it is possible and someone wants to take shot at it. I would like a utility to rename my squads. Something very simple like: rensquad "oldname" "newname" would be perfect.
Title: Re: DFHack Utility Request
Post by: uggi on March 15, 2012, 07:53:31 am
I have a request for a DFHack utility, if it is possible and someone wants to take shot at it. I would like a utility to rename my squads. Something very simple like: rensquad "oldname" "newname" would be perfect.

Already done, see the rename plugin.
Title: Re: DFHack 0.34.05 r1
Post by: Troopperi on March 15, 2012, 09:07:04 am
How can I toggle off that thing what shows lower z-levels in paler colors?
Title: Re: DFHack 0.34.05 r1
Post by: Mike Mayday on March 15, 2012, 11:43:46 am
How can I toggle off that thing what shows lower z-levels in paler colors?

Such a thing exists?? Then how do I toggle it ON?
Title: Re: DFHack Utility Request
Post by: vorpal+5 on March 15, 2012, 02:21:33 pm
I have a request for a DFHack utility, if it is possible and someone wants to take shot at it. I would like a utility to rename my squads. Something very simple like: rensquad "oldname" "newname" would be perfect.

Already done, see the rename plugin.

You can't rename creatures/units though. You can change their nickname or profession, but this is already available from the game itself.

Also, is it possible to alter the profession levels of dwarves? No that would not be to cheat by giving me legendary dwarves, but to set to 0 some skills I don't need on migrants, like cheesemakers etc. or to make sure that all my haulers have the peasants icons (unless it is possible to do otherwise)
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 15, 2012, 03:00:17 pm
Just noticed that you added "revforget" to the (hopefully) next version and wanted to thank you. While it might be only useful for some few users I guess I´ll be one of those who use it a lot due to my playing style.
Title: Re: DFHack Utility Request
Post by: telarin on March 15, 2012, 07:43:44 pm
I have a request for a DFHack utility, if it is possible and someone wants to take shot at it. I would like a utility to rename my squads. Something very simple like: rensquad "oldname" "newname" would be perfect.

Already done, see the rename plugin.

How did I manage to miss that? Thank you sir!
Title: Re: DFHack 0.34.05 r1
Post by: Goncyn on March 15, 2012, 10:31:45 pm
Thank you (preemptively) for the workflow enhancements I just noticed were committed to github. Being able to keep a certain stock of crafts will be awesome, and the command tweaks are also welcome.

I love workflow!  :D
Title: Re: DFHack 0.34.05 r1
Post by: telamon on March 15, 2012, 11:19:20 pm
Quote
Also, is it possible to alter the profession levels of dwarves? No that would not be to cheat by giving me legendary dwarves, but to set to 0 some skills I don't need on migrants, like cheesemakers etc. or to make sure that all my haulers have the peasants icons (unless it is possible to do otherwise)

iirc, runesmith was capable of this, and it was based on the DFHack offsets. however to the best of my knowledge, hack has no plugin that can do this.
Title: Re: DFHack 0.34.05 r1
Post by: Troopperi on March 16, 2012, 08:29:38 am
How can I toggle off that thing what shows lower z-levels in paler colors?

Such a thing exists?? Then how do I toggle it ON?

http://dl.dropbox.com/u/41961393/Uusi%20kansio/ScreenHunter_01%20Mar.%2016%2015.27.jpg (http://dl.dropbox.com/u/41961393/Uusi%20kansio/ScreenHunter_01%20Mar.%2016%2015.27.jpg)

http://dl.dropbox.com/u/41961393/Uusi%20kansio/ScreenHunter_02%20Mar.%2016%2015.27.jpg (http://dl.dropbox.com/u/41961393/Uusi%20kansio/ScreenHunter_02%20Mar.%2016%2015.27.jpg)

As you can see when I went some z-levels down, everything in surface seem to be brighter colored.
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 16, 2012, 09:38:06 am
You probably should've stated upfront that you were talking about Stonesense - we assumed you were talking about Dwarf Fortress itself, where there has never been any such option...
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 16, 2012, 10:18:30 am
How can I toggle off that thing what shows lower z-levels in paler colors?

Such a thing exists?? Then how do I toggle it ON?

http://dl.dropbox.com/u/41961393/Uusi%20kansio/ScreenHunter_01%20Mar.%2016%2015.27.jpg (http://dl.dropbox.com/u/41961393/Uusi%20kansio/ScreenHunter_01%20Mar.%2016%2015.27.jpg)

http://dl.dropbox.com/u/41961393/Uusi%20kansio/ScreenHunter_02%20Mar.%2016%2015.27.jpg (http://dl.dropbox.com/u/41961393/Uusi%20kansio/ScreenHunter_02%20Mar.%2016%2015.27.jpg)

As you can see when I went some z-levels down, everything in surface seem to be brighter colored.

stonesense/init.txt. change the fog alpha.
Title: Re: DFHack 0.34.05 r1
Post by: Mike Mayday on March 16, 2012, 10:35:46 am
You probably should've stated upfront that you were talking about Stonesense - we assumed you were talking about Dwarf Fortress itself, where there has never been any such option...

Yeah :/ Though I knew this couldn't have been true, I understood you're talking about DF itself. Welp!
Title: Re: DFHack 0.34.05 r1
Post by: Rinin_Rus on March 17, 2012, 01:56:46 am
Is it possible to control production of one item counting another? First of all to make it possible to control brew/food production. To keep making "something" in still using Plump helmets till it's not enough Dwarven wine. It's also could be usefull to produce bronze armor if fortress has no more steel.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 17, 2012, 02:26:36 am
check the workflow command. I think that's what it does
Title: Re: DFHack 0.34.05 r1
Post by: Rinin_Rus on March 17, 2012, 02:47:30 am
Quote
check the workflow command. I think that's what it does
I already use it a lot. But workflow count products of reaction, not something other. It's work perfect for most items, because microcline door in game mechanics is door made of microcline.

Since for example Dwarven wine is not a "brew made of Plump helmets" it's possible to start making "somthing made of pluml helmets in still" but workflow can't stop it when it's enough Dwarven wine. It'll wait for 10 of "brew made of Plump helmets" not for 10 Dwarven wine

And workflow could try maintain 10 steel armor, counting existing steel armor, but it can't count steel bars and start bronze armor if it's less steel than 10 for example.

It could spend last wood log for ash even if it's not so important to make more soap now. So work can't be restricted or permited by other material count. Or maybe it could be done, but I don't know how.
Title: Re: DFHack 0.34.05 r1
Post by: Nice Save on March 17, 2012, 05:28:42 am
The only part of dfusion I ever used was simple_embark to change the number of embark dwarves. Any chance of getting a plugin with that functionality?
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 17, 2012, 09:20:12 am
A question on workflow - how do you get auto-melt to work?  Or drybuckets?  When I try to punch them in, it acts like I entered something wrong and gives the help prompt.
Title: Re: DFHack 0.34.05 r1
Post by: Greiger on March 17, 2012, 09:26:28 am
I think you enable automelt when you enable workflow.  I think the command is 'workflow enable automelt'.


And a question from me as well.  Is there a command out there to reveal only dig designated tiles?  Sounds like it would be handy for big dig projects near the magma sea and large bodies of water.  Just reveal it all to keep from getting the cancellation when digging without revealing the whole map and seeing unrelated things you didn't wanna accidentally see.  (Like how that spire I was looking at getting to later is actually hollow all the way up.)


And question # 2.  Is there any helpful documentation out there for anybody with an interest that has no experience with real programming, source code, or github, or anything like that?  My request up there sounds to me like something really simple to throw together if I knew what I was doing, and it bugs me to request something that. 

I tried taking a look at skeleton.cpp but other than a few lines I recognize (I know what the includes are, even if I donno exactly how they work) it seems greek.  And I'm pretty sure I don't have the program I would need to do anything with it anyway.
Title: Re: DFHack 0.34.05 r1
Post by: ag on March 18, 2012, 03:15:42 am
Since for example Dwarven wine is not a "brew made of Plump helmets" it's possible to start making "somthing made of pluml helmets in still" but workflow can't stop it when it's enough Dwarven wine. It'll wait for 10 of "brew made of Plump helmets" not for 10 Dwarven wine

Dwarven wine should match the pattern "DRINK//MUSHROOM_HELMET_PLUMP:DRINK".

And workflow could try maintain 10 steel armor, counting existing steel armor, but it can't count steel bars and start bronze armor if it's less steel than 10 for example.

It could spend last wood log for ash even if it's not so important to make more soap now. So work can't be restricted or permited by other material count. Or maybe it could be done, but I don't know how.

This kind of stuff moves dangerously close to full scripting, so if it is to be supported we might as well try allowing the use of arbitrary lua scripts for the decision making step...
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 18, 2012, 05:36:41 am
And a question from me as well.  Is there a command out there to reveal only dig designated tiles?  Sounds like it would be handy for big dig projects near the magma sea and large bodies of water.  Just reveal it all to keep from getting the cancellation when digging without revealing the whole map and seeing unrelated things you didn't wanna accidentally see.  (Like how that spire I was looking at getting to later is actually hollow all the way up.)

If you don´t want to spoil yourself you could use "probe" instead of reveal to investigate the tile under your cursor.

But I guess it should be easy to implement something like "revpoint" to reveal one single tile and/or "revpointtoggle" to toggle the hidden bit of one single tile. If you bind that to a key you could easily take a peek at your digging designations.

The method revflood contains everything necessary - get the tile the ingame cursor is at and unhide it. You only need to remove the part where the whole map is hidden and the part with the floodfill. Maybe I´ll try to write that later today, I wanted to start playing around with the dfhack source anyways.

Quote
And question # 2.  Is there any helpful documentation out there for anybody with an interest that has no experience with real programming, source code, or github, or anything like that?  My request up there sounds to me like something really simple to throw together if I knew what I was doing, and it bugs me to request something that. 

I tried taking a look at skeleton.cpp but other than a few lines I recognize (I know what the includes are, even if I donno exactly how they work) it seems greek.  And I'm pretty sure I don't have the program I would need to do anything with it anyway.

I´m guessing you mean a documentation on how to code plugins? Take a look at "Compile.html" in the hack folder, it explains pretty well what you need to do to get the sourcecode and get it to compile. You´ll need at least some C/C++ knowledge to accomplish anything. Which should not discourage you, learning the basics of C++ is only a matter of a few weeks, probably less if you already know another programming languate.
Title: Re: DFHack 0.34.05 r1
Post by: Goncyn on March 18, 2012, 05:52:55 am
peterix, I saw your post over in the Dwarf Therapist thread about the API. I'm definitely interested in experimenting with that, just to try out some ideas I have about designing a better Therapist-like UI. (I can't promise I will ever finish such a project, only that I want to try it. ;D) The API will make it much, much easier for me to do that.

I don't think the protocols required for such a thing to work are a huge mystery, but laying out the actual protocol data structures is an interesting challenge. For a dwarf, I would want this data at least:


For "edit" APIs, I would want to be able to:


Getting live updates on each dwarf's current job when it changes would be interesting, too, but I don't know if it is practical performance-wise. I would be curious about some kind of "efficiency" metric for each dwarf.
Title: Re: DFHack 0.34.05 r1
Post by: Goncyn on March 18, 2012, 05:59:31 am
This kind of stuff moves dangerously close to full scripting, so if it is to be supported we might as well try allowing the use of arbitrary lua scripts for the decision making step...

I think a simpler feature would still be useful without making the tool harder to use. I can't speak for the person you were replying to, but my personal biggest wish for workflow is the ability to constrain a job by input items remaining. I would like to be able to do things like "make ash up to 50 ash, but only if there are at least 20 logs". I don't know how much more complicated this would make the code for the plugin.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 18, 2012, 06:03:57 am
possibly also according to a specific stockpile, if possible. like "Burn all logs from this pile after the first twenty"
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 18, 2012, 09:59:42 am
I had something strange happen when using the liquids plugin which I don´t really understand:

- channelled out a pit as vampire detection flooding chamber
- made that pit a burrow and set civilian alert to use it
- after all dwarves were inside, I flooded it with water using liquids
- almost nobody tried to leave the pit and nobody drowned (which is already weird because it would mean that almost my whole population is vampires)
- dried the pit with setting water level to 0 for the whole range

I did that a couple of times because I lost overview of 60+ dwarves running around in the pit so I put them there in smaller groups.

As effect after the last try some babies remained stuck in the pit. And I could not send anybody there anymore (orders for digging into it a bit deeper and removing the ramps etc were ignored). I investigated some of the tiles with "probe" and it told me that the "flow forbidden" flag is set - whatever that means. Solved the situation by pouring a bit water into it again, once water touched the tiles the bit was removed and the parents were able to grab their kids again.

So... has anybody some insight on what happened there and why?
Title: Re: DFHack 0.34.05 r1
Post by: telarin on March 18, 2012, 10:02:58 am
I haven't had any luck getting workflow to regulate milling, what am I doing wrong? Here are my steps.

Create a mill plant job at my quern
with the mill plant job selected, type "job item-material 1 MUSHROOM_CUP_DIMPLE" into dfhack, this seems to successfully set the Input Item 1 material to dimple cup plant
type "workflow amount POWDER_MISC//MUSHROOM_CUP_DIMPLE:MILL 100" into dfhack.
This sets the constraint without error, but lists "(no jobs)"
Is there a step I am missing in there somewhere to get this to work?

Edit: Ok, I think I figured it out, it only seems to work correctly if I create the workflow constraint BEFORE setting up the job in the workshop.
Title: Re: DFHack 0.34.05 r1
Post by: Kogut on March 18, 2012, 10:04:30 am
I had something strange happen when using the liquids plugin which I don´t really understand:

- channelled out a pit as vampire detection flooding chamber
- made that pit a burrow and set civilian alert to use it
- after all dwarves were inside, I flooded it with water using liquids
- almost nobody tried to leave the pit and nobody drowned (which is already weird because it would mean that almost my whole population is vampires)
- dried the pit with setting water level to 0 for the whole range

I did that a couple of times because I lost overview of 60+ dwarves running around in the pit so I put them there in smaller groups.

As effect after the last try some babies remained stuck in the pit. And I could not send anybody there anymore (orders for digging into it a bit deeper and removing the ramps etc were ignored). I investigated some of the tiles with "probe" and it told me that the "flow forbidden" flag is set - whatever that means. Solved the situation by pouring a bit water into it again, once water touched the tiles the bit was removed and the parents were able to grab their kids again.

So... has anybody some insight on what happened there and why?
Similar thing may happen with magma - removing magma with this tool may leave heat traps, where temperature is very high, without remaining magma. It is result of fact that DFHack is a hack that is doing weird things with memory of different program.
Title: Re: DFHack 0.34.05 r1
Post by: ag on March 18, 2012, 10:19:31 am
I think a simpler feature would still be useful without making the tool harder to use. I can't speak for the person you were replying to, but my personal biggest wish for workflow is the ability to constrain a job by input items remaining. I would like to be able to do things like "make ash up to 50 ash, but only if there are at least 20 logs". I don't know how much more complicated this would make the code for the plugin.

The ability to specify an explicit minimal amount constraint on another item attached to a production constraint might not be too bad, i.e. something like:

Code: [Select]
workflow count BAR//ASH 50 having 30 WOOD
# Coal is more important
workflow count BAR//COAL 50 having 15 WOOD

The key bit is linking the additional constraints to existing production constraints, rather than individual jobs.

Similar thing may happen with magma - removing magma with this tool may leave heat traps, where temperature is very high, without remaining magma. It is result of fact that DFHack is a hack that is doing weird things with memory of different program.

Specifically, it does not update temperature or pathfinding information like the game does when the amounts change naturally, because neither of those is fully understood - especially the pathfinding.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 18, 2012, 10:48:03 am
Specifically, it does not update temperature or pathfinding information like the game does when the amounts change naturally, because neither of those is fully understood - especially the pathfinding.

I see. Guess from now on I´ll set water to 1 instead of 0 and wait until it evaporizes. It leaves mud anyways.
Title: Re: DFHack 0.34.05 r1
Post by: Goncyn on March 18, 2012, 11:42:48 am
Code: [Select]
workflow count BAR//ASH 50 having 30 WOOD
# Coal is more important
workflow count BAR//COAL 50 having 15 WOOD

That's exactly what I was thinking, and I like this syntax.
Title: Re: DFHack 0.34.05 r1
Post by: idgarad on March 18, 2012, 04:59:41 pm
Has anyone gotten a working soap workflow yet? Haven't cracked the soap line yet...

workflow count BAR//ASH 50
workflow count LIQUID_MISC//LYE 50

So far I think seems to work but soap itself.. not so much.
Title: Re: DFHack 0.34.05 r1
Post by: telarin on March 19, 2012, 08:02:21 am
Has anyone gotten a working soap workflow yet? Haven't cracked the soap line yet...

workflow count BAR//ASH 50
workflow count LIQUID_MISC//LYE 50

So far I think seems to work but soap itself.. not so much.

All you should need after that is
workflow count BAR/SOAP 50
Title: Re: DFHack 0.34.05 r1
Post by: peterix on March 19, 2012, 11:41:22 am
peterix, I saw your post over in the Dwarf Therapist thread about the API. I'm definitely interested in experimenting with that, just to try out some ideas I have about designing a better Therapist-like UI. (I can't promise I will ever finish such a project, only that I want to try it. ;D) The API will make it much, much easier for me to do that.

Spoiler (click to show/hide)
ag (angavrilov) already started adding some parts of this. I'll see what can be done about adding a different backend to DT. It's possible that I'll have to commit some horrible code butchery :D
Getting live updates on each dwarf's current job when it changes would be interesting, too, but I don't know if it is practical performance-wise. I would be curious about some kind of "efficiency" metric for each dwarf.
Not a bad idea, but definitely not a priority. This can be implemented (or at least should be possible) regardless of how the data is accessed.
Title: Re: DFHack 0.34.05 r1
Post by: Icefire2314 on March 19, 2012, 03:25:49 pm
How do you use stone sense with this mod? I know it's a newb question, bear with me e_o
Title: Re: DFHack 0.34.05 r1
Post by: Kogut on March 19, 2012, 03:38:27 pm
You can check readme: https://github.com/peterix/dfhack/blob/master/README.rst.

PS It is not a mod.
Title: Re: DFHack 0.34.05 r1
Post by: Icefire2314 on March 19, 2012, 03:39:25 pm
I know stone sense isn't, but i heard it's incorporated with DFHack
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 19, 2012, 03:40:28 pm
DFhack isn't a mod either.
Title: Re: DFHack 0.34.05 r1
Post by: Icefire2314 on March 19, 2012, 03:41:53 pm
oh. I thought it was :/
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 19, 2012, 04:40:03 pm
A mod is something that changes the game's workings to produce a different flavor of gameplay, sometimes radically enough to create a new game in its own right.  A utility is something that you run alongside an unaltered game in order to facilitate certain things.
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 19, 2012, 10:26:31 pm
What would the command be to enable a workflow order for rock blocks?
like workflow amount <BLOCK THING HERE> UPPER_LIMIT GAP, what would I put for <BLOCK THING HERE>?
Title: Re: DFHack 0.34.05 r1
Post by: Buoyancy on March 20, 2012, 12:54:58 am
For blocks it's:
Code: [Select]
workflow amount BLOCKS 100 20
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 20, 2012, 08:33:47 am
Thanks.
Title: Re: DFHack 0.34.05 r1
Post by: RabblerouserGT on March 20, 2012, 03:02:31 pm
Edit: I have proved myself wrong!
Nothing good can come of this!
Title: Re: DFHack 0.34.05 r1
Post by: Zanara on March 20, 2012, 03:39:51 pm
So...at the risk of sounding a noob and idiot, has there been any progress, or workaround, for implimenting the Dfusions lair effect? (stopping items from scattering during a reclaim of a fallen or abandoned fortress). Because amusing as it is to see 7 dwarves all run halfway across the map, grab a -single- seed from a pile of 300+ of them, then triumphanty run back to the farm, seed held over their head...it gets old fast.
Title: Re: DFHack 0.34.05 r1
Post by: RabblerouserGT on March 20, 2012, 03:59:47 pm
So...at the risk of sounding a noob and idiot, has there been any progress, or workaround, for implimenting the Dfusions lair effect? (stopping items from scattering during a reclaim of a fallen or abandoned fortress). Because amusing as it is to see 7 dwarves all run halfway across the map, grab a -single- seed from a pile of 300+ of them, then triumphanty run back to the farm, seed held over their head...it gets old fast.
So far as I know, there's a workaround.
Make sure the fort's tombed in. As in nothing can get in or out. With lots of people's forts, this can be achieved just by raising the drawbridge. Though you may want to install a lever outside or something. Make sure you have sufficient way to get back in! My case is usually deconstructing the wall, but some people have moats.
Also, heavier stuff doesn't get spread as far.

The idea is the stuff will spread, but basically, it only spreads as far as it realistically should. i.e. scattered clothes won't magically scatter past the walls if there's no way for a dwarf to get out.
Also, not sure if clothes scatter into the caverns. Might want to wall it up before abandon.
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 20, 2012, 04:18:26 pm
Not true, I've observed items to scatter wherever they damn well please - primarily to the surface.  Items with no path will suddenly be on the surface more often than not.
Title: Re: DFHack 0.34.05 r1
Post by: RabblerouserGT on March 20, 2012, 05:06:55 pm
Weird, could've sworn I read that somewhere on the wiki. Someone might want to correct that then. Though I couldn't tell you where I saw it. :S
Title: Re: DFHack 0.34.05 r1
Post by: peterix on March 20, 2012, 05:53:53 pm
Weird, could've sworn I read that somewhere on the wiki. Someone might want to correct that then. Though I couldn't tell you where I saw it. :S
dflair will be back in the DFHack next release.
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 20, 2012, 06:18:02 pm
What is the syntax for designating a workflow order on bags?
Title: Re: DFHack 0.34.05 r1
Post by: celebrinborn on March 20, 2012, 06:24:15 pm
I know that the current version of df2minecraft is kind of rough and buggy however I have a couple questions about it.
1. Do you guy want/need bug reports? If so, what information do you need and how/where do you want me to submit it to?
2. I tried to use it on one of my forts but it crashed. I tried a second time with the same result. Is there any known way to improve the odds of it working? Will simply trying a few more times have any chance of getting it to work or is continued trying it a waste of time? Thanks.
Title: Re: DFHack 0.34.05 r1
Post by: Intrinsic on March 21, 2012, 03:36:50 am
What is the syntax for designating a workflow order on bags?

Example: workflow count BOX/YARN 30

Bags are BOX.
Title: Re: DFHack 0.34.05 r1
Post by: starvingpoet on March 21, 2012, 08:05:37 am
First off, I love your work

I don't know if it's possible; but would there be a way to make a plugin that would allow one to select a ghost and hit a hotkey that will engrave a memorial in one of your craftdwarf shops?
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 21, 2012, 08:44:18 am
What is the syntax for designating a workflow order on bags?

Example: workflow count BOX/YARN 30

Bags are BOX.

Thank you!
Title: Re: DFHack 0.34.05 r1
Post by: telarin on March 21, 2012, 12:58:24 pm
I would love to see some kind of herd management plugin. Basically, something along the following:

herd assign ALPACA

would set the plugin to automatically assign all alpacas to the selected pasture (you would have to have a pasture selected in DF, similar to how you need a job selected to use job item-material

Next would be
herd autocull ALPACA MALE 2

This would tell the plugin to automatically mark all but 2 males for butchering. Oldest animals would be marked first

Also, a couple simple toggle options that would work similar to workflow, automatically suspending or enabling the appropriate jobs:

herd automilk on|off
herd autoshear on|off

Oh, and it should definitely remember settings like workflow does so you don't have to set it up every time you continue playing a fortress like you do with seedwatch and keybinding.
Title: Re: DFHack 0.34.05 r1
Post by: lukesleftleg on March 21, 2012, 02:44:04 pm
Quote
I would love to see some kind of herd management plugin. Basically, something along the following:

herd assign ALPACA

would set the plugin to automatically assign all alpacas to the selected pasture (you would have to have a pasture selected in DF, similar to how you need a job selected to use job item-material

Next would be
herd autocull ALPACA MALE 2

This would tell the plugin to automatically mark all but 2 males for butchering. Oldest animals would be marked first

Also, a couple simple toggle options that would work similar to workflow, automatically suspending or enabling the appropriate jobs:

herd automilk on|off
herd autoshear on|off

Oh, and it should definitely remember settings like workflow does so you don't have to set it up every time you continue playing a fortress like you do with seedwatch and keybinding.

I was thinking exactly the same thing just earlier today, only your idea for an implementation is even better.

I think this is a great idea, and would definitely make up for regrass not being in DFhack any more.
The regrass plugin did feel a bit cheaty, but reassigning animals to new pens every few seasons is a real pain.

Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 21, 2012, 07:40:12 pm
Main reason I don't breed livestock is the trouble of assigning them to pastures.  I'll breed all one-gender of animal, usually something like female goats that will milk and wool, but don't bother breeding anything that grazes.  If I had a tool that allows for auto-pasturing, then perhaps I would.
Title: Re: DFHack 0.34.05 r1
Post by: Spish on March 21, 2012, 08:04:51 pm
Weird, could've sworn I read that somewhere on the wiki. Someone might want to correct that then. Though I couldn't tell you where I saw it. :S
dflair will be back in the DFHack next release.
Any chance of body swaparoo making it in, too? It'd be nice to be able to deck out our companions again (or fall back on them upon death).
Title: Re: DFHack 0.34.05 r1
Post by: EmeraldWind on March 22, 2012, 12:03:42 am
Weird, could've sworn I read that somewhere on the wiki. Someone might want to correct that then. Though I couldn't tell you where I saw it. :S
dflair will be back in the DFHack next release.
Any chance of body swaparoo making it in, too? It'd be nice to be able to deck out our companions again (or fall back on them upon death).

Already in. adv-bodyswap
Title: Re: DFHack 0.34.05 r1
Post by: Rumrusher on March 22, 2012, 11:13:56 am
Weird, could've sworn I read that somewhere on the wiki. Someone might want to correct that then. Though I couldn't tell you where I saw it. :S
dflair will be back in the DFHack next release.
Any chance of body swaparoo making it in, too? It'd be nice to be able to deck out our companions again (or fall back on them upon death).

Already in. adv-bodyswap
you can even force others as companions by adding "force permanent" to that line. only works on folks you talk to, had yell out their name, got a kill quest from, murder tons of things to get a name.
Title: Re: DFHack 0.34.05 r1
Post by: DustanH on March 23, 2012, 02:04:48 am
what is the proper syntax in tiletypes for making a river_source?  I know to get in to tiletypes you type tiletypes.  After that I'm lost.  Thanks!
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 23, 2012, 02:41:16 am
what is the proper syntax in tiletypes for making a river_source?  I know to get in to tiletypes you type tiletypes.  After that I'm lost.  Thanks!

Tiletypes? I don´t think you can do that there.

But you can use the liquids tool:
- Place your in-game cursor where you want to have the river source.
- Type "liquids" in the dfhack console.
- Type "rs" to enter the riversource mode.
- Hit enter.

This will give you a 1-tile river source at the cursor position. You can also use range if you want it to be bigger. Type "?" inside the liquids tool for a list of possible commands/modes.
Title: Re: DFHack 0.34.05 r1
Post by: DustanH on March 23, 2012, 03:26:50 am
thanks, just what I needed.
Title: Re: DFHack 0.34.05 r1
Post by: zilpin on March 23, 2012, 09:23:39 am
Main reason I don't breed livestock is the trouble of assigning them to pastures.  I'll breed all one-gender of animal, usually something like female goats that will milk and wool, but don't bother breeding anything that grazes.  If I had a tool that allows for auto-pasturing, then perhaps I would.

These problems with pastures is why I mostly mod out grazers.
Grazing is a cool feature, but far too buggy to play right now.
Title: Re: DFHack 0.34.05 r1
Post by: Nibble on March 23, 2012, 09:54:42 am
I noticed that when I place water and magma (under default settings), it just stays stationary, neither spreading horizontally or falling vertically. I'm pretty sure it wasn't like that before...
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 23, 2012, 10:24:36 am
what is the proper syntax in tiletypes for making a river_source?  I know to get in to tiletypes you type tiletypes.  After that I'm lost.  Thanks!

Tiletypes? I don´t think you can do that there.
You most definitely can. Here's how:
* paint shape FLOOR
* paint material RIVER
* paint special RIVER_SOURCE
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 23, 2012, 10:42:57 am
Workflow for plant fiber thread?
I've tried THREAD, but it gives me a value that is way overblown (like 3,000, i think it's counting spiderwebs I haven't found yet).
I tried THREAD/PLANT but it says that, with the process plants job set on repeat, it can't produce the thread, so what workflow constraint do I need to define to create to automate the production of plant fiber thread?
Title: Re: DFHack 0.34.05 r1
Post by: Buoyancy on March 23, 2012, 11:31:28 am
You get pig tail fiber thread through:
Code: [Select]
#Pig Tail
# PlantProcess
workflow amount THREAD//GRASS_TAIL_PIG:THREAD 100 10
# job item-material 1 GRASS_TAIL_PIG

Rope reed thread would be similar.
Title: Re: DFHack 0.34.05 r1
Post by: uggi on March 23, 2012, 12:32:53 pm
Would it be possible to move the fps counter to the bottom of the screen, just like the tidlers plugin does with the idlers counter?
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 23, 2012, 12:36:33 pm
Would it be possible to move the fps counter to the bottom of the screen, just like the tidlers plugin does with the idlers counter?
No.

The only reason "tidlers" can move around the Idlers count is because it's effectively just changing the [IDLERS:TOP|BOTTOM|OFF] option in d_init.txt - since there is no equivalent option for FPS, it is not possible to reposition it.
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 23, 2012, 02:17:43 pm
You get pig tail fiber thread through:
Code: [Select]
#Pig Tail
# PlantProcess
workflow amount THREAD//GRASS_TAIL_PIG:THREAD 100 10
# job item-material 1 GRASS_TAIL_PIG

Rope reed thread would be similar.

Thank you!
Title: Re: DFHack 0.34.05 r1
Post by: tahujdt on March 23, 2012, 04:24:01 pm
You need to change for 34.06. Darn It! On the plus side, you don't need to update the clothing confiscation plugin.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 23, 2012, 04:36:47 pm
it's being worked on. release should be soonish.
Title: Re: DFHack 0.34.05 r1
Post by: sasasmylee on March 24, 2012, 11:39:39 am
any release soon?  :D
Title: Re: DFHack 0.34.05 r1
Post by: orius on March 24, 2012, 11:50:18 am
Be patient people.  Besides, I need time to set up some traps to catch the animals wandering my map.  I hope that grizzly bear that's roaming around doesn't go anywhere.
Title: Re: DFHack 0.34.05 r1
Post by: Guedez on March 24, 2012, 01:44:24 pm
so.. it does NOT work on .06 or just most stuff don't? (i could live with just reveal/prospect working, since it's the only thing i use)
Title: Re: DFHack 0.34.05 r1
Post by: sasasmylee on March 24, 2012, 02:30:03 pm
so.. it does NOT work on .06 or just most stuff don't? (i could live with just reveal/prospect working, since it's the only thing i use)
say's unknown version of DF or something like that on startup.
Title: Re: DFHack 0.34.05 r1
Post by: psychologicalshock on March 24, 2012, 03:50:37 pm
I really just want to use stonesense with this build.
Title: Re: DFHack 0.34.05 r1
Post by: peterix on March 24, 2012, 03:57:13 pm
We're working on it guys :)

Should be available tomorrow, unless something horrible happens.
Title: Re: DFHack 0.34.05 r1
Post by: Garath on March 24, 2012, 04:21:51 pm
We're working on it guys :)

Should be available tomorrow, unless something horrible happens.

we're talking about DF, horrible things happening is normal.
Title: Re: DFHack 0.34.05 r1
Post by: AdeleneDawner on March 24, 2012, 04:40:10 pm
Is this the right place to make requests for new utilities? I have two I'd like to see:

- A utility that goes through the list of dwarves and makes a burrow for each one containing all of the dwarf's owned items and his bedroom. This should resolve 'cancels store owned item' spam more quickly than waiting for ownership to lapse.

- A utility that monitors the number of adult dwarves and raises or lowers the migration cap to maintain a certain number of adult dwarves in the fort, rather than making the player save and restart just because the last wave's 20 kids sent them over the pop cap but they don't have enough workers yet.
Title: Re: DFHack 0.34.05 r1
Post by: Eater of Vermin on March 24, 2012, 10:28:42 pm
OK...   probably a silly question...  but is there any handy URL/reference to find out what item keywords to use for workflow constraints?  The readme is a bit...  terse on the subject.    (Hardly surprising given how much info it'd need to cover, really.)

I want to keep a constant minimum reserve of mechanisms, grates, hatch covers, etc... and guessing isn't the best method to find out what works.   I can say that 'workflow count MECHANISMS/METAL,ROCK 30' & variations thereof doesn't.  ::) 

Perhaps it'd be possible to modify the output of 'workflow jobs' to display the appropriate constraint keywords for jobs that are already in production?


Title: Re: DFHack 0.34.05 r1
Post by: Rinin_Rus on March 25, 2012, 12:16:08 am
First of all look at:
this thread 
\DF\raw\objects
and "workflow jobs" output
Title: Re: DFHack 0.34.05 r1
Post by: Buoyancy on March 25, 2012, 12:24:59 am
I find most of them in the raws.  Haven't been able to find milk yet.  For mechanisms, you want TRAPPARTS.
Title: Re: DFHack 0.34.05 r1
Post by: Goran on March 25, 2012, 12:37:42 am
Since I completely lack the skill to make any sort of utility for DF Hack (my programming skills are still somewhere in early '90-ies) I would suggest one and cross my fingers someone sees the advantage in making this one.

I would like a utility which would parse the map and convert all artificial constructions into natural stone formation. I expect this would heavily improve FPS and stocks management since advanced forts can have thousands, if not tens of thousands of stone blocks forming megaprojects, walls, etc..

Plus, it would be ueber cool, since you could then engrave these surfaces as well. And much much less clutter.

I have no idea how difficult this would be to make, or if possible at all, but I can hope.

Thanks to anyone who takes this into consideration.

Goran
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 25, 2012, 12:57:50 am
Constructions are the only way the game can store walls that are of a material that does not occur naturally in the area. If you are in a granite layer, you can have natural granite walls, natural obsidian, and nothing else. unless it's a mineral vein.
Title: Re: DFHack 0.34.05 r1
Post by: telamon on March 25, 2012, 01:26:26 am
@Goran: I'd be willing to bet that, if you used tiletypes REALLY carefully, you could filter to constructed walls and convert them all into natural walls, and make a similar command for floors/stairs. I'm pretty sure the option for constructions is in there. You'd have to set a really big brush (I don't remember what all the brushes are either >_> and ofc with such a big brush, any errors in your filter will become apparent in a big way) but in theory it would work. The material of the wall might get messed up as Japa said; I haven't tried it so I have no idea what'll happen for sure.

Either way, try playing with tiletypes; you can probably find at least some of the functionality you are looking for without having to get a new plugin altogether.
Title: Re: DFHack 0.34.05 r1
Post by: Eater of Vermin on March 25, 2012, 01:49:09 am
Thanks Rinun_Rus.

I also found the start of a list in another thread re: workflow scripting.  It was far from complete, but got me pointed at the RAWs...  and, of course, I can't find that thread again now.   ::)

I find most of them in the raws.  Haven't been able to find milk yet.  For mechanisms, you want TRAPPARTS.

TRAPPARTS?    Many thanks!  No wonder I couldn't work that 'un out.  /facepalm.
Title: Re: DFHack 0.34.05 r1
Post by: telarin on March 25, 2012, 08:05:16 am
So once the new version of DFHack comes out, what is the procedure to transfer all my workflow settings from the old version to the new? I don't see a file anywhere that holds these settings so I'm not sure what to copy. For reference, I do not generally install new versions of DF over the old, I usually just unzip the new version clean to a new folder and copy over my save games.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 25, 2012, 08:37:17 am
I might be wrong but as I understand it the workflow settings are stored inside the savegame disguised as a historical figure (cool idea, by the way). So in theory you should be fine with just copying your save to the newest version of DF.
Title: Re: DFHack 0.34.05 r1
Post by: starvingpoet on March 25, 2012, 09:37:19 am
Thanks Rinun_Rus.

I also found the start of a list in another thread re: workflow scripting.  It was far from complete, but got me pointed at the RAWs...  and, of course, I can't find that thread again now.   ::)

I find most of them in the raws.  Haven't been able to find milk yet.  For mechanisms, you want TRAPPARTS.

TRAPPARTS?    Many thanks!  No wonder I couldn't work that 'un out.  /facepalm.

This is what you want, you should be able to get 99% of everything sorted out with this and the included readme.
http://dwarffortresswiki.org/index.php/DF2012:Item_token
Title: Re: DFHack 0.34.05 r1
Post by: BlackRogue on March 25, 2012, 09:55:32 am
I also found the start of a list in another thread re: workflow scripting.  It was far from complete, but got me pointed at the RAWs...  and, of course, I can't find that thread again now.   ::)

Is this the one? http://www.bay12forums.com/smf/index.php?topic=104015.0
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 25, 2012, 01:58:59 pm
For job item-material, how do you specify if you wanted a specific type of block used in the construction of something? Like BLOCKS:BASALT? What would the correct syntax for that be?
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 25, 2012, 02:01:55 pm
If you want a construction (like a workshop) then you just specify the material.  job item-material is used to specify things like "process plant" into "process pig tails".  For inorganic items, such as "construct rock block" then you can use the job-material tool.  q over it, settle over the job, and type "job-material BASALT" to change "construct rock blocks" into "construct basalt blocks".

At least I think it's "job-material" but I may have mispelt it.  Use "ls" to list commands, it should be very similar.
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 25, 2012, 02:03:55 pm
Okay, but if I have a job that makes things out of rock blocks, and I have a bunch of different types of rock blocks and, much to my chagrin the stupid dwarfs OBVIOUSLY use every OTHER block but the ones I want them to use, how do I make that job work only on the rock blocks of a specific type, or is that even possible?
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 25, 2012, 02:14:15 pm
For inorganic items, such as "construct rock block" then you can use the job-material tool.  q over it, settle over the job, and type "job-material BASALT" to change "construct rock blocks" into "construct basalt blocks".

At least I think it's "job-material" but I may have mispelt it.  Use "ls" to list commands, it should be very similar.
Reading comprehension.
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 25, 2012, 02:18:12 pm
For inorganic items, such as "construct rock block" then you can use the job-material tool.  q over it, settle over the job, and type "job-material BASALT" to change "construct rock blocks" into "construct basalt blocks".

At least I think it's "job-material" but I may have mispelt it.  Use "ls" to list commands, it should be very similar.
Reading comprehension.
What we have here is a failure to communicate.
I'm not making rock blocks. I'm making things OUT OF rock blocks.
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 25, 2012, 02:20:35 pm
Are you building floors and walls and such, or are you using a custom reaction that takes blocks and produces items?  There's no vanilla reactions that intake blocks.  Blocks used for construction, well, you just select "basalt blocks" from the list, that's basic construction.
Title: Re: DFHack 0.34.05 r1
Post by: Terratoch on March 25, 2012, 02:31:47 pm
Now we're getting somewhere.
No. It's part of a mod. Masterwork, which lets you make bins and barrels out of rock blocks.
Only my idiot dwarfs are using the rock blocks that I bought from the traders that I wanted to change back into NORMAL rock for the ore.
Beyond forbidding every OTHER type of rock block, is there a way to limit the use of rock blocks specifically to basalt rock blocks using the DF Hack job plugin for the purpose of constructing these bins and barrels?
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 25, 2012, 02:56:19 pm
It all comes back to Masterworks, it seems...  I swear, so many issues arising from that mod...

q, create the job, hover icon over the job.
DFHack, assuming it works the way I think it does, you should be able to simply enter "job-material BASALT", however since it's a custom reaction you'll likely need to use "job item-material 1 BASALT".  the "1" is a variable there.  Hit "job" simply, and it'll give you a readout of the selected task, and from there you can figure out what material to modify to make it take basalt instead of "anything".
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 25, 2012, 02:57:41 pm
Does job-materials even work [reliably] with custom reactions?
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 25, 2012, 03:02:05 pm
I haven't tried it, but I doubt that it does.
Title: Re: DFHack 0.34.05 r1
Post by: DirtyChineseCigarettes on March 25, 2012, 04:05:08 pm
is anyone going to update DFHACK for 34.06?
Title: Re: DFHack 0.34.05 r1
Post by: nenjin on March 25, 2012, 04:05:53 pm
No.

Or you could read up the thread instead of derping your question.
Title: Re: DFHack 0.34.05 r1
Post by: DirtyChineseCigarettes on March 25, 2012, 04:06:58 pm
damn, that sucks, it sure would be sweet if someone did actually update DF hack for version 34.06
Title: Re: DFHack 0.34.05 r1
Post by: Drawde on March 25, 2012, 04:30:27 pm
It will happen when it happens people.

Harassing the people who make it isn't going to get it done faster.  Remember that although you're only one person asking about it, so are all the hundreds of others asking too.
Title: Re: DFHack 0.34.05 r1
Post by: Shawarma on March 25, 2012, 04:52:46 pm
Dear Peterix and Co. defenders,

You are being trolled. Do not bite! I know it sucks to watch 12 year olds berate what they do not understand, but DO...NOT..BITE.

Signed,
DFhack and Runesmith lover- Shawarma
Title: Re: DFHack 0.34.05 r1
Post by: WillowLuman on March 25, 2012, 06:25:28 pm
It's only been a day and a half since the release, have some patience.
Title: Re: DFHack 0.34.05 r1
Post by: DirtyChineseCigarettes on March 25, 2012, 06:32:46 pm
perhaps you should get a dictionary and look up the definition of the word 'berate' shawarmamara. There is no berating going on here at all
Title: Re: DFHack 0.34.05 r1
Post by: nenjin on March 25, 2012, 06:45:57 pm
Just being demanding and being totally unwilling to read the thread to answer your own question and reflex posting instead. Which is far worse than berating, IMO.
Title: Re: DFHack 0.34.05 r1
Post by: DirtyChineseCigarettes on March 25, 2012, 06:47:46 pm
its good to see others agree with me
Title: Re: DFHack 0.34.05 r1
Post by: nenjin on March 25, 2012, 06:50:13 pm
No sir, that was about you.
Title: Re: DFHack 0.34.05 r1
Post by: Jachim on March 25, 2012, 07:13:01 pm
stop replying to the trolls
Title: Re: DFHack 0.34.05 r1
Post by: Juason on March 25, 2012, 07:52:30 pm
I was poking around in the git repository, and it looks like things have gotten quite a bit more complex from the days of just having to update a memory offset for a particular tool to work.  Is that accurate?

Title: Re: DFHack 0.34.05 r1
Post by: cousac on March 25, 2012, 08:05:40 pm
I was poking around in the git repository, and it looks like things have gotten quite a bit more complex from the days of just having to update a memory offset for a particular tool to work.  Is that accurate?

Yes, things have got quite a bit more complicated since 34.xx
Title: Re: DFHack 0.34.05 r1
Post by: Juason on March 25, 2012, 08:17:17 pm
In that case would it make sense to keep some of the utilities standalone (such as REVEAL or PROSPECTOR, the only one I really make use of..)?  The last 3 forts I've embarked on had no iron or flux and I'm about to just code up my own REVEAL utility out of frustration.
Title: Re: DFHack 0.34.05 r1
Post by: cousac on March 25, 2012, 08:22:01 pm
I just keep playing the 05 until they update. Not a big deal really.
Title: Re: DFHack 0.34.05 r1
Post by: Juason on March 25, 2012, 08:40:38 pm
My 05 fort descended into a tantrum spiral after the army "owned" a shitton of food out in the open causing it to go all miasma on me :/  My hospital also stopped working for some reason and I kept losing dwarves to minor wounds.  I am hopeful the many bug fixes in .06 will appease me for some time now.
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 25, 2012, 08:50:25 pm
I think all upgraded forts are suffering similar issues.  New forts aren't reporting much in the way of bugs.
Title: Re: DFHack 0.34.05 r1
Post by: tahujdt on March 25, 2012, 10:40:43 pm
The Troll DirtyChineseCigarettes has come! An annoying 12 year old with ADHD, it posts rude comments designed to seed anger. Beware its flames!
Title: Re: DFHack 0.34.05 r1
Post by: DirtyChineseCigarettes on March 25, 2012, 11:08:29 pm
i joined the forum before you did.

anyways im not trolling, the update caught me inbetween forts and without prospect i dont know if im getting fucked at embark. i dont want to gen in .05 and then update, esp since he said the update would come today and because there can be bugs.

althought it was fun to play the part, a few trixsy posts and the flame retardants came busting in frothing at the mouth " IGOTS THIS GUSY I GOTS THIS HES A TROLL!!!!!!!!!!!!!!!!"
Title: Re: DFHack 0.34.05 r1
Post by: tahujdt on March 25, 2012, 11:28:41 pm
The spinning comeback strikes the tahujdt in the ego, fracturing the supposed superiority and bruising the dignity! tahujdt has been struck down.
Title: Re: DFHack 0.34.05 r1
Post by: WillowLuman on March 25, 2012, 11:32:17 pm
The spinning comeback strikes the tahujdt in the ego, fracturing the supposed superiority and bruising the dignity! tahujdt has been struck down.

Good sportsmanship
Title: Re: DFHack 0.34.05 r1
Post by: quintilius on March 25, 2012, 11:48:02 pm
The spinning comeback strikes the tahujdt in the ego, fracturing the supposed superiority and bruising the dignity! tahujdt has been struck down.

Good sportsmanship

Yep -and better than than Tahujdt latches on.... i could do without 15 pages of red spam
Title: Re: DFHack 0.34.05 r1
Post by: tahujdt on March 25, 2012, 11:59:55 pm
Alternate ending: the spinning comeback strikes the tahujdt in the ego and the severed part sails off in an arc!
Title: Re: DFHack 0.34.05 r1
Post by: khearn on March 26, 2012, 12:37:16 am
Alternate ending: the spinning comeback strikes the tahujdt in the ego and the severed part sails off in an arc!
There are many, many students of zen who wish it were so easy to rid oneself of one's ego.
Title: Re: DFHack 0.34.05 r1
Post by: Andux on March 26, 2012, 12:43:21 am
I was poking around in the git repository, and it looks like things have gotten quite a bit more complex from the days of just having to update a memory offset for a particular tool to work.  Is that accurate?

Yeah. The way old DFHack did things, all the addresses (which give the location of statically-allocated structs, including pointers to dynamically-allocated stuff) and offsets (which give the location of fields within dynamically-allocated structs) were loaded at runtime from one big XML file.
Tools needed to update for a typical new version of DF:
In the new DFHack, all the offsets (and a fair number of addresses) are gone; all structs are now described using a system of XML files, which get translated into C++ header files and compiled into the DFHack binary.
Tools needed to update for a typical new version of DF:I guess the new system is meant to improve speed (nice for stuff like stonesense) and memory usage (very important, since the new SDL-fakery means DFHack lives in the same memory-space as DF now), but I'm glad it's not my job to update it.
Title: Re: DFHack 0.34.05 r1
Post by: narhiril on March 26, 2012, 12:46:39 am
... I'm glad it's not my job to update it.

Amen to that.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 26, 2012, 12:51:24 am
I was poking around in the git repository, and it looks like things have gotten quite a bit more complex from the days of just having to update a memory offset for a particular tool to work.  Is that accurate?

Yeah. The way old DFHack did things, all the addresses (which give the location of statically-allocated structs, including pointers to dynamically-allocated stuff) and offsets (which give the location of fields within dynamically-allocated structs) were loaded at runtime from one big XML file.
Tools needed to update for a typical new version of DF:
  • Cheat Engine (or similar)
  • a decent text editor

In the new DFHack, all the offsets (and a fair number of addresses) are gone; all structs are now described using a system of XML files, which get translated into C++ header files and compiled into the DFHack binary.
Tools needed to update for a typical new version of DF:
  • git
  • cmake
  • perl with XML::LibXML and XML::LibXSLT
  • MSVC++ 2010 (on Windows) or GCC (on Linux)
I guess the new system is meant to improve speed (nice for stuff like stonesense) and memory usage (very important, since the new SDL-fakery means DFHack lives in the same memory-space as DF now), but I'm glad it's not my job to update it.

Actually, we need more than that.

Cheat engine is still needed, as is ida, and likely a few other things I don't know about.
Title: Re: DFHack 0.34.05 r1
Post by: Beeskee on March 26, 2012, 06:19:02 am
Is this the place to post suggestions? I'd love to see a "Spear of Armok" / "Adamantine Spire" generator - something that makes a heaven-to-hell adamantine spire on a specified spot on the map.

If there's a way to do that with the existing utility, I could definitely use instructions how. I tried to use the "tiletypes" command to do this but I just could not figure out how. If it's possible to do with that, I could use step-by-step instructions.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 26, 2012, 06:23:33 am
With the existing dfhack it´s not possible to create new adamantine spires similar to the usual ones (i.e. huge spires stretching vertically over lots fo z levels). You can however cheat infinite amounts onto your map with changevein, probably also tiletypes. And the next version will allow you to change the material of stone layers so you could turn your whole map into candy.

Now what you want is probably possible somehow (by creating new veins on the game map), but it would need to be programmed first.

Edit: I still have to figure out how to properly use tiletypes myself. It could use some better documentation.
With changevein it works like this:
- put in-game cursor over a vein or cluster (for example one of those ugly microcline blobs).
- in the dfhack console type 'changevein RAW_ADAMANTINE' and press enter
Title: Re: DFHack 0.34.05 r1
Post by: Malarauko on March 26, 2012, 07:12:48 am
Long time user first time poster.

Please keep up all the good work and take all the time you need to make DFHack work.
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 26, 2012, 09:25:45 am
Is this the place to post suggestions? I'd love to see a "Spear of Armok" / "Adamantine Spire" generator - something that makes a heaven-to-hell adamantine spire on a specified spot on the map.

If there's a way to do that with the existing utility, I could definitely use instructions how. I tried to use the "tiletypes" command to do this but I just could not figure out how. If it's possible to do with that, I could use step-by-step instructions.
Tiletype deals with specific tiles.  The adamantine spires are map features, where the game essentially does worldgen, and during worldgen it leaves a sticky note, "there is a spire on this square".  Then it leaves it there.  When you actually visit the location, it makes the location on the spot and saves it.  When it makes the location, it gathers all the sticky notes it left during worldgen.  "The grass is arrow grass, the trees are maple, the dirt is clay, there is a spire."  Proper spires occur when it accidentally grabs the wrong sticky note.  Instead of "there is a spire at z20" it accidentally gets a "there is a spire at z100".

I've attempted to compile more information (http://www.bay12forums.com/smf/index.php?topic=104670.msg3095919#msg3095919) but it seems no one really caught onto it very heavily.
Title: Re: DFHack 0.34.05 r1
Post by: Eater of Vermin on March 26, 2012, 05:21:48 pm
Is this the one? http://www.bay12forums.com/smf/index.php?topic=104015.0

That's the one!  Thx.  :)
Title: Re: DFHack 0.34.05 r1
Post by: BlackRogue on March 26, 2012, 08:19:00 pm
Is this the one? http://www.bay12forums.com/smf/index.php?topic=104015.0

That's the one!  Thx.  :)
Glad I could help.
Title: Re: DFHack 0.34.05 r1
Post by: Beeskee on March 26, 2012, 09:10:13 pm
For the spire thing, it doesn't have to be an "official" spire, just something that looks like one.

Since the main problems with the spire maps is the tall spires end up being technically infinite, and producing some seriously weird glitches where dwarfs won't mine them.

I was thinking it would mainly be for RP maps or things like that.
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 26, 2012, 10:00:42 pm
In that case, you can open the raws, remove [LAVA] from Obsidian, and place it onto Adamantine.  Then use DFLiquids, and using the "obsidian" mode it will now paint adamantine instead.  When you're done, undo the changes and your artificial spire will remain.

Works for any material, really.  You can produce a slade tower if you want.
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 26, 2012, 10:39:28 pm
In that case, you can open the raws, remove [LAVA] from Obsidian, and place it onto Adamantine.  Then use DFLiquids, and using the "obsidian" mode it will now paint adamantine instead.  When you're done, undo the changes and your artificial spire will remain.
No, it will not - it'll change back to obsidian once you save/load. As such, you could just as easily cast a bunch of obsidian, save, then move [LAVA] from Obsidian to Raw Adamantine.
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 26, 2012, 11:09:05 pm
Hrm, really?  I could swear that it would stick...
Title: Re: DFHack 0.34.05 r1
Post by: Andux on March 27, 2012, 12:18:05 am
Obsidian is handled using a special set of tile types, rather than a vein, so there's no specific material ID stored with the tiles (though I'd imagine there's a global "LAVA Stone Mat Index" variable that gets filled in whenever the raws are loaded). Any stones you mined out should stick, though.
Title: Re: DFHack 0.34.05 r1
Post by: Quietust on March 27, 2012, 07:58:36 am
Obsidian is handled using a special set of tile types, rather than a vein, so there's no specific material ID stored with the tiles (though I'd imagine there's a global "LAVA Stone Mat Index" variable that gets filled in whenever the raws are loaded).
Interestingly, it's not a global, but part of the geology data - if you have more than one [LAVA] stone, you'll get a different one in each biome.
Title: Re: DFHack 0.34.05 r1
Post by: walberg on March 27, 2012, 10:34:37 am
I don't see that a 0.34.06 compatible release has been officially announced yet, so probably everything since 0.34.05-r1 is still considered unstable, but I wanted to report an apparent bug anyway...

On all commits since edf77c (Link protobuf to dfhack core as a shared library.), the Linux build seems to no longer work. It compiles fine, but running it simply gives "Memory fault" and dies. I did a Debug build, and the core file generated indicates the memory fault is here:

Core was generated by `/usr/local/games/dwarf-fortress/dfbin/libs/Dwarf_Fortress'.
Program terminated with signal 11, Segmentation fault.
[New process 25918]
#0  0xf74d0644 in global constructors keyed to DataStaticsFields.cpp ()
   from /usr/local/games/dwarf-fortress/dfbin/hack/libdfhack.so

Not so sure that helps a lot, but it gives someplace to start. This is on a 64-bit Debian 5.0.8 system with GCC 4.5.0, but is repeatable on Debian 6.0.4 (64-bit also with same version of compiler). I could try a different compiler version as well, but it'll take a while to cook one up...
Title: Re: DFHack 0.34.05 r1
Post by: Rinin_Rus on March 27, 2012, 10:52:05 am
http://zalil.ru/32962130
http://www.filehosting.org/file/details/325079/dfhack-0.34.06-r1f-Windows-pre-alpha.zip

Ok, since I can't wait anymore for release i've just download and compile partially complete version of DFHack. "Reveal" and "prospect" seems works, it's enough for me to start. Other features could work, or not. I did nothing except downloading and compiling.

If you can't wait like me - you could try it.

And thanks again to all people working at this awesome project

PS windows only
Title: Re: DFHack 0.34.05 r1
Post by: DirtyChineseCigarettes on March 27, 2012, 12:55:42 pm
Thnx, I wasnt sure what would happen first, dfhack getting updated or df getting updated.
Title: Re: DFHack 0.34.05 r1
Post by: narhiril on March 27, 2012, 01:47:25 pm
Obsidian is handled using a special set of tile types, rather than a vein, so there's no specific material ID stored with the tiles (though I'd imagine there's a global "LAVA Stone Mat Index" variable that gets filled in whenever the raws are loaded).
Interestingly, it's not a global, but part of the geology data - if you have more than one [LAVA] stone, you'll get a different one in each biome.


I must find a way to abuse this.
Title: Re: DFHack 0.34.05 r1
Post by: kingofthescots on March 27, 2012, 01:53:48 pm
Thanks Rinin, those two tools are the ones I use the most anyways.
Title: Re: DFHack 0.34.05 r1
Post by: slink on March 27, 2012, 04:21:40 pm
Yes, thanks Rinin.  Drybuckets seems to work.  18 buckets recovered, wheee!   :)
Title: Re: DFHack 0.34.05 r1
Post by: Electrode on March 27, 2012, 06:48:23 pm
I don't see that a 0.34.06 compatible release has been officially announced yet, so probably everything since 0.34.05-r1 is still considered unstable, but I wanted to report an apparent bug anyway...

On all commits since edf77c (Link protobuf to dfhack core as a shared library.), the Linux build seems to no longer work. It compiles fine, but running it simply gives "Memory fault" and dies. I did a Debug build, and the core file generated indicates the memory fault is here:

(snip)

Not so sure that helps a lot, but it gives someplace to start. This is on a 64-bit Debian 5.0.8 system with GCC 4.5.0, but is repeatable on Debian 6.0.4 (64-bit also with same version of compiler). I could try a different compiler version as well, but it'll take a while to cook one up...

Latest code (d2d16271f0) is working fine for me, built with GCC 4.5.3 on 64-bit Gentoo. Remember that you need to compile dfhack as a 32-bit app. Try:

Code: [Select]
cd dfhack/build
setarch i386 cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=~/df_linux
setarch i386 make install
Title: Re: DFHack 0.34.05 r1
Post by: the_game_hunt on March 28, 2012, 09:56:57 am
It seems that something horrible happened, that means no dfhacks, which is horrible.

Playing without dfhacks is really anoying (clean, prospect,fastdwarf,etc) :'(
Title: Re: DFHack 0.34.05 r1
Post by: Malarauko on March 28, 2012, 12:26:36 pm
Oh how we wept. When we remembered autodump.
Title: Re: DFHack 0.34.05 r1
Post by: peregarrett on March 28, 2012, 12:42:52 pm
http://zalil.ru/32962130
http://www.filehosting.org/file/details/325079/dfhack-0.34.06-r1f-Windows-pre-alpha.zip

Ok, since I can't wait anymore for release i've just download and compile partially complete version of DFHack. "Reveal" and "prospect" seems works, it's enough for me to start. Other features could work, or not. I did nothing except downloading and compiling.

If you can't wait like me - you could try it.

And thanks again to all people working at this awesome project

PS windows only
Hooray, vdig is up again! Thanks alot!
Title: Re: DFHack 0.34.05 r1
Post by: OneTwentySix on March 28, 2012, 01:00:18 pm
http://zalil.ru/32962130
http://www.filehosting.org/file/details/325079/dfhack-0.34.06-r1f-Windows-pre-alpha.zip

Ok, since I can't wait anymore for release i've just download and compile partially complete version of DFHack. "Reveal" and "prospect" seems works, it's enough for me to start. Other features could work, or not. I did nothing except downloading and compiling.

If you can't wait like me - you could try it.

And thanks again to all people working at this awesome project

PS windows only

Any chance you could host this somewhere else, like the DFFD?  I'm not really comfortable giving my e-mail address out to websites when there's no logical reason to do so; they don't need my address to let me download a file.  I don't want my address becoming unusable because of spam.
Title: Re: DFHack 0.34.05 r1
Post by: NecroRebel on March 28, 2012, 01:50:42 pm
The first of the two links doesn't require an email address. It appears to be in Russian, but just wait a bit and it should automatically start the download.
Title: Re: DFHack 0.34.05 r1
Post by: Rinin_Rus on March 28, 2012, 02:12:14 pm
The first of the two links doesn't require an email address. It appears to be in Russian, but just wait a bit and it should automatically start the download.
Absolutely right and anyone could upload it anywhere else, I'm just not too familiar with non-Russian filehostings.
Title: Re: DFHack 0.34.05 r1
Post by: acehawk on March 28, 2012, 03:36:37 pm
Whew, I've been needing vdig, I had forgotten how much useless stone I end up with without it lol
Title: Re: DFHack 0.34.05 r1
Post by: Electrode on March 28, 2012, 05:08:49 pm
I literally spent all day today setting up a winXP build box just for this...  ::)

Compiled from git checkout 1f5c586f62:
Windows (http://n8fq.org/df/dfhack_1f5c586f62_windows.zip) (untested)
Linux (http://n8fq.org/df/dfhack_1f5c586f62_linux.tar.bz2) (prospect works, haven't tried anything else yet)

From the looks of the commit log, an official release is probably not too far off...
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 28, 2012, 05:41:26 pm
The first of the two links doesn't require an email address. It appears to be in Russian, but just wait a bit and it should automatically start the download.
Absolutely right and anyone could upload it anywhere else, I'm just not too familiar with non-Russian filehostings.
DFFD is Dwarf Fortress File Depot.  It's a server/website hosted by Toady & Company, where you can freely upload dwarf fortress related things.

http://dffd.wimbli.com/

Generally, if you're gonna post a savegame, or a utility, or mod, this is the go-to place to do it!
Title: Re: DFHack 0.34.05 r1
Post by: Tatterdemalian on March 28, 2012, 06:58:23 pm
Whew, I've been needing vdig, I had forgotten how much useless stone I end up with without it lol
I still don't get why Fortress Mode has never had a (m)ine designation. It would only require a simple rule: dig the tile out like (d)ig, but when the tile converts to a floor, every tile newly revealed with the same material type as the one just removed is automatically marked for (m)ining. No need to reveal the size and extent of the entire vein like vdig, and no need to micromanage the excavation like (d)ig. It wouldn't go out of control as long as you limit the new designations to tiles that were hidden but are now revealed by the previous tile's removal, except when a cavern is breached. Even then, if you further limit new designations to tiles directly and diagonally adjacent to the tile that was removed (spreading to newly revealed tiles similarly adjacent, maybe, so the (m)ine designation will spread along cavern walls that are part of the vein being (m)ined), you wouldn't have to worry about un-designating the entire cavern.

Heck, make it a part of the (o)rder menu... "d: Dig designations spread to revealed tiles of same material."
Title: Re: DFHack 0.34.05 r1
Post by: Frogwarrior on March 28, 2012, 08:02:12 pm
That would be cool with two caveats:
One, revealed warm or wet tiles do NOT become designated, and
Two, it doesn't work on layer stone.........
Heck, there'd probably need to be some sort of menu where you choose which sorts of stones use this behavior, so you don't end up with your miners accidentally wasting their time digging out the WHOLE chunk of microcline.
Title: Re: DFHack 0.34.05 r1
Post by: Tatterdemalian on March 28, 2012, 09:38:40 pm
That would be cool with two caveats:
One, revealed warm or wet tiles do NOT become designated, and
Two, it doesn't work on layer stone.........
Heck, there'd probably need to be some sort of menu where you choose which sorts of stones use this behavior, so you don't end up with your miners accidentally wasting their time digging out the WHOLE chunk of microcline.

Or just have different (d)ig and (m)ine designations, so you can mine veins you mark for mining and dig areas you mark for digging. And there are lots of times I've wanted to eventually dig out a WHOLE chunk of marble...
Title: Re: DFHack 0.34.05 r1
Post by: Troas on March 28, 2012, 09:44:15 pm


Any chance you could host this somewhere else, like the DFFD?  I'm not really comfortable giving my e-mail address out to websites when there's no logical reason to do so; they don't need my address to let me download a file.  I don't want my address becoming unusable because of spam.
[/quote]

http://www.spamgourmet.com

This is a free email forwarding service - it allows you to create unlimited temporary or semi-permanent email addresses, so you can create an email just for this website.  By default email addresses self-destruct after 10 emails, but you can modify that for anywhere between 1 and 20, and also set up dedicated senders - for example if you created filehosting.onetwentysix@somedomain.net you could specify that any email from filehosting.org does not "use up" one of the 10 emails, so this website could send you emails without having to reset the address.

And when the website gets hacked and a spammer gets the email address you can turn it off and create a new one, or if you do nothing it will automatically turn off after 10 spams.  Or when you get email from "Bank X", or "Blizzard" or "Bioware" addressed to that email you know immediately it is a spam.
Title: Re: DFHack 0.34.05 r1
Post by: mrhanman on March 28, 2012, 10:22:00 pm
If anyone is interested, I just compiled this for windows, and it seems to work fine.

http://dl.dropbox.com/u/22141371/dfhack-0.34.06-r1-Windows.zip (http://dl.dropbox.com/u/22141371/dfhack-0.34.06-r1-Windows.zip)

I suspect a release is imminent, but you never know.
Title: Re: DFHack 0.34.05 r1
Post by: ydaraishy on March 28, 2012, 10:56:08 pm
If anyone is interested, I just compiled this for windows, and it seems to work fine.

http://dl.dropbox.com/u/22141371/dfhack-0.34.06-r1-Windows.zip (http://dl.dropbox.com/u/22141371/dfhack-0.34.06-r1-Windows.zip)

I suspect a release is imminent, but you never know.

Thanks!  Reveal, prospect and autodump are working fine, and those are the ones I usually use. 
Title: Re: DFHack 0.34.05 r1
Post by: Jiri Petru on March 29, 2012, 03:56:05 am
Posting to follow...
...and to say thank you! The new hack is very easy to control, and I love how Stonesense is bundled with it. Good work, guys.
Title: Re: DFHack 0.34.05 r1
Post by: Kar98 on March 29, 2012, 06:55:39 am
Thanks so much for making this. 99% of the time I'm using vdig which toady really should implement in the default release. I hate constantly having to micromanage my miners to dig out that vein
Title: Re: DFHack 0.34.05 r1
Post by: Sphalerite on March 29, 2012, 08:46:16 am
Is it possible to dump the output of a functions, say Prospect, to a file?  Windows doesn't let me copy and paste text from the dfhack window.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on March 29, 2012, 08:48:26 am
Right click the title bad and click mark. That will let you select it. Pressing enter when you select something will let you copy it.
Title: Re: DFHack 0.34.05 r1
Post by: Sphalerite on March 29, 2012, 08:55:04 am
That worked, thanks.
Title: Re: DFHack 0.34.05 r1
Post by: danaris on March 29, 2012, 09:04:28 am
It would still be vastly preferable to allow redirecting output to a file for a single command. This was possible with the old utilities, and was incredibly convenient with dfprospect. A text editor is just a much better interface for poking around at its output than the sadly-limited terminal window.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 29, 2012, 09:29:35 am
It would still be vastly preferable to allow redirecting output to a file for a single command.

On Windows:
(this is, of course, assuming that you already have DF running and are looking at the pre-embark map screen or a loaded map)
Open a cmd window, navigate to your DF folder (for example "cd d:/df_34_06_win").
Type "dfhack-run prospect > prospect.txt", hit enter.
This will call the plugin prospect and redirect the output into the file "prospect.txt".

Should work the same for all non-interactive plugins. Although prospect is probably the only one where you want to have the output in a text file. Dunno if dfhack-run is a windows-only thingie, I don´t have Linux.
Title: Re: DFHack 0.34.05 r1
Post by: RabblerouserGT on March 29, 2012, 10:43:33 am
Thanks so much for making this. 99% of the time I'm using vdig which toady really should implement in the default release. I hate constantly having to micromanage my miners to dig out that vein
vdig isn't really realistic. Doubt it'll be in vanilla.
How can you know which direction a vein flows if you can't see it?
Title: Re: DFHack 0.34.05 r1
Post by: starvingpoet on March 29, 2012, 10:50:51 am
auto-designate as it is revealed.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 29, 2012, 10:59:26 am
vdig isn't really realistic. Doubt it'll be in vanilla.
How can you know which direction a vein flows if you can't see it?

vdig is realistic. The miners follow the visible vein, just like real-world miners used to do. If anything, DF is not realistic since it does not have tattered veins (with some rock in-between and guesswork to do where the vein will continue).
Title: Re: DFHack 0.34.05 r1
Post by: Girlinhat on March 29, 2012, 11:00:32 am
Toady has already said that he wants to include a variety of vdig that will assign new designations as they're uncovered.

Also, Dwarves are the children of the earth.  I think they could figure out how a vein acts without digging it empty.
Title: Re: DFHack 0.34.05 r1
Post by: RabblerouserGT on March 29, 2012, 11:43:04 am
Toady has already said that he wants to include a variety of vdig that will assign new designations as they're uncovered.

Also, Dwarves are the children of the earth.  I think they could figure out how a vein acts without digging it empty.
Hmm.. maybe have it more accurate the higher the miner skill is.
I digress, though. This is off-topic (I think).

Waiting for DFhack to be released to the latest version. :O
Title: Re: DFHack 0.34.05 r1
Post by: toasteur on March 29, 2012, 11:53:05 am
Toady has already said that he wants to include a variety of vdig that will assign new designations as they're uncovered.

Also, Dwarves are the children of the earth.  I think they could figure out how a vein acts without digging it empty.
Hmm.. maybe have it more accurate the higher the miner skill is.
I digress, though. This is off-topic (I think).

Waiting for DFhack to be released to the latest version. :O

in game version of vdig would be different, it would only auto-designate the surrounding tiles if in the same vein, not reveal the whole vein directly. it is no different from what happens today, only we have to do it manually after each new tile is revealed.
Title: Re: DFHack 0.34.05 r1
Post by: narhiril on March 29, 2012, 01:35:51 pm
Toady has already said that he wants to include a variety of vdig that will assign new designations as they're uncovered.

Also, Dwarves are the children of the earth.  I think they could figure out how a vein acts without digging it empty.
Hmm.. maybe have it more accurate the higher the miner skill is.
I digress, though. This is off-topic (I think).

Waiting for DFhack to be released to the latest version. :O

in game version of vdig would be different, it would only auto-designate the surrounding tiles if in the same vein, not reveal the whole vein directly. it is no different from what happens today, only we have to do it manually after each new tile is revealed.

It would likely work by checking for newly available vein tiles every time a dwarf mines out a tile - that way, the digging designations will happen as the vein tiles are dug out, not revealing the entire thing up front.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 29, 2012, 01:39:24 pm
in game version of vdig would be different, it would only auto-designate the surrounding tiles if in the same vein, not reveal the whole vein directly. it is no different from what happens today, only we have to do it manually after each new tile is revealed.

A problem with auto-digging veins is that it can happen that you expose your fortress to danger (by creating an unwanted hole which leads to the surface or maybe even magma/water). And you can also destroy existing rooms, engraved walls (if masterpieces that will make the engraver sad) and whatnot. So I guess Toady's version would have to take all this into consideration.
Title: Re: DFHack 0.34.05 r1
Post by: toasteur on March 29, 2012, 01:45:38 pm
in game version of vdig would be different, it would only auto-designate the surrounding tiles if in the same vein, not reveal the whole vein directly. it is no different from what happens today, only we have to do it manually after each new tile is revealed.

A problem with auto-digging veins is that it can happen that you expose your fortress to danger (by creating an unwanted hole which leads to the surface or maybe even magma/water). And you can also destroy existing rooms, engraved walls (if masterpieces that will make the engraver sad) and whatnot. So I guess Toady's version would have to take all this into consideration.

it's no more dangerous than designating for digging a square of unrevealed map. also, they would surely have toggle options to accomodate the level of risk people are willing to take.
Title: Re: DFHack 0.34.05 r1
Post by: walberg on March 29, 2012, 01:46:42 pm
I don't see that a 0.34.06 compatible release has been officially announced yet, so probably everything since 0.34.05-r1 is still considered unstable, but I wanted to report an apparent bug anyway...

On all commits since edf77c (Link protobuf to dfhack core as a shared library.), the Linux build seems to no longer work. It compiles fine, but running it simply gives "Memory fault" and dies. I did a Debug build, and the core file generated indicates the memory fault is here:

(snip)

Not so sure that helps a lot, but it gives someplace to start. This is on a 64-bit Debian 5.0.8 system with GCC 4.5.0, but is repeatable on Debian 6.0.4 (64-bit also with same version of compiler). I could try a different compiler version as well, but it'll take a while to cook one up...

Latest code (d2d16271f0) is working fine for me, built with GCC 4.5.3 on 64-bit Gentoo. Remember that you need to compile dfhack as a 32-bit app. Try:

Code: [Select]
cd dfhack/build
setarch i386 cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=~/df_linux
setarch i386 make install

It's not related to setarch (or gcc -m32 for that matter). I'm starting to think it's due to a library mismatch or something. I've tried gcc-4.5.0, gcc-4.5.3 and gcc-4.7.0 all with the same results. Running 'dfhack -g', I can get a little more info:

Spoiler (click to show/hide)

Part-way through the global constructor routine, it's attempting to make an indirect call (probably through a vtable or some such), but the base address in %edx is 0. Must be a missing NULL check somewhere.

Unfortunately, there isn't an easy way that I know of to correlate that global constructor code back to an actual source code line number... And due to the fact that pretty much that entire source file is generated by the build process anyway, the culprit isn't readily obvious.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on March 29, 2012, 01:57:42 pm
I suggest you guys (desperately trying to build the linux version, mainly) just wait a short while longer. New release is imminent. Also it seems that the linux version needs to be built with gcc 4.4 by the way.
Title: Re: DFHack 0.34.05 r1
Post by: ag on March 29, 2012, 02:34:01 pm
Part-way through the global constructor routine, it's attempting to make an indirect call (probably through a vtable or some such), but the base address in %edx is 0. Must be a missing NULL check somewhere.

Just debugged that in the chat. It was me screwing up static initialization discipline - it was trying to access an object that was not guaranteed to be initialized yet ^^; Since this is undefined behavior, it apparently depended on something like the standard library version.
Title: Re: DFHack 0.34.05 r1
Post by: notfood on March 29, 2012, 02:37:58 pm
Works fine under Linux, I tested most tools.

DFHack 0.34.05-r1-232-g1f5c586
Archlinux
gcc-multilib 4.6.3-1

I had to remove the libs/libstdc++.so.6 from the df_linux folder for it to run properly, otherwise it complained about lack of Strings.
Title: Re: DFHack 0.34.06 r3
Post by: peterix on March 29, 2012, 03:18:40 pm
Alright, finally got this out of the gate :)

Check the first post for the news and download links. The new stonesense features alone are awesome, but there's a whole lot more of new stuff too.

Oh, and we have DFusion working on Windows again. The linux version actually runs, but some of the more involved things it does don't, so I haven't included it in the linux build yet.
Title: Re: DFHack 0.34.06 r3
Post by: vjek on March 29, 2012, 03:31:27 pm
Nice, well done!  /applaud /cheer
Title: Re: DFHack 0.34.05 r1
Post by: khearn on March 29, 2012, 03:59:26 pm
in game version of vdig would be different, it would only auto-designate the surrounding tiles if in the same vein, not reveal the whole vein directly. it is no different from what happens today, only we have to do it manually after each new tile is revealed.

A problem with auto-digging veins is that it can happen that you expose your fortress to danger (by creating an unwanted hole which leads to the surface or maybe even magma/water). And you can also destroy existing rooms, engraved walls (if masterpieces that will make the engraver sad) and whatnot. So I guess Toady's version would have to take all this into consideration.

Yeah, just like the building code takes into account whether or not the dwarf will be trapped. Or the channeling code takes into account whether or not it will cause a cave in. Or the removing construction code...

I suspect your dwarves will blithely follow a vein until they open a hole to let a siege in or flood the fortress. Why should they suddenly start being any more intelligent?
Title: Re: DFHack 0.34.06 r3
Post by: Korva on March 29, 2012, 04:39:28 pm
Thanks a bunch for the update. I have a hard time playing without reveal and prospect to see if an embark spot is really worthwhile, and clean map is a lifesaver too.
Title: Re: DFHack 0.34.06 r3
Post by: orius on March 29, 2012, 04:42:10 pm
Alright, finally got this out of the gate :)

Check the first post for the news and download links. The new stonesense features alone are awesome, but there's a whole lot more of new stuff too.

Oh, and we have DFusion working on Windows again. The linux version actually runs, but some of the more involved things it does don't, so I haven't included it in the linux build yet.

Hah, a few hours after I download one of the temp fixes for 34.06.  Well at least there's some good new stuff to play with too.
Title: Re: DFHack 0.34.06 r3
Post by: tahujdt on March 29, 2012, 04:46:00 pm
Yay, finally DFusion! I'm looking forward to changing my conglomerate to candy as well.
Title: Re: DFHack 0.34.06 r3
Post by: NecroRebel on March 29, 2012, 05:27:47 pm
I've encountered what might be a bug with vdig. I used it to designate veins of several materials, including limonite, hematite, and lignite, but the autodesignation process appeared to get interrupted by the presence of small clusters of various gems next to the veins, even when the desired vein material was itself continuous. Using vdig on these interruptions designated the desired material on the interrupting spots themselves and also the gems that were part of the small cluster. It appears that the material generation process scattered the small clusters, then drew the veins on top of them, but where the veins intercepted small clusters the program still considers to be the overwritten small cluster material. This may be a problem with vdig or with DF itself.
Title: Re: DFHack 0.34.06 r3
Post by: Rumrusher on March 29, 2012, 05:54:47 pm
Yay, finally DFusion! I'm looking forward to changing my conglomerate to candy as well.
you might want to add this code into dfusion's tools/init file because empregnate can't be use well in adventure mode as is.
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.06 r3
Post by: Girlinhat on March 29, 2012, 06:00:31 pm
I never got into DFusion... why is it so good?
Title: Re: DFHack 0.34.06 r3
Post by: slink on March 29, 2012, 06:07:46 pm
I've encountered what might be a bug with vdig. I used it to designate veins of several materials, including limonite, hematite, and lignite, but the autodesignation process appeared to get interrupted by the presence of small clusters of various gems next to the veins, even when the desired vein material was itself continuous. Using vdig on these interruptions designated the desired material on the interrupting spots themselves and also the gems that were part of the small cluster. It appears that the material generation process scattered the small clusters, then drew the veins on top of them, but where the veins intercepted small clusters the program still considers to be the overwritten small cluster material. This may be a problem with vdig or with DF itself.

I have the same problem here.  Where veins of hematite crossed veins of tetrahedrite, vdig once diverted to the tetrahedrite and once did not.  It skipped occasional ore tiles even when they were of the correct type for the vein it was following.  It sometimes marked gems with the ore, and always marked any surrounding ore with gems.  When I tried to choose a small inclusion of turquoise for mining, it marked an entire surrounding area of kaolinite.  I never had crossing veins of ore with the previous versions of DFHack, but I know it could tell ore from gems before.
Title: Re: DFHack 0.34.06 r3
Post by: Girlinhat on March 29, 2012, 06:20:53 pm
I've had crossing veins before, and I haven't used the newest DFHack but that's definitely a new bug.
Title: Re: DFHack 0.34.06 r3
Post by: peterix on March 29, 2012, 06:32:45 pm
Hmm. I'll look at it tomorrow :)
Title: Re: DFHack 0.34.06 r3
Post by: Quietust on March 29, 2012, 06:56:02 pm
I believe I've found the problem and have a fix for it - when I updated revflood to see through constructions and ice, I accidentally changed the way conflicting veins are handled from "last wins" to "first wins".

Until peterix rebuilds DFHack, a fixed version of vdig can be found here:
http://www.qmtpro.com/~quietust/df/vdig.plug.dll (http://www.qmtpro.com/~quietust/df/vdig.plug.dll) (md5sum 5a70dd16b4be2dd9fc5996cd5ffb2622)

[edit] Rebuilt without debugging information
Title: Re: DFHack 0.34.06 r3
Post by: telamon on March 29, 2012, 06:56:46 pm
As usual, DFhack delivers. Rock on guys, and my magma forges thank you for the new feature tool =]

EDIT: quick side question. is there any readme material prepared for dfusion now that it's back in play? I remember having used some of its features before but who knows what's changed since the last time I used dfusion (back when it was a standalone... long time ago to say the least).
Title: Re: DFHack 0.34.06 r3
Post by: orius on March 29, 2012, 06:59:29 pm
I've been having a slight problem with the workflow tool.  It doesn't protect repeating jobs for milking or shearing animals in the Farmer's Workshop.  Is this intentional, or an oversight?
Title: Re: DFHack 0.34.06 r3
Post by: drh on March 29, 2012, 07:41:24 pm
Just built dfhack from git; everything looks good. Great job!

It's not a big thing, but adding bash-style tabbed completion to the console would be pretty nifty.
Title: Re: DFHack 0.34.06 r3
Post by: ctoan on March 29, 2012, 11:41:19 pm
So I'm pretty sure dfhack is giving me some sort of stability issues. After a while of playing, DF would just randomly crash and bring up the window error recovery stuff. Nothing funny in the game log, and it seems to have gone away after swapping the SDL to deactivate dfhack.
Title: Re: DFHack 0.34.06 r3
Post by: WillowLuman on March 29, 2012, 11:42:18 pm
*Sees thread title*
*Literally spits out drink over key board*
Woohoo! Time to whip my fort back into shape with ☼peterix code whips☼!
Title: Re: DFHack 0.34.06 r3
Post by: peterix on March 30, 2012, 04:18:28 am
So I'm pretty sure dfhack is giving me some sort of stability issues. After a while of playing, DF would just randomly crash and bring up the window error recovery stuff. Nothing funny in the game log, and it seems to have gone away after swapping the SDL to deactivate dfhack.
Can you elaborate on that a bit? Which parts of DFhack are you actively using? Also, can you post the crash information?
Title: Re: DFHack 0.34.06 r3
Post by: telarin on March 30, 2012, 07:18:12 am
Ok, the new autolabor utility is kind of neat, but I have a few suggestions:

It keep disabling my legendary miners and enabling mining on dwarves with no skill, causing slower mining and loss of material. I suggest that there be a level threshold (either hard coded, or configurable) where it does not disable a labor. For instance, never disable labors if the skill is level is 10 or higher.

Since miners and woodcutters both require particular equipment, it might also be nice to be able to exclude those labors from autolabor entirely, but still have it manage all other labors.
Title: Re: DFHack 0.34.06 r3
Post by: LoSboccacc on March 30, 2012, 07:18:31 am
wow, autolabor is awesome! it should really be part of the standard game, maybe under a census and immigration officer noble.
Title: Re: DFHack 0.34.06 r3
Post by: Garath on March 30, 2012, 07:31:37 am
I'm using windows and copy the "hack" folder to the main df folder, then replace the sdl.dll with the one provided and I get an error message and df refuses to start. Am I missing something?
Title: Re: DFHack 0.34.06 r3
Post by: ctoan on March 30, 2012, 07:35:21 am
So I'm pretty sure dfhack is giving me some sort of stability issues. After a while of playing, DF would just randomly crash and bring up the window error recovery stuff. Nothing funny in the game log, and it seems to have gone away after swapping the SDL to deactivate dfhack.
Can you elaborate on that a bit? Which parts of DFhack are you actively using? Also, can you post the crash information?

I'm using a lot of workflow and digcircle.  It doesn't seem to be crashing when I use a command, it's just crashing randomly, usually right after I hit a key in the game.  The only reason I suspect dfhack is because I haven't had any problems without it.

As for crash information, do you mean the error log that windows spits out after you let it churn for a while?  I don't have one, but I can see if I can convince it to crash again.

Edit:  So the new version has some crash fixes in it, but I'm still reasonably confident that it's not that, since nothing were-creature related happened right before the crashes.
Title: Re: DFHack 0.34.06 r3
Post by: MagmaSolutionsInc on March 30, 2012, 07:55:44 am
Can I please be the first to remark with amusement that 0.34.07 is now out?  :P


Only kidding around of course. I do love DfHack and appreciate the effort  :)
Title: Re: DFHack 0.34.06 r3
Post by: rampagingfrodo on March 30, 2012, 07:59:00 am
Can I please be the first to remark with amusement that 0.34.07 is now out?  :P

This is why I just don't play this game until a stable version is out.

Thanks, nonetheless, DFhack team.
Title: Re: DFHack 0.34.06 r3
Post by: MagmaSolutionsInc on March 30, 2012, 08:01:25 am

This is why I just don't play this game until a stable version is out.

Thanks, nonetheless, DFhack team.

I do hope you mean a stable version of DFhack  ;D Decades is too long to wait for DF!  :P
Title: Re: DFHack 0.34.06 r3
Post by: Naros on March 30, 2012, 08:11:36 am
changelayer - I have told you I loved you a few times already, but.. I love you! <3

liquids-here ... handy obsidian cheating for fixing accidentally mined out tiles! :9
OC anyone?

I haven't needed a tool like revforget .. but it's awesome that one doesn't have to worry about that anymore!
Dunno about the others. Seems like I should check auto-labor out, if it's not too cheaty. :9

Title: Re: DFHack 0.34.06 r3
Post by: Garath on March 30, 2012, 08:17:29 am
maybe hack 06 is compatible with df 07?

If I can get it running with df 06 first...
Title: Re: DFHack 0.34.06 r3
Post by: Rose on March 30, 2012, 08:26:58 am
No. It isn't.
Title: Re: DFHack 0.34.06 r3
Post by: Garath on March 30, 2012, 08:30:12 am
Oh well, worth a wish
Title: Re: DFHack 0.34.06 r3
Post by: Girlinhat on March 30, 2012, 09:18:20 am
Suggestion: "tweather" command.  It would change the init option for weather.

Also going to re-suggest my "fdig" command idea, that being that it would flood out from the cursor position and designate any of a specific stone type to be mined.  Primarily for mining out layer stone for steelworks, or somesuch.
Title: Re: DFHack 0.34.06 r3
Post by: robertheinrich on March 30, 2012, 09:43:10 am
Also going to re-suggest my "fdig" command idea, that being that it would flood out from the cursor position and designate any of a specific stone type to be mined.  Primarily for mining out layer stone for steelworks, or somesuch.
Already finished. But with DF 34.07 out you´ll need a new version of dfhack anyways. Or would it make sense to offer a plugin which would only run on 34.06?

On another topic: In which way would you like macro-managing pastures improved? I decided to look into that.
Title: Re: DFHack 0.34.06 r3
Post by: Kogut on March 30, 2012, 09:48:02 am
Autoassign animals to the same pasture as a mother.
Title: Re: DFHack 0.34.06 r3
Post by: starvingpoet on March 30, 2012, 09:51:20 am
autobutcher when animal counts reach user set criteria - 1M 5F, etc.
Title: Re: DFHack 0.34.06 r3
Post by: Girlinhat on March 30, 2012, 10:10:37 am
Enter zone mode with the "i" key.  Hover over a zone and type "pasture ALPACA:MALE 3".  That will then assign 3 male alpaca to the zone.  Similarly elsewhere, "pasture ALPACA:FEMALE 10" would put 10 female alpaca into a different pasture.  A command for "pasture butcher ALPACA:MALE 3" would attempt to keep 3 fully grown male alpaca available, butchering the oldest first to curb population.

The gender token would be optional.  "pasture DOG 1" would be used to keep a guard animal stocked in the watchposts at all times.

Two warning might be needed.  The first would be in case there's no animal, such as if you've run out of dogs to stock the watchposts.  The second would be if there are unpastured animals of the same species.  Like, if you've got free-range alpaca running about it might let you know that you might want to change your butcher criteria.
Title: Re: DFHack 0.34.06 r3
Post by: ag on March 30, 2012, 10:54:03 am
The new 0.34.07 release appears to be close enough to the previous one that things should work with this replacement file:

https://github.com/angavrilov/df-structures/raw/31e91326eb01e002f525cb48bba1cda0dab68977/symbols.xml (https://github.com/angavrilov/df-structures/raw/31e91326eb01e002f525cb48bba1cda0dab68977/symbols.xml)

Disclaimer: unofficial and untested; official release probably in a few hours from now.
Title: Re: DFHack 0.34.06 r3
Post by: Garath on March 30, 2012, 10:58:23 am
Alright, I think I have set up workflow for trousers (pants) and shoes to always keep around 20 ready. I assume it doesn't count damaged items? But I can't find the word to also make shirts, which is kind of too bad. Any hints?
Title: Re: DFHack 0.34.06 r3
Post by: Rose on March 30, 2012, 11:08:12 am
They're armor.

If you turn on debug mode in stonesense, you can see what all the items are called that are on the floor.
Title: Re: DFHack 0.34.06 r3
Post by: Garath on March 30, 2012, 11:18:16 am
Ah, never knew that.
Title: Re: DFHack 0.34.06 r3
Post by: lukesleftleg on March 30, 2012, 11:24:42 am
On another topic: In which way would you like macro-managing pastures improved? I decided to look into that.

Well pretty much what Girlinhat said really, but I'd be happy to just be able to point to a pasture and say "stick all the cows in there" rather than having to do it manually whenever I'm reminded to do so by the "stray cow (tame) has starved to death" spam.

Thanks very much indeed for looking into it, and thanks very much to all the DFhack team for all your hard work.

The other plugin idea I had was to do with the trading screen. It would be really nice to have something where I could just say "mark all the seeds for buying" rather than having to sort through all the bags of sand and empty boxes that I don't need.
Title: Re: DFHack 0.34.06 r3
Post by: Garath on March 30, 2012, 11:36:36 am
how about mark all crafts for selling? and clothing (the worn ones get left over and dumped on the elves. I tend to sell quivers too even if I don't want to because they go in the same bins. and more of that fun stuff.

a quistion I can't find an answer to... Does the workflow also count damaged items? having 100 pants of one type or another available is no use if they're all damaged
Title: Re: DFHack 0.34.06 r3
Post by: lukesleftleg on March 30, 2012, 11:41:30 am
how about mark all crafts for selling? and clothing (the worn ones get left over and dumped on the elves. I tend to sell quivers too even if I don't want to because they go in the same bins. and more of that fun stuff.

That would be very cool too.
Anything to reduce the potential for RSI. :)
Title: Re: DFHack 0.34.06 r3
Post by: WillowLuman on March 30, 2012, 11:46:01 am
Damn, release just after DFhack update! Oh well, I can wait.
Title: Re: DFHack 0.34.06 r3
Post by: ZCM on March 30, 2012, 11:59:18 am
Ok, the new autolabor utility is kind of neat, but I have a few suggestions:

It keep disabling my legendary miners and enabling mining on dwarves with no skill, causing slower mining and loss of material. I suggest that there be a level threshold (either hard coded, or configurable) where it does not disable a labor. For instance, never disable labors if the skill is level is 10 or higher.

Since miners and woodcutters both require particular equipment, it might also be nice to be able to exclude those labors from autolabor entirely, but still have it manage all other labors.

Author of autolabor here. If it's disabling mining on legendary miners, it's probably because they're asleep or eating or similar. It would make sense to keep it enabled so they immediately return to mining when they're done.

Letting you configure how it handles individual labors is on my todo list.
Title: Re: DFHack 0.34.06 r3
Post by: telarin on March 30, 2012, 12:34:44 pm
Ok, the new autolabor utility is kind of neat, but I have a few suggestions:

It keep disabling my legendary miners and enabling mining on dwarves with no skill, causing slower mining and loss of material. I suggest that there be a level threshold (either hard coded, or configurable) where it does not disable a labor. For instance, never disable labors if the skill is level is 10 or higher.

Since miners and woodcutters both require particular equipment, it might also be nice to be able to exclude those labors from autolabor entirely, but still have it manage all other labors.

Author of autolabor here. If it's disabling mining on legendary miners, it's probably because they're asleep or eating or similar. It would make sense to keep it enabled so they immediately return to mining when they're done.

Letting you configure how it handles individual labors is on my todo list.

Awesome, thanks. Other than those couple of little issues, I really like the tool. Means I spend more time playing DF and planning projects and less time micro-managing labors in Dwarf Therapist.
Title: Re: DFHack 0.34.06 r3
Post by: miauw62 on March 30, 2012, 01:25:38 pm
Cant wait to test out autolabor, but goddamn, damn yu df updates!
Anyway, lets gen a new world while waiting for dfhack to update!
I adbandond because my carpenter was convinced that at the bottom of the waterfall was a awesome place to be.
NOTE: I accidently embarked on that waterfall, lol, i guess im lucky. or unlucky.
Great job again, i cant do without autodump, else my food stockpile will only be ready for use after 10 years.
Title: Re: DFHack 0.34.06 r3
Post by: Rose on March 30, 2012, 01:27:51 pm
/me is using autolabor in the new version and is enjoying it.
Title: Re: DFHack 0.34.06 r3
Post by: dreiche2 on March 30, 2012, 02:35:49 pm
Okay so for someone who can't actually play right now (me), what is autolabor actually doing? I don't think I've seen much info pop up anywhere.
Title: Re: DFHack 0.34.06 r3
Post by: toasteur on March 30, 2012, 02:45:26 pm
Okay so for someone who can't actually play right now (me), what is autolabor actually doing? I don't think I've seen much info pop up anywhere.

direct copy from the source code:
When enabled, autolabor periodically checks your dwarves and enables or
 disables labors. It tries to keep as many dwarves as possible busy but
 also tries to have dwarves specialize in specific skills.
 Warning: autolabor will override any manual changes you make to labors
 while it is enabled.
Title: Re: DFHack 0.34.06 r3
Post by: Captain Crazy on March 30, 2012, 02:55:15 pm
DFusion is back? I happy. I so very-est happy.
Title: Re: DFHack 0.34.06 r3
Post by: ZCM on March 30, 2012, 02:55:57 pm
Okay so for someone who can't actually play right now (me), what is autolabor actually doing? I don't think I've seen much info pop up anywhere.
It checks all your dwarfs every second or so and enables/disables labors based on their skills and what they're doing. The actual logic is complicated, but it essentially tries to keep every dwarf busy while still specializing your dwarfs in what they're skilled at.
Title: Re: DFHack 0.34.06 r3
Post by: dreiche2 on March 30, 2012, 03:28:51 pm
Mhm okay thanks, I think I get the idea. I guess the next question then would be, is it 'cheating' in any way or is just making things very efficient within the rules of the game?
Title: Re: DFHack 0.34.06 r3
Post by: ZCM on March 30, 2012, 03:31:17 pm
Mhm okay thanks, I think I get the idea. I guess the next question then would be, is it 'cheating' in any way or is just making things very efficient within the rules of the game?

It doesn't cheat at all, it just sets labors.
Title: Re: DFHack 0.34.06 r3
Post by: EmperorJon on March 30, 2012, 03:31:44 pm
It's just the equivalent of you reassigning all your dwarves' jobs the moment they finish one to make them do whatever job needs doing that they're still good at, AFAIK. So it's not "cheating" in terms of something impossible to do manually, but it is in terms of you never would do it manually... ;P
Title: Re: DFHack 0.34.06 r3
Post by: dreiche2 on March 30, 2012, 03:41:54 pm
Yeah okay thanks, I was just wondering. Sounds cool!
Title: Re: DFHack 0.34.06 r3
Post by: Garath on March 30, 2012, 03:45:58 pm
so, when you have a lot of masonry work to be done it looks for the most likely targets (eg, idlers)?
Title: Re: DFHack 0.34.06 r3
Post by: ZCM on March 30, 2012, 03:55:07 pm
so, when you have a lot of masonry work to be done it looks for the most likely targets (eg, idlers)?

Yes.
Title: Re: DFHack 0.34.06 r3
Post by: Garath on March 30, 2012, 03:57:07 pm
sounds cool, but I wouldn't want it to select miners for me.
Title: Re: DFHack 0.34.06 r3
Post by: Rose on March 30, 2012, 03:58:54 pm
sounds cool, but I wouldn't want it to select miners for me.

I thought so too, but then it gave me more miners than I realized I could support. but yes, some options would be good.
Title: Re: DFHack 0.34.06 r3
Post by: robertheinrich on March 30, 2012, 04:14:53 pm
Autolabor is great but need some more tweaks, especially when job items (picks, axes, xbows) are involved (assigning 2 miners when you only have 1 pick doesn't make much sense, for example). Feel free to make suggestions how to improve it.
Title: Re: DFHack 0.34.06 r3
Post by: Garath on March 30, 2012, 04:37:27 pm
suggestion 1. an option to limit the people assigned any labor. 2. excluding some labors. 3: excluding some people


on another note... I like idlers. My fort is very secure, so far. but my pop cap is at 60, and I just got to 78 including kids and babies, still no sieges.


so what I'm missing here is a link to autolabor and a list of its features.
Title: Re: DFHack 0.34.06 r3
Post by: Kogut on March 30, 2012, 04:55:12 pm
I think that it may be a good idea to remove fixwagons plugin as Toady ported this to DF.
Title: Re: DFHack 0.34.06 r3
Post by: the_game_hunt on March 30, 2012, 05:30:20 pm
Im not telling you to realease the update but, will it take, like the other time, a week or so? or just a day like other updates?
Title: Re: DFHack 0.34.06 r3
Post by: Rose on March 30, 2012, 05:31:52 pm
probably under an hour.
Title: Re: DFHack 0.34.06 r3
Post by: the_game_hunt on March 30, 2012, 05:34:11 pm
probably under an hour.

OH SWEET!

Playing DF without DFhacks is HORRIBLE. Blood here, blood there,digging incomplete veins, 100 broken buckets...

EDIT: thx for VERY fast reply

EDIT 2: Complete off-topic:

Why your avatar changes every 10 minutes?
Title: Re: DFHack 0.34.07 r1
Post by: peterix on March 30, 2012, 06:45:05 pm
Alright guys, another day, another release ;)

Not much changed between the last one and this one, so there's not much to report. Both 0.34.06 and 0.34.07 are supported this time.

Enjoy
Title: Re: DFHack 0.34.07 r1
Post by: the_game_hunt on March 30, 2012, 06:57:51 pm
Alright guys, another day, another release ;)

Not much changed between the last one and this one, so there's not much to report. Both 0.34.06 and 0.34.07 are supported this time.

Enjoy

THX very much!!!
Title: Re: DFHack 0.34.07 r1
Post by: lukesleftleg on March 30, 2012, 08:14:02 pm
Alright guys, another day, another release ;)

Thanks very much indeed for a very speedy update.

Time to start a new fortress methinks.
Title: Re: DFHack 0.34.07 r1
Post by: telamon on March 30, 2012, 08:14:22 pm
Quote
EDIT 2: Complete off-topic:

Why your avatar changes every 10 minutes?

bet it's on a rotator of some kind, something like this (http://rotasig.com/rotasig30/) or this (http://sig.grumpybumpers.com/) (i'm not japa, but i'm just throwing it out there because I've seen similar things before)
Title: Re: DFHack 0.34.07 r1
Post by: Haelfix on March 30, 2012, 09:35:48 pm
Is there any work being done on migrating DFHacks new format into the old .xml format so that Runesmith can be updated?
Title: Re: DFHack 0.34.07 r1
Post by: starvingpoet on March 30, 2012, 09:46:08 pm
Is there any work being done on migrating DFHacks new format into the old .xml format so that Runesmith can be updated?

IIRC Author of Runesmith said he'd update - just after he finishes his dissertation - be a couple weeks.
Title: Re: DFHack 0.34.07 r1
Post by: chessepuff on March 30, 2012, 11:27:22 pm
I'm intrigued by autolabor and would like to try it but I am wondering whether it will restore the labor settings i had before i turned it on when i turn it off documentation on the plugin is non existent and not even the comments in the code say anything about this
Title: Re: DFHack 0.34.07 r1
Post by: ZCM on March 30, 2012, 11:58:08 pm
I'm intrigued by autolabor and would like to try it but I am wondering whether it will restore the labor settings i had before i turned it on when i turn it off documentation on the plugin is non existent and not even the comments in the code say anything about this
No, it won't. It will screw up all your labor settings and not put them back.
Title: Re: DFHack 0.34.07 r1
Post by: tahujdt on March 31, 2012, 12:18:49 am
Tahujdt is ecstatic. He has enjoyed turning a mountain into candy lately. He has enjoyed embarking as antmen lately. He has been frustrated by an attempt to update Masterwork mod to 34.06 which resulted in Nail walls with clusters of polymorph spell lately. He has admired own fine Monitor lately. He has been amused by the updating of dfhack right as .07 came out lately.
Title: Re: DFHack 0.34.07 r1
Post by: WillowLuman on March 31, 2012, 12:34:20 am
Tahujdt is ecstatic. He has enjoyed turning a mountain into candy lately. He has enjoyed embarking as antmen lately. He has been frustrated by an attempt to update Masterwork mod to 34.06 which resulted in Nail walls with clusters of polymorph spell lately. He has admired own fine Monitor lately. He has been amused by the updating of dfhack right as .07 came out lately.

How'd you get DFusion to work?
Title: Re: DFHack 0.34.07 r1
Post by: HammerDave on March 31, 2012, 12:35:13 am
Alright guys, another day, another release ;)

Not much changed between the last one and this one, so there's not much to report. Both 0.34.06 and 0.34.07 are supported this time.

Enjoy
HammerDave was ecstatic to make a new acquisition!   8)
Title: Re: DFHack 0.34.06 r3
Post by: Kogut on March 31, 2012, 12:38:16 am
I think that it may be a good idea to remove fixwagons plugin as Toady ported this to DF.
Title: Re: DFHack 0.34.07 r1
Post by: chessepuff on March 31, 2012, 01:10:19 am
I'm intrigued by autolabor and would like to try it but I am wondering whether it will restore the labor settings i had before i turned it on when i turn it off documentation on the plugin is non existent and not even the comments in the code say anything about this
No, it won't. It will screw up all your labor settings and not put them back.
Thanks thats what i kinda figured i spent to much time with dgc to do that ah well maybe in a future release
Title: Re: DFHack 0.34.07 r1
Post by: Intrinsic on March 31, 2012, 01:12:16 am
I notice DFHack is now openning TCP port 5000 for access?
Title: Re: DFHack 0.34.07 r1
Post by: Rose on March 31, 2012, 01:22:05 am
I notice DFHack is now openning TCP port 5000 for access?

Yes, this is so that you can run commands to DF.

DF-Run is an example of this.
Title: Re: DFHack 0.34.07 r1
Post by: HammerDave on March 31, 2012, 01:29:03 am
A minor request:

In workflow, the dark blue text for suspended jobs is next to impossible to read on a standard black background.  For all plugin developers, please set it up so that all colors are on the same side of the light/dark spectrum, ie don't mix white with extremely dark colors.

The good news is, it suspended my brew tasks just like it should.  Now we'll see if they wake up again after the next cycle of binge drinking.   8)
Title: Re: DFHack 0.34.07 r1
Post by: tahujdt on March 31, 2012, 01:31:17 am
@HugoLuman: it was included in the .06 update.
Title: Re: DFHack 0.34.07 r1
Post by: WillowLuman on March 31, 2012, 01:51:39 am
@HugoLuman: it was included in the .06 update.
Yeah, but it crashes the game when I attempt to use it
Title: Re: DFHack 0.34.07 r1
Post by: Intrinsic on March 31, 2012, 05:37:20 am
I notice DFHack is now openning TCP port 5000 for access?

Yes, this is so that you can run commands to DF.

DF-Run is an example of this.

Guessed as much, ta.
Title: Re: DFHack 0.34.07 r1
Post by: LoSboccacc on March 31, 2012, 12:00:24 pm
may be dfhack related, may be not: while abandoning the fortress, dwarf fortress crashed.

at that time I had the map revealed, the workflow plugin on controlling food and drinks with count limit; food suspended because no material, drink suspended because requirements met, then smelt magnetite on repeat but suspended.

I did enable autolabor for a while, but then I had disabled it; then fixed labor with dwarf therapist.
Title: Re: DFHack 0.34.07 r1
Post by: Girlinhat on March 31, 2012, 12:30:15 pm
That sounds like DF is trying to tell you something.

Your fort isn't done yet.  It won't let you leave.
Title: Re: DFHack 0.34.07 r1
Post by: LoSboccacc on March 31, 2012, 01:01:02 pm
probably, I just ragequitted because some urist thrown himself into a pond and drowned despsite the ramps
Title: Re: DFHack 0.34.07 r1
Post by: ag on March 31, 2012, 01:45:42 pm
may be dfhack related, may be not: while abandoning the fortress, dwarf fortress crashed.

Thanks for a 100% predictably reproducible crash report - it was a recently introduced bug in a function for printing error messages. Workflow was trying to print a completely innocent error message, but the output utility function crashed.

Plus, of course, the world unload event heuristic has to be changed to work correctly during abandon, to avoid even those benign errors.
Title: Re: DFHack 0.34.07 r1
Post by: LoSboccacc on March 31, 2012, 01:49:46 pm
well, thanks to you all for this terrific utility  :P
Title: Re: DFHack 0.34.07 r1
Post by: Klegg on March 31, 2012, 02:57:32 pm
Not sure what is up with my DF, I keep getting the 'Not a known version of DF' error, despite a try at a fresh install. I have the latest DF, Phoebus and DFhack freshly downloaded and installed. The stderr.log is telling me
Spoiler (click to show/hide)
:-\
Title: Re: DFHack 0.34.07 r1
Post by: Quietust on March 31, 2012, 06:00:52 pm
Not sure what is up with my DF, I keep getting the 'Not a known version of DF' error, despite a try at a fresh install. I have the latest DF, Phoebus and DFhack freshly downloaded and installed.

What version of DFHack did you install (the name of the ZIP file), and what version of DF are you running (on the titlescreen)? If they are not both 0.34.06 or 0.34.07, then that's the problem.
Title: Re: DFHack 0.34.07 r1
Post by: Klegg on March 31, 2012, 06:09:28 pm
Both are v0.34.07.

I even tried a fresh install and it's giving me the error.

Zip names are df_34_07_win.zip and dfhack-0.34.07-r1-Windows.zip.
Title: Re: DFHack 0.34.07 r1
Post by: Rumrusher on March 31, 2012, 07:05:05 pm
Both are v0.34.07.

I even tried a fresh install and it's giving me the error.

Zip names are df_34_07_win.zip and dfhack-0.34.07-r1-Windows.zip.
SDL?
Title: Re: DFHack 0.34.07 r1
Post by: Quietust on March 31, 2012, 07:11:31 pm
Both are v0.34.07.

I even tried a fresh install and it's giving me the error.

Zip names are df_34_07_win.zip and dfhack-0.34.07-r1-Windows.zip.
SDL?
If it wasn't SDL, it wouldn't be loading DFHack.
Title: Re: DFHack 0.34.07 r1
Post by: telarin on March 31, 2012, 08:15:46 pm
workflow does not see wax craft jobs for generic CRAFTS orders.
Title: Re: DFHack 0.34.07 r1
Post by: Lord Afabie on March 31, 2012, 09:27:02 pm
Hello, I really like this utility.  I do have a question though.  I've been trying to change all the microline in my embark to something a bit more useful.  Is there a faster way to do this than using changevein on each cluster?
Title: Re: DFHack 0.34.07 r1
Post by: Rumrusher on March 31, 2012, 09:40:05 pm
okay here some stuff to improve adventure mode.
Ghost works by slapping the the xpointer over a creature living or dead(won't bring them back) and flips them into a ghost.
secondwind will revive your adventurer as a ghost allowing you to finish some business or access to possess folks with use of "adv-bodyswap force permanent"
depending on which mods you use you can still use race interactions.
to install these just dump them into the init.lua in the dfusion/tools folder.
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.07 r1
Post by: Vanaheimer on March 31, 2012, 09:46:08 pm
Hello, I really like this utility.  I do have a question though.  I've been trying to change all the microline in my embark to something a bit more useful.  Is there a faster way to do this than using changevein on each cluster?

changelayer I think it is will change a substantially larger clump in to whatever you would like.
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on March 31, 2012, 11:24:40 pm
Hello, I really like this utility.  I do have a question though.  I've been trying to change all the microline in my embark to something a bit more useful.  Is there a faster way to do this than using changevein on each cluster?

changelayer I think it is will change a substantially larger clump in to whatever you would like.
It will, but it will not touch his microcline veins (changelayer ignores veins on purpose). I think maybe adding an option like 'all' to changevein could be nice... which would then change all veins/clusters on the embark which are of the same material under the cursor to the target material.
Title: Re: DFHack 0.34.07 r1
Post by: SammyLiimex on April 01, 2012, 12:52:50 am
Can This work in adventure mode to heal myself or companion?
Title: Re: DFHack 0.34.07 r1
Post by: Rumrusher on April 01, 2012, 02:52:24 am
Can This work in adventure mode to heal myself or companion?
The answer to that is yeah if you know how to write up a dfusion function to repair limb lost.
Title: Re: DFHack 0.34.07 r1
Post by: deltakai on April 01, 2012, 04:03:55 am
well I have a question that I hope it will be resolved. One day I was using DFhack's reveal command to find if there were any useful ores underground but I didn't find any. So I carried on with building my fortress but I forgot to turn off the reveal command and so saved and exited with the reveal command still ON. The next time I went into that world I saw that everything was still revealed and so I went into the DFhack console and typed unreveal but it said 'nothing to revert to!' so then I tried revealing again then unrevealing but nothing happened. So now that world seems to be permanently revealed and its really annoying so can anybody help me on how to fix this problem? :-\

I am using Windows 7
 
Title: Re: DFHack 0.34.07 r1
Post by: deltakai on April 01, 2012, 04:07:02 am
well I have a question that I hope it will be resolved. One day I was using DFhack's reveal command to find if there were any useful ores underground but I didn't find any. So I carried on with building my fortress but I forgot to turn off the reveal command and so saved and exited with the reveal command still ON. The next time I went into that world I saw that everything was still revealed and so I went into the DFhack console and typed unreveal but it said 'nothing to revert to!' so then I tried revealing again then unrevealing but nothing happened. So now that world seems to be permanently revealed and its really annoying so can anybody help me on how to fix this problem? :-\

I am using Windows 7
 
Title: Re: DFHack 0.34.07 r1
Post by: deltakai on April 01, 2012, 04:09:27 am
sorry for the duplicate
well I have a question that I hope it will be resolved. One day I was using DFhack's reveal command to find if there were any useful ores underground but I didn't find any. So I carried on with building my fortress but I forgot to turn off the reveal command and so saved and exited with the reveal command still ON. The next time I went into that world I saw that everything was still revealed and so I went into the DFhack console and typed unreveal but it said 'nothing to revert to!' so then I tried revealing again then unrevealing but nothing happened. So now that world seems to be permanently revealed and its really annoying so can anybody help me on how to fix this problem? :-\

I am using Windows 7
Title: Re: DFHack 0.34.07 r1
Post by: cousac on April 01, 2012, 04:20:05 am
well I have a question that I hope it will be resolved. One day I was using DFhack's reveal command to find if there were any useful ores underground but I didn't find any. So I carried on with building my fortress but I forgot to turn off the reveal command and so saved and exited with the reveal command still ON. The next time I went into that world I saw that everything was still revealed and so I went into the DFhack console and typed unreveal but it said 'nothing to revert to!' so then I tried revealing again then unrevealing but nothing happened. So now that world seems to be permanently revealed and its really annoying so can anybody help me on how to fix this problem? :-\

I am using Windows 7
use revforget
Title: Re: DFHack 0.34.07 r1
Post by: kaijyuu on April 01, 2012, 04:30:45 am
And furthermore, there's an edit button you can use if you accidentally post twice. You can't delete the second post, but you can put your apologies there instead of making a third post :P
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 01, 2012, 05:35:46 am
Actually, revflood is what you need (revforget is for another case where you unreveal map A then exit and load a different map B and reveal/unreveal complains about the map being different). If you load a map which you accidentally saved in revealed state, move the cursor to a 'good' position like your fortress gate and use 'revflood'. It will hide everything then unhide everything which can be reached from the cursor position using a flood fill.
Title: Re: DFHack 0.34.07 r1
Post by: the_game_hunt on April 01, 2012, 08:52:41 am
Err... What happened to regrass? i used so much it.

I miss it  :'(
Title: Re: DFHack 0.34.07 r1
Post by: cousac on April 01, 2012, 02:06:35 pm
Err... What happened to regrass? i used so much it.

I miss it  :'(

I think it was obsoleted Toady's new approach to grass. not sure.
Title: Re: DFHack 0.34.07 r1
Post by: notfood on April 01, 2012, 02:13:01 pm
What's with this error? I'm trying to compile from git.

Code: [Select]
/media/Makai/opt/DwarfFortress/dfhack/plugins/autodump.cpp: In function ‘DFHack::command_result autodump_main(DFHack::color_ostream&, std::vector<std::basic_string<char> >&)’:
/media/Makai/opt/DwarfFortress/dfhack/plugins/autodump.cpp:235:29: error: ‘struct df::item_flags::<anonymous>’ has no member named ‘garbage_collect’
/media/Makai/opt/DwarfFortress/dfhack/plugins/autodump.cpp: In function ‘DFHack::command_result df_autodump_destroy_item(DFHack::color_ostream&, std::vector<std::basic_string<char> >&)’:
/media/Makai/opt/DwarfFortress/dfhack/plugins/autodump.cpp:325:26: error: ‘struct df::item_flags::<anonymous>’ has no member named ‘garbage_collect’
/media/Makai/opt/DwarfFortress/dfhack/plugins/autodump.cpp:333:26: error: ‘struct df::item_flags::<anonymous>’ has no member named ‘garbage_collect’
/media/Makai/opt/DwarfFortress/dfhack/plugins/autodump.cpp:360:22: error: ‘struct df::item_flags::<anonymous>’ has no member named ‘garbage_collect’
make[2]: *** [plugins/CMakeFiles/autodump.dir/autodump.cpp.o] Error 1
make[1]: *** [plugins/CMakeFiles/autodump.dir/all] Error 2

Title: Re: DFHack 0.34.07 r1
Post by: Quietust on April 01, 2012, 02:24:01 pm
What's with this error? I'm trying to compile from git.

Code: [Select]
error: ‘struct df::item_flags::<anonymous>’ has no member named ‘garbage_collect’
Update your submodules.
Title: Re: DFHack 0.34.07 r1
Post by: notfood on April 01, 2012, 02:32:42 pm
Yeah, that did it. Thanks.

So the correct procedure is to update is...

Code: [Select]
git submodule update
git pull
cd build
make
make install
Title: Re: DFHack 0.34.07 r1
Post by: peterix on April 01, 2012, 05:42:52 pm
Err... What happened to regrass? i used so much it.

I miss it  :'(

I think it was obsoleted Toady's new approach to grass. not sure.
Pretty much, yes. It's not entirely out of the question to bring it back, but it would have to do different things than before.
Title: Re: DFHack 0.34.07 r1
Post by: telamon on April 01, 2012, 06:54:53 pm
Quote
well I have a question that I hope it will be resolved. One day I was using DFhack's reveal command to find if there were any useful ores underground but I didn't find any. So I carried on with building my fortress but I forgot to turn off the reveal command and so saved and exited with the reveal command still ON. The next time I went into that world I saw that everything was still revealed and so I went into the DFhack console and typed unreveal but it said 'nothing to revert to!' so then I tried revealing again then unrevealing but nothing happened. So now that world seems to be permanently revealed and its really annoying so can anybody help me on how to fix this problem? :-\

I am using Windows 7

dfhack remembers the squares that were already visible before revealing, when you use reveal. then when you use unreveal, it looks at the squares it memorized, and hides them all. when you exited df, dfhack was closed, and the data that memorized which squares were revealed was lost. as a result, dfhack no longer has any idea which squares were and were not revealed, so if you try to unreveal it has no data to refer to and nothing will happen. lesson: do not leave the map revealed for prolonged periods of time

as robertheinrich mentioned, revflood will probably fix the problem. it hides the entire map, and then floods from the cursor outwards and reveals every square it can access.
Title: Re: DFHack 0.34.07 r1
Post by: kingubu on April 02, 2012, 05:43:26 am
Is it possible to run dfhack without having it take over the console window (linux)?

I ask because I want to play over ssh using [PRINT_MODE:TEXT] and dfhack taking over the window makes that impossible, as far as I can tell.
Title: Re: DFHack 0.34.07 r1
Post by: peterix on April 02, 2012, 06:15:17 am
Is it possible to run dfhack without having it take over the console window (linux)?

I ask because I want to play over ssh using [PRINT_MODE:TEXT] and dfhack taking over the window makes that impossible, as far as I can tell.
If it takes over the terminal in TEXT mode, then that's a bug. Does it?
Title: Re: DFHack 0.34.07 r1
Post by: kingubu on April 02, 2012, 07:07:03 am
If it takes over the terminal in TEXT mode, then that's a bug. Does it?

Yes, all I get in the console when I run ./dfhack is "DFHack is ready.  Have a nice day!" etc.

I can hear the game running the opening movies and the menu music.  Can't see the opening menu.
Title: Re: DFHack 0.34.07 r1
Post by: martinuzz on April 02, 2012, 02:37:44 pm
I can't remember if I ever said thanks, for making this great tool.

So... Thanks!
Title: Re: DFHack 0.34.07 r1
Post by: BigFatStupidHead on April 02, 2012, 03:08:54 pm
I think autolabor is assigning labours to active military dwarves. This might be a problem in fortresses with an extremely large proportion of active military to civilians, where most of the civilians have been auto assigned to tasks such as mining while hauling tasks need to be done. (My current fort matches this description; there is a large excavation occuring and noone is assigned hauling to take food from the depot, or dump the rotten food in the depot. The military has had hauling labours auto assigned to them.)
Title: Re: DFHack 0.34.07 r1
Post by: shadus on April 02, 2012, 05:57:30 pm
I have a few points of feedback on autolabor as well:
1) should be an option for medical tasks being changeable, it keeps switching on and off medical tasks on my medical dwarves (especially my chief medical dorf)... this is "really bad(tm)".
2) some tasks are never getting done... ever because of how rapidly it changes tasks, seems to be primarily an issue with tasks that require specialized tools, specifically woodcutting in my case.  I've had a tree for 3 seasons marked to be cut and it wasn't done.  a single tree on the entire map (was in the way of a wall.) I often see someone assigned to wood cutting but it never gets cut.  I finally said screw it and turned off autolabor and assigned everyone to woodcutting and it was cut in 5s. then turned autolabor back on.
3) it's assigning ~way~ more miners than i have it set for (5)... currently has 9 assigned to mining.
4) needs to be a way to exclude certain people from being messed with period... like my broker... and chief med dorf.
5) needs to be an option to exclude military dwarves from active labors... not an issue with current fort but will be with larger one when i separate civvies from military entirely.
6) weighting for certain jobs needs adjusted... gemcutting, gemsetting, architecture, etc... i really only EVER want ONE dwarf doing them for the most part because they take so much work to raise, yes... i have a job queued for cutting stones but that doesn't mean its not better to wait for the skilled dwarf to go off break.
7) with changes to animal training my dogs don't seem to be getting trained because of rapid job changing.
Really neat program though!  Hope it sees a lot more development!


Title: Re: DFHack 0.34.07 r1
Post by: quintilius on April 02, 2012, 06:14:46 pm
thanking whoever was responsible for tweak clear ghostly... toady's 07 ghost fix did not fix caravan guards, and this is the only way to clear them.
So far - i havent had any weird issues like them returning etc (i've had to clear 2 so far) - so this tweak has been the only reason i've continued my current fort
Title: Re: DFHack 0.34.07 r1
Post by: telamon on April 02, 2012, 09:16:02 pm
quick question - DFhack has no way to edit the stagnant flag on a given tile, does it? I checked tiletypes but it doesn't seem to be one of the special painting options. stupid stagnant water.... the last time I played a fortress through to the stage of building an advanced well, it was way back in early 0.31.xx where this crazy stagnation plague wasn't in effect >_>
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 03, 2012, 12:03:47 am
You can use the liquids tool to clear the stagnation flag. (probably also tiletypes as well)
Title: Re: DFHack 0.34.07 r1
Post by: telamon on April 03, 2012, 12:15:52 am
Ahh, so that's where wclean was! I thought it was its own command; I was accustomed to the liquids commands from 0.31.xx so I didn't know there were new ones. Thanks!
Title: Re: DFHack 0.34.07 r1
Post by: Alkhemia on April 03, 2012, 12:25:20 am
Is there a fix for embark anywhere with Dfusion it just crashes DF when I use it?
Title: Re: DFHack 0.34.07 r1
Post by: BigFatStupidHead on April 03, 2012, 12:34:48 am
I have also found running prospect on the embark map several times causes the dfhack window to become very slow until after I restart DF.
Title: Re: DFHack 0.34.07 r1
Post by: Rumrusher on April 03, 2012, 12:47:03 am
Is there a fix for embark anywhere with Dfusion it just crashes DF when I use it?
you could use the original non dfhack dfusion for 34.xx still works if you just use embark anywhere.
Title: Re: DFHack 0.34.07 r1
Post by: bigstuuu on April 03, 2012, 12:18:53 pm
When I try and run DFHack 0.34.04 on ubuntu 11.10 i'll get:

Code: [Select]
ERROR: ld.so: object './hack/libdfhack.so' from LD_PRELOAD cannot be preloaded: ignored.
Sound devices available:
PulseAudio Default
ALSA Default
No Output
Picking PulseAudio Default. If your desired device was missing, make sure you have the appropriate 32-bit libraries installed. If you wanted a different device, configure ~/.openalrc appropriately.
Perfect OpenAL context attributes GET
Loading bindings from data/init/interface.txt
New window size: 640x300
Font size: 8x12
Resizing grid to 80x25
Resizing font to 8x12
Picked font at 9 points for ceiling 12

Resetting textures
^CResizing font to 8x12
Picked font at 9 points for ceiling 12

and it will never get to the 'Welcome to DFHack' stage. Dwarf Fortress itself will load up normally. Anyone got any ideas whats going on?

Title: Re: DFHack 0.34.07 r1
Post by: peterix on April 03, 2012, 01:26:59 pm
When I try and run DFHack 0.34.04 on ubuntu 11.10 i'll get:
...
Is there anything in stderr.log?
Title: Re: DFHack 0.34.07 r1
Post by: bigstuuu on April 03, 2012, 02:52:19 pm
When I try and run DFHack 0.34.04 on ubuntu 11.10 i'll get:
...
Is there anything in stderr.log?

stderr.log contains the following, after booting DF and loading a game:

Code: [Select]
dfhack: hooking successful
Identifying DF version.
Loading hack/symbols.xml ... OK
Dummy symbol table entry: announcements
Dummy symbol table entry: announcements
Loaded 4 DF symbol tables.
Unable to retrieve version information.
File: /proc/self/exe
MD5: f4fc83475f9fdaa645f3217c57458235
working dir: /home/stu/desura/common/dwarf-fortress
length:14104364
1KB hexdump follows:

Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 03, 2012, 03:13:36 pm
thanking whoever was responsible for tweak clear ghostly... toady's 07 ghost fix did not fix caravan guards, and this is the only way to clear them.
So far - i havent had any weird issues like them returning etc (i've had to clear 2 so far) - so this tweak has been the only reason i've continued my current fort

Glad the tweak helped you and please report back if anything weird happens in your fort in the future (I kinda suspected ghosts coming back etc, cool that they don't). And please report your problem with the deceased caravan guard(s) on Mantis because not everybody uses dfhack and it seems Toady missed to fix that special issue.
Title: Re: DFHack 0.34.07 r1
Post by: peterix on April 03, 2012, 04:48:39 pm
stderr.log contains the following, after booting DF and loading a game:

Code: [Select]
dfhack: hooking successful
Identifying DF version.
Loading hack/symbols.xml ... OK
Dummy symbol table entry: announcements
Dummy symbol table entry: announcements
Loaded 4 DF symbol tables.
Unable to retrieve version information.
File: /proc/self/exe
MD5: f4fc83475f9fdaa645f3217c57458235
working dir: /home/stu/desura/common/dwarf-fortress
length:14104364
1KB hexdump follows:

OK.
There are two options:
1) You are trying to use a DF version that isn't supported by that version of DFHack
2) The DF binary has been tampered with. Could be a packaging thing done by desura.

Anyway, you can tweak your symbols.xml file and add a line like this to the appropriate section:
Code: [Select]
<md5-hash value='f4fc83475f9fdaa645f3217c57458235'/>
Title: Re: DFHack 0.34.07 r1
Post by: Alkhemia on April 04, 2012, 06:16:55 pm
Is there a fix for embark anywhere with Dfusion it just crashes DF when I use it?
you could use the original non dfhack dfusion for 34.xx still works if you just use embark anywhere.
Thanks Rum.
Title: Re: DFHack 0.34.07 r1
Post by: WillowLuman on April 04, 2012, 06:50:32 pm
There a fix for those weird squares of ice that randomly appear in arctic oceans?
Title: Re: DFHack 0.34.06 r3
Post by: uncivlengr on April 04, 2012, 08:43:14 pm
I believe I've found the problem and have a fix for it - when I updated revflood to see through constructions and ice, I accidentally changed the way conflicting veins are handled from "last wins" to "first wins".
Hi there,

I've been frustrated as hell trying to figure out why revflood doesn't work properly anymore, came to check the forums, and apparently this is why.

Is there any way that you could add an option to not see through constructions, or at least walls?  The only reason I ever use revflood is to mine out a vein, wall it off, and then hide the tiles behind the wall, and that's how I know a lot of people use it.  That functionality is lost in the latest version.
Title: Re: DFHack 0.34.07 r1
Post by: Quietust on April 04, 2012, 10:15:27 pm
The way it's currently done, disabling that behavior would also cause it to not properly reveal the walls of frozen rivers/ponds. It could also cause some rather odd problems upon removing said constructions, unless that's properly handled by the "cavern exploration" behavior added in v0.31.01.

For the time being, you could accomplish the same behavior by using tiletypes to paint a real wall in the spots you want to seal off.
Title: Running DFHack
Post by: Drecker on April 07, 2012, 12:33:01 pm
Hi,
I have a simly question: where I should write DFHacks commands (I have linux)? I tried it write commands to console where i ran dfhack but no respons. BTW when I tried to use dfhack-run it says:
Could not connect to localhost: 5000
Title: Re: DFHack 0.34.07 r1
Post by: nukularpower on April 07, 2012, 01:25:35 pm
Not sure if there is a good place for suggestions for DFHack (or if you guys take suggestions at all) but going to try anyways.  Reading Toady's recent blog posts about flying minecarts and possible future parabolic projectiles got me thinking: Would there be any way to say, put the cursor over a unit/item, enter a command like "lock" into the DFHack console, and then have the camera automatically follow that item?  IE recentering on it every time it moves a tile or something.  If you've ever tried tracking a moving animal in a hilly embark, you can imagine why I would want something like this, but it would also be neat for tracking flying minecarts and collapsing structures, among other things.  Plus, it would look cool :)

Thanks for all the work on this awesome tool!
Title: Re: DFHack 0.34.07 r1
Post by: kingubu on April 07, 2012, 01:32:17 pm
Hi,
I have a simly question: where I should write DFHacks commands (I have linux)? I tried it write commands to console where i ran dfhack but no respons. BTW when I tried to use dfhack-run it says:
Could not connect to localhost: 5000

Run the "dfhack" script.  "dfhack-run" from another window will interface with a running dfhack process.  So you can outout "prospect all" to a text file or something.
Not sure if there is a good place for suggestions for DFHack (or if you guys take suggestions at all) but going to try anyways.  Reading Toady's recent blog posts about flying minecarts and possible future parabolic projectiles got me thinking: Would there be any way to say, put the cursor over a unit/item, enter a command like "lock" into the DFHack console, and then have the camera automatically follow that item?  IE recentering on it every time it moves a tile or something.  If you've ever tried tracking a moving animal in a hilly embark, you can imagine why I would want something like this, but it would also be neat for tracking flying minecarts and collapsing structures, among other things.  Plus, it would look cool :)

Thanks for all the work on this awesome tool!

You're lucky, there's already a command for that.  "follow"  It works on units.  I'm guessing it will work on carts.  We'll find out.  Structures I don't know about.  I have used it to track animals I'm pitting.  Fun to watch them fly and splat. :)
Title: Re: DFHack 0.34.07 r1
Post by: nukularpower on April 07, 2012, 01:38:23 pm
Oh my.  How did I miss that?  Thanks a lot.
Title: Re: DFHack 0.34.07 r1
Post by: Drecker on April 07, 2012, 01:56:27 pm
Hi,
I have a simly question: where I should write DFHacks commands (I have linux)? I tried it write commands to console where i ran dfhack but no respons. BTW when I tried to use dfhack-run it says:
Could not connect to localhost: 5000
Run the "dfhack" script.  "dfhack-run" from another window will interface with a running dfhack process.  So you can outout "prospect all" to a text file or something.

I have ran "dfhack" - and I have no idea, where I should wride DFH commands - when I write any command to console where I launched "dfhack" it has no response.
And when I launch "dfhack" and in another console I launch "dfhack-ran prospect all" it will write that about localhost...
Title: Re: DFHack 0.34.07 r1
Post by: kingubu on April 07, 2012, 02:18:04 pm
Ah, I understand.

When you run dfhack it should print in the console first thing:
Code: [Select]
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]#

If you don't see that, Something is Wrong TM  I guess I would try reinstalling at that point, making sure my versions match, df and dfhack.
Title: Re: DFHack 0.34.07 r1
Post by: peterix on April 07, 2012, 02:27:47 pm
I have ran "dfhack" - and I have no idea, where I should wride DFH commands - when I write any command to console where I launched "dfhack" it has no response.
And when I launch "dfhack" and in another console I launch "dfhack-ran prospect all" it will write that about localhost...
Check if you have a file named stderr.log in your DF and if yes, post the contents.
Title: Re: DFHack 0.34.07 r1
Post by: Zabo on April 07, 2012, 02:59:19 pm
Hey
Is there a way to hide map again when i saved my game with revealed map?
Title: Re: DFHack 0.34.07 r1
Post by: Quietust on April 07, 2012, 03:11:14 pm
Hey
Is there a way to hide map again when i saved my game with revealed map?

This has probably been asked several dozen times within this thread (and other threads), but I'll answer it again:

1. Use "revflood".
2. Next time, don't save a revealed map.
Title: Re: DFHack 0.34.07 r1
Post by: Drecker on April 07, 2012, 03:16:26 pm
Ah, I understand.

When you run dfhack it should print in the console first thing:
Code: [Select]
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]#

If you don't see that, Something is Wrong TM  I guess I would try reinstalling at that point, making sure my versions match, df and dfhack.

OK, I'm idiot, I somehow missed latest version of DF. Now it seems worked.
Title: Re: DFHack 0.34.07 r1
Post by: Rose on April 07, 2012, 03:22:11 pm
Hey
Is there a way to hide map again when i saved my game with revealed map?

This has probably been asked several dozen times within this thread (and other threads), but I'll answer it again:

1. Use "revflood".
2. Next time, don't save a revealed map.

This bears repeating.

don't save a revealed map.
Title: Re: DFHack 0.34.07 r1
Post by: cousac on April 07, 2012, 09:37:51 pm
This bears repeating.

don't save a revealed map.

Honestly Japa, This should go in the OP in exactly the way you wrote it.
Title: Re: DFHack 0.34.07 r1
Post by: Girlinhat on April 07, 2012, 10:11:49 pm
Is there a function in DFHack (or DFusion, or whatever) that lets you embark with only one dwarf?  I want to perform a hermit challenge...
Title: Re: DFHack 0.34.07 r1
Post by: tahujdt on April 07, 2012, 10:15:18 pm
According to the devlog, follow is now obsolete.
Title: Re: DFHack 0.34.07 r1
Post by: Girlinhat on April 07, 2012, 10:27:47 pm
Well, it might bear waiting.  DFHack's version may be less CPU/memory intensive than vanilla version, though I suspect vanilla will run inherently smoother.
Title: Re: DFHack 0.34.07 r1
Post by: the_game_hunt on April 07, 2012, 11:59:32 pm
Is there a function in DFHack (or DFusion, or whatever) that lets you embark with only one dwarf?  I want to perform a hermit challenge...

WOW!!!

Nice idea you've got there. I also want this, this I like.
Title: Re: DFHack 0.34.07 r1
Post by: Zwaryczuk on April 08, 2012, 12:25:18 am
Is it just me or is revflood not working anymore. I've used it in previous versions but now its just not working. Reveal and such still work.
Title: Re: DFHack 0.34.07 r1
Post by: kingubu on April 08, 2012, 01:13:15 am
Is there a function in DFHack (or DFusion, or whatever) that lets you embark with only one dwarf?  I want to perform a hermit challenge...

before starting the game

dfusion in the dfhack console
select 1
type 1, enter
start dwarf fort mode
select embark location
embark
crash to desktop

That's what happened to me at least.  You might get lucky.
Title: Re: DFHack 0.34.07 r1
Post by: Warmist on April 08, 2012, 01:48:28 am
unfortunately you need at least 7 starting units.... you can start with 1 dwarf and 6 dogs if you edit "dfusion/embark/races.txt", just type. It should be something like this:
Code: [Select]
DWARF
DOG
DOG
... <4 more times>
Title: Re: DFHack 0.34.07 r1
Post by: Robotic on April 08, 2012, 02:33:59 am
I've been trying to use mode to play adventure mode as one of the dwarves in my embark.  So far I've managed to become a naked mole dog peasant and crash my game by sleeping.  How would I assume control of one of my dwarves?
Title: Re: DFHack 0.34.07 r1
Post by: telamon on April 08, 2012, 02:38:16 am
Erm... how do we use the commands in dfusion? I haven't seen any readmes on it, and when I open up DFhack, I don't get any interactive explanations:

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.07 r1
Post by: kingubu on April 08, 2012, 03:24:33 am
it's looking for the number 1

just press 1 for simple embark.
Title: Re: DFHack 0.34.07 r1
Post by: Girlinhat on April 08, 2012, 09:45:20 am
unfortunately you need at least 7 starting units.... you can start with 1 dwarf and 6 dogs if you edit "dfusion/embark/races.txt", just type. It should be something like this:
Code: [Select]
DWARF
DOG
DOG
... <4 more times>
Mine currently looks like this:
Code: [Select]
ANT_MAN:0
ANT_MAN:0
ANT_MAN:0
ANT_MAN:1
ANT_MAN:1
ANT_MAN:0
ANT_MAN:0
ANT_MAN:2
ANT_MAN:3

So how do I change that to embark me with a dwarf, a few dogs, and a cat or two?
Title: Re: DFHack 0.34.07 r1
Post by: Warmist on April 08, 2012, 09:55:15 am
unfortunately you need at least 7 starting units.... you can start with 1 dwarf and 6 dogs if you edit "dfusion/embark/races.txt", just type. It should be something like this:
Code: [Select]
DWARF
DOG
DOG
... <4 more times>
Mine currently looks like this:
Code: [Select]
ANT_MAN:0
ANT_MAN:0
ANT_MAN:0
ANT_MAN:1
ANT_MAN:1
ANT_MAN:0
ANT_MAN:0
ANT_MAN:2
ANT_MAN:3

So how do I change that to embark me with a dwarf, a few dogs, and a cat or two?
Yeah i should get around writing a normal readme.
Those numbers are 'caste number' So you could choose if you want a female or a male dwarf. If left out it is random.
Quote
DWARF
CAT
CAT
DOG
DOG
DOG
DOG
should work. Use it just before pressing 'e' to embark (in area selection menu).
Title: Re: DFHack 0.34.07 r1
Post by: Girlinhat on April 08, 2012, 09:56:40 am
Use it just before pressing 'e' to embark (in area selection menu).
Use what, exactly?  The "1" or "3" command, because by name, the "Embark | Multi race embark" tool sounds more fitting.
Title: Re: DFHack 0.34.07 r1
Post by: DimmurWyrd on April 08, 2012, 12:34:23 pm
hmmmm, seems someone forgot the executable for the current windows version... only has dfhack-run.exe :/ anyone feel like pm'ing me a copy?
Title: Re: DFHack 0.34.07 r1
Post by: Tapeworm on April 08, 2012, 01:21:26 pm
I'm trying to cut out a 3X7 hallway within a one-layer aquifer without much success; is there a way to do this simply with dfhack?
Title: Re: DFHack 0.34.07 r1
Post by: Warmist on April 08, 2012, 01:40:23 pm
Use it just before pressing 'e' to embark (in area selection menu).
Use what, exactly?  The "1" or "3" command, because by name, the "Embark | Multi race embark" tool sounds more fitting.
Multi race embark.

By saying 'e' i meant in df itself.
Title: Re: DFHack 0.34.07 r1
Post by: telamon on April 08, 2012, 03:31:42 pm
Quote
it's looking for the number 1

just press 1 for simple embark.

..... facepalm.

@tapeworm: try using changelayer on the aquifer, change it to a material that cannot contain an aquifer and see what happens
Title: Re: DFHack 0.34.07 r1
Post by: Girlinhat on April 08, 2012, 04:14:37 pm
Use it just before pressing 'e' to embark (in area selection menu).
Use what, exactly?  The "1" or "3" command, because by name, the "Embark | Multi race embark" tool sounds more fitting.
Multi race embark.

By saying 'e' i meant in df itself.
Code: [Select]
DWARF:1
CAT:2
CAT:2
DOG:1
DOG:1
DOG:2
DOG:2
DF/dfusion/embark/races.txt is as shown above.
Generated a world.
Found an embark.
Open DFHack -> "dfusion" -> 3
Hit "e" to confirm the embark location.
DwarfFortress.exe has stopped working and must be shut down.
Title: Re: DFHack 0.34.07 r1
Post by: Askot Bokbondeler on April 08, 2012, 04:26:33 pm
castes are usually 0 and 1, not 1 and 2
Title: Re: DFHack 0.34.07 r1
Post by: Girlinhat on April 08, 2012, 04:28:21 pm
castes are usually 0 and 1, not 1 and 2
Ah, list sequences.  Silly me.  -1 to all and it ran!  My dogs now have names ._.
Title: Re: DFHack 0.34.07 r1
Post by: Askot Bokbondeler on April 08, 2012, 04:30:34 pm
they're not pets but members of your civ. dfusion also has a mode to control them as if they were dwarves, though i'm not sure it'd work on non sentients
Title: Re: DFHack 0.34.07 r1
Post by: Girlinhat on April 08, 2012, 04:32:53 pm
Doesn't much matter, I'm doing a hermit challenge  I'll just treat them as livestock, though apparently I can have them butchered.  The solo dwarf also has no relationships, as usually the staring 7 know each other rather well.
Title: Cursor
Post by: Drecker on April 08, 2012, 04:58:02 pm
Hi,
I'm starting to use DFH. I have a little beginners problem: Many commads affect something "under cursor". What does it meand "cursor" here, how I choose where it is?
Title: Re: DFHack 0.34.07 r1
Post by: Askot Bokbondeler on April 08, 2012, 05:00:13 pm
the cursor is the yellow X you can move around with the arrow keys while using the look function, or any other that activates the cursor
Title: Re: DFHack 0.34.07 r1
Post by: Girlinhat on April 08, 2012, 05:00:23 pm
Anything that invokes a cursor.  "k" or "v" or "q" or "t" or even "b-c-w" will create a cursor on the screen.
Title: Re: DFHack 0.34.07 r1
Post by: Drecker on April 08, 2012, 05:17:25 pm
the cursor is the yellow X you can move around with the arrow keys while using the look function, or any other that activates the cursor
I thought it, I tried it, but it seems it doesn't work. To be more specific: Firstly I tried it with command "changelayer" and it really didn't change layer under cursor (and still don't). Now I tried it for other commands and it seems work right so far.
Title: Re: DFHack 0.34.07 r1
Post by: Rose on April 08, 2012, 06:31:43 pm
hmmmm, seems someone forgot the executable for the current windows version... only has dfhack-run.exe :/ anyone feel like pm'ing me a copy?

What executable?
Title: Re: DFHack 0.34.07 r1
Post by: Greiger on April 08, 2012, 07:29:05 pm
The new-er versions of DFhack are made to run automatically when DF starts so they have faster access to memory access to more DF functions, and fewer antiviruses flipping their shit when things run.   When you run DF, DFHack opens a console window for it's functions.
Title: Re: DFHack 0.34.07 r1
Post by: Tapeworm on April 08, 2012, 08:34:06 pm
Quote
@tapeworm: try using changelayer on the aquifer, change it to a material that cannot contain an aquifer and see what happens

Doesn't work, the tiles act as aquifers even when they're changed to non-aquifer soil. Tiletypes doesn't seem to let me remove that water_table flag, either.

Edit: No, t just didn't work the first time, but it does now. Strange.
Title: Re: DFHack 0.34.07 r1
Post by: Zwaryczuk on April 08, 2012, 08:58:26 pm
I wish revflood would hide what's behind constructed walls again. I hope this is fixed for the next release.
Title: Re: DFHack 0.34.07 r1
Post by: Quietust on April 08, 2012, 09:56:11 pm
There are several reasons why revflood reveals through constructed walls, but here's the most important one: if you remove a construction, hidden tiles behind it will not be revealed, so any jobs issued there will result in a flood of "could not find path" job cancellations.

Why are you trying to hide tiles behind constructions, anyways?
Title: Re: DFHack 0.34.07 r1
Post by: Zwaryczuk on April 09, 2012, 12:03:39 am
There are several reasons why revflood reveals through constructed walls, but here's the most important one: if you remove a construction, hidden tiles behind it will not be revealed, so any jobs issued there will result in a flood of "could not find path" job cancellations.

Why are you trying to hide tiles behind constructions, anyways?

Mainly to hide my ugly plumbing system. Also when building in soil layers, I was hoping to dig it a little bit bigger then cover the sand walls with stone walls and hide the ugly.

I wonder if there are ways to work around the issues you speak of.
Title: Re: DFHack 0.34.07 r1
Post by: Akhram on April 09, 2012, 12:11:15 am
There are several reasons why revflood reveals through constructed walls, but here's the most important one: if you remove a construction, hidden tiles behind it will not be revealed, so any jobs issued there will result in a flood of "could not find path" job cancellations.

Why are you trying to hide tiles behind constructions, anyways?

Mainly to hide my ugly plumbing system. Also when building in soil layers, I was hoping to dig it a little bit bigger then cover the sand walls with stone walls and hide the ugly.

I wonder if there are ways to work around the issues you speak of.

I know that feel bro, im stick to this :)
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 09, 2012, 02:58:29 am
I thought it, I tried it, but it seems it doesn't work. To be more specific: Firstly I tried it with command "changelayer" and it really didn't change layer under cursor (and still don't). Now I tried it for other commands and it seems work right so far.

Changelayer sometimes doesn't work at certain cursor positions. Don't ask why, I haven't found out yet. It does change the layer's geology but sometimes that doesn't directly affect the game map like it should. Probably a buffering issue. Try moving the cursor to another tile of that layer, preferrably at another z level, and try changelayer again. Sooner or later you'll find a "good" position. (the same is happening with changevein, by the way, but less often)
Title: Re: DFHack 0.34.07 r1
Post by: Rose on April 09, 2012, 03:11:40 am
There are several reasons why revflood reveals through constructed walls, but here's the most important one: if you remove a construction, hidden tiles behind it will not be revealed, so any jobs issued there will result in a flood of "could not find path" job cancellations.

Why are you trying to hide tiles behind constructions, anyways?

Mainly to hide my ugly plumbing system. Also when building in soil layers, I was hoping to dig it a little bit bigger then cover the sand walls with stone walls and hide the ugly.

I wonder if there are ways to work around the issues you speak of.

THere is.

Use liquids to place obsidian there. It will block the reveal, and also make it so things get revealed if you dig through there. plus you can engrave it.
Title: Re: DFHack 0.34.07 r1
Post by: Greiger on April 09, 2012, 10:38:26 am
I seem to have been making a lot of requests lately.

You know that bug where sometimes migrants come in as 'friendly' and just sit at the map edge?  Any chance of a bugfix utility for that?  Or is the bug not just something that can be fixed by changing a variable?
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 09, 2012, 12:04:46 pm
You know that bug where sometimes migrants come in as 'friendly' and just sit at the map edge?  Any chance of a bugfix utility for that?  Or is the bug not just something that can be fixed by changing a variable?

Do you have a 34.06 or 34.07 savegame with such migrants? It might be possible to force them into your civilization. For the time being you will be able to pit them with the next dfhack release :)
Title: Re: DFHack 0.34.07 r1
Post by: Greiger on April 09, 2012, 12:13:11 pm
Yes I do actually.  Pretty heavily modded, but it has those weird migrants (and quite a few dead ones, it's been happening for years in this fort) I'll throw it up on DFFD.  I'm guessing there's a mantis report that needs a save for that too then?

Save: http://dffd.wimbli.com/file.php?id=6139 for .07

Ah pitting them sounds very useful. Keep them from blocking the migrant tile, and get them inside so they stop filling all my coffins every siege.  I also had some cave crocs earlier that got themselves stuck in my fortress' plumbing and wouldn't let the siege flag go away.  That would have been handy for putting them someplace where my military could have dealt with them too.

Instead I just modded out their brains and watched them die.  But teleporting them someplace accessible and chopping them up would have been more satisfying.  :)
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 09, 2012, 04:54:40 pm
Yes I do actually.  Pretty heavily modded, but it has those weird migrants (and quite a few dead ones, it's been happening for years in this fort) I'll throw it up on DFFD.  I'm guessing there's a mantis report that needs a save for that too then?

You have a weird fort going on there... egg-laying winged reptiles as player race? Do they breed on nestboxes? :)

Anyways, there is a solution which fixes your migrants and it seems to work fine without side-effects. The wounded got looked after, the dead buried and the healthy started working. They show up in the unit screen and have proper thoughts etc when you look at them. Some more testing would be required if  the fix works in all cases without weirdness. For the time being (i.e. before Toady fixes it himself or a new dfhack version offers a more convenient tweak) you can do the following:

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.07 r1
Post by: Sibilantjoe on April 09, 2012, 06:39:55 pm
Hello, I've been running a fort in a world specifically generated to have no hostile races getting all up in my business, but oh look a 50-strong undead siege in my first year. I have no military, no weapons, and no defense. What's the easiest way to zot these zombies out of existence? Asking here since DFhack seems to be my best hope, that or RAW editing.
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 09, 2012, 06:43:34 pm
Use liquids to draw obsidian walls around the zombies (if you want to keep them for later on, but then the siege will continue until you kill them). Or drown them with magma:

type 'keybinding set F9 liquids-here'
type 'liquids' to enter the liquids tool (default is magma at 1 tile, so if you just want to use magma you don't need to do that)
type 'o' for painting obsidian
type 'q' to exit liquids again
move the ingame cursor over a tile where you want your magma/obsidian and press F9

for magma, you should spawn it 1 z above the zombies so it will flow down on them
Title: Re: DFHack 0.34.07 r1
Post by: Sibilantjoe on April 09, 2012, 06:45:00 pm
I'll try walling them in and dumping magma.
Title: Re: DFHack 0.34.07 r1
Post by: Sibilantjoe on April 09, 2012, 07:21:17 pm
Well, it worked. The zombies are taking a WHILE to die from the magma, but they can't hurt anyone anymore. Now my map has some neat obsidian landmarks!
Title: Re: DFHack 0.34.07 r1
Post by: dree12 on April 09, 2012, 07:32:23 pm
Hello, I've been running a fort in a world specifically generated to have no hostile races getting all up in my business, but oh look a 50-strong undead siege in my first year. I have no military, no weapons, and no defense. What's the easiest way to zot these zombies out of existence? Asking here since DFhack seems to be my best hope, that or RAW editing.
Just FYI, turning INVADERS off in dinit.txt is a better choice than modding out all hostile races.
Title: Re: DFHack 0.34.07 r1
Post by: Greiger on April 09, 2012, 09:17:35 pm
Awesome

Worked like a charm!  Thanks!  I think I'm going to back up that little lua file just to make sure it doesn't go anyplace.

[offtopic]
And yes, that's exactly what they are.  (just like my avatar actually)  And yes they use nest boxes.  It's a bit of a production to get them to use them properly though.  Any female will claim one and lay eggs, but only the married ones will hatch.  And even then you have to do the usual thing of disallowing eggs in the food stockpile or they will happily carry their own young to it. 

At least they don't have to be constantly on the boxes like the other egg layers do and they can still get work done.  They just sit on them in their idle time.  When they hatch the mom stops what she'd doing and goes back home and gathers the kid up before he falls into something dangerous just like normal dwarven childbirth, just with a longer commute.

Though as you probably saw I didn't get around to setting it all up yet for this fort, too busy trying out vampire defenses.[/offtopic]
Title: Re: DFHack 0.34.07 r1
Post by: Sibilantjoe on April 10, 2012, 01:14:44 am
Hello, I've been running a fort in a world specifically generated to have no hostile races getting all up in my business, but oh look a 50-strong undead siege in my first year. I have no military, no weapons, and no defense. What's the easiest way to zot these zombies out of existence? Asking here since DFhack seems to be my best hope, that or RAW editing.
Just FYI, turning INVADERS off in dinit.txt is a better choice than modding out all hostile races.

So noted. Does changing this require a new world?
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 10, 2012, 02:33:22 am
So noted. Does changing this require a new world?

You can change the invaders setting any time you want (as well as population count etc). But I think you need to restart DF because the ini most probably gets read during startup.
Title: Re: DFHack 0.34.07 r1
Post by: MasterMorality on April 10, 2012, 07:15:20 am
Question:
I'm running OSX and I wondered if anybody found a way of using DFhack with mac? I tried the Linux build, figuring that the two are closer together than windows and seems that both executables run through terminal equivalents, but no luck. I can't wine wrap a windows .dl

I just want to use it for adventure mode body swapping - so I can get my companions to pick up armour and weapons when they get hurt too bad, or a better alternative comes along. 
If not, is there another way to do this?
Title: Re: DFHack 0.34.07 r1
Post by: Rose on April 10, 2012, 09:32:55 am
The DFhack team doesn't have a mac dev. If you've got the skills needed, feel free to help.
Title: Re: DFHack 0.34.07 r1
Post by: walberg on April 10, 2012, 02:15:03 pm
Haven't looked through the code real closely yet, but was wondering how difficult it might be to add some filters on the "dwarfexport" module to filter out babies, children, dead, etc... Possibly just by adding some arguments like "dwarfexport /some/file nochildren" or some similar syntax...
Title: Re: DFHack 0.34.07 r1
Post by: Warmist on April 10, 2012, 02:43:21 pm
<...>
Then move the in-game cursor over a bugged migrant (or it's corpse). In the dfhack console type:
Code: [Select]
dfuse
lua
dofile("fixmigrant.lua")
quit
Could be shortened to:
Code: [Select]
dfuse "dofile('fixmigrant.lua')"

Edit: maybe... i forget which version is released which is not :/ ...
Title: Re: DFHack 0.34.07 r1
Post by: Quietust on April 10, 2012, 03:04:04 pm
I just tried running that fixmigrant script in a savegame that was posted to the bug report thread, and it did not fix the problem - once I changed it to check/clear flags1.merchant instead of flags2.resident, it worked correctly.
Title: Re: DFHack 0.34.07 r1
Post by: Flobulon on April 10, 2012, 07:00:31 pm
Is there a compile with the zone plugin available for 34.07?
Title: Re: DFHack 0.34.07 r1
Post by: Greiger on April 10, 2012, 07:06:58 pm
I just tried running that fixmigrant script in a savegame that was posted to the bug report thread, and it did not fix the problem - once I changed it to check/clear flags1.merchant instead of flags2.resident, it worked correctly.

I mentioned in one of the mantis things for one of those bugs (not sure if it was the main one or not) that I wasn't entirely sure if my problem was the exact same as others.  As I mentioned there, my migrants are NOT listing as traders, they are listing as normal migrants that just never really join the fortress and keep the @ symbol.

The lua works for me as-is, so I'm starting to think that maybe it actually is another bug, maybe related, maybe not.  But it certainly seems similar.
Title: Re: DFHack 0.34.07 r1
Post by: Rumrusher on April 10, 2012, 10:27:13 pm
here's return to fort a function for dfusion use for when your finish exploring the world in adventure mode and want to return back.
now best use this when before switching over to your fort or right when the game is paused after switching. this is needed to safely switch to fort mode(coming from adventure mode) or you will end up crumbling the fort for lack of members.
Code: [Select]
function tools.Zomb(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit.flags2.resident==true then
unit.flags2.resident=false
end
end
tools.menu:add("Return2fort",tools.Zomb)
Title: Re: DFHack 0.34.07 r1
Post by: Intrinsic on April 11, 2012, 02:54:44 am
Idea to expand copystock

To be able to have some sort of code which you can use which defines a stockpiles settings.

The code is basically just what stockpile settings were set, the best comparison, and probably a better example is like the template codes used in Guild Wars (http://wiki.guildwars.com/wiki/Template_format) which you can paste into the game and it defines your skills and attribute settings. The skill template consists of a single string such as ABJRkncAAAoVAAAAAAAA. This string is Base64 encoded as defined in rfc3548.

So these could be saved to a file or pasted directly into the console window.

For example:
copystock ABJRkncAAAoVAAAAAAAA

To load from a file:
copystock file clothing

To save the currently highlighted stockpile settings:
copystock save clothing


These codes can then easily be shared among the community.
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 11, 2012, 03:02:02 am
I just tried running that fixmigrant script in a savegame that was posted to the bug report thread, and it did not fix the problem - once I changed it to check/clear flags1.merchant instead of flags2.resident, it worked correctly.

I mentioned in one of the mantis things for one of those bugs (not sure if it was the main one or not) that I wasn't entirely sure if my problem was the exact same as others.  As I mentioned there, my migrants are NOT listing as traders, they are listing as normal migrants that just never really join the fortress and keep the @ symbol.

The lua works for me as-is, so I'm starting to think that maybe it actually is another bug, maybe related, maybe not.  But it certainly seems similar.

There are (at least) two different kinds of bugs:

#1 regular migrants who don't become proper part of your fort and stay on the map edge. This would be the case in the savegame Greiger posted. The problem seems to be that they have the resident flag set, clearing that helped.

#2 dwarf traders who don't leave the map. This happens quite often, and clearing the merchant flag does make them part of your fort. But I observed that they will run inside and start dropping all their clothes, which is followed by tantrums because they are naked.

Is there a compile with the zone plugin available for 34.07?
The zone plugin (zone, autonestbox, autobutcher) is still under development and could have bugs here and there. And there are some more features going to be added soon. For the time being, feel free to compile it yourself, but it's a bit too early to release it officially.
Title: Re: DFHack 0.34.07 r1
Post by: Quietust on April 11, 2012, 09:59:51 am
#2 dwarf traders who don't leave the map. This happens quite often, and clearing the merchant flag does make them part of your fort. But I observed that they will run inside and start dropping all their clothes, which is followed by tantrums because they are naked.
Those "traders" aren't actually merchants that are intended to leave the map - as noted here (http://www.bay12games.com/dwarves/mantisbt/view.php?id=5098), they're arriving along with migrants and are just being incorrectly flagged as merchants (despite the Trader profession actually being associated with the "Appraiser" skill used by Brokers).
Title: Re: DFHack 0.34.07 r1
Post by: NGgod on April 11, 2012, 10:25:21 am
I used tiletypes to change some damp sand into a stone wall, however it kept the damp tags. I then tried changing the space to air and then to a stone wall but the stone wall, again, had the damp tags.

Any way of removing the damp tags from a specific few tiles with tiletypes of just DFhack in general?
Title: Re: DFHack 0.34.07 r1
Post by: khearn on April 11, 2012, 12:45:35 pm
Is the tile in question next to water or an aquifer tile? I suspect the damp tag is set dynamically by DF itself when there is water next to a tile. So un-setting it in dfhack won't help if it just gets immediately re-set by the game.
Title: Re: DFHack 0.34.07 r1
Post by: NGgod on April 11, 2012, 01:14:52 pm
Is the tile in question next to water or an aquifer tile? I suspect the damp tag is set dynamically by DF itself when there is water next to a tile. So un-setting it in dfhack won't help if it just gets immediately re-set by the game.
the tiles were originally aquifer tiles, water producing, and then became water producing limestone walls.
Title: Re: DFHack 0.34.07 r1
Post by: khearn on April 11, 2012, 07:03:03 pm
Is the tile in question next to water or an aquifer tile? I suspect the damp tag is set dynamically by DF itself when there is water next to a tile. So un-setting it in dfhack won't help if it just gets immediately re-set by the game.
the tiles were originally aquifer tiles, water producing, and then became water producing limestone walls.

There's a very big difference between "water producing aquifer" and "damp". I suspect those tiles still have an "aquifer" tag set, so changing the stone type didn't remove that tag.
Title: Re: DFHack 0.34.07 r1
Post by: NGgod on April 12, 2012, 06:02:57 am
I take it Tiletypes can't remove the aquifer tag then?
Title: Re: DFHack 0.34.07 r1
Post by: vorpal+5 on April 14, 2012, 01:52:40 am
does a possibility to teleport a creature exists with DFHack?

If not, does a possibility to create a wall from thin air & instantly exists?
Title: Re: DFHack 0.34.07 r1
Post by: Antalia on April 14, 2012, 07:09:13 am
I was looking at what I'd need to do for my application to make contact with Goncyn's upcoming protobuf procedures for setting dwarf labors. (He mentions his future addition to DFHack around the bottom of page 2 in my thread here: http://www.bay12forums.com/smf/index.php?topic=105530.29)

I've cloned DFHack and searched through the project for anything relating to a protobufs RPC service, and it looks like there's nothing committed about one yet. (I see lots of .protos, but no service definitions.)

How is the DFHack RPC service going to work (at least from the "client" side)? Will an outside application need to know a port number? Will this be defined by the individual plugins? I'd like to understand this part of the design perspective, so that I can (hopefully) prepare my outside application a bit for communication with DFHack (if/when that becomes possible). Thanks for your help.
Title: Re: DFHack 0.34.07 r1
Post by: Rumrusher on April 14, 2012, 10:13:22 am
does a possibility to teleport a creature exists with DFHack?

If not, does a possibility to create a wall from thin air & instantly exists?
well dfusion kinda had a warp ability for adventure before, but it will take some time to rewrite that function for new dfusion.
Title: Re: DFHack 0.34.07 r1
Post by: Azhtabak on April 14, 2012, 12:13:22 pm
Hi,
I'm having trouble running the dfhack linux version; I launch it with ./dfhack and it loads dwarf fortress fine, but it doesn't take over the terminal; nothing happens when I attempt to use any of the dfhack commands. Does anyone have an idea as to why this might be?  :( This is under opensuse.
Title: Re: DFHack 0.34.07 r1
Post by: toasteur on April 14, 2012, 01:15:52 pm
I was looking at what I'd need to do for my application to make contact with Goncyn's upcoming protobuf procedures for setting dwarf labors. (He mentions his future addition to DFHack around the bottom of page 2 in my thread here: http://www.bay12forums.com/smf/index.php?topic=105530.29)

I've cloned DFHack and searched through the project for anything relating to a protobufs RPC service, and it looks like there's nothing committed about one yet. (I see lots of .protos, but no service definitions.)

How is the DFHack RPC service going to work (at least from the "client" side)? Will an outside application need to know a port number? Will this be defined by the individual plugins? I'd like to understand this part of the design perspective, so that I can (hopefully) prepare my outside application a bit for communication with DFHack (if/when that becomes possible). Thanks for your help.

protobuff is only the part used to encode the messages from client to server.
then ZMQ libraries are used to do the actual plumbing of creating connections and exchanging the data.

proto buff works this way:
protos files are used by google protobuff tools to generate code which will produce the same encoding for any OS/language combination.
so, for example, if you want to exchange messages on windows between 2 c++ applications, you only need one set of generated classes to exchange the data and can use existing ones if you don't create new protos.
but if you want, like me, to exchange between a c# .NET client and the dfhack c++ server, you'll have to get a protobuff code generator for C#, then create the equivalent code using the protos model.

then you have ZMQ:
it makes exchanging data beetween a client and server which don't have to be on the same OS or language easy and does the heavy lifting for you. then again, if you use a different language for the client, you have to get you're language version (often a wrapper of the c++ dlls) to make it work. and again, if your client is in c++, you can just use the same dlls as dfhack.
i think the code of the server part included in dfhack is here:
https://github.com/peterix/dfhack/blob/master/library/RemoteServer.cpp
for a simple exemple of the client part in c++, you can see it here, it's a console executable to transmit simple command to dfhack from a non-dfhack console:
https://github.com/peterix/dfhack/blob/master/library/dfhack-run.cpp
Title: Re: DFHack 0.34.07 r1
Post by: peterix on April 14, 2012, 03:10:36 pm
I was looking at what I'd need to do for my application to make contact with Goncyn's upcoming protobuf procedures for setting dwarf labors. (He mentions his future addition to DFHack around the bottom of page 2 in my thread here: http://www.bay12forums.com/smf/index.php?topic=105530.29)

I've cloned DFHack and searched through the project for anything relating to a protobufs RPC service, and it looks like there's nothing committed about one yet. (I see lots of .protos, but no service definitions.)

How is the DFHack RPC service going to work (at least from the "client" side)? Will an outside application need to know a port number? Will this be defined by the individual plugins? I'd like to understand this part of the design perspective, so that I can (hopefully) prepare my outside application a bit for communication with DFHack (if/when that becomes possible). Thanks for your help.

protobuff is only the part used to encode the messages from client to server.
then ZMQ libraries are used to do the actual plumbing of creating connections and exchanging the data.

proto buff works this way:
protos files are used by google protobuff tools to generate code which will produce the same encoding for any OS/language combination.
so, for example, if you want to exchange messages on windows between 2 c++ applications, you only need one set of generated classes to exchange the data and can use existing ones if you don't create new protos.
but if you want, like me, to exchange between a c# .NET client and the dfhack c++ server, you'll have to get a protobuff code generator for C#, then create the equivalent code using the protos model.
Yeah. This is close enough ;) It's a serialization/deserialization thing with the objects described in a custom language.

then you have ZMQ:
Nope. It's basic TCP sockets. We dropped zmq after it became evident that it just isn't the right tool for the job.

There's no real documentation and the only example so far is dfhack-run.cpp - your best bet is to look at that and at the mentioned Remote* files. A bit can be understood by looking at the rename plugin, which extends the core protocol with some of its functions - look for "plugin_rpcconnect" in plugins/rename.cpp.
Title: Re: DFHack 0.34.07 r1
Post by: Goncyn on April 14, 2012, 03:27:28 pm
peterix, I haven't had time to get on IRC the past few days. Is there any objection to my SetUnitLabors API, or have you just not gotten around to merging it yet? Any pointers, advice, complaints, or criticism is welcome.

If anyone wants to see some example client code, I have some work-in-progress stuff on github. E.g. the methods that actually write to and read from the socket:
https://github.com/wjrogers/HeavyDuck.DF.DwarfDuck/blob/master/HeavyDuck.DF.DFHack/DFHackClient.cs#L112
https://github.com/wjrogers/HeavyDuck.DF.DwarfDuck/blob/master/HeavyDuck.DF.DFHack/DFHackClient.cs#L127
Title: Re: DFHack 0.34.07 r1
Post by: peterix on April 14, 2012, 04:08:38 pm
peterix, I haven't had time to get on IRC the past few days. Is there any objection to my SetUnitLabors API, or have you just not gotten around to merging it yet? Any pointers, advice, complaints, or criticism is welcome.
I've seen it, but just couldn't get to it. It looks fine to me, but I'll give it a second read :)
Title: Re: DFHack 0.34.07 r1
Post by: TSTwizby on April 17, 2012, 05:28:31 am
I'm having some trouble running this. Whenever I open the command prompt window, it instantly closes. I've seen this problem with other, similar programs, and I have spent the last few hours searching to find a fix, but the only one which made any sense didn't apply to me, as it involved a registry entry I don't have. Does anyone have a clue what I'm talking about or should I try again after getting some sleep?
Title: Re: DFHack 0.34.07 r1
Post by: robertheinrich on April 17, 2012, 06:13:48 am
I'm having some trouble running this.

Running what? dfhack? You unpack the archive, then copy the contents into your df folder which will replace some files. After that, just run df like usual and you'll get an additional console window for the hack/tweak stuff.

Quote
Whenever I open the command prompt window, it instantly closes.


Did you maybe call 'dfhack-run'? That's for calling plugins from outside of the dfhack console. It will instantly close, yes.

Quote
but the only one which made any sense didn't apply to me, as it involved a registry entry I don't have.

dfhack does not change any registry entries. It doesn't have any kind of installer either. You download and unpack it and copy it into your df folder.
Title: Re: DFHack 0.34.07 r1
Post by: TSTwizby on April 17, 2012, 02:02:47 pm
I'm having some trouble running this.

Running what? dfhack? You unpack the archive, then copy the contents into your df folder which will replace some files. After that, just run df like usual and you'll get an additional console window for the hack/tweak stuff.

Quote
Whenever I open the command prompt window, it instantly closes.


Did you maybe call 'dfhack-run'? That's for calling plugins from outside of the dfhack console. It will instantly close, yes.

Quote
but the only one which made any sense didn't apply to me, as it involved a registry entry I don't have.

dfhack does not change any registry entries. It doesn't have any kind of installer either. You download and unpack it and copy it into your df folder.

I'm sorry, I guess I misunderstood the Readme. I'll give that a shot.
Title: Re: DFHack 0.34.07 r1
Post by: Gahagan on April 17, 2012, 05:54:36 pm
It was suggested that I post this here, from the Fortress Mode forums.

Quote from: Gahagan
I'm doing some work on attribute gains, changes, and decays, and need a quick way to export lots of attribute values out of DF and into something like Excel or SPSS, or even Word or Notepad.

I'm aware that Dwarf Therapist gives access to attribute values, but I have found no way of copy-pasting them, and manually transcribing them destroyed my frail arm. I also seem to recall Runesmith also having that functionality, but that's defunct now.

Does anyone know of a way to do this?
Title: Re: DFHack 0.34.07 r1
Post by: dree12 on April 17, 2012, 07:23:04 pm
It was suggested that I post this here, from the Fortress Mode forums.

Quote from: Gahagan
I'm doing some work on attribute gains, changes, and decays, and need a quick way to export lots of attribute values out of DF and into something like Excel or SPSS, or even Word or Notepad.

I'm aware that Dwarf Therapist gives access to attribute values, but I have found no way of copy-pasting them, and manually transcribing them destroyed my frail arm. I also seem to recall Runesmith also having that functionality, but that's defunct now.

Does anyone know of a way to do this?
dwarfexport is what you want. Then, just write a script to process the XML to a csv and import it into Excel.
Title: Re: DFHack 0.34.07 r1
Post by: Tabithda on April 17, 2012, 07:30:08 pm
Whenever I use the empregnate tool in dfusion the game crashes after a step or two.  Does anyone know why it does this and of so how to fix it?
Title: Re: DFHack 0.34.07 r1
Post by: peterix on April 17, 2012, 10:52:52 pm
OK guys, new release is out, along with a whole lot of new tools and improvements, many new automation tools included.

DFusion is now particularly cool. Anything the DFHack C++ plugins can access, you can access from LUA too. There's some serious power in that and you don't even need a compiler for it. Just remember that with great power comes great responsibility (it's still pretty much unchecked direct access to memory!) ;)

In the background, work continues on the external API and a possible OSX version.

DF2minecraft got removed again.

Recheck any bugs you ran into with 0.34.07-r1 and report them on github please (https://github.com/peterix/dfhack/issues).

See first post for downloads and news :)

Oh, and the dig designation commands got renamed to unify them a bit.
Title: Re: DFHack 0.34.07 r1
Post by: Rumrusher on April 18, 2012, 12:35:58 am
OK guys, new release is out, along with a whole lot of new tools and improvements, many new automation tools included.

DFusion is now particularly cool. Anything the DFHack C++ plugins can access, you can access from LUA too. There's some serious power in that and you don't even need a compiler for it. Just remember that with great power comes great responsibilitymass experiments that leads to arms coming back but turning into the lizard (it's still pretty much unchecked direct access to memory!) ;)

In the background, work continues on the external API and a possible OSX version.

DF2minecraft got removed again.

Recheck any bugs you ran into with 0.34.07-r1 and report them on github please (https://github.com/peterix/dfhack/issues).

See first post for downloads and news :)

Oh, and the dig designation commands got renamed to unify them a bit.
Fixed.
Title: Re: DFHack 0.34.07 r2
Post by: Graebeard on April 18, 2012, 12:37:18 am
Ok, this seems like the newbest of newbish questions, but here goes: how do I run the terminal?

I haven't used dfhack since the legacy version.  I just downloaded 0.31.25-r9a (so that I can use the mapexport dll thewonderidiot wrote to jive with ogreseer) and I don't see an executable.  Am I missing something obvious?  Should/can I use an executable bundled with another release?
Title: Re: DFHack 0.34.07 r2
Post by: thewonderidiot on April 18, 2012, 12:42:52 am
Ok, this seems like the newbest of newbish questions, but here goes: how do I run the terminal?

I haven't used dfhack since the legacy version.  I just downloaded 0.31.25-r9a (so that I can use the mapexport dll thewonderidiot wrote to jive with ogreseer) and I don't see an executable.  Am I missing something obvious?  Should/can I use an executable bundled with another release?

Hey there! The information you seek is in the first post.  ;)

How to install DFHack:
  • First, get the archive meant for your system. Extract the contents into your DF folder.
  • On Windows, you're ready to use DFHack. An extra command line window should appear when you run DF.
  • On Linux, use the 'dfhack' script from a terminal to run DF with DFHack. If you have stonesense problems, you might have to get your own allegro 5 libraries and delete the ones in stonesense/deplibs.

If you do it right, you'll be prompted to overwrite SDL.dll, which you should do. After you've done that, simply running DF will cause the DFHack terminal to automagically pop up.
Title: Re: DFHack 0.34.07 r2
Post by: Graebeard on April 18, 2012, 12:48:13 am
Ah, and there we are.  Thanks for the obvious pointer!  Amazing what 15 hour work days do to your brain...
Title: Re: DFHack 0.34.07 r2
Post by: Rumrusher on April 18, 2012, 01:09:31 am
oh guys you might want this in your commons if you want to run any of my future functions...
Code: [Select]
function getItemAtPos(x,y,z) -- gets the item index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.items.all -- load all items
for i = 0, #vector-1 do -- look into all items offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("item not found!")
return nil

end
like this one which allows you to trap souls into items though this is mostly warmist code I just slightly modified.
Code: [Select]
function putInItem(item,unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if item==nil then
item=getItemAtPos(getxyz())
end
for a,b in ipairs(df.global.world.items.all) do for c,d in ipairs(b.itemrefs) do end end
local u_ref=df.general_ref_contains_unitst:new()
u_ref.unit_id=unit.id
item.itemrefs:insert(#item.itemrefs,u_ref)

local u_cr_ref=df.general_ref_contained_in_itemst:new()
unit.flags1.caged=true
u_cr_ref.item_id=item.id
unit.refs:insert(#unit.refs,u_cr_ref)
end
tools.menu:add("Shove in bag",putInItem)
 
Title: Re: DFHack 0.34.07 r2
Post by: lukesleftleg on April 18, 2012, 07:05:22 am
I just noticed the new zone and autobutcher commands in the new release.

I haven't had a chance to play with them yet, and probably wont until later today, but I just wanted to say a big thank you to the DFhack team. Not only for the update, but also for taking requests on board so quickly.

Nice one guys :)

- EDIT -

And regrass is back as well! Even nicer :D
Title: Re: DFHack 0.34.07 r2
Post by: telarin on April 18, 2012, 09:15:09 am
Looks like vdig didn't end up in this release for some reason.
Title: Re: DFHack 0.34.07 r2
Post by: robertheinrich on April 18, 2012, 09:30:51 am
Looks like vdig didn't end up in this release for some reason.

vdig was renamed to digv (all *dig commands are now called dig*)
Title: Re: DFHack 0.34.07 r1
Post by: Gahagan on April 18, 2012, 09:42:50 am
It was suggested that I post this here, from the Fortress Mode forums.

Quote from: Gahagan
I'm doing some work on attribute gains, changes, and decays, and need a quick way to export lots of attribute values out of DF and into something like Excel or SPSS, or even Word or Notepad.

I'm aware that Dwarf Therapist gives access to attribute values, but I have found no way of copy-pasting them, and manually transcribing them destroyed my frail arm. I also seem to recall Runesmith also having that functionality, but that's defunct now.

Does anyone know of a way to do this?
dwarfexport is what you want. Then, just write a script to process the XML to a csv and import it into Excel.

Where does dwarfexport place the XML file it generates? I'm not able to find it.
Title: Re: DFHack 0.34.07 r1
Post by: walberg on April 18, 2012, 10:20:42 am
Where does dwarfexport place the XML file it generates? I'm not able to find it.

If you just type dwarfexport, it responds with export <filename> (that help text should probably be fixed to reflect the fact that the tool name has changed). So you explicitly name where you want the file to go...
Title: Re: DFHack 0.34.07 r2
Post by: Dragula on April 18, 2012, 10:27:41 am
The procedure entry point
?ReadGeology@Maps@DFHack@@YA_NAAV?$vector@V?$vector@GV?@allocator@G@std@@@std@@V?$allcotar blabla

could not be located in the dynamic link library SDL.dll
Title: Re: DFHack 0.34.07 r2
Post by: Goncyn on April 18, 2012, 10:29:53 am
The new animal management stuff is super great! I might actually breed animals, now. Thanks everyone!  :D
Title: Re: DFHack 0.34.07 r2
Post by: robertheinrich on April 18, 2012, 10:36:16 am
The procedure entry point
?ReadGeology@Maps@DFHack@@YA_NAAV?$vector@V?$vector@GV?@allocator@G@std@@@std@@V?$allcotar blabla

could not be located in the dynamic link library SDL.dll

You copied the newest version of dfhack over your old version and one of the old plugins (most probably df2minecraft and vdig) can't use the new SDL.dll. You can either ignore the message or delete the old plugin(s) from the /hack/plugins folder. When you look at the dfhack console there will be a message which tells you which plugins could not be loaded. Delete these.

The new animal management stuff is super great! I might actually breed animals, now. Thanks everyone!  :D

It could (and will) be improved in the future. Some ideas about how to auto-pasture animals are floating around but not realized yet. Suggestions on that topic are welcome.
Title: Re: DFHack 0.34.07 r2
Post by: Girlinhat on April 18, 2012, 12:29:12 pm
I haven't played yet, but it seems there's some options to use in tandem, namely with autozone and autobutcher.  What occurs to me most is to, for instance, set up a series of nest boxes with 1x1 pasture zones, and bring turkey.  Set the butchery rules to "keep 5 males and 10 females" and it will automatically keep them producing eggs and butchering off the excess.

Or, if you're a bit creative, you could even do such things as an automated system that would breed wild animals, cage them, and toss them off a cliff so you can butcher the gibbles.
Title: Re: DFHack 0.34.07 r2
Post by: robertheinrich on April 18, 2012, 01:23:08 pm
@Girlinhat: well, almost. Autobutcher and autonestbox work together fine. Zone is currently not yet automated like that, it's a run-once command. So you still have to manually pasture fresh animals which are not autonestboxed manually now and then.
Title: Re: DFHack 0.34.07 r2
Post by: Captain Crazy on April 18, 2012, 04:52:54 pm
I'd like that if there were to be an 'autopasture' addition, it automatically assigns grazers to patches of grass it can feed on. Oftentimes I've forgotten to pasture a stray baby llama, to find it starving to death, milling about in the dining room.
Title: Re: DFHack 0.34.07 r2
Post by: robertheinrich on April 18, 2012, 05:36:54 pm
As for 'autopasture' / 'autozone': please describe how you want it to act like. It was not added to the current dfhack release because there are tons of different cases depending on the current situation. Adding all new grazers to some default zone might result into not enough grass for all of them, just to mention one example. We are considering some way to watch (grazer) pastures and check the grass available on them, though... Some future release of dfhack will probably be able to automagically move your grazers from zone1 to zone2 once the grass on zone1 is deplenished... but not the current one, sorry.
Title: Re: DFHack 0.34.07 r2
Post by: khearn on April 18, 2012, 07:33:51 pm
Suggestion: A command that makes the selected garbage zone active, and all other garbage zones inactive. I don't know how many times I've wanted to dump some items to a specific zone and instead the REDACTED dwarves grab the items and run off to the stairs, and I have to search all over the place to figure out what garbage zone they decided to take the stuff to. This is the main reason I've never built a garbage shaft that leads straight down to the magma sea. I'm afraid that I'll designate some caged goblin's iron sword to be dumped and they'll toss it down the shaft instead of in the zone where I want it. If I could select one and only one garbage zone to be active, dumping would be much less stressful.

I have no idea how hard it would be to find all the garbage zones and make them inactive. Since they all get listed in the 'R' list, I'm guessing it wouldn't be too hard.
Title: Re: DFHack 0.34.07 r2
Post by: Girlinhat on April 18, 2012, 09:06:33 pm
If I were going all out on the autopasture feature, then I'd have the user put the cursor over a pasture and type a command to add it to the list.  It would store a list of flagged pastures and their sizes.  You then use a separate command to specify "Keep llamas pastured."  It would skim the raws to check the grazer tag on llamas and assign them to different pastures based on their grazing speed.  Like, if we find that llamas need 5 tiles of grass to self-sustain, and you make a pasture zone 24 tiles large and another that's 6 tiles large, it would automatically put 4 llamas into one zone and 1 into the other.

Of course that would rely on a formula that compares the grazer and trample tokens to figure out the tiles needed per creature, but would be very nifty if it worked at all.

As a simpler solution, the player could make a pasture zone and then put the cursor over it and specify "this zone can support 3 llamas."  Then when autopasture was enabled, it would find any llamas that were not assigned to a pasture, and it would dole them out to any pastures flagged for llama use.  If a llama was removed by some means, then it would recognize that there was open space and would place another llama there if available.  If there were more llamas than there were available pastures, then it would dump them into a "default zone" or could just let them roam free.

This method would also let you keep a war dog pastured at the entrance, even if the previous dog was killed, by letting you specify "autopasture dog war".  The flags would probably include male/female, war/hunting/untrain/unspecified, egg, sheer, milk, graze, and anything else I might not have thought of.  That way you could specify things like "keep all the milkable creatures closer to the farmer's workshop" or "don't put any grazers here" or "make sure there's a war dog staring at my mayor as he sleeps".
Title: Re: DFHack 0.34.07 r2
Post by: rtg593 on April 19, 2012, 01:00:09 am
Ok, so 2 pages of tiletypes results came up, but I couldn't find the answer to my specific question, so here goes:

I dropped a white sand wall (and floor above it) 15 z-levels to my magma glass furnace. When it landed, it turned into a sandy loam wall (and floor above it. I know there's a bug with dropping soil layers, but I do this every fort, and this is the first time sand turned into something else.

Is it possible to use tiletypes to change it back to a sand type? I can't seem to figure out if you can...

EDIT: This is also the first time I decided to leave most of the shaft the exact size of the plug, instead of channeling out a space around it the entire way down. As a result, it came into contact with a sandy loam layer on the way down, is this my culprit?
Title: Re: DFHack 0.34.07 r2
Post by: vorpal+5 on April 19, 2012, 03:44:53 am
if only we could teleport a unit, imagine the number of hair pulling cases we could solve, legit cases like a stupid dorf that build something the wrong side of a wall. Is it legit? Sure you can say it is part of the fun, but having to fall back to trick like suspending work etc. to make it work the right side seems more to me like fighting the interface, don't you think?

Others examples include your most precious armorsmith that decides to pasture an animal (you can't disable this behavior, any dwarf can do that) and get killed, unless you teleport him back 10 tiles away. Cheating again? No, fixing a miserable loophole in DF.

I can go a long way in how useful teleporting a creature would be. Liaison stuck, etc. But you get the idea. I think this will be a great feature to have that would save tons of hours for many players.
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on April 19, 2012, 06:28:22 am
So I tried the new autolabor plugin.  I like it.

But it won't chop trees.  I have 2 axes and 2 picks and 4 worker dwarfs.  And it turns mining on for all 4, so 2 go dig and the other 2 have a tea party.

It would be nice if there was a way to exclude dwarfs from the autolabor.  Till then, not useful.  Unless you dont need to chop trees.

Edit: Now that I think about it more.  Not including the "uniform" labors, mining, woodcutting, hunting, in autolabor would be nice.  Since those all will mess up civilian armor as well.
Title: Re: DFHack 0.34.07 r2
Post by: Hamek McEisenfaust on April 19, 2012, 06:28:51 am
I am having problems getting autodump working as a keybinding hotkey. I am using the following line in dfhack.init to set the binding 'keybinding set Ctrl-A autodump' . I get no evident errors in either error log, yet, or when dfhack starts up, but, when i set items to dump, choose a dump point using dig to get the X and invoke the hotkey, it does not move anything. I believe i had it working at one point, but cannot be sure. curious if i may be missing something simple in my keybind? thanks for any assistance.
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on April 19, 2012, 06:46:54 am
I am having problems getting autodump working as a keybinding hotkey. I am using the following line in dfhack.init to set the binding 'keybinding set Ctrl-A autodump' . I get no evident errors in either error log, yet, or when dfhack starts up, but, when i set items to dump, choose a dump point using dig to get the X and invoke the hotkey, it does not move anything. I believe i had it working at one point, but cannot be sure. curious if i may be missing something simple in my keybind? thanks for any assistance.

I had the same problem.  Switched to Ctrl-D autodump.  Voila!
Title: Re: DFHack 0.34.07 r2
Post by: Hamek McEisenfaust on April 19, 2012, 06:56:16 am
I am having problems getting autodump working as a keybinding hotkey. I am using the following line in dfhack.init to set the binding 'keybinding set Ctrl-A autodump' . I get no evident errors in either error log, yet, or when dfhack starts up, but, when i set items to dump, choose a dump point using dig to get the X and invoke the hotkey, it does not move anything. I believe i had it working at one point, but cannot be sure. curious if i may be missing something simple in my keybind? thanks for any assistance.

I had the same problem.  Switched to Ctrl-D autodump.  Voila!

Holy smokes. You Sir/Ma'am are awarded One (1) Internet thank you cookie!
Title: Re: DFHack 0.34.07 r2
Post by: Rumrusher on April 19, 2012, 10:22:56 am
if only we could teleport a unit, imagine the number of hair pulling cases we could solve, legit cases like a stupid dorf that build something the wrong side of a wall. Is it legit? Sure you can say it is part of the fun, but having to fall back to trick like suspending work etc. to make it work the right side seems more to me like fighting the interface, don't you think?

Others examples include your most precious armorsmith that decides to pasture an animal (you can't disable this behavior, any dwarf can do that) and get killed, unless you teleport him back 10 tiles away. Cheating again? No, fixing a miserable loophole in DF.

I can go a long way in how useful teleporting a creature would be. Liaison stuck, etc. But you get the idea. I think this will be a great feature to have that would save tons of hours for many players.
Well warping folks is easy, getting them to not horribly clutter the area with knee high invisible blocks is hard. good thing old dfusion warp isn't that hard to port over.

Code: [Select]
function tools.warp(unit)
print("Self or at position? (s or anything else):");
local r=getline()
local unit
if r=="s" or r=="S" then
unit=df.global.world.units.other[0][0]
else
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
end
local sx,sy,sz
sx=unit.pos.x
sy=unit.pos.y
sz=unit.pos.z
print("Current coords:"..sx.." "..sy.." "..sz)
print("Jump where (coordinates in form 'dx dy dz' or 'c' for cursor):")
r=getline()
local tx,ty,tz
if r=="c" then
tx,ty,tz=getxyz()
else
lp=string.gmatch(r,"%-?%d+")
--local d
--d=lp()
tx=sx+tonumber(lp())
ty=sy+tonumber(lp())
tz=sz+tonumber(lp())
end
print("Warp to coords:"..tx.." "..ty.." "..tz)
unit.pos.x=tx
unit.pos.y=ty
unit.pos.z=tz
end
tools.menu:add("warp",tools.warp)

edit: here's the codes for a warp, this works both in adventure mode and fort mode, you need to have the pointer on top of the unit you want... and also to make sure the unit not sharing the same tile as someone else.
Title: Re: DFHack 0.34.07 r2
Post by: 0x517A5D on April 19, 2012, 01:17:44 pm
EDIT: This is also the first time I decided to leave most of the shaft the exact size of the plug, instead of channeling out a space around it the entire way down. As a result, it came into contact with a sandy loam layer on the way down, is this my culprit?

I don't think so.  I think the dirt-type changes each time dirt tiles fall into a dirt layer, and sandy loam happened to be the lowest one in that biome.

I can't answer the editing question, sorry.
Title: Re: DFHack 0.34.07 r2
Post by: rtg593 on April 19, 2012, 02:37:27 pm
EDIT: This is also the first time I decided to leave most of the shaft the exact size of the plug, instead of channeling out a space around it the entire way down. As a result, it came into contact with a sandy loam layer on the way down, is this my culprit?

I don't think so.  I think the dirt-type changes each time dirt tiles fall into a dirt layer, and sandy loam happened to be the lowest one in that biome.

I can't answer the editing question, sorry.

Hmm. Well rats, guess I lucked out on other embarks. Well, just for some science, I'll try it the way I normally do, where it won't touch the s loam on the way down. But ya, I think the sand I wanted was the lowest layer on my other embarks... Drat :p

Thanks anyway!
Title: Re: DFHack 0.34.07 r2
Post by: Morwaul on April 19, 2012, 09:40:54 pm
Is there any way to do with DFHack what we used to do with Runesmith?  Mainly change attributes and moods?
Title: Re: DFHack 0.34.07 r2
Post by: Rose on April 19, 2012, 09:48:32 pm
Yeah, you can do lua scripting that'll do the same stuff.
Title: Re: DFHack 0.34.07 r2
Post by: Morwaul on April 19, 2012, 09:59:08 pm
Hmm, I know nothing of Lua.  Could you give me an example of what I would type into the DFHack Console?  Or, is that not what you mean?
Title: Re: DFHack 0.34.07 r2
Post by: the_game_hunt on April 19, 2012, 10:18:21 pm
Hmm, I know nothing of Lua.  Could you give me an example of what I would type into the DFHack Console?  Or, is that not what you mean?

Youll be helping 2 persons  :P
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on April 20, 2012, 12:11:57 am
So I tried the new autolabor plugin.  I like it.

But it won't chop trees.  I have 2 axes and 2 picks and 4 worker dwarfs.  And it turns mining on for all 4, so 2 go dig and the other 2 have a tea party.

It would be nice if there was a way to exclude dwarfs from the autolabor.  Till then, not useful.  Unless you dont need to chop trees.

Edit: Now that I think about it more.  Not including the "uniform" labors, mining, woodcutting, hunting, in autolabor would be nice.  Since those all will mess up civilian armor as well.
You can exclude specific labors or set the maximum number of dwarfs to assign to any particular labor.
Title: Re: DFHack 0.34.07 r2
Post by: vorpal+5 on April 20, 2012, 12:56:28 am
Well warping folks is easy, getting them to not horribly clutter the area with knee high invisible blocks is hard. good thing old dfusion warp isn't that hard to port over.

Code: [Select]
function tools.warp(unit)
print("Self or at position? (s or anything else):");
local r=getline()
local unit
if r=="s" or r=="S" then
unit=df.global.world.units.other[0][0]
else
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
end
local sx,sy,sz
sx=unit.pos.x
sy=unit.pos.y
sz=unit.pos.z
print("Current coords:"..sx.." "..sy.." "..sz)
print("Jump where (coordinates in form 'dx dy dz' or 'c' for cursor):")
r=getline()
local tx,ty,tz
if r=="c" then
tx,ty,tz=getxyz()
else
lp=string.gmatch(r,"%-?%d+")
--local d
--d=lp()
tx=sx+tonumber(lp())
ty=sy+tonumber(lp())
tz=sz+tonumber(lp())
end
print("Warp to coords:"..tx.." "..ty.." "..tz)
unit.pos.x=tx
unit.pos.y=ty
unit.pos.z=tz
end
tools.menu:add("warp",tools.warp)

edit: here's the codes for a warp, this works both in adventure mode and fort mode, you need to have the pointer on top of the unit you want... and also to make sure the unit not sharing the same tile as someone else.

thanks!
where do I plug this code exactly?
Title: Re: DFHack 0.34.07 r2
Post by: ag on April 20, 2012, 01:20:24 am
I don't think so.  I think the dirt-type changes each time dirt tiles fall into a dirt layer, and sandy loam happened to be the lowest one in that biome.

Yesterday we spent some time investigating what exactly happens if there is a soil tile in a stone layer, or vice versa. It turned out that for soil it takes the material of the lowest soil layer of the biome, and for stone the topmost stone one - irrespective of the actual location of the tile in question. If there are no such layers at all, it leads to the 'disco soil' flashing effect bug.
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on April 20, 2012, 01:21:41 am
You can exclude specific labors or set the maximum number of dwarfs to assign to any particular labor.

Woo! Thanks.  I was typing "autolabor help" for extended help text and the command is "help autolabor" for some reason.

Hmm, looking at the readme page some more.  It says 'command help' under "Using DFHack", and 'help <command-name>' under "Commands" a few paragraphs later.
Title: Re: DFHack 0.34.07 r2
Post by: robertheinrich on April 20, 2012, 04:27:57 am
You can exclude specific labors or set the maximum number of dwarfs to assign to any particular labor.

Woo! Thanks.  I was typing "autolabor help" for extended help text and the command is "help autolabor" for some reason.

Hmm, looking at the readme page some more.  It says 'command help' under "Using DFHack", and 'help <command-name>' under "Commands" a few paragraphs later.

Writing dfhack plugins is a tad inconvenient when it comes to the help function(s). 'plugin help' and 'help plugin' need to be taken care of at two seperate places, so it's easy to forget about one or the other or even both. And a third place is the external readme file. If this were a commercial project it would probably have one guy responsible for keeping these three locations up-to-date all the time, but since it isn't you can't really blame anybody who spent his free time to do stuff and forgot/didn't bother with pasting the same text to three locations...
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on April 20, 2012, 09:39:08 am
I appreciate the work you guys do on this.  I was just confused about what the "right" way to invoke help was.
Title: Re: DFHack 0.34.07 r2
Post by: simonthedwarf on April 20, 2012, 10:23:13 am
May I suggest that you incorporate a way to teleport entities from one tile to another? Like if I wanted a whale teleported? :D
Title: Re: DFHack 0.34.07 r2
Post by: khearn on April 20, 2012, 10:32:26 am
Writing dfhack plugins is a tad inconvenient when it comes to the help function(s). 'plugin help' and 'help plugin' need to be taken care of at two seperate places, so it's easy to forget about one or the other or even both. And a third place is the external readme file. If this were a commercial project it would probably have one guy responsible for keeping these three locations up-to-date all the time, but since it isn't you can't really blame anybody who spent his free time to do stuff and forgot/didn't bother with pasting the same text to three locations...

One thing that could be done is to have one place just point to the other. So "help foo" could just print out "See 'foo help' for usage information." Then you never need to touch it again and just have to keep "foo help" and the readme up to date.
Title: Re: DFHack 0.34.07 r2
Post by: Rumrusher on April 20, 2012, 12:06:13 pm
Well warping folks is easy, getting them to not horribly clutter the area with knee high invisible blocks is hard. good thing old dfusion warp isn't that hard to port over.

Code: [Select]
function tools.warp(unit)
print("Self or at position? (s or anything else):");
local r=getline()
local unit
if r=="s" or r=="S" then
unit=df.global.world.units.other[0][0]
else
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
end
local sx,sy,sz
sx=unit.pos.x
sy=unit.pos.y
sz=unit.pos.z
print("Current coords:"..sx.." "..sy.." "..sz)
print("Jump where (coordinates in form 'dx dy dz' or 'c' for cursor):")
r=getline()
local tx,ty,tz
if r=="c" then
tx,ty,tz=getxyz()
else
lp=string.gmatch(r,"%-?%d+")
--local d
--d=lp()
tx=sx+tonumber(lp())
ty=sy+tonumber(lp())
tz=sz+tonumber(lp())
end
print("Warp to coords:"..tx.." "..ty.." "..tz)
unit.pos.x=tx
unit.pos.y=ty
unit.pos.z=tz
end
tools.menu:add("warp",tools.warp)

edit: here's the codes for a warp, this works both in adventure mode and fort mode, you need to have the pointer on top of the unit you want... and also to make sure the unit not sharing the same tile as someone else.

thanks!
where do I plug this code exactly?
dfusion folder, best to stick this in tools/init.lua file.
Title: Re: DFHack 0.34.07 r2
Post by: vorpal+5 on April 20, 2012, 01:51:53 pm
I fear I'll need more course to get the warp command works. The console says it is still an unknown command despite me having added the code to the right place (tools/init.lua).

There is some code in the same file for a follow command... but then there is also a dll for follow, so would it means warp can only works if it has a dll? I hope not...

Another angle of approach in my search, there are some tools named 'advanced', like
function adv_tools.ressurect()

in adv_tools\init.lua

How one would call such command? Because if this is simple, I can paste the warp code there too... I don't mind. I just want to be able to warp a unit from a tile to another, please  :-*
Title: Re: DFHack 0.34.07 r2
Post by: robertheinrich on April 20, 2012, 03:25:21 pm
I fear I'll need more course to get the warp command works. The console says it is still an unknown command despite me having added the code to the right place (tools/init.lua).

There is some code in the same file for a follow command... but then there is also a dll for follow, so would it means warp can only works if it has a dll? I hope not...

Another angle of approach in my search, there are some tools named 'advanced', like
function adv_tools.ressurect()

in adv_tools\init.lua

How one would call such command? Because if this is simple, I can paste the warp code there too... I don't mind. I just want to be able to warp a unit from a tile to another, please  :-*

a) the teleport code posted by rumrusher can result in having spots on the map where you can't build stuff on, but he already mentioned that... df maps store some occupancy thing which is not properly cleared by just changing unit positions.

b) the lua stuff needs a bit more documentation as a whole. For the time being look at the lua readme (which is part of the download) and check out http://dwarffortresswiki.org/index.php/Utility:DFusion and call 'dfuse' before you start a 'lua' session and come back here to complain about stuff which won't work so we can figure it out.
Title: Re: DFHack 0.34.07 r2
Post by: Rumrusher on April 20, 2012, 04:20:14 pm
I fear I'll need more course to get the warp command works. The console says it is still an unknown command despite me having added the code to the right place (tools/init.lua).

There is some code in the same file for a follow command... but then there is also a dll for follow, so would it means warp can only works if it has a dll? I hope not...

Another angle of approach in my search, there are some tools named 'advanced', like
function adv_tools.ressurect()

in adv_tools\init.lua

How one would call such command? Because if this is simple, I can paste the warp code there too... I don't mind. I just want to be able to warp a unit from a tile to another, please  :-*
Wait are you using dfusion to run it or some other process? you also need to boot out of dfusion mode while playing dwarf fortress. dfusion follow and "follow" are two different follows.

the dfhack follow is just a camera zoom on to a unit useful in fort mode.
dfusion's follow is for making unit's follow the adventurer.  their not the same. and the tools aren't named advance more so it's a short for ADVenture for their highly useful for adventure mode.
Title: Re: DFHack 0.34.07 r2
Post by: vorpal+5 on April 21, 2012, 02:19:51 am
Ok, I made it work. But three things.

[1]
I had to alter the code because for reason unknown no unit was retrieved when using
getCreatureAtPos(getxyz)

and yes, the cursor was on a dwarf, and he was the unique entity of the tile.

So I altered it with
unit=getSelectedUnit()
using V to select a dwarf, it worked.

Do you know why there was a problem?

[2]
Second, using the command is quite convoluted. For people wanting to use it and want a step by step, you have to activate DFusion by typing DFusion in the DFHack console. Then you are presented with a menu, the new command is in tools, so your type (2). Then you have a list of available commands, warp is (6) for me, so I type (6). And then I can operate the command... Once the command activates, I'm back to the first menu...

Any possibility to have a less convoluted way of using the command, ideally like just typing 'warp' in DFHack, or at worse when DFusion is active?

In any case, big thanks to you, this will change my life... Now if there is a stuck dorf, I can unstuck him.

[3]
About the glitch, a data not cleared on occupancy, is the glitch on the source tile or the target tile? If on the target tile, I can always use the same destination tile, knowing the tile is now 'screwed', this will be my 'dump tile'... If on the source, this can be more problematic indeed.
Title: Re: DFHack 0.34.07 r2
Post by: Antalia on April 21, 2012, 07:15:34 am
Quote
There's no real documentation and the only example so far is dfhack-run.cpp - your best bet is to look at that and at the mentioned Remote* files. A bit can be understood by looking at the rename plugin, which extends the core protocol with some of its functions - look for "plugin_rpcconnect" in plugins/rename.cpp.
This looks great for C-based clients. But I don't think DFHack's RPC functions, as implemented, can be compatible with Java clients. This is because Java RPC clients rely on a service library compatible with the server. DFHack's RPC service appears to be homebrewed--I did not find any Java service library compatible with the style of function stubs it uses. (The stream object getting passed around in DFHack, seems to be the most serious hurdle here. Passing back return values as function arguments may be a problem, too.) Writing this Java service library from scratch would not be trivial.

This is disappointing, because I was quite hopeful that my Java application could make use of some functions in RemoteTools, especially SetUnitLabors().

Is there any intention of DFHack supporting Java client RPC in the future? I didn't see anything like "// Let's only support C/C++/C#!" when studying the code, which leaves me vaguely hopeful.

I know I can theoretically just write my own C++ middle-man to do RPC with DFHack, using protobufs service (or whatever) to talk to my Java app. (That would be a less intense headache than the other option, for me.) This could manage passing information between DFHack and my Java client. But in reality I doubt I would ever go this far. (This feature is not critical enough to the main function of my cross-platform application, to justify repeating any past "fun" I've had cross-platforming with C++.)
Title: Re: DFHack 0.34.07 r2
Post by: the_game_hunt on April 21, 2012, 09:42:04 am
Ive found a minor bug!

When you embark on a Dirt road built by the dwarf (or humans, i dont know...) and use regrass, grass will grow on top of the road.

Trees and bushes cant grow where the road was.
Title: Re: DFHack 0.34.07 r2
Post by: robertheinrich on April 21, 2012, 10:10:54 pm
Ive found a minor bug!

When you embark on a Dirt road built by the dwarf (or humans, i dont know...) and use regrass, grass will grow on top of the road.

Trees and bushes cant grow where the road was.

From the viewpoint of regrass, a dirt road is simply a spot where there is soil but no grass, so it will regrow grass there. When you tell your dorfs ingame to build a dirt road all they will do is remove the grass there and after a while that tile will get re-claimed by the game and grow grass maybe even a tree/shrub... But if you have a savegame where you embarked on a dirt road and it's regrassed and no trees/shrubs grow on it after observing it for a couple of years, please upload it... it might be possible that dirt roads you embarked on are some weird special case.
Title: Re: DFHack 0.34.07 r2
Post by: dree12 on April 22, 2012, 09:03:18 am
Ive found a minor bug!

When you embark on a Dirt road built by the dwarf (or humans, i dont know...) and use regrass, grass will grow on top of the road.

Trees and bushes cant grow where the road was.

From the viewpoint of regrass, a dirt road is simply a spot where there is soil but no grass, so it will regrow grass there. When you tell your dorfs ingame to build a dirt road all they will do is remove the grass there and after a while that tile will get re-claimed by the game and grow grass maybe even a tree/shrub... But if you have a savegame where you embarked on a dirt road and it's regrassed and no trees/shrubs grow on it after observing it for a couple of years, please upload it... it might be possible that dirt roads you embarked on are some weird special case.
Human dirt roads are never reclaimed by the game, so they must have a flag or something. I've found that this occurs very frequently and a save game probably isn't useful.
Title: Re: DFHack 0.34.07 r2
Post by: Rumrusher on April 22, 2012, 03:46:25 pm
Ok, I made it work. But three things.

[1]
I had to alter the code because for reason unknown no unit was retrieved when using
getCreatureAtPos(getxyz)

and yes, the cursor was on a dwarf, and he was the unique entity of the tile.

So I altered it with
unit=getSelectedUnit()
using V to select a dwarf, it worked.

Do you know why there was a problem?

[2]
Second, using the command is quite convoluted. For people wanting to use it and want a step by step, you have to activate DFusion by typing DFusion in the DFHack console. Then you are presented with a menu, the new command is in tools, so your type (2). Then you have a list of available commands, warp is (6) for me, so I type (6). And then I can operate the command... Once the command activates, I'm back to the first menu...

Any possibility to have a less convoluted way of using the command, ideally like just typing 'warp' in DFHack, or at worse when DFusion is active?

In any case, big thanks to you, this will change my life... Now if there is a stuck dorf, I can unstuck him.

[3]
About the glitch, a data not cleared on occupancy, is the glitch on the source tile or the target tile? If on the target tile, I can always use the same destination tile, knowing the tile is now 'screwed', this will be my 'dump tile'... If on the source, this can be more problematic indeed.
okay [1] warp was ported over from my adventure_tools folder though originally was meant to be universal for getSelectedUnit doesn't work well in adventure mode due to lack of V button.
so it's news to me that the other way to select folks doesn't work. testing okay it works in fort mode, did you place the X pointer on top of the creature you want to select? because that line of code checks for position of the creature and the pointer and if it matches up the creature will be selected.
[2] dfhack made this even more convoluted given that old dfusion saved the command inputs thus repeating a function was just scrolling up. I think someone made a plugin that just reads the function of dfusion folder and you just need to type out the name.
[3]source of (original)tile not target(IE the spot you wanted the creature to warp to).
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on April 22, 2012, 06:29:59 pm
Trying to fix my [PRINT_MODE:TEXT] problem so I cloned dfhack and compiled it, without changes yet, to make sure building works before I start editing code.

Everything builds fine, with some warnings about tile_designations.h and enums that I hope are not relevant to my interests.  But when I run dfhack I get:
Code: [Select]
./libs/Dwarf_Fortress: /home/ubu/Downloads/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
But I'm looking right at the file:
Code: [Select]
ubu@ubu-PX790AA-ABA-SR1511NX-NA530:~/Downloads/df_linux/libs$ ls -al
total 20936
drwxr-xr-x 2 ubu ubu     4096 2012-03-30 06:27 .
drwxr-xr-x 8 ubu ubu     4096 2012-04-22 18:14 ..
-rwxr-xr-x 1 ubu ubu 14669276 2012-03-30 06:27 Dwarf_Fortress
-rw-r--r-- 1 ubu ubu   466491 2012-03-30 06:27 libgcc_s.so.1
-rwxr-xr-x 1 ubu ubu  1435396 2012-03-30 06:27 libgraphics.so
-rwxr-xr-x 1 ubu ubu  4852343 2012-03-30 06:27 libstdc++.so.6

What am I missing?  I'm on Ubuntu 11.10 32bit.  Fresh install of df_linux, haven't even edited the inits yet.
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on April 22, 2012, 09:48:13 pm
Bump, some research leads me to think I'm using the wrong version of gcc.
Currently I'm using gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1

Anyone know what version I should be using? 

Edit: Nevermind, used 4.5 and it works fine.  Now for some coding.
Title: Re: DFHack 0.34.07 r2
Post by: ag on April 23, 2012, 02:47:23 am
Everything builds fine, with some warnings about tile_designations.h and enums that I hope are not relevant to my interests.

Those warnings are a gcc bug in a way. In earlier versions they actually made sense (and therefore didn't appear), but in the current one they are broken.

Code: [Select]
./libs/Dwarf_Fortress: /home/ubu/Downloads/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)

That copy of libstdc++ works only for gcc versions up to a certain point. If you use a newer one, you have to delete it so it falls back to the one in your system.
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on April 23, 2012, 06:48:21 am
Thanks for the reply.  Yeah, switching to gcc 4.5 fixed my problems including the enum one.  Which did turn out to be my problem.  'prospect all' was reporting there were 1.5 million tiles of "IRON" which seemed iffy.

Now I've got [PRINT_MODE:TEXT] and dfhack running together, I can't use the function keys to zoom.  I can use them for dfhack commands like follow.  But plain zooming doesn't work. 

I'm headed back to the source code with a bottle of Mountain Dew in hand.  Wish me luck.
Title: Re: DFHack 0.34.07 r2
Post by: Alexander86 on April 23, 2012, 08:48:21 pm
I'm having a problem with the liquids command. Ok, what I want to do is setup a great tower made out of obsidian so i change it to 'o' then set my ranges say 100 100 and 20 Z's high. This is on the ground level btw. So instead of making this solid tower straight up it only does the base floor and a part of the second floor, whats worse is that you can't just go up to the next level and try to fill in the rest it just won't work. but it works perfectly as long as its underground up until it gets to above ground then it has the same problem and there's plenty of levels of sky above so that's not the problem I haven't tried doing the same with the tile types command because frankly it confuses the hell out of me. Can anyone help me out?

Tl:dr liquids command refuses to make giant tower of obsidian.
Title: Re: DFHack 0.34.07 r2
Post by: Rose on April 23, 2012, 08:59:24 pm
The blocks in the sky don't actually exist yet till you build something there yourself first. you need to first make a stairway going up where you want the obsidian tower to be, then the space will be created for the tower.
Title: Re: DFHack 0.34.07 r2
Post by: Alexander86 on April 23, 2012, 09:08:10 pm
So just build a XX  straight up 20 z levels and then that'll work? Going to try it out now, thanks a lot.
                    XX
Title: Re: DFHack 0.34.07 r2
Post by: Rose on April 23, 2012, 09:16:33 pm
yeah, just remember that the map is devided into 16x16 sections (3x3 per embark square) and each one needs to be initialized like this.
Title: Re: DFHack 0.34.07 r2
Post by: Alexander86 on April 23, 2012, 09:34:58 pm
sweet, that worked like a charm. I just put an up down stair every 10 spaces in every direction and put them up 10 levels, worked perfectly. Thanks again this (i thought bug) had been bothering me for a long time.
Title: Re: DFHack 0.34.07 r2
Post by: Rumrusher on April 24, 2012, 12:51:13 am
okay for adventurers who had issues with bogeymen here's a command that makes them less hostile.
Code: [Select]
function advancenames(unit)--for naming units
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
entry=getline()
unit.name.first_name=entry
end
tools.menu:add("NameGenerator",advancenames)
function tools.Civedit(unit) --use this on bogey and they will calm down.
--local myoff=offsets.getEx("AdvCreatureVec")
--local vector=engine.peek(myoff,ptr_vector)
print("Self or at position? (s or anything else):");
local r=getline()
local unit
if r=="s" or r=="S" then
unit=df.global.world.units.other[0][0]
else
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
unit.civ_id=1
end
end
tools.menu:add("ChangeCiv",tools.Civedit)

Though you need to have the yellow x pointer on top of the creature to make it work.
Title: Re: DFHack 0.34.07 r2
Post by: WillowLuman on April 24, 2012, 12:53:15 am
Is there a utility for measuring the populations of creatures on a map?
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on April 24, 2012, 04:10:11 am
Is there a utility for measuring the populations of creatures on a map?

reveal the map and hit (u), at least in dwarf mode
Title: Re: DFHack 0.34.07 r2
Post by: WillowLuman on April 24, 2012, 07:52:46 pm
Was trying to check to see if anyone died while I was out of town in adventure mode.
Title: Re: DFHack 0.34.07 r2
Post by: Talvieno on April 24, 2012, 08:03:16 pm
A bit curious - what was the reason df2minecraft got taken out? Did it not work yet with the newer versions, or is it being dropped permanently?
Title: Re: DFHack 0.34.07 r2
Post by: Rose on April 24, 2012, 10:17:36 pm
It got to the point that it would be easier to write it from scratch than to update it to the latest version
Title: Re: DFHack 0.34.07 r2
Post by: slink on April 26, 2012, 10:23:55 am
What could be causing the errors below when I invoke stonesense?  I am using dfhack-0.34.07-r2-Windows, and have tried deleting and re-extracting the stonesense directory.  It has happened with every fortress in 34.07.  If I invoke and quit stonesense several times, it crashes DF.

stonesense\buildings\Shop.xml: <building> Is generic - game_subtype missing.: building (Line 5)
stonesense\buildings\Blueprint.xml: <building> Is generic - game_subtype missing.: building (Line 5)

sometimes followed by

backbuffer w, h: 1916, 1001

and occasionally by

Cannot load image: stonesense\creatures\large_256\dwarff.png
Cannot load image: stonesense\creatures\large_256\dwarff.png
Cannot load image: stonesense\creatures\large_256\dwarff.png
Cannot load image: stonesense\creatures\large_256\dwarff.png
Cannot load image: stonesense\creatures\large_256\dwarff.png
Title: Re: DFHack 0.34.07 r2
Post by: Rose on April 26, 2012, 10:54:12 am
open stonesense/creatures/index.txt, and remove the first line, that says large_256/index.txt. This is the line that tells stonesense to load the really big creature sprites that take a lot of video memory. If you have an older videocard, you won't be able to load them.
Title: Re: DFHack 0.34.07 r2
Post by: slink on April 26, 2012, 12:42:03 pm
That will surely get rid of the occasional large_256 error, but it has not changed the xml errors.  These do not occur in 34.05 DF andf DFHack, but stonesense in 34.05 thinks two vanilla shops are custom (soapmaker and screwpress).  Could these be the buildings that 34.07 is giving errors for?
Title: Re: DFHack 0.34.07 r2
Post by: Rose on April 26, 2012, 12:46:26 pm
Soapmaker and screwpress /are/ custom, though, in the sense that they are loaded from the raws.

why, is it giving you lip about them?
Title: Re: DFHack 0.34.07 r2
Post by: slink on April 26, 2012, 02:33:41 pm
In 34.05 was it saying they were custom, but not in red text.  Just letting me know for some reason, I guess.  I was thinking the two red-text xml errors in 34.07 might be due to them, somehow.  I have no better reason to think so than that two equals two, which is not much of a reason.
Title: Re: DFHack 0.34.07 r2
Post by: Rose on April 26, 2012, 02:40:54 pm
Nah, those two red text errors really shouldn't be errors. they should be logged when verbose logging is on, but that's about it.
Title: Re: DFHack 0.34.07 r2
Post by: peterix on April 26, 2012, 03:32:29 pm
Quote
There's no real documentation and the only example so far is dfhack-run.cpp - your best bet is to look at that and at the mentioned Remote* files. A bit can be understood by looking at the rename plugin, which extends the core protocol with some of its functions - look for "plugin_rpcconnect" in plugins/rename.cpp.
This looks great for C-based clients. But I don't think DFHack's RPC functions, as implemented, can be compatible with Java clients. This is because Java RPC clients rely on a service library compatible with the server. DFHack's RPC service appears to be homebrewed--I did not find any Java service library compatible with the style of function stubs it uses. (The stream object getting passed around in DFHack, seems to be the most serious hurdle here. Passing back return values as function arguments may be a problem, too.) Writing this Java service library from scratch would not be trivial.

This is disappointing, because I was quite hopeful that my Java application could make use of some functions in RemoteTools, especially SetUnitLabors().

Is there any intention of DFHack supporting Java client RPC in the future? I didn't see anything like "// Let's only support C/C++/C#!" when studying the code, which leaves me vaguely hopeful.

I know I can theoretically just write my own C++ middle-man to do RPC with DFHack, using protobufs service (or whatever) to talk to my Java app. (That would be a less intense headache than the other option, for me.) This could manage passing information between DFHack and my Java client. But in reality I doubt I would ever go this far. (This feature is not critical enough to the main function of my cross-platform application, to justify repeating any past "fun" I've had cross-platforming with C++.)

Well. Where to begin?

You send messages to DF and you get messages back (when it doesn't crash :P). It's a network protocol. I don't want it to be bogged down with anything that implements any kind of RPC spec or conforms to anything with more than a few A4 pages worth of documentation required. And honestly, I'd much rather have just registered event handlers that can process and respond to *versioned* messages instead of actual 'procedure calls'. So this stuff may change when I actually start looking at it.

There's no part of this protocol that would prevent you from using it from any language with:

Take a look at this for inspiration:
https://github.com/wjrogers/HeavyDuck.DF.DwarfDuck

I'm not sure how complete it is, but it's in C#, which should be reasonably close to Java (the DFHack protocol part is relevant).
Title: Re: DFHack 0.34.07 r2
Post by: Antalia on April 27, 2012, 07:42:04 am
Quote
Well. Where to begin?

You send messages to DF and you get messages back (when it doesn't crash :P). It's a network protocol. I don't want it to be bogged down with anything that implements any kind of RPC spec or conforms to anything with more than a few A4 pages worth of documentation required. And honestly, I'd much rather have just registered event handlers that can process and respond to *versioned* messages instead of actual 'procedure calls'. So this stuff may change when I actually start looking at it.

There's no part of this protocol that would prevent you from using it from any language with:
  • Basic protobuf implementation. It's hard to find a language with no protobuf suport.
  • TCP sockets.

Take a look at this for inspiration:
https://github.com/wjrogers/HeavyDuck.DF.DwarfDuck

I'm not sure how complete it is, but it's in C#, which should be reasonably close to Java (the DFHack protocol part is relevant).
I'm sorry, I must not have set out my question properly :)

Using TCP sockets in Java is easy.
And using protobufs objects in any language is easy.
These things I know :)

Sending a C struct as part of a handshake from Java to a procedure running in another language is not easy or trivial. (I might wager that's a reason libraries like protobufs exist.)
Sending a C stream object to a remote procedure call from Java is not trivial, either.
(The underlines are what I was concerned about. It seems odd to use protobufs if we'll have to delve into JNI to deal with the handshake and all the function calls anyway, from my side of things.)

Anyway I just wanted to clarify what I meant to ask--I don't require remedial help understanding sockets or protobufs. :) I suppose the answer is clear either way. For me, unless I find time to master JNI, my application won't be bothering with this. (It would have been nice, but it's not a big deal in any way.) Thanks for your guidance :)
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on April 27, 2012, 08:14:47 am
Sending a C struct as part of a handshake from Java to a procedure running in another language is not easy or trivial. (I might wager that's a reason libraries like protobufs exist.)
You're drastically exaggerating the complexity of the handshake "structure" - it's nothing more than an 8-byte character array and a 4-byte integer.
Sending a C stream object to a remote procedure call from Java is not trivial, either.
There are no "remote procedure calls" going on here, so this concern is completely irrelevant - all you are doing is constructing protobuf objects, serializing them, and pushing them across the TCP socket, at which point the DFHack server unserializes them, calls the appropriate local functions to do the work requested, then constructs a protobuf "reply" object and sends it (serialized) back to you over the TCP socket (which you then receive, unserialize, and interpret to get your results).

For me, unless I find time to master JNI, my application won't be bothering with this.
If you think JNI is required, then you've significantly misunderstood how this interface works - see above.
Title: Re: DFHack 0.34.07 r2
Post by: ag on April 27, 2012, 08:21:56 am
Sending a C stream object to a remote procedure call from Java is not trivial, either.
There are no "remote procedure calls" going on here, so this concern is completely irrelevant - all you are doing is constructing protobuf objects, serializing them, and pushing them across the TCP socket, at which point the DFHack server unserializes them, calls the appropriate local functions to do the work requested, then constructs a protobuf "reply" object and sends it (serialized) back to you over the TCP socket (which you then receive, unserialize, and interpret to get your results).

And 'sending' that 'C stream' consists entirely in expecting to receive zero or more additional messages with text data before the main reply if something is written to it on the server.
Title: Re: DFHack 0.34.07 r2
Post by: DrKillPatient on April 27, 2012, 11:15:57 pm
I recently switched from Arch to Debian, and I'm having some issues building DFHack. When I run
Code: [Select]
cmake .. -DCMAKE_BUILD_TYPE:string=Relase -DCMAKE_INSTALL_PREFIX=(my DF folder)
I get:
Code: [Select]
CMake Error at depends/protobuf/CMakeLists.txt:60 (MESSAGE):
  Could not find a working has map implementation. Please update GCC.

-- Could NOT find Threads (missing: Threads_FOUND)
-- Configuring incomplete, errors occurred!

I have lib32gcc1 and GCC 4.4. Before I go on a wild goose chase and try to get a higher version of GCC from unofficial repositories... am I doing something wrong here already? Or is my version of GCC really insufficient?

EDIT: I should note that I am running 64-bit Debian stable/Squeeze/6.0.
Title: Re: DFHack 0.34.07 r2
Post by: ag on April 28, 2012, 01:02:15 am
Code: [Select]
CMake Error at depends/protobuf/CMakeLists.txt:60 (MESSAGE):
  Could not find a working has map implementation. Please update GCC.

EDIT: I should note that I am running 64-bit Debian stable/Squeeze/6.0.

That error usually means you don't have all necessary 32-bit development libraries installed. Check stuff like libstdc++ and so on.
Title: Re: DFHack 0.34.07 r2
Post by: DrKillPatient on April 28, 2012, 01:57:07 am
Thank you. The missing package turned out to be g++-multilib. However, although cmake completes, it still warns "could not find threads". I suspect this causes the remaining problem: when I make dfhack, I get this:
Code: [Select]
libprotoc.so: undefined reference to 'pthread_once'
collect2: ld returned 1 exit status

I needed lib32z-dev to get past an error before this, but now I can't find any references to the library necessary to fix the thread issues.

EDIT: Oh hell. From CMake's error log:
Code: [Select]
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directoryI have libc6-dev-i386. and /usr/include/gnu/stubs-32.h actually exists. I've no idea what's causing this to happen...
Wait, that's not recent. I'm completely stumped now.
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on April 28, 2012, 04:50:23 am
I just built dfhack last week.  Used gcc/g++ 4.5.  Using 4.6 gave me a bunch of errors.  I am on 32bit Ubuntu Oneiric.

From COMPILE.rst "For building, you need a 32-bit version of GCC. For example, to build DFHack on a 64-bit distribution like Arch, you'll need the multilib development tools and libraries."

Wish I could be more help.
Title: Re: DFHack 0.34.07 r2
Post by: peterix on April 28, 2012, 10:10:10 am
Thank you. The missing package turned out to be g++-multilib. However, although cmake completes, it still warns "could not find threads". I suspect this causes the remaining problem: when I make dfhack, I get this:
Code: [Select]
libprotoc.so: undefined reference to 'pthread_once'
collect2: ld returned 1 exit status

I needed lib32z-dev to get past an error before this, but now I can't find any references to the library necessary to fix the thread issues.

EDIT: Oh hell. From CMake's error log:
Code: [Select]
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directoryI have libc6-dev-i386. and /usr/include/gnu/stubs-32.h actually exists. I've no idea what's causing this to happen...
Wait, that's not recent. I'm completely stumped now.
Looks like broken multilib support or some packaging issue. Are you sure you have all the multilib gcc packages?
Title: Re: DFHack 0.34.07 r2
Post by: DrKillPatient on April 28, 2012, 01:37:48 pm
It appears that CMake was confused due to all the packages I ended up installing as I went along. I deleted, redownloaded, and re-CMake'd (cmade?) DFHack, and it found strings this time. I needed to install another package, libxml-libxslt-perl, to continue the process shortly after.

As a resource to future readers who use Debian, I'll try to list all the packages I needed to build dfhack:
Code: [Select]
ia32-libs
ia32-libs-gtk
gcc-4.4-multilib
g++-4.4-multilib
libxml-libxml-perl
lib32z-dev
libxml-libxslt-perl

I may have missed some that I used earlier, because I had to install several multilib libraries to get DF working as well (tutorial here (http://blog.isja.org/index.php?/archives/81-Setting-up-Dwarf-Fortress-in-64bit-Debian.html), by the way).
Title: Re: DFHack 0.34.07 r2
Post by: Captain Crazy on April 29, 2012, 01:49:36 am
Sorry to pop in the midst of this discussion, but is there any repositories for cool DFusion plugins?

Also, is there plugins to restore those old dummied out Mountain Halls and Goblin towers from early versions?
Title: Re: DFHack 0.34.07 r2
Post by: DrKillPatient on April 29, 2012, 12:31:51 pm
Most of DFHack's plugins seem to work nicely now, but have one more issue. The Stonesense plugin, when started, just pops up a window called "Dwarf_Fortress" and sits there blankly. I can't find any sort of errorlog (I don't think stonesense.log was generated), so unfortunately that's all I can say about the problem. How can I at least get it to show some errors?


Sorry to pop in the midst of this discussion, but is there any repositories for cool DFusion plugins?

Also, is there plugins to restore those old dummied out Mountain Halls and Goblin towers from early versions?

Not sure about DFusion plugins, however, with regards to recreating the Mountain Halls and such, I think there's no way to do it with just a plugin. The only fix you might do is to change the goblin/dwarf/elf entity raws so that they live in towns like humans, and not their normal towers/halls/retreats.
Title: Re: DFHack 0.34.07 r2
Post by: ZZmage on April 29, 2012, 11:30:10 pm
Hey i've noticed something interesting on an empty magma forge that has had a lot of stuff constructed at it if you hit the changeitem here it registers stuff thats no longer there is this a thing of dwarf fortress not clearing memory on that tile or could it be something else? cause if you deconstruct the magma forge or any building thats shoing items in changeitem here info the center tile will still register it.
Title: Re: DFHack 0.34.07 r2
Post by: Rumrusher on April 30, 2012, 01:40:20 am
Sorry to pop in the midst of this discussion, but is there any repositories for cool DFusion plugins?

Also, is there plugins to restore those old dummied out Mountain Halls and Goblin towers from early versions?
hmm well that takes someone to bring them back. also here the thread for dfusion's dfhack plugin (http://www.bay12forums.com/smf/index.php?topic=93317.0)
Title: Re: DFHack 0.34.07 r2
Post by: Intrinsic on April 30, 2012, 08:22:27 am
Hey i've noticed something interesting on an empty magma forge that has had a lot of stuff constructed at it if you hit the changeitem here it registers stuff thats no longer there is this a thing of dwarf fortress not clearing memory on that tile or could it be something else? cause if you deconstruct the magma forge or any building thats shoing items in changeitem here info the center tile will still register it.

If this is the case maybe it's one of the reasons why DF starts to get slower and slower over time in a fort?
Title: Re: DFHack 0.34.07 r2
Post by: Jeoshua on April 30, 2012, 08:39:37 am
It gets slower and slower over time because there are more... More Dwarves, More Items, More Corpses, More Ghosts, More History, More Stones, More ways to Path, More dug out tiles, More relationships, more more more more more.

And just about everything gets processed every "tick"
Title: Re: DFHack 0.34.07 r2
Post by: TDSS02 on April 30, 2012, 09:56:48 am
Hello everyone, sorry for posting in this thread but i just had a quick question. I'm so used to DfHack being integrated into the Lazy Newb Pack and for some reason it doesn't show up in the "advanced version" of the lazy newb pack. So i was wondering if someone can help me get this working without Lazy Newb Pack or help me integrate it into LNP because i just cant get the darn thing to work.  ???

Thanks in advance
Title: Re: DFHack 0.34.07 r2
Post by: Rose on April 30, 2012, 10:04:38 am
Download it, extract it over your DF folder, run df.
Title: Re: DFHack 0.34.07 r2
Post by: TDSS02 on April 30, 2012, 10:22:30 am
It will automatically launch dfhack when i start DF?
Title: Re: DFHack 0.34.07 r2
Post by: Jeoshua on April 30, 2012, 10:24:31 am
It replaces SDL.dll, which runs then DFHack automatically.

So, yes.
Title: Re: DFHack 0.34.07 r2
Post by: TDSS02 on April 30, 2012, 10:25:45 am
Awesome, thank you both, sorry for the newb question but now i know  8)
Title: Re: DFHack 0.34.07 r2
Post by: Eric Blank on May 01, 2012, 08:26:57 pm
Is there a way to back out of a utility, like liquids, so I can use other functions again?
Title: Re: DFHack 0.34.07 r2
Post by: Rumrusher on May 01, 2012, 08:43:46 pm
Is there a way to back out of a utility, like liquids, so I can use other functions again?
Q or quit

edit: new function called "Buff reading" aka bare bone alter skills function.
Code: [Select]
function tools.buffreading(unit)
if unit==nil then
unit=getAdv()
end
print("which skill 0-?")
B=getline()
print("How much?")
r=getline()
unit.status.souls[0].skills[0+B].rating=r
end
tools.menu:add("Buff Reading",tools.buffreading)
Title: Re: DFHack 0.34.07 r2
Post by: Greiger on May 02, 2012, 12:32:55 pm
So fir the first time since the merge into the sdl file DFhack (this time stonesense) froze everything up.  And I see there is no longer a DFUnstuck or anything obvious that acts like it.  Is it just an oversight or is it impractical do have something like that now?
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 02, 2012, 12:48:22 pm
DFunstuck can no longer work at all, because of the way things are handled now.

This means if something crashes, it brings down DF, sadly.
Title: Re: DFHack 0.34.07 r2
Post by: kenpoaj on May 02, 2012, 10:33:55 pm
Changed a layer to fire clay, the clay is successfully gathered via a kiln, but can't be used to build. Is this a known bug, and is there a workaround?

couldn't find anything after 30 mins of searching, I assume it's related to the old obsidian casting without obsidian on the map bug though.
Title: Re: DFHack 0.34.07 r2
Post by: caddybear on May 03, 2012, 07:17:32 am
Hi, for some reason I have a migrant that will not show up on units screen, or indeed get inside the fort at all. He is not a merchant or trader, strangely enough so I wonder if there's a way to fix him. His wife is safely inside and working, and it would be a shame if he gets killed like that fisherman migrant that came last wave but didn't get in either.
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on May 03, 2012, 07:51:22 am
Changed a layer to fire clay, the clay is successfully gathered via a kiln, but can't be used to build. Is this a known bug, and is there a workaround?
Fire clay can be used in reactions (making stoneware), so it's flagged as an economic stone by default - the only reason you'd be able to build stuff out of it normally is because layer stones are automatically marked as non-economic under the assumption that there's more than enough to spare for mundane uses (in previous versions, this was only the case for flux and obsidian layers).
Title: Re: DFHack 0.34.07 r2
Post by: kenpoaj on May 03, 2012, 08:09:27 am
Thanks Quietust! I'll just find a place with it naturally occurring then I guess.
Title: Re: DFHack 0.34.07 r2
Post by: Graebeard on May 03, 2012, 08:53:34 am
Can you not manually allow it under the Stones menu?
Title: Re: DFHack 0.34.07 r2
Post by: kenpoaj on May 03, 2012, 09:36:31 am
Can you not manually allow it under the Stones menu?

It isn't listed there for me. probably since it wasn't naturally on the map to start.
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on May 03, 2012, 09:51:11 am
You should be able to enable it with a but of Lua trickery - "df.global.ui.economic_stone[N] = false", where N corresponds to the index for fire clay (obtaining said index is left as an exercise to the reader).
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 04, 2012, 07:20:01 am
Hi, for some reason I have a migrant that will not show up on units screen, or indeed get inside the fort at all. He is not a merchant or trader, strangely enough so I wonder if there's a way to fix him. His wife is safely inside and working, and it would be a shame if he gets killed like that fisherman migrant that came last wave but didn't get in either.
We think this is caused when a former trader decides to migrate to your fort; for some reason the "merchant" flag is not cleared from the unit.  In any case, "tweak fixmigrant" will fix this.
Title: Re: DFHack 0.34.07 r2
Post by: Greiger on May 05, 2012, 11:58:55 am
I think I may have found some kind of bug.  At first I thought it was only stonesense, but after doing a prospect and it saying I had marble (when in fact I do not...at least not in sight.  I noticed it seems to be DFHack in general.

It appears to be reporting layer materials wrong in my save. it is reporting schist as marble, white sand as clay loam, clay loam as silt...

Has anyone else found this?  If not I'll throw a save up.  Maybe something I modded is throwing stuff off.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 05, 2012, 12:12:47 pm
I think I may have found some kind of bug.  At first I thought it was only stonesense, but after doing a prospect and it saying I had marble (when in fact I do not...at least not in sight.  I noticed it seems to be DFHack in general.

It appears to be reporting layer materials wrong in my save. it is reporting schist as marble, white sand as clay loam, clay loam as silt...

Has anyone else found this?  If not I'll throw a save up.  Maybe something I modded is throwing stuff off.
There's a bug in ReadGeology a while back but I can't find the commit that fixed it right now.  Are you on r1 or r2?
Title: Re: DFHack 0.34.07 r2
Post by: Greiger on May 05, 2012, 12:40:04 pm
That sir is a very good question.

I want to say R2.  Since I have a backup file that calls itself "Backed up HackR1 Files".  Any way to tell for certain?
Title: Re: DFHack 0.34.07 r2
Post by: vjek on May 05, 2012, 03:55:51 pm
I promise I searched this forum and this thread, and didn't find this information, so I apologize for a duplication if there is one.

You can use tiletypes to change underground areas into "above ground" areas, for farming above ground crops deep underground, without all that messing about with channeling to expose the tiles.  Of course you still need mud/soil and the appropriate seeds gathered before planting will work.

You can change:
Inside   Dark   Subterranean
to
Outside   Light   Above Ground

Example:
Spoiler (click to show/hide)

That's it, enjoy your berries!  8)
Title: Re: DFHack 0.34.07 r2
Post by: UHaulDwarf on May 07, 2012, 11:14:02 pm
I cant get dfhack to run.
Something about ''MSVCP100.dll is missing from your computer''. What can I do?
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on May 08, 2012, 12:15:51 am
Did you copy the contents of the dfhack zip file into the df directory and replace the SDL.dll?

Because that's where MSVCP100.dll is.  In the df directory.
Title: Re: DFHack 0.34.07 r2
Post by: caddybear on May 08, 2012, 03:35:37 am
Thanks for the help by the way, I forgot to thank when you got back to me, sorry. Had other things in my mind. Great work and thanks again ( notice a pattern here? )
Without DFhack and Therapist this game would be less .. fun.
Title: Re: DFHack 0.34.07 r2
Post by: UHaulDwarf on May 08, 2012, 03:39:36 am
Did you copy the contents of the dfhack zip file into the df directory and replace the SDL.dll?

Because that's where MSVCP100.dll is.  In the df directory.
Ah, silly me thinking it should go in the utilities of LNP. Thanks.
Title: Re: DFHack 0.34.07 r2
Post by: Remadan on May 09, 2012, 05:12:47 am
Since clothes wear out now, it would be nice to have some kind of clothes check plugin:
It can show:
- how many dwarfs have enough clothes to prevent bad thoughts;
- how many of them have first stage worn clothes ( xPig tail shirtx );
- how many unclaimed/unforbidden clothes in fortress stockpiles.
Title: Re: DFHack 0.34.07 r2
Post by: vjek on May 09, 2012, 11:40:36 am
Since clothes wear out now, it would be nice to have some kind of clothes check plugin:
It can show:
- how many dwarfs have enough clothes to prevent bad thoughts;
- how many of them have first stage worn clothes ( xPig tail shirtx );
- how many unclaimed/unforbidden clothes in fortress stockpiles.

' cleanowned x dryrun '

will give you an idea.
similarly

' cleanowned scattered dryrun '

for clothing scattered about on the ground.

You can, if you want, cleanowned everything, which will be dumped into the nearest garbage dump.  Then re-claim all the dumped clothing, forbid what you don't want them to wear, and they'll put all that back into stockpiles and/or on their body.

Yes, it may be a few days of bad thoughts, but in my experience, they survive if they're ecstatic when you start.
' fastdwarf 1 ' also, of course, makes this go much faster. :)

If you only want them to wear the clothing you make, go into the stocks menu and dump everything that isn't made with pig tails or rope reed or silk or whatever you're making it from.  Then you can be sure they only have access to what you want them to wear, or at the very least, the list is much shorter.
Title: Re: DFHack 0.34.07 r2
Post by: theothersteve7 on May 09, 2012, 09:11:40 pm
If anyone is getting the "could not connect to localhost:5000" error, you may have extracted it into its own folder and are trying to run it separately.  When placed in the DF folder directly, it will start up with DF.

Figured it cost me a half hour so maybe this post will save someone else some time.  My bad, I thought I was too good for instructions again.   ::)
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 09, 2012, 09:24:57 pm
Yeah, the only exe file that comes with DFhack is just an example program that connects with DFhack and sends commands.
Title: Re: DFHack 0.34.07 r2
Post by: Hamek McEisenfaust on May 11, 2012, 07:26:00 am
I seem to be having an issue with R2, i believe. I downloaded the new listed version on the first page, and extracted it to my df directory. almost all of the plugins? are working, save the autolabor plugin, which was working, prior to downloading and 'installing' dfhack. the message when i attempt to start autolabor is ' the plugin is not enabled'. I am unsure how i go about starting the autolabor plugin. sorry if my search fu has failed me again. thanks for any assistance you can render.
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on May 11, 2012, 07:51:26 am
Did you do "autolabor 1"?
Title: Re: DFHack 0.34.07 r2
Post by: Hamek McEisenfaust on May 11, 2012, 07:58:16 am
Oh christ. That line is in the init. but it decided it did not want to run? yes, i ran the 'autolabor 1' and it initialized. thank you.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 11, 2012, 08:20:19 am
Putting "autolabor 1" in the init does no good, because the init is loaded when DFHack starts, which is when DF starts, not when your fortress is loaded.

I have a standard script that I run whenever I start a new fortress that sets up a bunch of stuff, that I run with the "script" command.  Autolabor, workflow, autobutcher, and autonestbox all persist their settings in the DF save file, so you only have to run these commands once, at fortress creation.
Title: Re: DFHack 0.34.07 r2
Post by: Hamek McEisenfaust on May 11, 2012, 08:26:48 am
Putting "autolabor 1" in the init does no good, because the init is loaded when DFHack starts, which is when DF starts, not when your fortress is loaded.

I have a standard script that I run whenever I start a new fortress that sets up a bunch of stuff, that I run with the "script" command.  Autolabor, workflow, autobutcher, and autonestbox all persist their settings in the DF save file, so you only have to run these commands once, at fortress creation.

Does this mean, when i save this fortress now that i have corrected the autolabor issue, and restart it, autolabor will kick in again and do what it is supposed to? Forgive me if im misunderstanding.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 11, 2012, 09:05:28 am
Putting "autolabor 1" in the init does no good, because the init is loaded when DFHack starts, which is when DF starts, not when your fortress is loaded.

I have a standard script that I run whenever I start a new fortress that sets up a bunch of stuff, that I run with the "script" command.  Autolabor, workflow, autobutcher, and autonestbox all persist their settings in the DF save file, so you only have to run these commands once, at fortress creation.

Does this mean, when i save this fortress now that i have corrected the autolabor issue, and restart it, autolabor will kick in again and do what it is supposed to? Forgive me if im misunderstanding.
Yes, when you save and then reload that fortress, autolabor will automatically restart when that fortress is loaded.  The same holds for autobutcher/autonestbox (both part of the "zone" plugin) and for workflow.
Title: Re: DFHack 0.34.07 r2
Post by: Hamek McEisenfaust on May 11, 2012, 12:13:43 pm
Sorry for all the questions firstly. I have another question regarding liquids this time. I have completed a rooftop area i want to turn into a pastureland for all my food animals. I have built the floor, and ran dfliquids to put a layer of water down, however, it is not creating mud/peat/earth, so i can run regrass to get some growing up there. Could someone assist me with a way to complete this? The gist is i want a rooftop pasture area that is secure from invaders. thank you for all of your assistance.
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 11, 2012, 12:48:01 pm
You need to let the water fall from one level above where you actually need it, so that it approaches the tile naturally,
Title: Re: DFHack 0.34.07 r2
Post by: vjek on May 11, 2012, 01:04:23 pm
Sorry for all the questions firstly. I have another question regarding liquids this time. I have completed a rooftop area i want to turn into a pastureland for all my food animals. I have built the floor, and ran dfliquids to put a layer of water down, however, it is not creating mud/peat/earth, so i can run regrass to get some growing up there. Could someone assist me with a way to complete this? The gist is i want a rooftop pasture area that is secure from invaders. thank you for all of your assistance.

It has to be flowing water.  Just evaporating water won't do it.

Myself, I do it this way.
For an 11x11 room, I use liquids to create three walls of water, each with a depth of 5.
So, say your entrance/exit to the room is on the east side of the room.
There will be FLOW across all the tiles in the middle, away from the walls.  This flow will create mud.
You'll end up with a mud on 90 tiles out of 121, with 10 tiles on the north wall clean, 10 tiles on the south wall clean, and 11 tiles on the west wall clean.  All 90 in the middle are now suitable for farming.  It also will evaporate in about one minute of real time, so you don't have to wait, you can start growing crops immediately.

Example:
Spoiler (click to show/hide)

(http://dl.dropbox.com/u/1339319/df-hamek.gif)

Here's an image to show what I'm describing.
1) Starting Room
2) dfhack liquids ready to unpause
3) after unpause, wait one minute for flowing to stop.
4) ready to farm/grow

If you don't put a farm on it, you'll start growing grass/moss immediately.
Title: Re: DFHack 0.34.07 r2
Post by: Hamek McEisenfaust on May 11, 2012, 01:58:53 pm
Thats exactly what im looking for, just enough water to start grass growing for the grazers on the top of my fort.. Greatly appreciated. Thank you
Title: Re: DFHack 0.34.07 r2
Post by: Sphalerite on May 11, 2012, 02:14:20 pm
Constructed floors don't grow grass.  You need to remove the floor, then create obsidian, and then mine out the obsidian to leave a natural stone floor.  Then muddy that to make a muddied stone floor that grass should grow on.
Title: Re: DFHack 0.34.07 r2
Post by: the_game_hunt on May 12, 2012, 08:28:39 am
How do I make permanent keybinds?

I want this:  V "digv"

Is there a way?
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on May 12, 2012, 10:48:09 am
How do I make permanent keybinds?

I want this:  V "digv"

Is there a way?

Look in the file dfhack.init-example.  First line is ctrl-V digv.  Name a file dfhack.init and put your bind in it.
Title: grow saplings/trees with help from tiletypes?
Post by: vjek on May 12, 2012, 12:48:11 pm
Question regarding saplings/trees and tiletypes.

I've done my best to recreate the conditions to grow saplings/trees...

normal "Ash Sapling":

[DFHack]# probe
block addr: 0x114fa330

tiletype: 231 = sapling
Class     :   14 SAPLING
Material  :    1 SOIL
Special   :    0 NORMAL
Variant   :   -1 NONE
Direction : --------

temperature1: 10045 U
temperature2: 10045 U
biome: 7
geolayer: 3
Layer material: 258 / PEAT /
hidden          =
light           = Y
outside         = Y
subterranean    =
water_table     =
rained          =
monster_lair    =
feature_local   =
feature_global  =
local feature idx: -1
global feature idx: -1
mystery: -1


My tiletype painted "red S" sapling:

[DFHack]# probe
block addr: 0x11b262d8

tiletype: 231 = sapling
Class     :   14 SAPLING
Material  :    1 SOIL
Special   :    0 NORMAL
Variant   :   -1 NONE
Direction : --------

temperature1: 10045 U
temperature2: 10045 U
biome: 4
geolayer: 3
Layer material: 258 / PEAT /
hidden          =
light           = Y
outside         = Y
subterranean    =
water_table     =
rained          =
monster_lair    =
feature_local   =
feature_global  =
local feature idx: -1
global feature idx: -1
mystery: -1

---
So what am I missing?  Across the map, depending on the type of sapling, the biome will be different, but I can't see anything else different.  It seems I'm missing something fundamental, so if anyone can shed some light on this, please do!

I've used tiletypes to create an area that grows grass as you would expect.  Grass pops up, can be burned, will re-pop up, everything is normal, for outdoor grass.  But I don't see any saplings and thusly no trees!  So, how to either manually place saplings (which I can do, but they show up as a red capital S) or paint the tiles so they will grow naturally?
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on May 12, 2012, 09:19:33 pm
The problem is that you forgot to create a plant object, fill in the proper fields, and add it to the appropriate vectors (global:world.plants.all, global:world.plants.other[n], and map_block.plants), since that's what determines the species of the plant, how much longer it'll take to grow up, and even its name (back in older versions of DF, trees and shrubs in Elven forest retreats all had names).
Title: Re: DFHack 0.34.07 r2
Post by: TheCoolSideofthePIllow on May 14, 2012, 01:15:54 am
I am curious; can you REMOVE squares with TileTypes?

I tried making walls of air, but that didn't work. Off that it accepts PAINT MATERIAL AIR as a valid type, but doesn't seem to do anything.

EDIT: Figured it out.

paint shape empty
paint material air
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on May 14, 2012, 04:01:36 am
I am curious; can you REMOVE squares with TileTypes?

I tried making walls of air, but that didn't work. Off that it accepts PAINT MATERIAL AIR as a valid type, but doesn't seem to do anything.

I hope you don't mind, but the sparkly white edges of your avatar were bugging me, so I edited them out.

(http://s19.postimage.org/4arxu0q9r/remap.gif)

Also I don't have an answer to your question. :)
Title: Re: DFHack 0.34.07 r2
Post by: MagmaSolutionsInc on May 14, 2012, 08:34:44 am
oh, for autosquishwithminecart now that 34.08 is out ...  ;D
Title: Re: DFHack 0.34.07 r2
Post by: the_game_hunt on May 14, 2012, 10:53:09 am
What would be faster, a full speed minecart or a fastdwarf?
Title: Re: DFHack 0.34.07 r2
Post by: Enki on May 14, 2012, 12:00:31 pm
Anyone got an idea how long it will take for DFHack to support 0.34.08? Sorry if this might seem like I am demanding stuff though it is the first time for me to need an update on a mod for DF ;)
Oh, and thanks for the good work. I love to digcircles :)
Title: Re: DFHack 0.34.07 r2
Post by: Girlinhat on May 14, 2012, 01:55:22 pm
As usual, the DFHack monkeys know about the update, and will be working.  Just leave them to it.
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 14, 2012, 07:15:02 pm
There's a lot of changes in the game this time around, all of which need to be found.

I'm as antsy as you are.

I need my autolabor.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 14, 2012, 10:18:01 pm
As of now, DFHack compiles, and does not immediately cause DF to crash, but there are still many things that don't work.  Progress is being made, at least.  Japa will be especially pleased to know that autolabor works.
Title: Re: DFHack 0.34.07 r2
Post by: Meph on May 14, 2012, 11:26:03 pm
Just take your time guys. :) I will wait with the update of my mod till you are done as well. No pressure :P
Title: Re: DFHack 0.34.07 r2
Post by: TheCoolSideofthePIllow on May 15, 2012, 12:23:54 am
I can't go back to my fortress until I can fix the tiletypes mistake I made. :(
Title: Re: DFHack 0.34.07 r2
Post by: orius on May 15, 2012, 02:26:27 am
There's a lot of changes in the game this time around, all of which need to be found.

I'm as antsy as you are.

I need my autolabor.

How's Stonsense doing?  Has Caldfir's work on the high-res dwarves been finished?  I'm still using the old dwarf sprites because the forts look a bit off with an all-male population.
Title: Re: DFHack 0.34.07 r2
Post by: AO on May 15, 2012, 03:13:27 am
How's Stonsense doing?  Has Caldfir's work on the high-res dwarves been finished?  I'm still using the old dwarf sprites because the forts look a bit off with an all-male population.
Caldfir's dwarves look rather complete and were merged to main version according to Github. So they should be in the next DFhack release.
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 15, 2012, 03:44:14 am
I've also done some experimentation with rendered tiles, and they look decent, but would need a bit of work to be complete.
Title: Re: DFHack 0.34.07 r2
Post by: Siquo on May 15, 2012, 05:01:42 am
PTW because anxiously waiting for .08...
Title: Re: DFHack 0.34.07 r2
Post by: the_game_hunt on May 15, 2012, 11:35:24 am
digv... Im dying...digv........
the_game_hunt has bled to death
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on May 15, 2012, 12:25:38 pm
The new version was just released yesterday, and it takes time to find the data structure offsets and update the various structure layouts.

Quit being so impatient.
Title: Re: DFHack 0.34.07 r2
Post by: the_game_hunt on May 15, 2012, 12:44:48 pm
The new version was just released yesterday, and it takes time to find the data structure offsets and update the various structure layouts.

Quit being so impatient.
I never said GIVE ME THE UPDATE NAW!, I just said I missed the digv plugin  >:(
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 15, 2012, 01:05:47 pm
I never said GIVE ME THE UPDATE NAW!, I just said I missed the digv plugin  >:(
If you want it that bad, pull the sources from github and build it yourself.  As of last night, digv was working, at least in my copy.  (There are still things that don't work quite right.)
Title: Re: DFHack 0.34.07 r2
Post by: the_game_hunt on May 15, 2012, 01:12:34 pm
I never said GIVE ME THE UPDATE NAW!, I just said I missed the digv plugin  >:(
If you want it that bad, pull the sources from github and build it yourself.  As of last night, digv was working, at least in my copy.  (There are still things that don't work quite right.)
I have no hurry.
Title: Re: DFHack 0.34.07 r2
Post by: drvoke on May 15, 2012, 01:58:57 pm
I think what people are trying to do is communicate how important this utility has become to their Dwarf Fortress experience.  It's not about harassing any of the active developers to give it up right now.  Like most of us, the developers of the project have other responsibilities (work, school, etc...). We just really miss the utils when they're gone, and many of us don't have the wherewithal to set up an environment for compiling them ourselves.

Anyway, good work, looking forward to the .08-compatible versions.  Missing prospect and digv the most, personally, but I'm making do with just Therapist and Legends Viewer for now.
Title: Re: DFHack 0.34.07 r2
Post by: Gaybarowner on May 15, 2012, 02:29:42 pm
someone explain how to use it i put it in the DF folder but no dice ;/
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 15, 2012, 02:30:36 pm
which DFhack? which DF?
Title: Re: DFHack 0.34.07 r2
Post by: Gaybarowner on May 15, 2012, 02:34:14 pm
latest one i try to open reveal and i get this error and it crashes ;_;
Title: Re: DFHack 0.34.07 r2
Post by: ClkWrkJester on May 15, 2012, 02:52:18 pm
I never realized how much I was using DFHack as a crutch. I still would like prospector so I can tell if my maps going to give me iron or if I go to war in bronze, but the lack of auto dump, liquid, etc, has made me really step up my game. Especially in this haunted location.  So. When its done awesome, but no rush. =D
Title: Re: DFHack 0.34.07 r2
Post by: Hammerstar on May 15, 2012, 03:28:45 pm
latest one i try to open reveal and i get this error and it crashes ;_;
If you're using the DF 34.08 (the newest one), then DFHack isn't compatable with it yet.
Title: Re: DFHack 0.34.07 r2
Post by: Meph on May 15, 2012, 04:42:00 pm
Well, for me it is important for reveal and prospect, otherwise modding would be a lot more difficult. Same goes for fastdwarf 1 for testing forts...

Besides that I offer it in a download package, and like to include it for the people... mostly for bugfixes, cleanmap and such.
Title: Re: DFHack 0.34.07 r2
Post by: Draevos on May 15, 2012, 04:51:55 pm
The workflow functions are a must for me. I like not having to remember to check drink and food every 30 seconds.

Also for Masterwork^  :P
Title: Re: DFHack 0.34.07 r2
Post by: Weaselcake on May 15, 2012, 06:12:25 pm
So.

Is the OP dead? Where the hell is my update..?
Title: Re: DFHack 0.34.07 r2
Post by: hikkiko on May 15, 2012, 06:48:54 pm
So.

Is the OP dead? Where the hell is my update..?

Your update? Probably it was compiled and I hope you'll test it and if there is no bugs - upload it... I think everyone there would be happy to know there is somebody who can do it faster and better!
Title: Re: DFHack 0.34.07 r2
Post by: dragginmaster on May 15, 2012, 08:34:42 pm
So.

Is the OP dead? Where the hell is my update..?

So demanding. Such a sense of entitlement.

You must be a democrat.

All joking aside, stfu and use some manners.
Title: Re: DFHack 0.34.07 r2
Post by: EmeraldWind on May 15, 2012, 08:42:09 pm
So.

Is the OP dead? Where the hell is my update..?

So demanding. Such a sense of entitlement.

You must be a democrat.

All joking aside, stfu and use some manners.
Dear sir, I do believe that is a mandate.

You know what we do with mandating nobles in these here parts?
We give you your own room with climate control installed. If it gets to cold, just pull the lever in the corner...  :P
Title: Re: DFHack 0.34.07 r2
Post by: TerryDactyl on May 15, 2012, 10:19:56 pm
Warning! May contain traces of: irony.
Title: Re: DFHack 0.34.07 r2
Post by: danaris on May 16, 2012, 09:07:37 am
OK...I have downloaded the latest with git and built it with MSVC++ 2010 Express, as was suggested, and it says that it doesn't recognize the current DF version.

Was there something else I was supposed to do besides follow the instructions on the Compile page?
Title: Re: DFHack 0.34.07 r2
Post by: the_game_hunt on May 16, 2012, 09:13:53 am
Correct use of Quietust message:
So.

Is the OP dead? Where the hell is my update..?

The new version was just released yesterday, and it takes time to find the data structure offsets and update the various structure layouts.

Quit being so impatient.

Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 16, 2012, 09:17:50 am
OK...I have downloaded the latest with git and built it with MSVC++ 2010 Express, as was suggested, and it says that it doesn't recognize the current DF version.

Was there something else I was supposed to do besides follow the instructions on the Compile page?

Yes, the one on peterix's branch is still the old version. You need to pull in the changes from a couple other repos that are more up to date.
Title: Re: DFHack 0.34.07 r2
Post by: danaris on May 16, 2012, 09:25:38 am
OK...I have downloaded the latest with git and built it with MSVC++ 2010 Express, as was suggested, and it says that it doesn't recognize the current DF version.

Was there something else I was supposed to do besides follow the instructions on the Compile page?

Yes, the one on peterix's branch is still the old version. You need to pull in the changes from a couple other repos that are more up to date.

Ah, OK.

Um...where do I find them?
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on May 16, 2012, 10:08:01 am
You'll need to use angavrilov/df-structures (https://github.com/angavrilov/df-structures/) instead of the default submodule.
Title: Re: DFHack 0.34.07 r2
Post by: Girlinhat on May 16, 2012, 10:24:08 am
latest one i try to open reveal and i get this error and it crashes ;_;
You don't "open reveal" anymore, it's run through a command prompt that launches alongside DF.  You can either run .07 with the current DFHack, or wait for it to update for .08.  Either way, the whole way that DFHack runs has been changes.  Forget everything you knew about how to run it and read the instal instructions again.
Title: Re: DFHack 0.34.07 r2
Post by: danaris on May 16, 2012, 10:28:19 am
You'll need to use angavrilov/df-structures (https://github.com/angavrilov/df-structures/) instead of the default submodule.

OK, I feel like a bit of a fool, but...how, exactly? The Readme included is a bit cryptic.

Is this a drop-in replacement for one of the pieces of peterix's dfhack, or do I have to use it to do various other processing before it will be of use?

Apologies for sounding like an idiot  :-[
Title: Re: DFHack 0.34.07 r2
Post by: sluggompopeye on May 16, 2012, 10:29:51 am
Lest you get too buried in the people snivelling, whining and demanding.  Please remember there are a lot of us non-programmers who can't do this stuff for ourselves and who are also grateful for all your hard work.  You make a great game even more enjoyable.  It is because your tools are so useful that we so eagerly await your next release.  Thank you for your efforts. 


Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 16, 2012, 10:32:56 am
open git bash

go to dfhack/library/xml

do
Code: [Select]
git remote add quietdust https://github.com/quietust/df-structures.gitThis one is currently slightly more up to date than angavrilov's one. If you want the one quietdust pointed to, do this:
Code: [Select]
git remote add angavrilov https://github.com/angavrilov/df-structures.gityou can right click on the title bar and do edit->paste.

then do
Code: [Select]
git pull quietdust master or
Code: [Select]
git pull angavrilov master, depending on which repo you added. (You can add both)

then build as normal.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 16, 2012, 11:13:46 am
You'll need to use angavrilov/df-structures (https://github.com/angavrilov/df-structures/) instead of the default submodule.

OK, I feel like a bit of a fool, but...how, exactly? The Readme included is a bit cryptic.

Is this a drop-in replacement for one of the pieces of peterix's dfhack, or do I have to use it to do various other processing before it will be of use?
The dfhack in peterix' repo should mostly work with angavrilov's df-structures; however, there is an array overrun in autolabor that might conceivably cause a crash or other misoperation.  (It was there in .07, but it was only one element due to the animal training job; it's now an overrun of five due to the four new hauling jobs.)  The version in my repo (https://github.com/ab9rf/dfhack/) has been patched for this, and also properly supports the five new jobs and one new labor added in .08. 

The only other problem I've encountered is annoyance-level: using DF zoom hotkeys generates harmless error messages in DFHack.  I don't build stonesense so I can offer no assurances as to whether it works.

Still, I'd wait until peterix merges the concurrent development before trying to use dfhack, unless you are fairly skilled at gitfu and know how to properly merge the various main and subordinate repositories into a working build environment.  It's not that hard, but I don't feel like trying to explain it just now.
Title: Re: DFHack 0.34.07 r2
Post by: danaris on May 16, 2012, 11:33:41 am
open git bash

go to dfhack/library/xml

do
Code: [Select]
git remote add quietdust https://github.com/quietust/df-structures.gitThis one is currently slightly more up to date than angavrilov's one. If you want the one quietdust pointed to, do this:
Code: [Select]
git remote add angavrilov https://github.com/angavrilov/df-structures.gityou can right click on the title bar and do edit->paste.

then do
Code: [Select]
git pull quietdust master or
Code: [Select]
git pull angavrilov master, depending on which repo you added. (You can add both)

then build as normal.

Aha! Excellent!

Thank you very much. This worked nicely.

Stonesense and autolabor appear to be broken, but I'm not too worried about that; I mostly wanted reveal, vdig, and prospect :)

And once peterix has his official version out, I can just replace my cobbled-together one with it and see if autolabor is as good as everyone seems to be saying ;D
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on May 16, 2012, 03:08:32 pm
If you want the one quietdust pointed to, do this:
My name does not contain a "d", thankyouverymuch.
Title: Re: DFHack 0.34.07 r2
Post by: kendo on May 16, 2012, 03:55:29 pm
I've just started playing DF again after a while away, there used to be a tool within dfhack which allowed you to hide (unreveal) walled off sections within your fort. Does it still exist if so what is it called now? I've tried the one called 'revflood' doesn't seem to do it.
Title: Re: DFHack 0.34.07 r2
Post by: TheCoolSideofthePIllow on May 16, 2012, 05:16:20 pm
I've just started playing DF again after a while away, there used to be a tool within dfhack which allowed you to hide (unreveal) walled off sections within your fort. Does it still exist if so what is it called now? I've tried the one called 'revflood' doesn't seem to do it.

The command is "reveal."

"Unreveal" hides the walls again after using "reveal." ;)
Title: Re: DFHack 0.34.07 r2
Post by: tahujdt on May 16, 2012, 05:21:42 pm
I really need this release. I won't use it, but Meph won't release ☼34.08☼ until he can bundle DFhack in.
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 16, 2012, 07:00:15 pm
If you want the one quietdust pointed to, do this:
My name does not contain a "d", thankyouverymuch.

wait, really?

/me checks

my mind is blown. This whole time I had your name wrong.
Title: Re: DFHack 0.34.07 r2
Post by: kendo on May 16, 2012, 08:26:45 pm
I've just started playing DF again after a while away, there used to be a tool within dfhack which allowed you to hide (unreveal) walled off sections within your fort. Does it still exist if so what is it called now? I've tried the one called 'revflood' doesn't seem to do it.

The command is "reveal."

"Unreveal" hides the walls again after using "reveal." ;)


Doesn't work like that for me, it just reveals the whole map and then unhides everything same as it was. I want to hide additional extra parts, I want sections that I've walled off/parts that I can't path to to remain blacked out.
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 16, 2012, 08:31:27 pm
You can use the revflood tool to do something like that, but constructed walls won't work. You need to use caste obsidian to block areas off. If you don't mind cheating, you can place them with liquids.
Title: Re: DFHack 0.34.07 r2
Post by: kendo on May 16, 2012, 08:36:01 pm
Maybe that what I used to do, I'll try that thanks

Edit: Actually tiletypes is more like it, it lets you 'paint' hidden status where ever you like
Title: Re: DFHack 0.34.07 r2
Post by: Ieb on May 17, 2012, 02:51:22 am
You guys still take ideas for utilities to add on this thing?
There used to be a tool that told you how many "ticks" you needed for the next strange mood to hit one of your dwarves, or just set it straight to 0 and wait until inspiration struck.

Think that's good enough to hunt down and add?
...after the version update, because I have a feeling I'd get beaten by a mob if I throw a suggestion that delays the release of DFhack for this new and glorious updated DF.
Title: Re: DFHack 0.34.07 r2
Post by: danaris on May 17, 2012, 07:33:03 am
...Aaaand peterix might as well just move on to working on .09 now! ;D
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 17, 2012, 09:35:49 am
You guys still take ideas for utilities to add on this thing?
There used to be a tool that told you how many "ticks" you needed for the next strange mood to hit one of your dwarves, or just set it straight to 0 and wait until inspiration struck.

Think that's good enough to hunt down and add?
...after the version update, because I have a feeling I'd get beaten by a mob if I throw a suggestion that delays the release of DFhack for this new and glorious updated DF.
Can probably do that with a one-liner in lua, provided the appropriate variable has been found and exposed.  I don't know if we know where that timer is anymore, though; it might be ui.mood_cooldown, although I certainly don't know that for sure.
Title: Re: DFHack 0.34.07 r2
Post by: HammerDave on May 17, 2012, 10:49:03 am
Another tool (Runesmith perhaps) had the ability to change a possession into fey, or if you want macabre you could go to fell.  I'd definitely like the posession->fey/secretive tool.

As expected, 34.09 leapfrogs dfhack for 34.08.  I've actually survived pretty well hackless in .08.  The one function I thought I'd be doomed without was autodump, but the mining change to drop a lot less stone meant that it was slightly less important, at least in the early years.  I do seriously miss workflow though, got additcted to that one.  But patience is a virtue, and there's always the option of pulling the source and hacking.   ;D
Title: Re: DFHack 0.34.07 r2
Post by: kingubu on May 17, 2012, 11:08:39 am
workflow 4 lyfe!
Title: Re: DFHack 0.34.07 r2
Post by: Weaselcake on May 17, 2012, 11:47:07 am
Peter hasn't even acknowledged that he's working on this anymore. His post history displays that he hasn't been active in almost 2 months..
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on May 17, 2012, 11:53:59 am
Peter hasn't even acknowledged that he's working on this anymore. His post history displays that he hasn't been active in almost 2 months..
That's because he's been busy with school. I can personally guarantee that updates will be coming soon.
Title: Re: DFHack 0.34.07 r2
Post by: Rinin_Rus on May 17, 2012, 12:11:34 pm
Peter hasn't even acknowledged that he's working on this anymore. His post history displays that he hasn't been active in almost 2 months..
Look at IRC and github network, this guys are not only works hard on it, it looks like they start working less than a couple of hours after release =)
Title: Re: DFHack 0.34.07 r2
Post by: Meph on May 17, 2012, 01:21:24 pm
Just a quick question: Will the next update be for 34.08, or will the team just skip that and go diretly over to a compatible version for 34.09 ?
Title: Re: DFHack 0.34.07 r2
Post by: ag on May 17, 2012, 01:27:18 pm
I'd say 34.09, unless it ends up working with both, which is quite likely given the small time between releases and the type of changes made.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 17, 2012, 02:40:44 pm
Just a quick question: Will the next update be for 34.08, or will the team just skip that and go diretly over to a compatible version for 34.09 ?
It should work with both, but I suspect most of the testing and development will be against 34.09 because the bugs in 34.08 make that version fairly unsuitable for extended use. 
Title: Re: DFHack 0.34.07 r2
Post by: Meph on May 17, 2012, 02:43:25 pm
In that case I upload a 34.08 version of my mod now, and wait with the 34.09 update till dfhack is done as well. :)
Title: Re: DFHack 0.34.07 r2
Post by: dree12 on May 17, 2012, 02:45:16 pm
Just a quick question: Will the next update be for 34.08, or will the team just skip that and go diretly over to a compatible version for 34.09 ?
It should work with both, but I suspect most of the testing and development will be against 34.09 because the bugs in 34.08 make that version fairly unsuitable for extended use.
For a release of its size, 0.34.08 is surprisingly non-buggy. There were no problems with egg-laying crashing the game this time around.
Title: Re: DFHack 0.34.07 r2
Post by: Zared on May 17, 2012, 03:16:01 pm
Quietust's branch is compiling again (Following Japa's instructions) and works with .09, in case anybody hasn't been watching religiously ;)
Very fast work, thanks!
Title: Re: DFHack 0.34.07 r2
Post by: Rinin_Rus on May 18, 2012, 04:22:34 am
Quietust's branch for impatient (not complete of course)
https://docs.google.com/open?id=0B2hg23s5yV1aclFScGVqdy11Yms
Title: Re: DFHack 0.34.07 r2
Post by: TheCoolSideofthePIllow on May 18, 2012, 07:07:11 am
Quietust's branch for impatient (not complete of course)
https://docs.google.com/open?id=0B2hg23s5yV1aclFScGVqdy11Yms

What works and what doesn't?
Title: Re: DFHack 0.34.07 r2
Post by: slink on May 18, 2012, 11:45:49 am
Quietust's branch for impatient (not complete of course)
https://docs.google.com/open?id=0B2hg23s5yV1aclFScGVqdy11Yms

What works and what doesn't?
stonesense and dfusion are not included
judging by the error message at start-up, autolabor won't work
prospect, drybuckets, autodump, digv, and die all work
Title: Re: DFHack 0.34.07 r2
Post by: Meph on May 18, 2012, 11:47:53 am
Yeah, I tested it and 5 plugins dont work yet.
dfusion, digv, stonesense, autolabor and df2minecraft.
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 18, 2012, 11:51:39 am
Stonesense does work, but like dfhack, it needs to be pulled in from angavrilov's repo.
Title: Re: DFHack 0.34.07 r2
Post by: slink on May 18, 2012, 12:29:16 pm
I'm getting some red-text errors with Quietust's build for using the in-game hotkeys.  It keeps wanting to execute the names of the Zoom locations.  The Zooming works fine, though.
Title: Re: DFHack 0.34.07 r2
Post by: Weylyn on May 18, 2012, 03:47:48 pm
Thanks for that link, the plugins that are most important to me work perfectly, particularly prospect and digcircle.

So far, no strangeness using it. Reveal also works like it should, including the clown filter.

Title: Re: DFHack 0.34.07 r2
Post by: Iceflame on May 18, 2012, 04:12:29 pm
And digcircle? Any problems with that?
Title: Re: DFHack 0.34.07 r2
Post by: Weylyn on May 18, 2012, 04:39:55 pm
Digcircle seems to be working normally, yes.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 18, 2012, 11:47:18 pm
Yeah, I tested it and 5 plugins dont work yet.
dfusion, digv, stonesense, autolabor and df2minecraft.
Autolabor confuses me because that's worked for me almost from the start.  Although I don't know if the repo you're using includes my autolabor patches or not.  The others are unsurprising; digv didn't work on Windows because the repo that the version your using was built from did not have all the Windows offsets.
Title: Re: DFHack 0.34.07 r2
Post by: TheCoolSideofthePIllow on May 19, 2012, 03:04:45 am
Quietust's branch for impatient (not complete of course)
https://docs.google.com/open?id=0B2hg23s5yV1aclFScGVqdy11Yms

What works and what doesn't?
stonesense and dfusion are not included
judging by the error message at start-up, autolabor won't work
prospect, drybuckets, autodump, digv, and die all work

FFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUU

The one command I want D:

Stonesense does work, but like dfhack, it needs to be pulled in from angavrilov's repo.

How would I do that? I miss being able to see my bad ass fort in 3D.
Title: Re: DFHack 0.34.07 r2
Post by: ydaraishy on May 19, 2012, 03:18:58 am
Quietust's branch for impatient (not complete of course)
https://docs.google.com/open?id=0B2hg23s5yV1aclFScGVqdy11Yms

What works and what doesn't?
stonesense and dfusion are not included
judging by the error message at start-up, autolabor won't work
prospect, drybuckets, autodump, digv, and die all work

FFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUUUU

The one command I want D:

Stonesense does work, but like dfhack, it needs to be pulled in from angavrilov's repo.

How would I do that? I miss being able to see my bad ass fort in 3D.

She said it does work, though.
Title: Re: DFHack 0.34.07 r2
Post by: orius on May 19, 2012, 04:02:20 am
What about workflow?  That one's pretty important in easing the micromanagement.
Title: Re: DFHack 0.34.07 r2
Post by: TerryDactyl on May 19, 2012, 04:42:17 am
What about workflow?  That one's pretty important in easing the micromanagement.

That's my favourite. No such luck.
Title: Re: DFHack 0.34.07 r2
Post by: Rinin_Rus on May 19, 2012, 08:55:25 am
What about workflow?  That one's pretty important in easing the micromanagement.
That's my favourite. No such luck.

It's not current state of DFhack, but Peter adds some changes yesterday and workflow looks back online.

https://docs.google.com/open?id=0B2hg23s5yV1aUVE3TTNCbl9uS0U

PS I'm almost love people who makes such a cool thing for every dwarf.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 19, 2012, 12:02:05 pm
What about workflow?  That one's pretty important in easing the micromanagement.

That's my favourite. No such luck.
Workflow requires ui_workshop_job_cursor.  The build you used didn't have that offset identified for Windows.
Title: Re: DFHack 0.34.07 r2
Post by: Icefire2314 on May 19, 2012, 03:19:17 pm
When i try to open 'dfhack-run', it VERY quickly opens a console screen and just as quickly closes it. Any help?
Title: Re: DFHack 0.34.07 r2
Post by: danaris on May 19, 2012, 03:23:04 pm
When i try to open 'dfhack-run', it VERY quickly opens a console screen and just as quickly closes it. Any help?

Don't open dfhack-run. Just open Dwarf Fortress. You will get a dfhack console along with it.
Title: Re: DFHack 0.34.07 r2
Post by: Icefire2314 on May 19, 2012, 03:28:48 pm
Ah. I downloaded while I was in the middle of playing XD I guess I should've considered that. Thanks :)
Title: Re: DFHack 0.34.07 r2
Post by: Icefire2314 on May 19, 2012, 03:36:30 pm
Excuse double post: Is DFHack updated to .34.09?
Title: Re: DFHack 0.34.07 r2
Post by: Rinin_Rus on May 19, 2012, 04:19:56 pm
Excuse double post: Is DFHack updated to .34.09?
No, see first post, for last version.
Title: Re: DFHack 0.34.07 r2
Post by: Rhenaya on May 20, 2012, 08:45:25 am
i just noticed it says it can load vdig.dll but its renamed digv and works fine?
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 20, 2012, 09:00:31 am
yeah, all the dig commands are renamed to start with dig, so when you pres ls, they appear together.
Title: Re: DFHack 0.34.07 r2
Post by: petebull on May 20, 2012, 01:39:27 pm
Excuse double post: Is DFHack updated to .34.09?
No, see first post, for last version.

The version from http://www.bay12forums.com/smf/index.php?topic=91166.msg3297341#msg3297341 works for me.
Title: Re: DFHack 0.34.07 r2
Post by: jocan2003 on May 20, 2012, 02:27:52 pm
Im trying to use the job command to change that damn shell from my moody dwarf but to no afvgail, i either get cannot find material, (or item id ) When i do manage to get past tha.... i get item doesnt meet requirement o.O
Spoiler (click to show/hide)

What do i have to do to get rid of the shell and change it for anything from metal, to stone or even bone if need...

edit: Ive been looking around for tutorial, example of commands and so on im just totaly lost o.O
Title: Re: DFHack 0.34.07 r2
Post by: Icefire2314 on May 20, 2012, 02:53:31 pm
Excuse double post: Is DFHack updated to .34.09?
No, see first post, for last version.

The version from http://www.bay12forums.com/smf/index.php?topic=91166.msg3297341#msg3297341 works for me.
That works. Thank you :D
Title: Re: DFHack 0.34.07 r2
Post by: HD23 on May 20, 2012, 02:57:16 pm
What do i have to do to get rid of the shell and change it for anything from metal, to stone or even bone if need...

You can enable other materials, like hooves or ivory to be used in strange moods instead of shells.
http://dwarffortresswiki.org/index.php/Shell

That is what I do, just remember, the change won't affect body parts that are already lying around,
but will affect newly created body parts from butchered creatures.
Title: Re: DFHack 0.34.07 r2
Post by: jocan2003 on May 20, 2012, 04:39:44 pm
Cant i just use DFhack to change that job material requirement? If i dont hear soon that what ill do, add the shell to hoof or something and be free of that stupid moody dwarf...
Title: Re: DFHack 0.34.07 r2
Post by: Rafal99 on May 20, 2012, 09:48:33 pm
Is there any possibility to stop a dwarf from being "On Break" using DFHack or another utility?
Perhaps someone knows the right offset so I can at least try with Cheat Engine?
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on May 20, 2012, 10:08:16 pm
Is there any possibility to stop a dwarf from being "On Break" using DFHack or another utility?
Absolutely - just locate the dwarf's "On Break" counter (located in unit.status.misc_traits) and either set it to a really high value (I forget the maximum) or remove the entry altogether.
Title: Re: DFHack 0.34.07 r2
Post by: Rafal99 on May 20, 2012, 11:06:52 pm
Where do I use this variable? In DFHack command line or in C++ plugin or in lua script for DFusion?
(sorry for stupid question but I am not very familiar DFHack except for using a few already provided plugins)


Nevermind I figured how to make scripts for DFFusion. But it seems DFFusion is not included in the DFHack version I got:
https://docs.google.com/file/d/0B2hg23s5yV1aclFScGVqdy11Yms/edit?pli=1 (https://docs.google.com/file/d/0B2hg23s5yV1aclFScGVqdy11Yms/edit?pli=1)

Edit: Ok I copied DFusion from DFHack 0.34.07 r2 and it works.


I dont see this variable mentioned anywhere in the API doc nor in symbols.xml.
So the second question is where in DFHack files do I find list of the available variables and their offsets?


Nevermind, found it here:
https://github.com/peterix/df-structures (https://github.com/peterix/df-structures)
Title: Re: DFHack 0.34.07 r2
Post by: bluescreen1988 on May 20, 2012, 11:30:44 pm
tried using autolabor for the latest version of the game but it says the plugin is missing?
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 21, 2012, 02:33:50 am
you have to pull autolabor from the git repo of the guy who writes the plugin.
Title: Re: DFHack 0.34.07 r2
Post by: Rafal99 on May 21, 2012, 07:55:42 am
I successfully managed to stop my dwarf from being On Break! :D
Achievement unlocked!

Code: [Select]
for k,v in pairs(df.global.world.units.all) do
  if (v.name.first_name ~= "") then
    for kk,vv in pairs(v.status.misc_traits) do
      if (vv.id == 17) then  --OnBreak counter id
        print(v.name.first_name .. " " .. v.name.nickname .. " " .. v.custom_profession)
        print("  " .. tostring(vv.id) .. " " .. tostring(vv.value))
        if (vv.value == 2202) then  --the OnBreak counter value my specific dwarf has on game load
          vv.value = 14990
          break
        end
      end 
    end 
  end
end

It seems the OnBreak counter goes up to something like 14k-17k but the exact value seems to be different for each dwarf. Setting all my "On Break" dwarves to the same value, didn't mean they all finish their break at the same time.
Title: Re: DFHack 0.34.07 r2
Post by: Quietust on May 21, 2012, 08:08:20 am
The OnBreak counter keeps track of how long they've been On Break - once it reaches a particular value (exactly what that value is, I don't recall), the break ends.
Title: Re: DFHack 0.34.07 r2
Post by: Tierre on May 21, 2012, 08:45:11 am
Can anybody install a Runesmith features into DFhack? If it is possible then some kind of manual for that could b cool. Also it would be really good to implement that as a usual feature in next versions of DFhack (if developer has time for that of course). Runesmth is not updating and it's left a vacant space which should be takan by somebody. DFhack is the best choice for that.
Title: Re: DFHack 0.34.07 r2
Post by: slink on May 21, 2012, 11:33:43 am
Just a note, that Quietust's DFHack for Windows 34.09 works fine for Windows 34.10 if you change the Windows 34.09 SDL checksum in symbols.xml to the one in the Dwarf Therapist thread.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 21, 2012, 12:23:00 pm
Just a note, that Quietust's DFHack for Windows 34.09 works fine for Windows 34.10 if you change the Windows 34.09 SDL checksum in symbols.xml to the one in the Dwarf Therapist thread.
df-structures has been updated for 34.10, and builds from github work fine, although the hotkey "problem" still exists and there is reportedly a problem with using DFHack on linux in text mode, as well.  I think it's resolving this problem that is delaying the release.
Title: Re: DFHack 0.34.07 r2
Post by: thistleknot on May 21, 2012, 12:25:34 pm
anyone know how & care to write an xml parser for dfhack's dwarfexport .xml file?

I'm looking for the attribute values, trait values, skill exp, dorf name values exportable to a csv file, or importable into scalc.

It's for a project for DT research.  See this post

http://www.bay12forums.com/smf/index.php?topic=66525.msg3303414#msg3303414
Title: Re: DFHack 0.34.07 r2
Post by: bluescreen1988 on May 21, 2012, 12:36:48 pm
you have to pull autolabor from the git repo of the guy who writes the plugin.

and where would i find that?
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 21, 2012, 12:44:50 pm
you have to pull autolabor from the git repo of the guy who writes the plugin.
and where would i find that?
Autolabor has been part of the standard distribution for some time now.  If it's not working for you, it's because you're using an incomplete symbols.xml that doesn't expose one of the symbols that autolabor needs.  That, or you're using a defective or incomplete build of DFhack, or you installed it incorrectly.
Title: Re: DFHack 0.34.07 r2
Post by: Rose on May 21, 2012, 12:52:04 pm
Or she could have pulled DFhack from the git before your updates were merged, if they have been yet.
Title: Re: DFHack 0.34.07 r2
Post by: bluescreen1988 on May 21, 2012, 12:56:25 pm
you have to pull autolabor from the git repo of the guy who writes the plugin.
and where would i find that?
Autolabor has been part of the standard distribution for some time now.  If it's not working for you, it's because you're using an incomplete symbols.xml that doesn't expose one of the symbols that autolabor needs.  That, or you're using a defective or incomplete build of DFhack, or you installed it incorrectly.

All i did was take the version from this https://docs.google.com/file/d/0B2hg23s5yV1aUVE3TTNCbl9uS0U/edit# so im not sure if any were correctly installed or not (I just copy pasted over DF folder)  It's my first time using this, but all the other options seem to work fine including stonesense.
Title: Re: DFHack 0.34.07 r2
Post by: Captain Goatse on May 21, 2012, 02:00:30 pm
Just a note, that Quietust's DFHack for Windows 34.09 works fine for Windows 34.10 if you change the Windows 34.09 SDL checksum in symbols.xml to the one in the Dwarf Therapist thread.

May I have a translation from geekspeak to english, please?
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 21, 2012, 02:32:21 pm
Or she could have pulled DFhack from the git before your updates were merged, if they have been yet.
Let's be clear on this: I am not the author of autolabor.  I just tweak it from time to time.  I think RossM was the original author, although the original commit for autolabor on github is attributed to "unknown", which is often the case for someone's first git commit as fairly few people get git completely configured correctly until after their first push.  Ross hasn't pushed anything in about two months, though, and most of the recent work has been me and peterix.
Title: Re: DFHack 0.34.07 r2
Post by: TerryDactyl on May 21, 2012, 03:41:56 pm
anyone know how & care to write an xml parser for dfhack's dwarfexport .xml file?

I'm looking for the attribute values, trait values, skill exp, dorf name values exportable to a csv file, or importable into scalc.

It's for a project for DT research.  See this post

http://www.bay12forums.com/smf/index.php?topic=66525.msg3303414#msg3303414

Look up the source code for 'Dwarven Guidance Counsellor'. It's mostly there, but a bit out of date... could do with some restructuring, possibly...
Title: Re: DFHack 0.34.07 r2
Post by: thistleknot on May 21, 2012, 03:57:25 pm
Can I make a suggestion for how dwarfexport exports to xml?

current export

Spoiler (click to show/hide)

importing such a file into excel creates a bunch of duplicates because of the way the traits are coded to export to html, it would work flawlessly into excel if it was exported like this

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.07 r2
Post by: peterix on May 21, 2012, 04:12:24 pm
Can I make a suggestion for how dwarfexport exports to xml?
The current export format won't be changed, because it's what the 'dwarf guidance counselor' tool expects. Also, it's not HTML. I have no idea if people still use it for dgc, but if you want to add your own export format, DO IT ;)

Also, new release is here. Check the first post and then report any bugs you may find. I've listed some things that are known to be buggy (missing track graphics in stonesense, etc.), so don't report those ;)
Title: Re: DFHack 0.34.07 r2
Post by: thistleknot on May 21, 2012, 04:40:54 pm
Can I make a suggestion for how dwarfexport exports to xml?
The current export format won't be changed, because it's what the 'dwarf guidance counselor' tool expects. Also, it's not HTML. I have no idea if people still use it for dgc, but if you want to add your own export format, DO IT ;)

Also, new release is here. Check the first post and then report any bugs you may find. I've listed some things that are known to be buggy (missing track graphics in stonesense, etc.), so don't report those ;)

ok... if dgc uses it, can't someone make another option?  DGC is outdated btw (Splinterz DT does what DGC did and a lot more), but I don't want to step on another developer's toes, especially if they gave us an awesome tool, but the format of the dwarfexport's traits is all messed up, and I never said html, I said xml.  I'll try to take another look at the code and see if I can't figure it out, make it look like the attributes export, maybe submit it myself, but I had to point it out.  As is, it does not CLEANLY import into excel, and that one change would make the world of difference for excel imports.
Title: Re: DFHack 0.34.07 r2
Post by: peterix on May 21, 2012, 04:48:05 pm
DGC is outdated btw (Splinterz DT does what DGC did and a lot more)
OK. Feel free to rip the export thing out and replace it with something better then :) More compatible formatting of the same can't hurt.
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on May 21, 2012, 05:23:53 pm
Well found something new. If you become a ghost and ride a minecart into a wall. you die. More so that you lose all your limbs from head to toe and be a ghost stump.
Title: Re: DFHack 0.34.07 r2
Post by: TerryDactyl on May 21, 2012, 05:53:18 pm
Can I make a suggestion for how dwarfexport exports to xml?
The current export format won't be changed, because it's what the 'dwarf guidance counselor' tool expects. Also, it's not HTML. I have no idea if people still use it for dgc, but if you want to add your own export format, DO IT ;)

No, it doesn't. DGC is still a useful tool because it can read information about dwarves during embark, which splinterz' DT can not do; However, it's a pain in the ass. The XML format must-have changed somewhere along the line, because DGC is buggy as hell without manual reformatting to remove extraneous data. I was playing around with it last week and modded the source to make colour-code stats above and below average... a few days before I discovered splinterz' DT.  ::)

While DGC's parser is functional, it relies on hard-coded variables - which would make maintenance a chore. It would ultimately be much simpler to iterate through fields than to assign variables by name. It was pretty cheap of me to bring it up, when I'm not quite prepared to rework the codebase. But I'm glad that you're working on/thinking about this, because it puts us on the same page.
Title: Re: DFHack 0.34.07 r2
Post by: khearn on May 21, 2012, 06:19:35 pm
Can I make a suggestion for how dwarfexport exports to xml?
The current export format won't be changed, because it's what the 'dwarf guidance counselor' tool expects. Also, it's not HTML. I have no idea if people still use it for dgc, but if you want to add your own export format, DO IT ;)

No, it doesn't. DGC is still a useful tool because it can read information about dwarves during embark, which splinterz' DT can not do;

Yes, it can read  the dwarves during embark. I use the roles tab to figure out who should do what when I'm peparing carefully.
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on May 21, 2012, 07:08:30 pm
It would be interesting to implement DGC as a plug-in, either to assist with embark planning, or to augment autolabor.  Have to think about that.
Title: Re: DFHack 0.34.07 r2
Post by: zenerbufen on May 21, 2012, 07:34:23 pm
New release
I noticed no os x release. I remember you mentioning this should be coming soon, and have also read that what is stopping it is a "dev with a mac". I saw that someone made a fork about a month ago and added 'preliminary mac compatibility', but that hasn't been updated since or been merged back to the main branch. Whats the status with that? I'm a dev with a mac but my experience is mostly with python and limited objective c. Is that something I could possible help with or do I just need to be patient?
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on May 21, 2012, 07:56:04 pm
how am I supposed to download the source of dfhack?  Is there a git repository somewhere?   I want to edit dwarfexport, and then build the entire project.  What is the recommended ide?  Are there dependent libraries?

nm

https://github.com/peterix/dfhack/zipball/master
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on May 21, 2012, 08:11:50 pm
how am I supposed to download the source of dfhack?
You download it from github.

Is there a git repository somewhere?
Yes, right here (https://github.com/peterix/dfhack).

What is the recommended ide?
On Windows, you must use Visual C++ 2010, Express or Standard/Professional/etc.. No other compiler will work.
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on May 21, 2012, 08:22:14 pm
thank you, just got up to that point

looks like the only part of code I need to concern myself with is in the dwarfexport.cpp file, and it's right here

Code: [Select]
    out << "    <Traits>" << endl;
    df::unit_soul * s = cre->status.current_soul;
    if (s)
    {
        FOR_ENUM_ITEMS(personality_facet_type,index)
        {
            out << "      <Trait name='" << ENUM_KEY_STR(personality_facet_type, index) <<
                "' value='" << s->traits[index] << "'>";
            //FIXME: needs reimplementing trait string generation
            /*
            string trait = con->vinfo->getTrait(i, s->traits[i]);
            if (!trait.empty()) {
                out << trait.c_str();
            }
            */
            out << "</Trait>" << endl;
           
        }
    }
    out << "    </Traits>" << endl;
}

update:
actually, with the addition of labors, and skills.  which I actually do want... there is a bit more work to do.
Title: Re: DFHack 0.34.10 r1
Post by: Meph on May 21, 2012, 08:47:29 pm
Thanks for the long awaited update :) Great work, and 3 versions at once. :)
Title: Re: DFHack 0.34.10 r1
Post by: drvoke on May 21, 2012, 09:24:29 pm
Thanks peterix and quietust!

I'm only a recent convert to using dfhack, but I think its tools provide the perfect compliment to Dwarf Therapist for fort planning and management.
Title: Re: DFHack 0.34.07 r2
Post by: ab9rf on May 21, 2012, 10:03:22 pm
New release
I noticed no os x release. I remember you mentioning this should be coming soon, and have also read that what is stopping it is a "dev with a mac". I saw that someone made a fork about a month ago and added 'preliminary mac compatibility', but that hasn't been updated since or been merged back to the main branch. Whats the status with that? I'm a dev with a mac but my experience is mostly with python and limited objective c. Is that something I could possible help with or do I just need to be patient?
There have been at least three efforts to start a Mac fork, none of which have come to fruition.  The problem is, as you note, a lack of interested devs with Macs.

You might try to contact the committing developers at github directly.
Title: Re: DFHack 0.34.10 r1
Post by: bluescreen1988 on May 21, 2012, 11:13:51 pm
seems like i was wrong about the autolabor pluging being missing.  when i try to start it in game it says the plugin is not enabled.  Is there a way to manually enable it?
Title: Re: DFHack 0.34.10 r1
Post by: Rose on May 21, 2012, 11:14:46 pm
"autolabor 1"
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on May 21, 2012, 11:57:34 pm
okay found some nice info on carts. one being that you can get more than one unit to ride it. though how I did it was kinda rough. since I need to get the cart to be in motion to carry both passengers and I needed bodyswap to do so. Once I get use to selecting units base on if they are following the adventurer or are apart of the civ then I'll make a function called "Party carts" so the adventurer can roll through the lands with their array of companions and not have to worry about leaving one behind in a mad dash to safety (just worry about hitting a tree and killing them all).
Title: Re: DFHack 0.34.10 r1
Post by: bluescreen1988 on May 22, 2012, 12:59:27 am
"autolabor 1"

 :o well now i feel like an idiot, thanks though.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on May 22, 2012, 03:16:09 am
So no Runesmith tools in DFhack? :( Nobody even commented on my request. Oh well gotta live without it then.
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 22, 2012, 03:27:40 am
So no Runesmith tools in DFhack? :( Nobody even commented on my request. Oh well gotta live without it then.

What runesmith tools exactly do you want?
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on May 22, 2012, 03:46:23 am
Changing attributes and traits in game (aside from creature definitions trait changes) and checking flags - like invader. Changing strange mood type. Resurrecting creatures. Making them pregnant (well runesmith didn't have that but that's i want :) ).
Title: Re: DFHack 0.34.10 r1
Post by: Rose on May 22, 2012, 03:59:24 am
You can do all that with lua scripting.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on May 22, 2012, 04:07:37 am
Is there some manual on how to do it? I know the basics of python and PL/SQL programming but i had no practice with lua in dfhack:) Some tips and links maybe:) I would really be glad just to learn how to do it;)

PS in fact i suspected that it has to be here already, but i wasn't sure. Also some kind of utility in dfhack helping newbies doing it can be a good idea.
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 22, 2012, 04:09:30 am
It could already be there in dfusion actually - Rumrusher in particular likes that kind of stuff  ;)
Title: Re: DFHack 0.34.10 r1
Post by: Warmist on May 22, 2012, 04:22:03 am
Changing attributes and traits in game (aside from creature definitions trait changes) and checking flags - like invader. Changing strange mood type. Resurrecting creatures. Making them pregnant (well runesmith didn't have that but that's i want :) ).
So a little tutorial:
Bonus:
making a creature pregnant is not trivial, but there is already a script in dfusion, (again, activated with "dfuse" to be used in lua, or "dfusion" for a menu gui) so you can do "tools.empregnate()" with a cursor on (or [v]iewing a creature) or if you already have written "unit=dfhack.gui.getSelectedUnit()", you can do "tools.empregnate(unit)".
Bonus Bonus:
try this (with something you are not afraid to lose, destroy etc...):
Code: [Select]
for k,v in pairs(df.global.world.units.all) do tools.empregnate(v) end

Also for a more complete Lua guide, please search the internet, the syntax is very easy (compared to all other languages) there are some strange things (like "almost everything is a table" ) but it's very easy to learn and should not take a lot of time.

Happy hacking.
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 22, 2012, 04:34:54 am
  • checking flags is trivial: type "printall(unit.flags1)", "printall(unit.flags2)", "printall(unit.flags3)", changing them also easy: "unit.flags1.dead=true"
  • for a list of unit fields (with values) type "printall(unit)"
  • some things may hide in substructures e.g. "printall(unit.status)"

Some time recently I've added '~' as an alias for printall at toplevel, so just "~unit.flags1" etc should work. The complete set of magic prefix characters now is:


And to make some lua code behave almost like a native dfhack command, put it into a file in hack/scripts/ - see scripts already in there for examples. Scripts in subdirectories are still usable as e.g. "fix/item-occupancy", but invisible to the 'ls' command. Note: these scripts cannot use dfusion code yet.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on May 22, 2012, 06:26:11 am
Wow. Thanks a lot. I will start digging in it then i return home:) (Can't play at work - any exe file opened on a pc is logged and then security will start asking questions like what am i doing at worktime....). This will make it much easier than waiting for Runesmith as i can search for all things myself and do some !SCIENCE!.

Prepare dwarfs... you are up for some really nasty experiments.
Title: Re: DFHack 0.34.10 r1
Post by: Rubberneck on May 22, 2012, 07:09:03 am
Does Stonesense work with the current (0.34.10) release? Since 0.34.07 my computer completely freezes whenever I try to initialize it, forcing me to reboot.
Title: Re: DFHack 0.34.10 r1
Post by: therahedwig on May 22, 2012, 07:41:38 am
That might have to do with the new dwarf-sprites.

You can try two things:
1) Go into the stonesense folder and open init.txt
Try to find the second to last option, it should say renderer=ANY, change that to OPENGL
Check if stonesense works for you. If it doesn't, go to step two.

2)Open the index.txt in stonesense/creatures.
find the sentence 'large_256/index.txt', put a '#' infront of it, or remove the line entirely. Save. Test out stonesense.
If this doesn't work, then there's something wrong there's no solution for yet.

There's HD content now, but if your computer hasn't got a decent amount of ram...
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on May 22, 2012, 08:39:17 am
I made some changes to dwarfexport.cpp, but I have no idea how to build it within visual studios 2010.

f6 doesn't do anything, nor do I see an option to build.  I also don't see a project file to open to work with, although I don't think I need it, because this is supposed to compile as a dll, anyhelp would be appreciated.
Title: Re: DFHack 0.34.10 r1
Post by: Rose on May 22, 2012, 08:52:36 am
follow the build instructions. you need cmake for one, but there's a bunch else.
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on May 22, 2012, 08:56:47 am
I see a build folder, where are the build instructions?

I found some instructions on the 1st page

but... if anyone is interested in helping me, I get this when I try to build-release.bat

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.10 r1
Post by: Rose on May 22, 2012, 09:02:27 am
https://github.com/peterix/dfhack/blob/master/COMPILE.rst
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on May 22, 2012, 09:44:40 am
https://github.com/peterix/dfhack/blob/master/COMPILE.rst

THANKS, got the solution file generated, hopefully I'll have my new dwarfexport up tonight, it's some real simple changes.  I'm hoping to do this for some dwarf therapist research.

Here's a preview of what I did to traits, simple stuff really.  I'm hoping that if I do the same for labors and skills, that it will auto generate the columns one at a time... I'm not sure how that will work.  I may have to generate EVERY skill column prior, and do a loop.  Which would suck.

Spoiler (click to show/hide)

Update:

I just realized, am I wasting my time if I can generate this stuff within dfhack's console via lua scripting?

If so, any suggestions on how I can export dwarf names, attributes, traits, skills, labors assigned for each dwarf as one record/row per dwarf in a csv format?
Title: Re: DFHack 0.34.10 r1
Post by: ClkWrkJester on May 22, 2012, 03:56:55 pm
I've been watching this thread in confusion... are we past the point where DFHack is something nice and simple for idiots like me to just drop in and go with?
Title: Re: DFHack 0.34.10 r1
Post by: peterix on May 22, 2012, 04:15:35 pm
I've been watching this thread in confusion... are we past the point where DFHack is something nice and simple for idiots like me to just drop in and go with?
And why would that be the case?  DFHack is just a lot more than it was before, but that doesn't mean all the old stuff isn't still there :)
Title: Re: DFHack 0.34.10 r1
Post by: ClkWrkJester on May 22, 2012, 06:40:15 pm
I just watched all this talk of lua and branches and compiling... and my liberal arts brain popped, but seeing a new proper release makes me feel better. >.>
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on May 22, 2012, 08:12:10 pm
:(

38>Time Elapsed 00:00:08.37
40>LINK : fatal error LNK1104: cannot open file '..\library\Debug\SDL-debug.lib'
40>
40>Build FAILED.
Title: Re: DFHack 0.34.10 r1
Post by: peterix on May 22, 2012, 08:31:49 pm
I just watched all this talk of lua and branches and compiling... and my liberal arts brain popped, but seeing a new proper release makes me feel better. >.>
Hehe. As long as you don't delve into the developer stuff, you should be safe from any brain-popping craziness :)

However, DFHack always was more of a developer thing. Quoting the first post:
Quote
DFHack is an attempt to unite the various ways hack tools access DF memory and allow for easier development of new tools (and of course, make the game more enjoyable for players).

So, don't be surprised to see some developer talk in the thread :)

:(

38>Time Elapsed 00:00:08.37
40>LINK : fatal error LNK1104: cannot open file '..\library\Debug\SDL-debug.lib'
40>
40>Build FAILED.
There is no debug. I made debug builds impossible to complete because they aren't compatible with DF (instant crash). Switch your IDE to Release or RelWithDebInfo mode. RelWithDebInfo actually leaves some debugging info in the libs, so use that if you need to poke around with a debugger.

Also, hop on IRC :) It will be easier to resolve problems that way. It's #dfhack on freenode
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on May 22, 2012, 11:01:50 pm
thank you guys, I got a dwarfexport2, so far it just has traits fixed.  The skills and labors have spaces hard coded elsewhere in their names that throw off the xml tagging.

so...

I got what I need for my lil mini project though, traits, and attributes.  It would be nice to have skills, but I think i'm good with what I got as I don't use skills for my calculations.
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on May 23, 2012, 12:20:19 am
Code: [Select]
function allin(unit,item)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
r=getline()
if item==nil then
item=getItemAtPos(getxyz())
end

unit.riding_item_id=item.id
ref=df.general_ref_unit_riderst:new()
ref.unit_id=unit.id
item.itemrefs:insert("#",ref)
end

function getItemAtPos(x,y,z) -- gets the item index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.items.all -- load all items
for i = 0, #vector-1 do -- look into all items offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end

here the function with help of the dfhack community. this here will select any unit and place them on a currently riding minecart.
note you need to be riding in the cart for this to work.
Title: Re: DFHack 0.34.10 r1
Post by: vjek on May 23, 2012, 05:55:53 pm
So, my first foray into lua for dfhack, hopefully someone will find it useful:

Spoiler: elevate_physical.lua (click to show/hide)

Sample output is:

[DFHack]# lua c:\df_34_10_win\hack\scripts\elevate_physical.lua 2200
Old Physical Attributes for åblel
Strength: 1224 | Agility: 1122 | Toughness: 1223 | Endurance: 1075 | Recuperation: 716 | Disease Resistance: 1651
Updating Physical Attributes for åblel
New Physical Attributes for åblel
Strength: 2200 | Agility: 2200 | Toughness: 2200 | Endurance: 2200 | Recuperation: 2200 | Disease Resistance: 2200
[DFHack]#

If the consensus is this is a good & useful thing, I'll write up the mental attributes and personality traits in similar separate scripts.
EDIT: formatting
Title: Re: DFHack 0.34.10 r1
Post by: TerryDactyl on May 24, 2012, 12:18:31 am
I  ;) need ;) a utility that changes values (in memory) from the 'announcements.txt' while the game is running. I like to fight battles with combat details appearing in a popup, but reading the combat rolls for sparring and gratuitous prisoner beatings is tedious. So is restarting DF every time I want to make a change.

......where do I start?
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on May 24, 2012, 12:25:22 am
I  ;) need ;) a utility that changes values (in memory) from the 'announcements.txt' while the game is running. I like to fight battles with combat details appearing in a popup, but reading the combat rolls for sparring and gratuitous prisoner beatings is tedious. So is restarting DF every time I want to make a change.

......where do I start?
By finding where in memory those values are stored.  IIRC, we don't know where that is anymore.
Title: Re: DFHack 0.34.10 r1
Post by: Martin on May 24, 2012, 01:25:36 am
If the consensus is this is a good & useful thing, I'll write up the mental attributes and personality traits in similar separate scripts.


Holy shit! That's exactly what I needed for Morul. Yes, the mental/personality would be appreciated as well. I haven't gotten around to digging into those areas and working out what the values mean. Thank you for posting that.


I've got an okay, if tedious mechanism for raising his skills. Here's what I did to raise his stats after many failed efforts to do it more automatically:


Code: [Select]
function tools.morul(unit)
if unit==nil then
unit=getCreatureAtPointer()  --place the x pointer on top of the creature you want to change. best use is the look pointer and not 'v'
end
--Set the name. Surname is comprised of an array of references [words] into the language file. Each entry grabs a word fragment and the name is
--all of these catenated
  unit.name.first_name = "Morul"
  unit.name.words[0] = 1416
  unit.name.words[1] = 1304
 
  replace_labor = 1
  labor_rating = 20
  military_rating = 70
 
  --These are the skill ids we want to add
  skill = { 0,2,3,4,5,6,7,8,9,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,41,42,43,44,45,46,47,48,49,54,55,57,58,59,60,61,62,63,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,95,96,97,98,99,100,101,102,103,104,105,109,110,111,112,113,114,115 }
  --These are the military skills that will get higher values
  military = { 38,39,41,42,43,44,45,46,54,99,100,101,102,103,104,105 }


  replaced = false
  for sk,sv in ipairs(skill) do
    if (replaced == false) then
      replace_key = -1
      present = false
      for dk,dv in pairs(unit.status.souls[0].skills) do
        if (dv.id == sv) then
          present = true
          unit.status.souls[0].skills[dk].rating = labor_rating
          for _,v in ipairs(military) do
            if v == sv then
              unit.status.souls[0].skills[dk].rating = military_rating
            end
          end
          rating = unit.status.souls[0].skills[dk].rating
          unit.status.souls[0].skills[dk].experience = (rating * 500) + (rating * (rating - 1)) * 50
        end
        if (dv.id == replace_labor) then
          replace_key = dk
        end
      end
     
      if (present == false) and (replace_key > -1) then
        print("Replace with ", sv)
        unit.status.souls[0].skills[replace_key].id = sv
        unit.status.souls[0].skills[replace_key].rating = labor_rating
        for _,v in ipairs(military) do
          if v == sv then
            unit.status.souls[0].skills[replace_key].rating = military_rating
          end
        end
        rating = unit.status.souls[0].skills[replace_key].rating
        unit.status.souls[0].skills[replace_key].experience = (rating * 500) + (rating * (rating - 1)) * 50
        replaced = true
      end
    end
  end


  for sk,sv in ipairs(unit.status.souls[0].skills) do
    printall(sv)
  end
end
tools.menu:add("Morul",tools.morul)


I tried inserting skills to the skills array, but I couldn't get it to stop duplicating skills - so he'd wind up with 100 entries for legendary wax worker or whatever. It appeared that there was more involved in adding skills than just that, and as soon as it tried writing it out it went all wonky. This routine instead takes a list of skill ids that you want added, looks for them, sets them if it finds one, and writes the next new skill over top of something that you identify (I did woodcutting). So I had Morul go and cut down a tree, run the script which would replace woodcutting with mining or fish dissecting or whatever, set the level and experience, and then exit, wait for him to cut another tree, do it again, etc. Any help finding a way to build them all out at once would be appreciated in the event I need to regen. I got the skill codes (and other goodies) out of DwarfTherapist.


It also shows how to update the name, but it doesn't fix it in the description screen. Any help with that would also be appreciated.


Learning lua in the process didn't help much. It's kind of a wonky language.
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 24, 2012, 01:52:03 am
So I had Morul go and cut down a tree, run the script which would replace woodcutting with mining or fish dissecting or whatever, set the level and experience, and then exit, wait for him to cut another tree, do it again, etc.

You can't do that - the vector must be sorted by skill id.

Try:

Code: [Select]
utils = require 'utils'
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = ..., rating = ... }, 'id')
Title: Re: DFHack 0.34.10 r1
Post by: Martin on May 24, 2012, 02:08:48 am
You can't do that - the vector must be sorted by skill id.


Ah, nice. I'll work on that tomorrow. If it works, I'll clean it up and post it.


There's a bit of stuff on the wiki. Should we dump this stuff there? Finding stuff here in the forum comments is pretty damn hit or miss.
Title: Re: DFHack 0.34.10 r1
Post by: peterix on May 24, 2012, 07:00:57 am
There's a bit of stuff on the wiki. Should we dump this stuff there? Finding stuff here in the forum comments is pretty damn hit or miss.
Yes. A wiki, any wiki, would be good for this kind of stuff.
Title: Re: DFHack 0.34.10 r1
Post by: vjek on May 24, 2012, 08:46:08 am
...Yes, the mental/personality would be appreciated as well. I haven't gotten around to digging into those areas and working out what the values mean. Thank you for posting that. ...

Ok, here's the elevate_mental.lua and brainwash.lua scripts.  Brainwash doesn't have the same style of "before and after" checking as the other two, but it works just fine.  These are written in such a way that others can take them and modify them, not for conciseness of code.  So feel free to adjust/modify as you wish!

Spoiler: elevate_mental.lua (click to show/hide)

Example:
[DFHack]# lua c:\df_34_10_win\hack\scripts\elevate_mental.lua
Old Mental Attributes for tobul
Analytical_Ability: 1491 | Focus: 1777 | Willpower: 1963 | Creativity: 1309 | Intuition: 937 | Patience: 1161 | Memory: 1336 | Linguistic_Ability: 1076 | Spatial_Sense: 1393 | Musicality: 512 | Kinesthetic_Sense: 823 | Empathy: 1054 | Social_Awareness: 1499
Updating Mental Attributes for tobul
New Mental Attributes for tobul
Analytical_Ability: 2600 | Focus: 2600 | Willpower: 2600 | Creativity: 2600 | Intuition: 2600 | Patience: 2600 | Memory: 2600 | Linguistic_Ability: 2600 | Spatial_Sense: 2600 | Musicality: 2600 | Kinesthetic_Sense: 2600 | Empathy: 2600 | Social_Awareness: 2600
[DFHack]#


Spoiler: brainwash.lua (click to show/hide)

Example:
[DFHack]# lua c:\df_34_10_win\hack\scripts\brainwash.lua
Previous personality values for kadol
ANXIETY                  = 45
...
CAUTIOUSNESS             = 32
New personality values for kadol
ANXIETY                  = 1
...
CAUTIOUSNESS             = 99
kadol has been brainwashed, happy happy, joy joy!
[DFHack]#


I didn't want to have to fire up a third party tool to get this functionality, and now I don't.  8)  Go go dfhack.
Title: Re: DFHack 0.34.10 r1
Post by: TerryDactyl on May 24, 2012, 09:08:11 am
I  ;) need ;) a utility that changes values (in memory) from the 'announcements.txt' while the game is running. I like to fight battles with combat details appearing in a popup, but reading the combat rolls for sparring and gratuitous prisoner beatings is tedious. So is restarting DF every time I want to make a change.

......where do I start?
By finding where in memory those values are stored.  IIRC, we don't know where that is anymore.

What is the correct methodology?
Title: Re: DFHack 0.34.10 r1
Post by: Numbers on May 24, 2012, 03:29:54 pm
Trying to write some sort of a vampirism curse cure since one of my well respected and quite skillful dwarves seem to also be a bloodsucker that is sucking the life out of my fortress.

What I've done so far was to fetch him by

unit = dfhack.gui.getSelectedUnit()

cleared lists from

unit.curse.add_tags1
unit.curse.add_tags2

as well as

unit.curse.rem_tags1
unit.curse.rem_tags2

cleared names and all and I don't know what else should I clear because curseshow still shows him as cursed.

Any idea how to heal him completely from his curse?
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on May 24, 2012, 04:08:53 pm
Set unit.curse_year to -1 and cursecheck should no longer detect it.
Title: Re: DFHack 0.34.10 r1
Post by: Numbers on May 24, 2012, 05:09:09 pm
Curses... apparently the tag solution was temporary as the vampire dwarf went to continue his blood sucking ways...

I'm kind of stumped what to do
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on May 24, 2012, 11:02:27 pm
I've just identified the very field you need - its current (new) name is 'unit.unknown7.syndromes', and (with it) it should now be possible to properly cure vampirism, weresickness, and even restore husked creatures to their natural state.
Title: Re: DFHack 0.34.10 r1
Post by: Numbers on May 25, 2012, 02:39:17 am
printall(unit.unknown7) shows only following fields:

unk_7c4 = <vector<void*>: 0x17037fe0>
anon_1 = <vector<void*>: 0x17037ff0>
anon_2= <vector<void*>: 0x17038000>
unk_7d4= <vector<void*>: 0x17038010>
unk_7e4= <vector<void*>: 0x17038010>

I'm using current version of DFHack (34.10 rc1) so I'm quite confused...
Title: Re: DFHack 0.34.10 r1
Post by: Warmist on May 25, 2012, 04:39:24 am
printall(unit.unknown7) shows only following fields:

unk_7c4 = <vector<void*>: 0x17037fe0>
anon_1 = <vector<void*>: 0x17037ff0>
anon_2= <vector<void*>: 0x17038000>
unk_7d4= <vector<void*>: 0x17038010>
unk_7e4= <vector<void*>: 0x17038010>

I'm using current version of DFHack (34.10 rc1) so I'm quite confused...
Quietust meant that in current (github/nonreleased) version it's called like that. The next release will have that.
Title: Re: DFHack 0.34.10 r1
Post by: Numbers on May 25, 2012, 09:42:03 am
Superb. I'll try to get ahold of that version and play with it...

I think I saw the link to this earlier in this thread.
Title: Re: DFHack 0.34.10 r1
Post by: peterix on May 25, 2012, 01:33:34 pm
Superb. I'll try to get ahold of that version and play with it...

I think I saw the link to this earlier in this thread.
Nope, I'm pretty sure that's older than the current release.
Title: Re: DFHack 0.34.10 r1
Post by: Numbers on May 25, 2012, 01:59:28 pm
Grabbed the version from the beginning of the thread. Re-downloaded it again and tried it. Nope Unknown7 still has non-descript values
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on May 25, 2012, 02:00:34 pm
There is no build which contains the information I found - if you want to make use of it, you will have to compile DFHack yourself and explicitly use my fork of df-structures instead of the default one.
Title: Re: DFHack 0.34.10 r1
Post by: Numbers on May 25, 2012, 03:30:12 pm
Okay with a little help from my friend I managed to get it up and running and yeah I see it now!

Unit1 is a healthy dorf, Unit2 is a vampire. Not sure what to do to remove that syndrome not to cause some major crash or corruption, since I'm fairly new to LUA poking.

[lua]# printall(unit1.unknown7.syndromes)
[lua]# printall(unit2.unknown7.syndromes)
0                        = <unit.T_unknown7.T_syndromes: 0x1b3d0d20>
Title: Re: DFHack 0.34.10 r1
Post by: Warmist on May 25, 2012, 03:51:58 pm
letsee...
Try this:
Code: [Select]
syn=unit2.unknown7.syndromes[0]
unit2.unknown7.syndromes:erase(0)
syn:delete()
if it fails or crashes than maybe this is enough:
Code: [Select]
unit2.unknown7.syndromes:erase(0)
Title: Re: DFHack 0.34.10 r1
Post by: Numbers on May 25, 2012, 08:26:26 pm
Prelimary tests show that the 'cured' vampire goes back to his blood-sucking ways sooner or later.

I'm kind of wondering if I'm missing something
Title: Re: DFHack 0.34.10 r1
Post by: Rose on May 25, 2012, 08:32:42 pm
Probably historical figure stuff.
Title: Re: DFHack 0.34.10 r1
Post by: Martin on May 25, 2012, 11:21:45 pm
You can't do that - the vector must be sorted by skill id.

Try:

Code: [Select]
utils = require 'utils'
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = ..., rating = ... }, 'id')


require 'utils' throws an error - module utils not found.


utils.lua doesn't contain an insert_or_update function. Is this new, or is there something I'm missing?
Title: Re: DFHack 0.34.10 r1
Post by: Martin on May 26, 2012, 12:05:41 am
Aha! It is new! This is fantastic, everyone. I have one-click Morul now!


And I added my function to the wiki (http://dwarffortresswiki.org/index.php/Utility:DFusion#How_to).


I've generalized vjeks code so you can pass in the unit and an array of value for each of his categories. It might be nice to get those on the wiki as well. I imagine these would be popular things for people to do.
Title: Re: DFHack 0.34.10 r1
Post by: Numbers on May 26, 2012, 03:47:00 am
Well I gave up currently on curing the vampirism, due to lack of time.

There are probably more factors involved... I can gladly give my save for further tampering with.
Title: Re: DFHack 0.34.10 r1
Post by: Iceflame on May 26, 2012, 07:28:43 am
Can I add a tower to the world map with DFHack anyhow?
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on May 26, 2012, 07:32:14 am
Can I add a tower to the world map with DFHack anyhow?
well yes but the one way I know kinda revolves around fixing the site changer in dfusion and using nano fort. then use fort mode to stick a the site any where you want then change the type of site using site changer.
don't know if doing so will turn the place into a tower or anything.
Title: Re: DFHack 0.34.10 r1
Post by: splinterz on May 26, 2012, 09:36:17 am
Probably historical figure stuff.

speaking of historical figures, i've been poking around memory at the world.history.figures vector offset, but i'm not able to find a vector there, am i missing something or are historical figures loaded somewhere else?
Title: Re: DFHack 0.34.10 r1
Post by: vjek on May 26, 2012, 09:37:57 am
Aha! It is new! This is fantastic, everyone. I have one-click Morul now!


And I added my function to the wiki (http://dwarffortresswiki.org/index.php/Utility:DFusion#How_to).


I've generalized vjeks code so you can pass in the unit and an array of value for each of his categories. It might be nice to get those on the wiki as well. I imagine these would be popular things for people to do.

Nice!  I was also thinking that eventually, it would be nice to walk through all the living current dwarves/units and be able to set attributes for all of them, recursively.   Rather than having to target each one.   

something like using df.global.world.units.all , whatever.whatever.race==dwarf and first_unit.flags.dead==false or whatever combination results in:  All the living dwarves in the embark area.  Then just fire each of them through the ringer of attribute and trait changes.  Heck, throw in a skills template and you've got a winner.

For the to-do list... heheheh
Title: Re: DFHack 0.34.10 r1
Post by: AVE on May 26, 2012, 09:42:53 am
Prelimary tests show that the 'cured' vampire goes back to his blood-sucking ways sooner or later.

I'm kind of wondering if I'm missing something
Yes. In the end of the "vampire curse" interaction (look at the raw/interaction_examples/interaction_vampire.txt) the syndrome adds DRINKING_BLOOD counter, which, I suppose, is responsible for the renewing blood-drinking habits of "not-a-vampire-anymore".

Where and how to remove that counter I have no idea of.

BTW, do reverting the vamp syndrome actually reverts stat gain bonuses and undead status (and immunity too)?
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 26, 2012, 10:00:15 am
speaking of historical figures, i've been poking around memory at the world.history.figures vector offset, but i'm not able to find a vector there, am i missing something or are historical figures loaded somewhere else?

Are you subtracting that stupid 4-byte padding DT assumes vectors have at the beginning on windows?
Title: Re: DFHack 0.34.10 r1
Post by: Rafal99 on May 26, 2012, 10:25:26 am
I got an idea for some utility for DF and plan to write it as C++ DFHack plugin. I looked at the code of existing plugins and browsed what structures DFHack reads from DF to get the general idea of how plugins work and what are the possiblities.
But still have some questions:
- can plugin get informed about SDL events from DF such as mouse movements?
- does DFHack provide functionality to send keypresses to DF or should I rely on my own code to do so?
Title: Re: DFHack 0.34.10 r1
Post by: splinterz on May 26, 2012, 11:12:07 am
speaking of historical figures, i've been poking around memory at the world.history.figures vector offset, but i'm not able to find a vector there, am i missing something or are historical figures loaded somewhere else?

Are you subtracting that stupid 4-byte padding DT assumes vectors have at the beginning on windows?

yes i remembered the stupid 4-byte padding. :) i figured out what's happening. it's refusing to load any vector > 5000 entries, which for historical figures i'm going to assume is often higher than that...
Title: Re: DFHack 0.34.10 r1
Post by: Martin on May 26, 2012, 12:57:08 pm
Nice!  I was also thinking that eventually, it would be nice to walk through all the living current dwarves/units and be able to set attributes for all of them, recursively.   Rather than having to target each one. 


That shouldn't be too hard from what I could tell poking about. That kind of thing really begs for a UI, though - something like DwarfTherapist where you could click on everyone's jobs and just hit the 'make them legendary in their job' button and boom, it's done. Has anyone worked out the relationship between experience in individual skills and how they translate to attributes? I know that some people have worked out what skills contribute to what attributes, but do we know how many points of strength are gained by x experience in mining, or whatever? Would be nice to have that automatically worked out if you dial up specific skills just to keep everything in balance.
Title: Re: DFHack 0.34.10 r1
Post by: PK1312 on May 26, 2012, 02:49:55 pm
Hey, guys- complete and utter newbie here. How exactly do I install the lua scripts so I can execute them from DFhack? I would /really/ like to be able to use the elevate scripts but after like an hour of fiddling around blindly I've had no success. Can anyone give me a step-by-step walkthrough?
Title: Re: DFHack 0.34.10 r1
Post by: danaris on May 26, 2012, 03:45:21 pm
There is a new effort underway to get DFHack compiling and working on the Mac. The code can be found on GitHub, at https://github.com/danaris/dfhack

The compiling part works, and it even runs and hooks into DF, but trying to actually do anything still causes it to crash.

I'm working on it :D
Title: Re: DFHack 0.34.10 r1
Post by: azrael300 on May 26, 2012, 03:53:18 pm
help! the tiletypes> paint shape channel does not work!
Title: Re: DFHack 0.34.10 r1
Post by: Aerval on May 26, 2012, 04:04:15 pm
help! the tiletypes> paint shape channel does not work!
What does not work about it?
Example:
Code: [Select]
p shape WALLAtleast it worked some versions ago.
Title: Re: DFHack 0.34.10 r1
Post by: azrael300 on May 26, 2012, 04:08:40 pm
help! the tiletypes> paint shape channel does not work!
What does not work about it?
Example:
Code: [Select]
p shape WALLAtleast it worked some versions ago.
i want a downward slope
Title: Re: DFHack 0.34.10 r1
Post by: Martin on May 26, 2012, 04:37:07 pm
There is a new effort underway to get DFHack compiling and working on the Mac. The code can be found on GitHub, at https://github.com/danaris/dfhack (https://github.com/danaris/dfhack)

The compiling part works, and it even runs and hooks into DF, but trying to actually do anything still causes it to crash.

I'm working on it :D


My hero! I shall name the manager of the sanctuary dwarves in your honor if you are successful. And having a Mac version will almost certainly get me writing more lua scripts for dfusion.
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on May 26, 2012, 07:15:53 pm
Hey, guys- complete and utter newbie here. How exactly do I install the lua scripts so I can execute them from DFhack? I would /really/ like to be able to use the elevate scripts but after like an hour of fiddling around blindly I've had no success. Can anyone give me a step-by-step walkthrough?
Step 1: Copy the .lua file into the [DF]/hack/scripts folder
Step 2: Type the name of the script (without the ".lua") at the DFHack command prompt (along with any parameters).
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on May 27, 2012, 02:49:46 am
Anyone else having their map revealed when running .lua scripts ?
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 27, 2012, 01:51:07 pm
I wonder if somebody could upload a really slow 0.34.10 fortress save - I'm curious what will turn out to be the most noticeable bottleneck in this version. :)
Title: Re: DFHack 0.34.10 r1
Post by: Robotic on May 27, 2012, 02:17:17 pm
Is there a way to designate a dig for all unrevealed tiles?  I've noticed that digexp allows a filter for unrevealed, but ideally I'd like to be able to run a command to dig out an entire surface layer without digging out the walls around surface lakes, or the "edge" walls surrounding the layer in question.  I'd be willing to use lua scripts or however else it could be accomplished, ideally I'd expected this to be an option in digexp though, seems weird that you can set it as a filter, but not a pattern.  It'd also be a bonus if I could use this to channel instead of dig, as I could make the hollow mountain (and cavern-marksdwarf-coasters) in my dreams.
Title: Re: DFHack 0.34.10 r1
Post by: tryrar on May 27, 2012, 07:41:23 pm
I'm having bit of a problem with autobutcher-namely I can't get it to work at all. How do I use it?(I've followed the steps in the readme, but I still can't do it)
Title: Re: DFHack 0.34.10 r1
Post by: PK1312 on May 28, 2012, 12:22:35 am
Hey, guys- complete and utter newbie here. How exactly do I install the lua scripts so I can execute them from DFhack? I would /really/ like to be able to use the elevate scripts but after like an hour of fiddling around blindly I've had no success. Can anyone give me a step-by-step walkthrough?
Step 1: Copy the .lua file into the [DF]/hack/scripts folder
Step 2: Type the name of the script (without the ".lua") at the DFHack command prompt (along with any parameters).

Oh, wow, it's that easy? I feel silly now. Thanks very much.

EDIT: okay actually it would appear I have no folder called scripts. The only thing in my hack folder is "plugins" and those are all DLL files, not lua, and dropping it in there doesn't allow it to run. Neither does making my own script folder and dropping it in there.
Title: Re: DFHack 0.34.10 r1
Post by: Rinin_Rus on May 28, 2012, 01:34:10 am
okay actually it would appear I have no folder called scripts. The only thing in my hack folder is "plugins" and those are all DLL files, not lua, and dropping it in there doesn't allow it to run. Neither does making my own script folder and dropping it in there.
Take latest DfHack from first post. It definitely has "script" folder.
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on May 28, 2012, 01:38:59 am
Anyone else having their map revealed when running .lua scripts ?
nevermind, it was cleanmap I forgot that it revealed the map.
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on May 28, 2012, 01:43:16 am
This may help people or it may not. I renamed some lua scripts and put them in my c:/ directory so all I had to do was just type:    runlua c:/Example.lua
and that worked fine for me. Short path = less typing.
I didn't know you could run the script any other way but to each his own. I don't use them a lot.
Title: Re: DFHack 0.34.07 r2
Post by: peetaur on May 28, 2012, 02:06:06 am
But when I run dfhack I get:
Code: [Select]
./libs/Dwarf_Fortress: /home/ubu/Downloads/df_linux/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
But I'm looking right at the file:
Code: [Select]
ubu@ubu-PX790AA-ABA-SR1511NX-NA530:~/Downloads/df_linux/libs$ ls -al
total 20936
drwxr-xr-x 2 ubu ubu     4096 2012-03-30 06:27 .
drwxr-xr-x 8 ubu ubu     4096 2012-04-22 18:14 ..
-rwxr-xr-x 1 ubu ubu 14669276 2012-03-30 06:27 Dwarf_Fortress
-rw-r--r-- 1 ubu ubu   466491 2012-03-30 06:27 libgcc_s.so.1
-rwxr-xr-x 1 ubu ubu  1435396 2012-03-30 06:27 libgraphics.so
-rwxr-xr-x 1 ubu ubu  4852343 2012-03-30 06:27 libstdc++.so.6

What am I missing?  I'm on Ubuntu 11.10 32bit.  Fresh install of df_linux, haven't even edited the inits yet.

To fix this I simply replaced the DF shipped copy of the file with the one installed in my OS (in my case opensuse 12.1):

    cd mydfdir/libs
    mv libstdc++.so.6 dforig.libstdc++.so.6
    ln -s /usr/lib/libstdc++.so.6
Title: Re: DFHack 0.34.10 r1
Post by: kingubu on May 28, 2012, 02:39:19 am
Lol, thanks.  That was from over a month ago.  I fixed it by going down a version of gcc to 4.5
Title: Re: DFHack 0.34.10 r1
Post by: Warmist on May 28, 2012, 02:54:20 am
This may help people or it may not. I renamed some lua scripts and put them in my c:/ directory so all I had to do was just type:    runlua c:/Example.lua
and that worked fine for me. Short path = less typing.
I didn't know you could run the script any other way but to each his own. I don't use them a lot.
also if you put them into DF directory you can type "runlua Example.lua" or if you put into DF subdir (e.g. myscripts) then you can type "runlua myscripts/Example.lua" (also same with command "lua")
Title: Re: DFHack 0.34.10 r1
Post by: robertheinrich on May 28, 2012, 03:55:13 am
I'm having bit of a problem with autobutcher-namely I can't get it to work at all. How do I use it?(I've followed the steps in the readme, but I still can't do it)

Hm, weird. If you followed one of the examples (1. set target count for a race, 2. put that race onto the watchlist, 3. start autobutcher) it should work. By default it´s set to run ca. once per minute, so you might not see an effect right away, though.

But it´s possible that the latest updates somehow killed it, I didn´t have the time to play more than a short while since Toady introduced the minecart stuff. I´ll look into it later today. Anybody else having problems with autobutcher and/or autonestbox?
Title: Re: DFHack 0.34.10 r1
Post by: JAFANZ on May 28, 2012, 06:07:03 am
(Apologies if this is the wrong thread or has been answered somewhere in the previous 600 posts)

Now that Prospector is part of dfhack, &  not a standalone exe (yes, I've been away from DF for "a while"), is there any way to export the results to an external, preferably text, file (on Winblows 7)?
Title: Re: DFHack 0.34.10 r1
Post by: Rose on May 28, 2012, 06:14:53 am
You can copy and paste from the DFhack window. just right click the title bar, and do edit->mark.
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 28, 2012, 06:44:44 am
You can copy and paste from the DFhack window. just right click the title bar, and do edit->mark.

... or use "dfhack-run prospect"
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on May 28, 2012, 06:57:02 am
btw instead of running scripts by typing them by handyu can add them to tools of dfusion.
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on May 28, 2012, 07:09:48 am
btw instead of running scripts by typing them by handyu can add them to tools of dfusion.
or if you go advance and make a folder for them and go into the main dfusion init to link the folder with the rest of dfusion. that what I did way back in dfusion was standalone
Title: Re: DFHack 0.34.10 r1
Post by: The Scout on May 28, 2012, 08:33:44 am
How am I supposed to use the liquids command? DFHack says I must have my cursor in-game, but then I cannot enter in the command in DFHack. Is there a simple way to do this I am missing?
Title: Re: DFHack 0.34.10 r1
Post by: Rose on May 28, 2012, 08:55:13 am
Not your mouse cursor, your X cursor
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on May 28, 2012, 10:37:42 am
I'm having bit of a problem with autobutcher-namely I can't get it to work at all. How do I use it?(I've followed the steps in the readme, but I still can't do it)

Hm, weird. If you followed one of the examples (1. set target count for a race, 2. put that race onto the watchlist, 3. start autobutcher) it should work. By default it´s set to run ca. once per minute, so you might not see an effect right away, though.

But it´s possible that the latest updates somehow killed it, I didn´t have the time to play more than a short while since Toady introduced the minecart stuff. I´ll look into it later today. Anybody else having problems with autobutcher and/or autonestbox?
No, both work mostly fine for me and I've been poking at them fairly aggressively.  I have run into autonestbox trying to move nested birds, though, so the logic to avoid that may not be working correctly.

Also, I think it's safe to autonest trained but not yet domesticated egglayers.  Even if they break training they'll still remain nested.  The problem comes when you autonest egglayers who were previously war creatures.  Those will not remain nested and will instead attack anyone in the vicinity.  I'm not sure how to test for that, though.
Title: Re: DFHack 0.34.10 r1
Post by: Iceflame on May 28, 2012, 12:16:45 pm
Is there a way to remove or kill single units with DFhack?
Title: Re: DFHack 0.34.10 r1
Post by: danaris on May 28, 2012, 12:22:47 pm
You can always use the liquids command to drop magma on them.

Or if they're particularly persistent, drop magma and water on them.
Title: Re: DFHack 0.34.10 r1
Post by: Iceflame on May 28, 2012, 01:46:58 pm
They are undead - I placed magma on them, and they became a living existing torch, running around and setting the whole map on fire.
I do not know where they came from - i have no evil biome, nor is a tower nerby my embark.
Title: Re: DFHack 0.34.10 r1
Post by: robertheinrich on May 28, 2012, 03:20:53 pm
They are undead - I placed magma on them, and they became a living existing torch, running around and setting the whole map on fire.
I do not know where they came from - i have no evil biome, nor is a tower nerby my embark.

Undead burn in magma, too. They just take more damage before they die. You can seal them off with obsidian walls (using liquids), then pour magma from above. Currently dfhack has no easy "kill creature" function... I´ve read that setting the blood amount to zero works, but for that you need lua or direct memory hacks and I´m not sure if it will even help against undead.
Title: Re: DFHack 0.34.10 r1
Post by: JAFANZ on May 28, 2012, 03:44:09 pm
You can copy and paste from the DFhack window. just right click the title bar, and do edit->mark.
... or use "dfhack-run prospect"

Thank you, both.
Title: Re: DFHack 0.34.10 r1
Post by: PK1312 on May 28, 2012, 06:44:07 pm
okay actually it would appear I have no folder called scripts. The only thing in my hack folder is "plugins" and those are all DLL files, not lua, and dropping it in there doesn't allow it to run. Neither does making my own script folder and dropping it in there.
Take latest DfHack from first post. It definitely has "script" folder.

Oh, jeez. This is what I get for using the lazy newb pack, I suppose. Thanks for putting up with me. Now I no longer have to wait several hours for strand extraction :P
Title: Re: DFHack 0.34.10 r1
Post by: zkm2erjfdb on May 29, 2012, 03:17:31 am
Sorry..my english = very little linguistic ability
And this is my first reply with the help of (google translation)

I have some ploblem with LUA.
I copy somewords from (vjek:Reply #1565 on: May 23, 2012, 05:55:53 pm)
//I don't know how to use function of forum,sorry.

from elevate_physical.lua:
function elevate_unit(demigod)
{}
end
local opt = ...
local demigod = 2600

if opt then
   demigod = opt
end

elevate_unit(demigod)

I checked a lot of information ,but I didn't know how {local opt = ...} worked.
If enter like :
      [DFHack]# lua elevate_physical.lua 3000
Then opt = 3000 so demigod =3000.

But I want to learn :how can I pass two variables
Is it like :
      [DFHack]# ***.lua 2300 3000 ??
And how can I get these two variables?


 :o...I find another way to do it :      local n2=Console.lineedit("second number:")
Is there a way to do it easier?
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on May 29, 2012, 03:52:16 am
They are undead - I placed magma on them, and they became a living existing torch, running around and setting the whole map on fire.
I do not know where they came from - i have no evil biome, nor is a tower nerby my embark.

Undead burn in magma, too. They just take more damage before they die. You can seal them off with obsidian walls (using liquids), then pour magma from above. Currently dfhack has no easy "kill creature" function... I´ve read that setting the blood amount to zero works, but for that you need lua or direct memory hacks and I´m not sure if it will even help against undead.

Code: [Select]
function tools.dead(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
print("which flag")
unit.flags1.dead=true
end
tools.menu:add("dead",tools.dead)

the bit about flags is on dfusoin's utility page on the wiki.
 (http://dwarffortresswiki.org/index.php/Utility:DFusion)
Title: Re: DFHack 0.34.10 r1
Post by: vjek on May 29, 2012, 09:09:16 am
... Is there a way to do it easier?
That's a pretty good way to make it interactive, but if you want it to accept an array of values, then you'll have to use an array! :)  Martin mentioned he had done this already, so it may be worth PM'ing him to see what he's written and if he's willing to share it with you.

I'm busy for the rest of the week, but I could investigate next week and write up a version that would accept a range of values.

However, if you want to use a particular set of values, you could always change it so you pass it a single keyword, or a single number:  IF that string is the input, THEN use this template of attributes or traits.  IF a different string, THEN use a different template, and so on. 

I'm not exactly sure what your end goal is, I'm just guessing, but those are some ideas.
Title: Re: DFHack 0.34.10 r1
Post by: zkm2erjfdb on May 29, 2012, 09:56:14 am
I'm not exactly sure what your end goal is
I want to...make it interactive...
Because I find DwarfTherapist isn't (comprehensive).
And when use:[LUA]#printall(unit.status.souls[0].skills[0])
can get messages like
unk_14  =  2
rusty  =  13
unk_18 =  2
When I want to know more about one skills ,just need to type once.But there are so many skills to check.
Also  many other attribute .
So I'm trying to make them more clean like a form,easier to check and chang it.
Thanks for your help.I will try to learn array later.
Title: Re: DFHack 0.34.10 r1
Post by: vjek on May 29, 2012, 10:31:24 am
I'm not exactly sure what your end goal is
I want to...make it interactive...
Because I find DwarfTherapist isn't (comprehensive).
And when use:[LUA]#printall(unit.status.souls[0].skills[0])
can get messages like
unk_14  =  2
rusty  =  13
unk_18 =  2
When I want to know more about one skills ,just need to type once.But there are so many skills to check.
Also  many other attribute .
So I'm trying to make them more clean like a form,easier to check and chang it.
Thanks for your help.I will try to learn array later.
Ok, well, I split up the three scripts intentionally.
Physical attributes, mental attributes, and personality traits are pretty straightforward, as far as how they sit in memory, and being able to modify the values.
It would be easy to change attributes and personality traits with multiple keywords.  It would just be a matter of taking something like "modify_attribute.lua strength 3000" and then adjusting strength based on that.  You could even expand it to something like "modify_attributes_personality.lua strength 3000 agility 3000 modesty 99" so based on the first attribute or personality trait in the key-value pair, it updated the correct one.

To the best of my knowledge, every physical attribute, mental attribute, and personality trait are adjusted with the scripts I posted earlier for 34.10.  I could be wrong, but that's my understanding.

Skills, on the other hand, are trickier, but not considerably so.  The missing piece is what text value the 'id' value corresponds to, such as 22 = Growing, and so on.  Once I have time to find that ( I know it's there, dwarfexport uses it ) then I'll be able to create something like "make_legendary.lua Growing" and bam, you've got a legendary grower.

None of the scripts I have released to date will help with skills.  However, there are some code snippets earlier in this thread from other helpful community authors that specifically address skills, so take a look at those.
Title: Re: DFHack 0.34.10 r1
Post by: Martin on May 29, 2012, 02:47:22 pm
Here are the skills, nicked from DwarfTherapist:


Spoiler (click to show/hide)


Any thoughts on where these should go on the wiki? I'll put them up.
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on May 29, 2012, 03:00:12 pm
Here are the skills, nicked from DwarfTherapist:

Any thoughts on where these should go on the wiki? I'll put them up.

No need - they're already right here (http://dwarffortresswiki.org/index.php/DF2012:Skill_token) (and have been for well over a year, at least for version 0.31).

Most of the other important lists (professions and labors) are also on similar pages.
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 29, 2012, 03:06:02 pm
Skills, on the other hand, are trickier, but not considerably so.  The missing piece is what text value the 'id' value corresponds to, such as 22 = Growing, and so on.  Once I have time to find that ( I know it's there, dwarfexport uses it ) then I'll be able to create something like "make_legendary.lua Growing" and bam, you've got a legendary grower.

See df.job_skill[id] or df.job_skill[name]. Also, ~df.job_skill.attrs[id].
Title: Re: DFHack 0.34.10 r1
Post by: danaris on May 29, 2012, 04:58:09 pm
There is a new effort underway to get DFHack compiling and working on the Mac. The code can be found on GitHub, at https://github.com/danaris/dfhack

The compiling part works, and it even runs and hooks into DF, but trying to actually do anything still causes it to crash.

I'm working on it :D

Compiling with gcc version 4.5 (which appears to be the same version Toady uses) has resulted in a working build of this. reveal worked perfectly; other plugins await more complete offsets being mapped out (which I'm not yet experienced enough to do).

I'm still working on getting a build together that will run anywhere except on my build machine.
Title: Re: DFHack 0.34.10 r1
Post by: Martin on May 29, 2012, 05:14:11 pm
No need - they're already right here (http://dwarffortresswiki.org/index.php/DF2012:Skill_token) (and have been for well over a year, at least for version 0.31).


Grr. How much time did I spend searching the wiki and not finding it?
Title: Re: DFHack 0.34.10 r1
Post by: vjek on May 29, 2012, 07:56:43 pm
I'll update this post later, I have to step out for a few hours, but figured it was worth sharing:

Spoiler: make_legendary.lua (click to show/hide)

As with the other scripts, it can be used with either
' lua c:\path\to\script '
or if you put it into the dfhack scripts directory, just call it with make_legendary

typical usage would be to target a dwarf in dfhack, then make_legendary MINING
and voila, you have a legendary miner.  make_legendary list will provide a list of available skills.
Title: Re: DFHack 0.34.10 r1
Post by: Rinin_Rus on May 30, 2012, 12:52:43 am
Ok, I'm sure a lot of people tired of useless children. I think butchering children is fun, and solves two problems in one shot: you have no children, but you have a nice material for crossbow =) Involve parents for additional fun.

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on May 30, 2012, 01:11:50 am
Ok, I'm sure a lot of people tired of useless children. I think butchering children is fun, and solves two problems in one shot: you have no children, but you have a nice material for crossbow =) Involve parents for additional fun.

Spoiler (click to show/hide)
I don't think you need to include the  getCreatureAtPos(x,y,z) or the getxyz functions in your post... when dfusion has them already. though I guess this is for those who want to run straight out of LUA functions.
Title: Re: DFHack 0.34.10 r1
Post by: Rinin_Rus on May 30, 2012, 01:18:59 am
I don't think you need to include the  getCreatureAtPos(x,y,z) or the getxyz functions in your post... when dfusion has them already. though I guess this is for those who want to run straight out of LUA functions.
Yep, this script could be run without dfusion, actually function in this script are copy-pasted from Dfusion )
Title: Re: DFHack 0.34.10 r1
Post by: Numbers on May 30, 2012, 03:12:17 am
Prelimary tests show that the 'cured' vampire goes back to his blood-sucking ways sooner or later.

I'm kind of wondering if I'm missing something
Yes. In the end of the "vampire curse" interaction (look at the raw/interaction_examples/interaction_vampire.txt) the syndrome adds DRINKING_BLOOD counter, which, I suppose, is responsible for the renewing blood-drinking habits of "not-a-vampire-anymore".

Where and how to remove that counter I have no idea of.

BTW, do reverting the vamp syndrome actually reverts stat gain bonuses and undead status (and immunity too)?

No i still had to manually remove the curse. The stat gains and undead statuses are coded under .curses.add_tags1 etc. and .curses.attr_gain
Title: Re: DFHack 0.34.10 r1
Post by: zkm2erjfdb on May 30, 2012, 04:49:22 am
it was worth sharing
Thanks.Then I make mine like yours,a bigger one like dfusion.
Sorry.I chack it in a new way(a popular way) and find it dosen't work. Now error has been fixed.(putin DF_Phoebus_34_10\hack\scripts)
Spoiler: skill.lua (click to show/hide)

I'm trying to make it a better view.Is it works?I find : just 'u' In Unit List is also work.
legendary is not I want.. 8)
But  "put it into the dfhack scripts directory" mean what? I don't know about dfhack scripts directory,where can I find it?
I sleep you wake up,you sleep I wake up ...... :'(
!!!Why? I find Console. don't work in /scripts/   like Console.lineedit
But when use lua skill.lua to run.it work then.
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 30, 2012, 06:21:33 am
Everybody with an older fortress that begins to slow down could try this for a potential 5-10% increase in fps:

Spoiler (click to show/hide)

The script works around this bug: http://www.bay12games.com/dwarves/mantisbt/view.php?id=5971 (http://www.bay12games.com/dwarves/mantisbt/view.php?id=5971)
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on May 30, 2012, 06:29:45 am
If this really is a working solution then it should be added as a tool to dfhack and maybe be put to automatic usage every year.
Title: Re: DFHack 0.34.10 r1
Post by: vjek on May 30, 2012, 09:47:02 am
...
But  "put it into the dfhack scripts directory" mean what? I don't know about dfhack scripts directory,where can I find it? ...

For 34.10 (not sure about .09 and .08) after you uncompress dfhack into the DF directory, it creates a \hack\ directory.

Within \hack\, there is another directory, called \scripts\

Within \scripts\ there are a few .lua files.  If you place it there, you can call it without manually specificying ' lua scriptname.lua' although that will still work.

You can just use the scriptname without the extension, directly from the [DFHack]# prompt.

So if you extracted DF 34.10 into c:\df_34_10_win, and uncompressed dfhack into that directory, you would put the script at:

c:\df_34_10_win\hack\scripts\make_legendary.lua

Then, for example:

[DFHack]# make_legendary MINING
amost is now a Legendary Miner
[DFHack]#


Easy! :)  And your script looks great, it's good to see people writing more code!
Title: Re: DFHack 0.34.10 r1
Post by: zkm2erjfdb on May 30, 2012, 10:54:08 am
Within \scripts\ there are a few .lua files.  If you place it there, you can call it without manually specificying ' lua scriptname.lua' although that will still work.
Great!I have done something unnecessary to make so many part in one file.With \scripts\ I can make my code look like the part of DFHack.with out .lua  so great.
And from
Everybody with an older fortress that begins to slow down could try this for a potential 5-10% increase in fps:
I learn: df.global.world.units.all,why I didn't find this function before.It makes my code work better!
Today is a great day.I go to sleep now. :D
!!!Why? I find Console.* don't work in /scripts/   like Console.lineedit()
But it works when use lua skill.lua to run .
So I change them into dfhack.*
I find it works,but is it standard?
I find Utility:DFusionin wiki, I can't understand FunctionCall. yet.
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 31, 2012, 02:30:41 am
!!!Why? I find Console.* don't work in /scripts/   like Console.lineedit()
But it works when use lua skill.lua to run .
So I change them into dfhack.*

Because Console stuff is part of dfusion, which is still not completely merged into the new lua interface, and uses its own interpreter instance. The 'lua' command is also part of dfusion and uses its interpreter, while scripts run in the one managed by dfhack core.

Things described in this document are available in both interpreter instances:

https://github.com/peterix/dfhack/blob/master/LUA_API.rst (https://github.com/peterix/dfhack/blob/master/LUA_API.rst)
Title: Re: DFHack 0.34.10 r1
Post by: Rinin_Rus on May 31, 2012, 04:36:17 am
Is it possible to locate from global map any of features, except subterranean, magma_core and underworld? And is it possible to iterate all veins in all biomes from embark screen? So how many information could be collected about world during embark?

My brain explodes while I try to realize a structure of "DF" class for example. Which members is it has?
Title: Re: DFHack 0.34.10 r1
Post by: ag on May 31, 2012, 06:22:11 am
My brain explodes while I try to realize a structure of "DF" class for example. Which members is it has?

What "DF" class?
Title: Re: DFHack 0.34.10 r1
Post by: Iceflame on June 01, 2012, 02:22:29 am
is there a way to fully cure dwarfs with DFHack?
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on June 01, 2012, 04:13:37 am
is there a way to fully cure dwarfs with DFHack?
that depends on what you mean of cure?
if you mean fully heal then
Code: [Select]
function tools.heal2(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
unit.body.wounds:resize(0) -- memory leak here :/
unit.body.blood_count=unit.body.blood_max
--set flags for standing and grasping...
unit.status2.able_stand=4
unit.status2.able_stand_impair=4
unit.status2.able_grasp=4
unit.status2.able_grasp_impair=4
--should also set temperatures, and flags for breath etc...
unit.flags1.dead=false
unit.flags2.calculated_bodyparts=false
unit.flags2.calculated_nerves=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.counters.winded=0
unit.counters.unconscious=0
for k,v in pairs(unit.body.components) do
for kk,vv in pairs(v) do
v[kk]=0
end
end
end
tools.menu:add("heal2",tools.heal2)
Should do the job, if you mean cure them of vamprism then I think warmist posted something a while back on it.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 01, 2012, 04:21:21 am
Will it work fine? I would try to test it but dwarf will not regrow any limbs this way eh.... but he will be alive - so you can add masterwork fortress workshop for full healing dwarfs later. This will make you reanimate any dwarf. Also there can be interactions moded to resurrect and fully heal any dwarf by your other dwarfes. Only question is - will it stop ghost from appearing and bad thoughts from happening AFTER resurrection.
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 01, 2012, 04:27:03 am
If you can add and remove syndromes, then adding a were-syndrome, changing to manimal and back, then removing the syndrome would also heal them up.
Title: Re: DFHack 0.34.10 r1
Post by: Iceflame on June 01, 2012, 04:56:33 am
Thanks, I think this is exactly what I needed - vamprism is not the problem - only blind migrants from my abandoned fortress.

Where do I have to put this script?
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 01, 2012, 06:44:07 am
If you can add and remove syndromes, then adding a were-syndrome, changing to manimal and back, then removing the syndrome would also heal them up.
Actually masterwork does it similary. It converts a creature to itself and its healed this way with restored limbs. But it has to be alive to use a workshop:)
Title: Re: DFHack 0.34.10 r1
Post by: Robotic on June 01, 2012, 07:13:36 am
I'll update this post later, I have to step out for a few hours, but figured it was worth sharing:

Spoiler: make_legendary.lua (click to show/hide)

As with the other scripts, it can be used with either
' lua c:\path\to\script '
or if you put it into the dfhack scripts directory, just call it with make_legendary

typical usage would be to target a dwarf in dfhack, then make_legendary MINING
and voila, you have a legendary miner.  make_legendary list will provide a list of available skills.

How could I modify this to make a dwarf legendary in ALL skills in one go?
Title: Re: DFHack 0.34.10 r1
Post by: avtolik on June 01, 2012, 07:23:41 am
How could I modify this to make a dwarf legendary in ALL skills in one go?

See the script here:
http://dwarffortresswiki.org/index.php/Utility:DFusion#How_to (http://dwarffortresswiki.org/index.php/Utility:DFusion#How_to)
Title: Re: DFHack 0.34.10 r1
Post by: Hamek McEisenfaust on June 01, 2012, 09:46:06 am
Hey, guys- complete and utter newbie here. How exactly do I install the lua scripts so I can execute them from DFhack? I would /really/ like to be able to use the elevate scripts but after like an hour of fiddling around blindly I've had no success. Can anyone give me a step-by-step walkthrough?
Step 1: Copy the .lua file into the [DF]/hack/scripts folder
Step 2: Type the name of the script (without the ".lua") at the DFHack command prompt (along with any parameters).
Sorry to drag this up again. I would like to know if there is a way to tell DFhack? to run all three scripts, brainwash,physical and mental all at the same time rather then selecting each one after the other? I have the scripts running separately , however, i would like to be able to just type in say, GOD, and all three scripts run on the Urist targeted. Thank you for your assistance.
Title: Re: DFHack 0.34.10 r1
Post by: Robotic on June 01, 2012, 10:28:42 am
Sorry to drag this up again. I would like to know if there is a way to tell DFhack? to run all three scripts, brainwash,physical and mental all at the same time rather then selecting each one after the other? I have the scripts running separately , however, i would like to be able to just type in say, GOD, and all three scripts run on the Urist targeted. Thank you for your assistance.

Sure, you can just combine all the scripts into one .lua file called godmode (or whatever you'd like to name it).  Here it is for the lazy.

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.10 r1
Post by: vjek on June 01, 2012, 10:41:12 am
...
How could I modify this to make a dwarf legendary in ALL skills in one go?

Here you go, version 1.1, with a make_legendary all option:

Spoiler: make_legendary.lua (click to show/hide)

In a future version, I'll be adding the keywords normal, military, social, etc.
Title: Re: DFHack 0.34.10 r1
Post by: cainiao on June 01, 2012, 01:20:45 pm
Game crashed everytime when I accidently tear down a workshop with job protected by "workflow".
Is there anyone same with me?
Title: Re: DFHack 0.34.10 r1
Post by: khearn on June 01, 2012, 01:25:35 pm
Game crashed everytime when I accidently tear down a workshop with job protected by "workflow".
Is there anyone same with me?

I tore down a craftsdwarf workshop with 3 repeating jobs last night with no problem. All of the jobs were suspended at the time, if that matters.
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on June 02, 2012, 02:12:43 am
Code: [Select]
function tools.tame(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit.flags1.tame==false then
unit.flags1.tame=true
end
end

function tools.detame(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit.flags1.tame==true then
unit.flags1.tame=false
end
end
tools.menu:add("fastTame2",tools.detame)
tools.menu:add("fastTame",tools.tame)
for easy taming of wild creatures.

oh here's a convert site function to change elven cities and dark towers into sites you can access.

Code: [Select]
function sitetest(site)
--if site==nil then
--site=getsiteAtPos(x,y,z)
--dfhack.TranslateName(site.name,true)
--end
--print(site.id)
--A=getline()
--printall(df.global.world.world_data.sites[0+A].name)
--printall(df.global.world.world_data.sites[0+A])
--civ=df.global.world.world_data.sites[0+A]
--df.global.world.world_data.sites.type=0+A
for k,v in pairs(df.global.world.world_data.sites) do
print(k)
if v.type==4 then
v.type=7
end
if v.type==1 then
v.type=8
end
end

--Adv=Getadv()
--Advid=Adv.unit.id
--civ.owner1=Advid
end
tools.menu:add("sitetest",sitetest)
Title: Re: DFHack 0.34.10 r1
Post by: Morticeq on June 02, 2012, 06:16:52 pm
Code: [Select]
function tools.tame(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit.flags1.tame==false then
unit.flags1.tame=true
end
end

function tools.detame(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit.flags1.tame==true then
unit.flags1.tame=false
end
end
tools.menu:add("fastTame2",tools.detame)
tools.menu:add("fastTame",tools.tame)
for easy taming of wild creatures.
Sorry, but dfhack keeps giving me some error message about tail calls... I put it in folder scripts as *lua file, as always, but...
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 02, 2012, 09:22:58 pm
One of the things I most wanted to do when I first became a necromancer was clear the tower out and claim it as my own, storing my loot there, getting furniture, perhaps a tasteful set of drapes...

Anyway, that didn't happen.  First off, sleeping is impossible in a tower, unlike most normal lairs.  Second, although I've not tested this myself, it seems that undead will respawn at towers whether a necromancer is there or not.  They're not dangerous to necromancers, but they are a bit of an eyesore and make it hard to move around or find stuff.

Would it be feasible to write a script or plugin to make towers suitable as a home for an adventurer?

Failing that, I could retire for a bit and ask a group of dwarves to build me a tower I suppose.  But once they leave it or mysteriously vanish, can dfhack be used to keep monsters from spawning there like in other abandoned forts?

Thanks!

EDIT:
Derp.  Looks like lair and mode set are all that is needed.  Won't be able to make structural changes, but should be good enough.
Title: Re: DFHack 0.34.10 r1
Post by: Martin on June 02, 2012, 09:42:34 pm
for easy taming of wild creatures.


Sweet. The untame will come in handy with the hunting effort in my fortress.
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on June 02, 2012, 11:32:18 pm
Is DF hack open source ?
Title: Re: DFHack 0.34.10 r1
Post by: 0x517A5D on June 02, 2012, 11:40:24 pm
Is DF hack open source ?

LICENSE (https://github.com/peterix/dfhack/blob/master/LICENSE)
Code: [Select]
License of dfhack
[...]
Permission is granted to anyone to use this software for any
purpose, including commercial applications, and to alter it and
redistribute it freely, subject to the following restrictions:
[...]
2. Altered source versions must be plainly marked as such, and
must not be misrepresented as being the original software.
[...]
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on June 02, 2012, 11:47:01 pm
thanx. I'll google it. Sometimes I just hate googling shit. I'll open up my homepage and see an ad for "beans that don't make you fart!"  about 10 minutes after googling it.
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 03, 2012, 01:48:55 am
Why would you google it when there's a link to the source in the first post?
Title: Re: DFHack 0.34.10 r1
Post by: LuRockz on June 03, 2012, 02:22:28 am
I dont know if its bad to ask this but I'm really curious  ???
Will DFHack ever be mac compatible?
I really want to swap bodies  :P
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on June 03, 2012, 02:30:00 am
Why would you google it when there's a link to the source in the first post?
didn't look at the first post. probably should have.
Title: Re: DFHack 0.34.10 r1
Post by: danaris on June 03, 2012, 08:47:22 am
I dont know if its bad to ask this but I'm really curious  ???
Will DFHack ever be mac compatible?
I really want to swap bodies  :P

I'm working on Mac compatibility. It's almost working perfectly: the two things missing are finding all the offsets for the Mac version of DF (so that DFHack knows how to do its job), and making sure it actually runs on a machine other than the one I build it on :-\
Title: Re: DFHack 0.34.10 r1
Post by: Felgard on June 03, 2012, 10:55:32 am
Could anyone here help me or give me an answer to how i should set up a workflow for clay bricks?

i tried many variations but cant figure out how.

some of the commands i tried are
Code: [Select]
workflow count BLOCKS/CLAY 1
workflow count BLOCKS//CLAY 1
workflow count BLOCKS//BRICKS 1
workflow count BLOCKS//CERAMIC_EARTHENWARE 1
workflow count BLOCKS//CERAMIC 1

some of them work but do not detect the job in the kiln
i believe there should be a way since "workflow count BLOCKS 1" detects the job

wierd the command "workflow count BLOCKS//CERAMIC_EARTHENWARE 1" finds the bricks but not the job
Title: Re: DFHack 0.34.10 r1
Post by: IamanElfCollaborator on June 03, 2012, 10:56:58 am
 On my embark, I am unable to use the embark function, but I am able to use friendship and migrants. This a regular problem or am I alone in this?
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on June 03, 2012, 12:24:26 pm
Could anyone here help me or give me an answer to how i should set up a workflow for clay bricks?

i tried many variations but cant figure out how.

some of the commands i tried are
Code: [Select]
workflow count BLOCKS/CLAY 1
workflow count BLOCKS//CLAY 1
workflow count BLOCKS//BRICKS 1
workflow count BLOCKS//CERAMIC_EARTHENWARE 1
workflow count BLOCKS//CERAMIC 1

some of them work but do not detect the job in the kiln
i believe there should be a way since "workflow count BLOCKS 1" detects the job

wierd the command "workflow count BLOCKS//CERAMIC_EARTHENWARE 1" finds the bricks but not the job
The problem is that the output of a "make blocks" job at the kiln is a block of several different possible types: earthenware, stoneware, or porcelain.  I'm not sure that there's a single matmask that covers all three of these.  You may have to use the "job" plugin to limit the input material for the make bricks job to, say, clay, which may hopefully lead to a fixed output material that you can match against.

Workflow does a great job on 80% of things, and fails miserably on the remaining 20%.  Fixing this is going to require some pretty serious reworking, I'm afraid.
Title: Re: DFHack 0.34.10 r1
Post by: Felgard on June 03, 2012, 12:47:54 pm
Could anyone here help me or give me an answer to how i should set up a workflow for clay bricks?

i tried many variations but cant figure out how.

some of the commands i tried are
Code: [Select]
workflow count BLOCKS/CLAY 1
workflow count BLOCKS//CLAY 1
workflow count BLOCKS//BRICKS 1
workflow count BLOCKS//CERAMIC_EARTHENWARE 1
workflow count BLOCKS//CERAMIC 1

some of them work but do not detect the job in the kiln
i believe there should be a way since "workflow count BLOCKS 1" detects the job

wierd the command "workflow count BLOCKS//CERAMIC_EARTHENWARE 1" finds the bricks but not the job
The problem is that the output of a "make blocks" job at the kiln is a block of several different possible types: earthenware, stoneware, or porcelain.  I'm not sure that there's a single matmask that covers all three of these.  You may have to use the "job" plugin to limit the input material for the make bricks job to, say, clay, which may hopefully lead to a fixed output material that you can match against.

Workflow does a great job on 80% of things, and fails miserably on the remaining 20%.  Fixing this is going to require some pretty serious reworking, I'm afraid.

thanks but i am interested in just earthenware but i think i figured out that it currently might not be possible.

As to why i think it's not possible is due to the fact that most of the kiln jobs uses clay as material but the resulting item is of one of the ceramic materials. I think workflow looks for a job that uses the material one specified and expect the item made to be of the same material.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 03, 2012, 12:55:12 pm
As to why i think it's not possible is due to the fact that most of the kiln jobs uses clay as material but the resulting item is of one of the ceramic materials and i think workflow looks for an job that uses the material one specified and expect the item made to be of the same material.

No, it is slightly more intelligent than that - if it knows the specific input material, it tries to deduce what the output would be; that code might be missing the necessary rules for clay stuff though. For instance, in the current release it does that correctly for all kinds of 'extract from plant' jobs, but Brew Drink was somehow forgotten :D
Title: Re: DFHack 0.34.10 r1
Post by: Felgard on June 03, 2012, 01:07:55 pm
wierd then why cant i find a command that lets it find the make clay bricks?
i only find one that finds the bricks(blocks) but not the job... got an idea shall test it now

Idea did not work or i couldn't figure out how to do it
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on June 03, 2012, 01:24:00 pm
As to why i think it's not possible is due to the fact that most of the kiln jobs uses clay as material but the resulting item is of one of the ceramic materials and i think workflow looks for an job that uses the material one specified and expect the item made to be of the same material.

No, it is slightly more intelligent than that - if it knows the specific input material, it tries to deduce what the output would be; that code might be missing the necessary rules for clay stuff though. For instance, in the current release it does that correctly for all kinds of 'extract from plant' jobs, but Brew Drink was somehow forgotten :D
As I recall the clay reactions are custom reactions, and there is enough information to predict the result.  The problem is that the "make clay bricks" reaction has a BOULDER ([REAGENT:clay:1:BOULDER:NONE:NONE:NONE]) input with a material selection mask to select only boulders that have a FIRED_MAT specification.  Workflow doesn't really understand material selection masks, except on an ad hoc basis, and does not know what to make of FIRED_MAT specifically.  If you specify a specific boulder type to be used (with the job item-material command), then workflow will be able to determine the output product.  What it cannot do is synthesize the set of all possible outputs, with a filtered wildcard input, and monitor stocks of that set.  It could, in theory; it just doesn't. 

It would be nice if we could use material selectors like FIRED_MAT as masks for workflow, but I'm certainly not up to the required code changes, not at the moment at least.
Title: Re: DFHack 0.34.10 r1
Post by: Felgard on June 03, 2012, 01:32:36 pm
ah thanks :D

I had started to suspect the FIRE_MAT tag. Oh well I'll live with what i have at the moment.

anyways to the creator of workflow great job so far
Title: Re: DFHack 0.34.10 r1
Post by: IamanElfCollaborator on June 03, 2012, 03:41:35 pm
Anyone going to answer my question?
Title: Re: DFHack 0.34.10 r1
Post by: miganders on June 04, 2012, 05:19:23 am
(http://i.imgur.com/6ySua.png)

Could it be possible to have DF hack do something like this?
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 04, 2012, 05:31:14 am
Yes
Title: Re: DFHack 0.34.10 r1
Post by: Ogantai on June 04, 2012, 05:45:31 am
On my embark, I am unable to use the embark function, but I am able to use friendship and migrants. This a regular problem or am I alone in this?
Embark crashes DF for me also.
Title: Re: DFHack 0.34.10 r1
Post by: IamanElfCollaborator on June 04, 2012, 08:10:50 am
No, I mean that embark simply doesn't work. It doesn't crash, and I can use the other functions. Anyone got a fix for this?
Title: Re: DFHack 0.34.10 r1
Post by: Hamek McEisenfaust on June 04, 2012, 09:30:10 am
I would like to know if DFHack will allow the conversion of an entire 'cluster' of stone to another type at once, or just the 16X16? blocks. What i would like to do is change all of a cluster at once from worthless stone to useful stone. Thanks for your assistance folks.

EDIT- When I use changevein, it only changes a chunk of the cluster, not the whole thing. If i use changelayer, it well, changes the layer, and leaves the cluster alone. Am I using the wrong commands to change that entire cluster to something else? Or, is there a different command i need to be using. My ultimate goal is to change orthoclase to say.... kaolinite or rock crystal. Thanks for reading.
Title: Re: DFHack 0.34.10 r1
Post by: IamanElfCollaborator on June 04, 2012, 09:32:10 am
I'm pretty sure it does.
Title: Re: DFHack 0.34.10 r1
Post by: vjek on June 04, 2012, 10:31:43 am
I would like to know if DFHack will allow the conversion of an entire 'cluster' of stone to another type at once, or just the 16X16? blocks. What i would like to do is change all of a cluster at once from worthless stone to useful stone. Thanks for your assistance folks.

EDIT- When I use changevein, it only changes a chunk of the cluster, not the whole thing. If i use changelayer, it well, changes the layer, and leaves the cluster alone. Am I using the wrong commands to change that entire cluster to something else? Or, is there a different command i need to be using. My ultimate goal is to change orthoclase to say.... kaolinite or rock crystal. Thanks for reading.

Put the cursor on an unchanged portion of the vein, and re-issue the changevein command.  If a vein is on a "block" boundary, you'll have to do it a few times, and move the cursor each time.  The command respects the layer/vein boundary.
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 04, 2012, 10:35:12 am
Specifically, it only handles 16x16 blocks because it doesn't search for mineral events in adjacent map blocks (because doing so is more complicated and could potentially result in false positives, changing more stuff than was intended).
Title: Re: DFHack 0.34.10 r1
Post by: Hamek McEisenfaust on June 04, 2012, 01:04:56 pm
Thank you for your information. Its greatly appreciated, rather then just saying Nope, cant be done.
Title: Re: DFHack 0.34.10 r1
Post by: khearn on June 04, 2012, 07:10:46 pm
Is there any way to find out how much a given dwarf weighs? I'm doing some testing of falling damage, and I'm noticing that some dwarfs accelerate downward much quicker than others, and I'd like to see if there is a correlation with weight. But I can't figure out a way to determine a given dwarf's weight. It seems like dfhack ought to be able to tell me this, but i can't see any existing function that seems to do so.

Title: Re: DFHack 0.34.10 r1
Post by: atazs on June 04, 2012, 07:12:49 pm
I found a bug. Im not sure if this has been posted before as i dont want to read trough 114 pages.
Basically if you reveal the whole map with the "reveal" command and then you dig underground such as to a magma or underground cave or anything, it wont say you discovered it even if your miner dies in the magma lake thus making magma forges and furnaces unavaible. Then once the dwarves mined them out and then you unreveal the map it basically spams up announcement with cant find path errors until you reveal the map again. The mined area doesnt show up either. Saving the map while the map is revealed then reloading it causes it to be permanently revealed on that save.
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 04, 2012, 07:22:02 pm
This is a known issue, and is why unreveal exists, so that you can hide it again and discover it properly.
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 04, 2012, 07:28:36 pm
You can also use the "feature" command to manually discover the magma sea (to enable magma workshops/furnaces) and the various cavern layers (to activate plant growth in the rest of your fortress).
Title: Re: DFHack 0.34.10 r1
Post by: peterix on June 05, 2012, 12:29:52 am
Reveal was never meant to be used like that - playing with the map revealed and then reverting the reveal will lead to this kind of problem. Just don't let the game go out of pause with the map revealed if you can help it.

This leads me to an idea... how about a kind of 'live' reveal? It would reveal the map when the game is paused and hide stuff again when it's not paused. Thoughts?
Title: Re: DFHack 0.34.10 r1
Post by: WillowLuman on June 05, 2012, 12:33:08 am
Yes! And with an ingame toggle for when you don't want it. The map looks kind of ugly while revealed, truth be told. If you need to designate some things, though, having it reveal automatically while paused would be awesome!
Title: Re: DFHack 0.34.10 r1
Post by: robertgoss on June 05, 2012, 02:32:13 am
excuse me, but would anyone know how to hack your adventurers stats, I can get skills just not attributes.
Title: Re: DFHack 0.34.10 r1
Post by: 46852 on June 05, 2012, 03:32:25 am
How big job is it to convert 0.34.10r1 DFHack to work with 0.34.11? Just changing the checksum makes it run but it doesn't recognize the map. Just interested in "prospect"-command really.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 05, 2012, 04:07:55 am
If you're feeling risky, just download this file for completely untested v0.34.11 support ;)

https://raw.github.com/angavrilov/df-structures/master/symbols.xml (https://raw.github.com/angavrilov/df-structures/master/symbols.xml)

You might need to nuke all the experimental and unsupported osx stuff in it, though.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 05, 2012, 04:11:54 am
Reveal was never meant to be used like that - playing with the map revealed and then reverting the reveal will lead to this kind of problem. Just don't let the game go out of pause with the map revealed if you can help it.

Playing with revealed map can also cause other problems, e.g. see http://www.bay12games.com/dwarves/mantisbt/view.php?id=5967 (http://www.bay12games.com/dwarves/mantisbt/view.php?id=5967) - this lag bug is barely noticeable with normal map unless you use tools to detect it, but simply kills fps on a fully revealed one.
Title: Re: DFHack 0.34.10 r1
Post by: 46852 on June 05, 2012, 04:49:06 am
If you're feeling risky, just download this file for completely untested v0.34.11 support ;)

https://raw.github.com/angavrilov/df-structures/master/symbols.xml (https://raw.github.com/angavrilov/df-structures/master/symbols.xml)

You might need to nuke all the experimental and unsupported osx stuff in it, though.

What did you edit there on the symbols.xml? Seems like at least "prospect" is not working ("Map is not availabe!" or something like that).
Title: Re: DFHack 0.34.07 r2
Post by: Tierre on June 05, 2012, 04:49:47 am
I successfully managed to stop my dwarf from being On Break! :D
Achievement unlocked!

Code: [Select]
for k,v in pairs(df.global.world.units.all) do
  if (v.name.first_name ~= "") then
    for kk,vv in pairs(v.status.misc_traits) do
      if (vv.id == 17) then  --OnBreak counter id
        print(v.name.first_name .. " " .. v.name.nickname .. " " .. v.custom_profession)
        print("  " .. tostring(vv.id) .. " " .. tostring(vv.value))
        if (vv.value == 2202) then  --the OnBreak counter value my specific dwarf has on game load
          vv.value = 14990
          break
        end
      end 
    end 
  end
end

It seems the OnBreak counter goes up to something like 14k-17k but the exact value seems to be different for each dwarf. Setting all my "On Break" dwarves to the same value, didn't mean they all finish their break at the same time.

So this script is working and really helps:) But it has a flaw - you have to change    if (vv.value == 2202) value in the csript to run it again and then it makes your dwarf skip breaak (after a day or two). You have to dothis for each dwarf. I am not that good with lua to devise un upgrade to script to make itmore automatic.

Also wouldn't it be cool to add this as a commant to DFhack and make it toggeble - so that your dwarfes never go on break longer than few days and you don't have to monitor it.
Title: Re: DFHack 0.34.10 r1
Post by: IamanElfCollaborator on June 05, 2012, 06:56:16 am
Oh come on! I just got 0.34.10. ._.
Oh well, I'm going to see if THIS version of Dfhack has working Dfusion.
Title: Re: DFHack 0.34.10 r1
Post by: Argelle on June 05, 2012, 10:32:22 am
Is installing DFHAck 0.34.10 r1 on top of DF 34.11 working?
I'm a week old noob at DF, and only using DFHack for stonesense.
Seems I got an error message on start and stderr.log says :

Quote
FirstCall()
Initized HOOKS!
Identifying DF version.
Loading hack\symbols.xml ... OK
Dummy symbol table entry: timed_events
Loaded 6 DF symbol tables.
Title: Re: DFHack 0.34.10 r1
Post by: 46852 on June 05, 2012, 10:55:09 am
Is installing DFHAck 0.34.10 r1 on top of DF 34.11 working?
I'm a week old noob at DF, and only using DFHack for stonesense.
Seems I got an error message on start and stderr.log says :

Quote
FirstCall()
Initized HOOKS!
Identifying DF version.
Loading hack\symbols.xml ... OK
Dummy symbol table entry: timed_events
Loaded 6 DF symbol tables.

You can at least make DFHack start by replacing the following in "...\df_34_11_win\hack\symbols.xml":

Quote
<symbol-table name='v0.34.10 SDL' os-type='windows'>
        <binary-timestamp value='0x4fba073a'/>

to

Quote
<symbol-table name='v0.34.11 SDL' os-type='windows'>
        <binary-timestamp value='0x4fcc9488'/>


But as I said, that just allows it to start properly, other things may not function. At least prospect-command doesn't work, it doesn't find the map even if DF is running.
Title: Re: DFHack 0.34.10 r1
Post by: Argelle on June 05, 2012, 10:58:56 am
But as I said, that just allows it to start properly, other things may not function. At least prospect-command doesn't work, it doesn't find the map even if DF is running.

Thanks!
What would be enough for me, as I only use it for stonesense :)
Title: Re: DFHack 0.34.10 r1
Post by: 46852 on June 05, 2012, 11:00:39 am
But as I said, that just allows it to start properly, other things may not function. At least prospect-command doesn't work, it doesn't find the map even if DF is running.

Thanks!
What would be enough for me, as I only use it for stonesense :)

I wouldn't bet on StoneSense working either, but give it a try :)
Title: Re: DFHack 0.34.10 r1
Post by: Argelle on June 05, 2012, 11:25:38 am
You're - sadly -  right :(
It went up to opening stonesense welcome screen, but never goes further (loading the game running into a 3D view).
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 05, 2012, 11:33:03 am
Is installing DFHAck 0.34.10 r1 on top of DF 34.11 working?
I'm a week old noob at DF, and only using DFHack for stonesense.
Seems I got an error message on start and stderr.log says :

Quote
FirstCall()
Initized HOOKS!
Identifying DF version.
Loading hack\symbols.xml ... OK
Dummy symbol table entry: timed_events
Loaded 6 DF symbol tables.

You can at least make DFHack start by replacing the following in "...\df_34_11_win\hack\symbols.xml":

Quote
<symbol-table name='v0.34.10 SDL' os-type='windows'>
        <binary-timestamp value='0x4fba073a'/>

to

Quote
<symbol-table name='v0.34.11 SDL' os-type='windows'>
        <binary-timestamp value='0x4fcc9488'/>


But as I said, that just allows it to start properly, other things may not function. At least prospect-command doesn't work, it doesn't find the map even if DF is running.

Doing this has a very high chance of destroying your everything, and a zero chance of making anything work at all.
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 05, 2012, 11:34:38 am
You can at least make DFHack start by replacing the following in "...\df_34_11_win\hack\symbols.xml":

Quote
<symbol-table name='v0.34.10 SDL' os-type='windows'>
        <binary-timestamp value='0x4fba073a'/>

to

Quote
<symbol-table name='v0.34.11 SDL' os-type='windows'>
        <binary-timestamp value='0x4fcc9488'/>


But as I said, that just allows it to start properly, other things may not function. At least prospect-command doesn't work, it doesn't find the map even if DF is running.

This is the WRONG thing to do, and it is absolutely TERRIBLE advice! Editing the XML file in that manner will make DFHack try to use the v0.34.10 offsets with v0.34.11, which, in this case, will simply cause Dwarf Fortress to crash whenever you try to do anything with DFHack.

If the current version is not defined in symbols.xml, DFHack pops up a warning message and exits - this is expected behavior, and it's there to prevent it from screwing up your game.
Title: Re: DFHack 0.34.10 r1
Post by: slink on June 05, 2012, 11:36:20 am
The DFHack binary-timestamp seems to be the same as the checksum in DT.  That's a start.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 05, 2012, 11:38:45 am
Just everybody quit doing pointless things, grab this file, erase all os-type='darwin' symbol tables at the end, and be happy:

https://raw.github.com/angavrilov/df-structures/master/symbols.xml (https://raw.github.com/angavrilov/df-structures/master/symbols.xml)
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 05, 2012, 11:39:31 am
Not really a start at all. All that does it lets DFhack know that this is, indeed, some version of DF.

It doesn't actually tell it where anything is that it needs, which will result in it poking around the wrong places and breaking things.
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 05, 2012, 11:44:54 am
Not really a start at all. All that does it lets DFhack know that this is, indeed, some version of DF.

It doesn't actually tell it where anything is that it needs, which will result in it poking around the wrong places and breaking things.
No, it's even worse - it tells DFHack that things are located at addresses where they aren't, which is what will cause it to break things.

Just adding "<symbol-table name='v0.34.11 SDL' os-type='windows'> <binary-timestamp value='0x4fcc9488'/> </symbol-table>" would have accomplished this "fix" much more cleanly - it'd make it stop complaining about unknown versions, and the absence of any defined addresses would have just caused all plugins to fail to do anything (or crash as a result of trying to access null pointers).
Title: Re: DFHack 0.34.10 r1
Post by: slink on June 05, 2012, 01:36:08 pm
Not really a start at all. All that does it lets DFhack know that this is, indeed, some version of DF.

It doesn't actually tell it where anything is that it needs, which will result in it poking around the wrong places and breaking things.
No, it's even worse - it tells DFHack that things are located at addresses where they aren't, which is what will cause it to break things.

Just adding "<symbol-table name='v0.34.11 SDL' os-type='windows'> <binary-timestamp value='0x4fcc9488'/> </symbol-table>" would have accomplished this "fix" much more cleanly - it'd make it stop complaining about unknown versions, and the absence of any defined addresses would have just caused all plugins to fail to do anything (or crash as a result of trying to access null pointers).
Well excuse me for contributing information, starting at the beginning.  Jerks.

Edit: If you really want to demonstrate how superior you are, post a working copy.  I've posted a working ini for one version of DT.  I didn't go around saying anyone else was doing worse than nothing for trying to work it out for themselves.
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on June 05, 2012, 02:10:12 pm
Well excuse me for contributing information, starting at the beginning.  Jerks.

Edit: If you really want to demonstrate how superior you are, post a working copy.  I've posted a working ini for one version of DT.  I didn't go around saying anyone else was doing worse than nothing for trying to work it out for themselves.
The people you just called jerks are the people who are working right now on producing a working product.  And what they had to say is accurate: your suggestion will not yield a working DFHack, it'll just make it not crash immediately.  You're free, of course, to make DFHack useless for people, but don't act like that by offering instructions to make it useless, you're providing some sort of useful service.

DFHack needs a lot more information discovered from each version of DF than DwarfTherapist does, so it takes longer.  And DFHack is less tolerant of incorrect offset information than DT is.  So you'll pardon us for taking a bit longer to do the job right.

In any case, an updated symbols.xml has been available (https://github.com/angavrilov/df-structures/blob/master/symbols.xml) for at least the past seven hours now.  All courtesy of the very people you are being so jackassed towards.
Title: Re: DFHack 0.34.10 r1
Post by: IamanElfCollaborator on June 05, 2012, 02:47:55 pm
Is Dfusion working? Seriously, I honestly don't care what jackassery you people have been spouting, but I just want to know.
Title: Re: DFHack 0.34.10 r1
Post by: Greiger on June 05, 2012, 02:53:35 pm
Quietust and Japa are right.  bypassing safeties is not making DFhack Work.  Thats like going up to a circuit breaker and disabling the tripping mechanism so that your power works.

I'm not a coder, but even I know that using those methods to get DFhack 'working' will do nothing in the best case, outright crash DF in the second best case, or corrupt data and by extension saves in the worst case.  Telling DFhack to use the previous version of DF's offsets is completely un-advisable and borderline stupid. 

Some versions are similar enough for the only difference in versions is a checksum.  If this was one of those versions DFHack would already be updated.  Don't post a modification that will break stuff, and call the people actually trying to update it jerks.

EDIT: Hmm, seems Slink is not actually the one posting the bypasses.  Sorry for the confusion, but the folks who this is aimed at know who they are.
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on June 05, 2012, 03:14:34 pm
My take on it is that with each release of DF we see a comedy of errors as a double dozen people all post wrong offsets to the DT forum thread, leading to much confusion and confustulation as people all fall over themselves and each other trying to make sense of all the nonsense.  I'd rather very much like not to have the same idiocy with respect to DFHack, please.  And having people post "suggestions" on how to get a completely broken symbols.xml file is not consistent with that.

If you want to live dangerously, feel free to download the development versions from the appropriate github repositories and roll your own; it's not hard.  I just completed a test build that seems to be working fine, but that doesn't mean it's ready for general release.  The repos also have instructions on how to build the software and also advice on how to find the offsets yourself if you want.  But odds are by the time you figure out what you're doing, one of the regular developers will have the job done already.  And if you do want to help, at least take the time to educate yourself as to what's involved in the process before you try to "contribute".
Title: Re: DFHack 0.34.10 r1
Post by: WillowLuman on June 05, 2012, 03:23:02 pm
I think that until there is a relatively long time between updates, it will be difficult to get a working build out for whatever the most current version is. It might be best just to wait and be patient for the game updates to not be so frequent.
Title: Re: DFHack 0.34.10 r1
Post by: slink on June 05, 2012, 03:28:02 pm
Well excuse me for contributing information, starting at the beginning.  Jerks.

Edit: If you really want to demonstrate how superior you are, post a working copy.  I've posted a working ini for one version of DT.  I didn't go around saying anyone else was doing worse than nothing for trying to work it out for themselves.
The people you just called jerks are the people who are working right now on producing a working product.  And what they had to say is accurate: your suggestion will not yield a working DFHack, it'll just make it not crash immediately.  You're free, of course, to make DFHack useless for people, but don't act like that by offering instructions to make it useless, you're providing some sort of useful service.

DFHack needs a lot more information discovered from each version of DF than DwarfTherapist does, so it takes longer.  And DFHack is less tolerant of incorrect offset information than DT is.  So you'll pardon us for taking a bit longer to do the job right.

In any case, an updated symbols.xml has been available (https://github.com/angavrilov/df-structures/blob/master/symbols.xml) for at least the past seven hours now.  All courtesy of the very people you are being so jackassed towards.

Excuse me, but where did I say that changing the checksum would make a working copy of DFHack?  And never did I complain that you were taking too long to update.

My take on it is that with each release of DF we see a comedy of errors as a double dozen people all post wrong offsets to the DT forum thread, leading to much confusion and confustulation as people all fall over themselves and each other trying to make sense of all the nonsense.  I'd rather very much like not to have the same idiocy with respect to DFHack, please.  And having people post "suggestions" on how to get a completely broken symbols.xml file is not consistent with that.

If you want to live dangerously, feel free to download the development versions from the appropriate github repositories and roll your own; it's not hard.  I just completed a test build that seems to be working fine, but that doesn't mean it's ready for general release.  The repos also have instructions on how to build the software and also advice on how to find the offsets yourself if you want.  But odds are by the time you figure out what you're doing, one of the regular developers will have the job done already.  And if you do want to help, at least take the time to educate yourself as to what's involved in the process before you try to "contribute".

Yes, I do post properly working ini files in the DT thread.  Isn't that a hilarious comedy of jackassed effort?  But by all means, I will leave this thread to the super-important hangers-on who live in it.  Personally, I prefer to wait and get my updates from peterix, but if necessary, I could re-install a C compiler and "roll my own", as you coyly put it.  I'm truly not that impatient, but of course you'll never believe that.  It's too much fun to rant at someone without having seen what they actually posted to start this argument.
Title: Re: DFHack 0.34.10 r1
Post by: robertheinrich on June 05, 2012, 03:42:20 pm
I could re-install a C compiler and "roll my own", as you coyly put it. ed to start this argument.

You won´t get far with a C compiler. Your ignorance is showing and you better stop whining.
Title: Re: DFHack 0.34.10 r1
Post by: jaked122 on June 05, 2012, 04:04:50 pm
Wow, hostility.
I personally think that a C-compiler would be useful, but not for what I understand is the goal. You would be better off with cheat engine than a C-compiler, unless you wanted to write your own DF memory editing program.
Either way, that is one route to a solution, but not to your problem. A C-compiler could not help you update the memory list, making it virtually useless for the moment, but in the future, where instead of using DFHack, you learned how to write code in order to produce a sentient DFhack memory set assembler, which then proceeded to take over the world, making it detrimental.
Either way, it really doesn't matter right now.
I'd go for a disassembler, then I'd look through the data-section to find the correct addresses, but even then, I would not be helping, I would simply have done ten hours worth of work when someone else knows how to do it better than I do, and did it in four.
Where was I going again?
Oh yes, hostility.
Why are you being so hostile? Ignorance is hardly a good excuse to insult someone... well... not when he is going down a route that won't help or hurt anyone else.

Title: Re: DFHack 0.34.10 r1
Post by: slink on June 05, 2012, 04:11:55 pm
A C-compiler could not help you update the memory list, making it virtually useless for the moment, but in the future, where instead of using DFHack, you learned how to write code in order to produce a sentient DFhack memory set assembler, which then proceeded to take over the world, making it detrimental.
I know how to write C code.  I know how to read and edit the memory space of a different program.  But that aside, you did make me laugh at the suggestion of weaponizing DFHack for world domination.  That a properly Dwarfy goal.  Thank you for that.   ;D
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on June 05, 2012, 04:17:01 pm
Hate to be a jackass but the updated symbols.xml isn't working for me. I'm getting

DFHACK ERROR!
error while reading symbols.xml
attribute is either missing or invalid : OS type
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 05, 2012, 04:29:38 pm
Just wait with upgrading to new version if there isn't a dfhack version yet if you really want it. There's no reason to tantrum. Thanks.
Title: Re: DFHack 0.34.10 r1
Post by: EmeraldWind on June 05, 2012, 04:32:28 pm
Wow, hostility.
I personally think that a C-compiler would be useful, but not for what I understand is the goal. You would be better off with cheat engine than a C-compiler, unless you wanted to write your own DF memory editing program.
Either way, that is one route to a solution, but not to your problem. A C-compiler could not help you update the memory list, making it virtually useless for the moment, but in the future, where instead of using DFHack, you learned how to write code in order to produce a sentient DFhack memory set assembler, which then proceeded to take over the world, making it detrimental.
Either way, it really doesn't matter right now.
I'd go for a disassembler, then I'd look through the data-section to find the correct addresses, but even then, I would not be helping, I would simply have done ten hours worth of work when someone else knows how to do it better than I do, and did it in four.
Where was I going again?
Oh yes, hostility.
Why are you being so hostile? Ignorance is hardly a good excuse to insult someone... well... not when he is going down a route that won't help or hurt anyone else.


They are being hostile due to slink calling Japa and Quietust jerks and then saying that if they are so superior they should release a working version.

Not really a start at all. All that does it lets DFhack know that this is, indeed, some version of DF.

It doesn't actually tell it where anything is that it needs, which will result in it poking around the wrong places and breaking things.
No, it's even worse - it tells DFHack that things are located at addresses where they aren't, which is what will cause it to break things.

Just adding "<symbol-table name='v0.34.11 SDL' os-type='windows'> <binary-timestamp value='0x4fcc9488'/> </symbol-table>" would have accomplished this "fix" much more cleanly - it'd make it stop complaining about unknown versions, and the absence of any defined addresses would have just caused all plugins to fail to do anything (or crash as a result of trying to access null pointers).
Well excuse me for contributing information, starting at the beginning.  Jerks.

Edit: If you really want to demonstrate how superior you are, post a working copy.  I've posted a working ini for one version of DT.  I didn't go around saying anyone else was doing worse than nothing for trying to work it out for themselves.

Perhaps slink doesn't know who Japa and Quietust are...
But it wasn't like they were being rude, they were just urgently calling attention to a fix that could cause more problems than it fixes.
So naturally the hornets aren't going to take kindly the insults directed at two of the people responsible for maintaining parts of the dfhack project.
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on June 05, 2012, 04:36:10 pm
Hate to be a jackass but the updated symbols.xml isn't working for me. I'm getting

DFHACK ERROR!
error while reading symbols.xml
attribute is either missing or invalid : OS type
it also says to check the stderr   which says:
FirstCall()
Initized HOOKS!
Identifying DF version.
Loading hack\symbols.xml ... OK
Dummy symbol table entry: timed_events
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 05, 2012, 04:46:15 pm
slaytanic - try this:

Just everybody quit doing pointless things, grab this file, erase all os-type='darwin' symbol tables at the end, and be happy:

https://raw.github.com/angavrilov/df-structures/master/symbols.xml (https://raw.github.com/angavrilov/df-structures/master/symbols.xml)

[edit] Also, slink, we were yelling at 46852, not you - any 'rudeness' directed at you would have been from suggesting that 46852's advice was "a start" (when it was actually downright harmful).
Title: Re: DFHack 0.34.10 r1
Post by: slink on June 05, 2012, 04:56:28 pm
slaytanic - try this:

Just everybody quit doing pointless things, grab this file, erase all os-type='darwin' symbol tables at the end, and be happy:

https://raw.github.com/angavrilov/df-structures/master/symbols.xml (https://raw.github.com/angavrilov/df-structures/master/symbols.xml)

[edit] Also, slink, we were yelling at 46852, not you - any 'rudeness' directed at you would have been from suggesting that 46852's advice was "a start" (when they were absolutely nothing of the sort).
I actually had not even seen that post when I made mine.  I read the post about changing the name of the XML section, went to the files, and came back to post without seeing what had been posted in the meantime.  I meant it literally, that the checksum was the start, not that it was the finish.  I can see now why you jumped on me when you were angry at 46852, and I think you can understand why I was angry when you did that.
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on June 05, 2012, 05:02:54 pm
slaytanic - try this:

Just everybody quit doing pointless things, grab this file, erase all os-type='darwin' symbol tables at the end, and be happy:

https://raw.github.com/angavrilov/df-structures/master/symbols.xml (https://raw.github.com/angavrilov/df-structures/master/symbols.xml)

[edit] Also, slink, we were yelling at 46852, not you - any 'rudeness' directed at you would have been from suggesting that 46852's advice was "a start" (when it was actually downright harmful).
THANX Quietust that worked !
Title: Re: DFHack 0.34.10 r1
Post by: TerryDactyl on June 05, 2012, 08:00:13 pm
So, is there anything I can do to find that memory pointer for the announcements settings? I'm presently limited to hacking around with the DT-memory scanner. Which really got me 'nowhere, fast'. Send me a link to something I can read if need be - I don't want to bug a volunteer for features, when they've already got hands full with other tasks.

My fortress is highly dependent on workflows right now, so I'll be waiting on y'all for updates, this time, I think...
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 05, 2012, 08:14:10 pm
Which "announcements settings" pointer are you looking for, and why do you need it?
Title: Re: DFHack 0.34.10 r1
Post by: TerryDactyl on June 05, 2012, 08:20:38 pm
Oh, well, announcements.txt has some handy settings, but they only come into effect when DF is closed and restarted. In-combat, I like the strike details to pause the game and pop up in a box, so that I don't need to constantly check combat 'R'eports; However, the same setting also pauses my game while troops are sparring, which is especially irritating. So I figure that behaviour is being held in memory somewhere, but haven't the foggiest...

http://www.bay12forums.com/smf/index.php?topic=91166.msg3312170#msg3312170

Edit for further clarity: data/init/announcements.txt, line 49, line 50.
[COMBAT_STRIKE_DETAILS:A_D:UCR]
[COMBAT_STRIKE_DETAILS_2:A_D:UCR]
<------------------->
[COMBAT_STRIKE_DETAILS:A_D:UCR:BOX:P]
[COMBAT_STRIKE_DETAILS_2:A_D:UCR:BOX:P]
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 05, 2012, 08:46:09 pm
The "announcements" global has been removed (because no plugins used it, and nobody ever bothered to find the address for it), but angavrilov has since readded it (latest sources on github only) with the observation that it immediately follows d_init, suggesting that it's part of the same structure.
Title: Re: DFHack 0.34.10 r1
Post by: TerryDactyl on June 05, 2012, 10:25:31 pm
Thanks!

I'll read up on anga's source and brush up on my c++.
Title: Re: DFHack 0.34.10 r1
Post by: robertgoss on June 05, 2012, 10:30:19 pm
Excuse me, but would anybody have a lua to make someone a vampire/werebeast/Necromancer, also maybe one to become a particular werebeast, like a giant sponge.
Title: Re: DFHack 0.34.10 r1
Post by: golgy on June 05, 2012, 11:05:54 pm
Is there a listing of the full software/package requirements for building from source on Linux? I've had a quick look around, but ccmake is complaining about missing some hash map implementation without giving any sort of clue as to what it's requiring.

Exact error:

 CMake Error at depends/protobuf/CMakeLists.txt:60 (MESSAGE):
   Could not find a working hash map implementation.  Please install GCC >=
   4.4, and all necessary 32-bit C++ development libraries.
Title: Re: DFHack 0.34.10 r1
Post by: 46852 on June 05, 2012, 11:31:34 pm
I admit my ignorance, I haven't used DFHack up until 0.34.10 and didn't realize just replacing the checksum would be that much of a drastic mistake... I hope my uneducated suggestion of a "fix" didn't screw up anyone's promising starts in this new version.

I was just doing some dwarven science and didn't notice it was the magma trigger I was playing around with, sorry :(


PS. I mentioned in my post that that most likely nothing other than starting DFHack will work, so I was on the right track, kind of.
Title: Re: DFHack 0.34.10 r1
Post by: Greiger on June 06, 2012, 12:44:31 am
Heart was in the right place at least.  I suppose it isn't immediately obvious what could happen, and part of my harshness was to add extra emphasis to the 'no, do not do this'. 

Because I'm sure we all looked at a forum thread somewhere in the past that suggested something, followed by a few posts of 'no, that is a bad idea' and thought 'Hmm, well maybe it does work if you are really careful...'.

...Just me huh?   Oh well.  Whatever dosn't let the magic blue smoke out of the computer makes us stronger I guess.  Group hug!
Title: Re: DFHack 0.34.10 r1
Post by: Rafal99 on June 06, 2012, 01:56:07 am
Does anyone know variable name or offset to change number of starting dwarves on embark?

Unfortunately DFusion plugin "simple_embark" crashes, and it was crashing in 0.34.10 too.
While the "start_dwarf_count" variable it apparently tries to use doesn't appear anywhere in the structures files...
Title: Re: DFHack 0.34.10 r1
Post by: robertgoss on June 06, 2012, 03:28:50 am
Does anyone know variable name or offset to change number of starting dwarves on embark?

Unfortunately DFusion plugin "simple_embark" crashes, and it was crashing in 0.34.10 too.
While the "start_dwarf_count" variable it apparently tries to use doesn't appear anywhere in the structures files...
I beleive I have seen a mod that allows you to do this normally, It was in this very sub-forum I beleive, although I am probably wrong as my memory is failing.
Title: Re: DFHack 0.34.10 r1
Post by: Hss on June 06, 2012, 04:14:49 am
Hey guys. I have a question about stonesense. How can i turn off shrubs and make terran looks like on this screen:

http://www.icesus.org/Gallery/static/gallery/f/Belannaer/3394

Because now i have something like this:

http://ge.tt/8iZ4RjI/v/0?c

Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 06, 2012, 04:21:51 am
Hss, you have alot of grass and trees, thus it looks like that.
Title: Re: DFHack 0.34.10 r1
Post by: danaris on June 06, 2012, 06:21:23 am
Is there a listing of the full software/package requirements for building from source on Linux? I've had a quick look around, but ccmake is complaining about missing some hash map implementation without giving any sort of clue as to what it's requiring.

Exact error:

 CMake Error at depends/protobuf/CMakeLists.txt:60 (MESSAGE):
   Could not find a working hash map implementation.  Please install GCC >=
   4.4, and all necessary 32-bit C++ development libraries.

Based on my experience getting it to build for Mac, this may mean that you are using a GCC that is too old, or it may mean you are using one that is not built for i386, but only for x86_64. (Or, I suppose, only for ARM, if you're running on an ARM system ;D )
Title: Re: DFHack 0.34.10 r1
Post by: peterix on June 06, 2012, 06:54:35 am
Is there a listing of the full software/package requirements for building from source on Linux? I've had a quick look around, but ccmake is complaining about missing some hash map implementation without giving any sort of clue as to what it's requiring.

Based on my experience getting it to build for Mac, this may mean that you are using a GCC that is too old, or it may mean you are using one that is not built for i386, but only for x86_64. (Or, I suppose, only for ARM, if you're running on an ARM system ;D )
Yep. If you are running a 64bit linux system, the compilers are usually 64bit only. You need to install multilib versions of all the relevant gcc related packages. DFHack is 32bit only, because DF has no 64bit version.
Title: Re: DFHack 0.34.10 r1
Post by: EmeraldWind on June 06, 2012, 09:06:03 am
Hey guys. I have a question about stonesense. How can i turn off shrubs and make terran looks like on this screen:

http://www.icesus.org/Gallery/static/gallery/f/Belannaer/3394

Because now i have something like this:

http://ge.tt/8iZ4RjI/v/0?c

yeah, it's easy.

Open stonesense/plants/index.txt, and change it to:

Code: [Select]
#DT_trees/dt_trees.xml
trees.xml
shrubs.xml

And in stonesense/index.txt, stick a '#' in front of the 'grasses/index.txt' line
Title: Re: DFHack 0.34.10 r1
Post by: Hss on June 06, 2012, 09:47:46 am
yeah, it's easy.

Open stonesense/plants/index.txt, and change it to:

Code: [Select]
#DT_trees/dt_trees.xml
trees.xml
shrubs.xml

And in stonesense/index.txt, stick a '#' in front of the 'grasses/index.txt' line
[/quote]

yeah, it's easy.

Open stonesense/plants/index.txt, and change it to:

Code: [Select]
#DT_trees/dt_trees.xml
trees.xml
shrubs.xml

And in stonesense/index.txt, stick a '#' in front of the 'grasses/index.txt' line


But in stonesense, which goes in pack with DFHack no /plants/ folder. When i put # before grasses/index.txt it starts to lagg\freeze\crash. Any suggestion? Maybe i do something wrong?
Title: Re: DFHack 0.34.10 r1
Post by: Rafal99 on June 06, 2012, 01:18:11 pm
Does anyone know variable name or offset to change number of starting dwarves on embark?

Unfortunately DFusion plugin "simple_embark" crashes, and it was crashing in 0.34.10 too.
While the "start_dwarf_count" variable it apparently tries to use doesn't appear anywhere in the structures files...

So, any help with this?
I looked at the sources of old Tweak and Dtil utilities for 40d, which could change number or starting dwarves, and found that the responsible DF variable is unsigned short.
But I am trying to find it with Cheat Engine and obviously there are hundreds of variables with value 7, and most of them don't change in any way, so I have no idea how to find the right one. I am keep learning new stuff from Cheat Engine tutorials, but still no success.
Any hints?

Edit: Nvm, I got the offset thanks to Quietust!
Also simple_embark will work in next DFHack.
Title: Re: DFHack 0.34.10 r1
Post by: EmeraldWind on June 06, 2012, 09:29:02 pm
But in stonesense, which goes in pack with DFHack no /plants/ folder. When i put # before grasses/index.txt it starts to lagg\freeze\crash. Any suggestion? Maybe i do something wrong?

They must have changed it since that post. I'm not sure otherwise.

Um, I just tried it out. Just simply putting the # in front of the grasses/index.txt should work. It won't get rid of trees or shrubs, but to get rid of those just put the # in front of their respective lines in the index.txt.

Did you try to run Stonesense more than once in a single DF session, because that might be why you got the lag? There's a memory leak there that reeks havoc on that.

Title: Re: DFHack 0.34.10 r1
Post by: TheKaspa on June 07, 2012, 08:41:43 am
When is an update for 0.34.11 expected?
Title: Re: DFHack 0.34.10 r1
Post by: LordBaal on June 07, 2012, 09:05:55 am
We must be patient, for what I understand they need to work out a lot of memory addresses, and that seems like a lot of work to be done.
Title: Re: DFHack 0.34.10 r1
Post by: TheKaspa on June 07, 2012, 11:27:44 am
We must be patient, for what I understand they need to work out a lot of memory addresses, and that seems like a lot of work to be done.

Yeah, thake all the time you need. I was just curious.
Title: Re: DFHack 0.34.10 r1
Post by: LordBaal on June 07, 2012, 12:52:51 pm
I'm actually checking this and the lazy thread several times a day.
Title: Re: DFHack 0.34.10 r1
Post by: WillowLuman on June 07, 2012, 01:40:50 pm
Looks like bugfixes might be over for now, so there might be enough time between versions to get a stable build out! :D
And enough time to play with it before it becomes outdated, too!
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 07, 2012, 02:03:29 pm
Looks like bugfixes might be over for now, so there might be enough time between versions to get a stable build out! :D
And enough time to play with it before it becomes outdated, too!

I certainly hope so. Fixmigrant and clearghost commands are required to play the game, in my view.
Title: Re: DFHack 0.34.10 r1
Post by: Hamek McEisenfaust on June 08, 2012, 07:22:42 am
Forgive my question please. I would like to know, does changelayer when applied, change the already mined stone from that layer if used accidentally on a flux layer? i am unable to actually find my flux stone i already mined out, wasn't a huge amount, but is fairly important in the short term. my stone listing no longer lists the marble i had mined. should i just run it again, and use marble?
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 08, 2012, 07:45:48 am
Changelayer only affects unmined stone - any mined-out boulders should not be changed.
Title: Re: DFHack 0.34.10 r1
Post by: Grax on June 08, 2012, 09:24:30 am
Changelayer only affects unmined stone - any mined-out boulders should not be changed.

Seems that changelayer don't work with my slightly modded 34.11 ;-(
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 08, 2012, 09:27:35 am
There are some problems with changelayer. Try reloading and changing and saving..... might help.
Title: Re: DFHack 0.34.10 r1
Post by: Iceflame on June 08, 2012, 09:35:28 am
Looks like bugfixes might be over for now, so there might be enough time between versions to get a stable build out! :D
And enough time to play with it before it becomes outdated, too!

I certainly hope so. Fixmigrant and clearghost commands are required to play the game, in my view.

I didn't have to use the fixmigrant command once.
But for the clerghost - i agree.
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 08, 2012, 09:41:09 am
I didn't have to use the fixmigrant command once.
But for the clerghost - i agree.

I always play low pop civs. When there's only a handful historical figures remain, the game will send traders that won't be able to join the fort without tweaking, consistently.
Title: Re: DFHack 0.34.10 r1
Post by: Bonepart on June 08, 2012, 11:59:33 am
I didn't have to use the fixmigrant command once.
But for the clerghost - i agree.

I always play low pop civs. When there's only a handful historical figures remain, the game will send traders that won't be able to join the fort without tweaking, consistently.

Holy crap! Is that what happened?

I started a game on Year 5 in 34.11 and I noticed a couple of traders wandering around doing nothing. Sadly they didn't last long once the Goblin Siege hit.

I didn't even realize that was a thing. Of course I don't think I've ever started on Year 5 before either.
Title: Re: DFHack 0.34.10 r1
Post by: Neszreth on June 08, 2012, 01:53:58 pm
Oh my god! Thank you so much for this amazing tool ! Keep up the good work !)
Title: Re: DFHack 0.34.10 r1
Post by: WillowLuman on June 08, 2012, 05:02:46 pm
I'm limited to playing this game on a mac right now. I grab the linux version then, right?
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 08, 2012, 07:53:41 pm
Linux version most likely won't work on a mac, but if you have wine, you can use the windows version with the windows version of DF.
Title: Re: DFHack 0.34.10 r1
Post by: Hanslanda on June 08, 2012, 11:28:48 pm
I just possessed my Adept Militia Captain in full candy, wandered around my fortress, hit k, it said I could talk to two dieties, so I did.
Dwarf Fortress has stopped working.
Glad I backed up that save... I was gonna kick some ass too.
Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 08, 2012, 11:31:03 pm
I just possessed my Adept Militia Captain in full candy, wandered around my fortress, hit k, it said I could talk to two dieties, so I did.
Dwarf Fortress has stopped working.
Glad I backed up that save... I was gonna kick some ass too.

Instructions?
Title: Re: DFHack 0.34.10 r1
Post by: Hanslanda on June 08, 2012, 11:51:40 pm
Open up DF to a nice fortress you got going. In DFhack, type 'mode set'. It'll then give you a set of numbers:
0- Fortress Mode
1- Adventurer mode
2- Arena Mode
3- Arena Mode possessing creature
And a couple others. Type in '2'. Then hold your cursor in DF over the desired unit. Use standard Arena controls to possess the unit, I believe its 'k' then 'a' or maybe just 'a'. Then, go back to DFhack, type 'mode set' '1'. You lost a fortress, gained an adventurer. Don't talk to the dieties, save your fortress in a seperate file from the whole game so you can restore it later. And Adept and Candy doesn't mean a lame ass bowgoblin won't just RUIN your whole day.
Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 09, 2012, 12:02:06 am
Open up DF to a nice fortress you got going. In DFhack, type 'mode set'. It'll then give you a set of numbers:
0- Fortress Mode
1- Adventurer mode
2- Arena Mode
3- Arena Mode possessing creature
And a couple others. Type in '2'. Then hold your cursor in DF over the desired unit. Use standard Arena controls to possess the unit, I believe its 'k' then 'a' or maybe just 'a'. Then, go back to DFhack, type 'mode set' '1'. You lost a fortress, gained an adventurer. Don't talk to the dieties, save your fortress in a seperate file from the whole game so you can restore it later. And Adept and Candy doesn't mean a lame ass bowgoblin won't just RUIN your whole day.

Im currently digging into hell so my adventurer can fight demons, in a human capital. !!FUN!!?
Title: Re: DFHack 0.34.10 r1
Post by: Hanslanda on June 09, 2012, 12:06:49 am
I would hope its !!FUN!!. Dwarf Hack is totally epic. Fastdwarf broke the beginning of the game for me.
Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 09, 2012, 01:08:51 am
I just discovered how to get infinate companions.


First- Find a random person.

2. Adv-bodyswap force

*Repeat until you done it 60-70 times*

Adv-bodyswap back into your old body.

3. ???

4.They are following eachogher, and thus because your the original, they follow you, and there followers follow them, who follow you. :D

-Works for everything, demons, Exalted Sweetnesses, kings, civilians, trolls.-
Title: Re: DFHack 0.34.10 r1
Post by: Hanslanda on June 09, 2012, 01:22:57 am
That is epic. Zombie swarms, without the zombies!
Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 09, 2012, 01:24:47 am
They will help you too, because of this!


1. The first guy you got? You became his companion TEMP while you bodyswapped.

You swapped into another, while in HIS body. So he became his.

And over and over. You just gotta adv-bodyswap into your body, not revert back into it. Otherwise the chain breaks.
Title: Re: DFHack 0.34.10 r1
Post by: Hanslanda on June 09, 2012, 01:36:52 am
What happens if you do this, then attack the civ they are a part of? Awesome loyalty cascade?
Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 09, 2012, 01:39:27 am
What happens if you do this, then attack the civ they are a part of? Awesome loyalty cascade?

Yes.


HOWEVER, this is fun.




THIS IS REVOLUTIONARY EVEN!


I have discovered how to kill a quest-giver without being a civ enemy.


Adv-bodyswap, attack a civilan, swap back. MURDER THE "traitorous" BASTARD.
Title: Re: DFHack 0.34.10 r1
Post by: Hanslanda on June 09, 2012, 01:45:05 am
And thus, a malicious bug was finally defeated.
Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 09, 2012, 01:45:58 am
You love me yet, forum? You love me yet? :)


-Edit-

If you tweakmigrant a foreign trader, will they join your fort?
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 09, 2012, 04:41:18 am
You love me yet, forum? You love me yet? :)


-Edit-

If you tweakmigrant a foreign trader, will they join your fort?


No. But you can do "makeown". fixmigrant only works on your own guys still having the trader tags I think.
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on June 11, 2012, 06:20:55 am
Open up DF to a nice fortress you got going. In DFhack, type 'mode set'. It'll then give you a set of numbers:
0- Fortress Mode
1- Adventurer mode
2- Arena Mode
3- Arena Mode possessing creature
And a couple others. Type in '2'. Then hold your cursor in DF over the desired unit. Use standard Arena controls to possess the unit, I believe its 'k' then 'a' or maybe just 'a'. Then, go back to DFhack, type 'mode set' '1'. You lost a fortress, gained an adventurer. Don't talk to the dieties, save your fortress in a seperate file from the whole game so you can restore it later. And Adept and Candy doesn't mean a lame ass bowgoblin won't just RUIN your whole day.

this is old way. there a better way to switch between fort mode and adventure mode. it just that you need to save into it.

Open up DF to a nice fortress you got going. In DFhack, type 'mode set'. It'll then give you a set of numbers:
0- Fortress Mode
1- Adventurer mode
2- Arena Mode
3- Arena Mode possessing creature
And a couple others.go into the Esc menu in dwarf fortress don't do anything yet. go back to Dfhack and Type in '1'. back to Dwarf fort you notice the menu changed, this is good now either A)save and reload into adventure mode B) retire*/kill the random unknown adventurer Then hold your cursor in DF over the desired unit. Use standard Arena controls to possess the unit, I believe its 'k' then 'a' or maybe just 'a'. Then, go back to DFhack, type 'mode set' '1'. You lost control a fortress, gained an Buggy adventurer. Don't talk to the dieties, save your fortress in a seperate file from the whole game so you can restore it laterfor other reasons like coming back to the site means you need to do the same thing again but you need dfusion to check the flag "is resident" on all citizens if you want to get them back. And Adept and Candy doesn't mean a lame ass bowgoblin won't just RUIN your whole day.


*now since Warmist made it so you can retire as anybody you can retire the fort just by selecting a person as an adventurer then doing the steps up to the choice of saving or retiring/killing(which will say you can retire instead of starving to death) retiring the fort means you have a custom build mountain home filled with dwarves and what ever you had in the area and can be double as an adventure home. I have a thread in Adventure mode that talks all about this. I REALLLY REALLY hope someone modify that help page to update the correct way to do it(for those to not lose out of a fort and end up causing every one in the site to go apeshit and lose saving(?)).

edit: looks like Corai going through what I did back when Dfusion had it's body swapping functions.

also there an easier way to grab tons of companions if you go into dfusion.
hell you can pick up random animals, pets, wild life with the function and slightly better than using Adv-bodyswap trick.
Title: Re: DFHack 0.34.10 r1
Post by: Thorik on June 11, 2012, 06:51:58 am
does this work with 34.11 yet?
Title: Re: DFHack 0.34.10 r1
Post by: dangerPhil on June 11, 2012, 07:30:02 am
Nope, as it says in the starting thread: supported up to version 34.10.
Title: Re: DFHack 0.34.10 r1
Post by: Kipi on June 11, 2012, 09:34:54 am
Nope, as it says in the starting thread: supported up to version 34.10.

The official version hasn't been updated to 34.11 yet but there is the a updated symbol.xml which allows it to work in the latest version of DF.

https://raw.github.com/angavrilov/df-structures/master/symbols.xml

So far I haven't noticed any problems, though I have only used drybuckets and fixmigrant so far.
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 11, 2012, 10:33:00 am
Nope, as it says in the starting thread: supported up to version 34.10.

The official version hasn't been updated to 34.11 yet but there is the a updated symbol.xml which allows it to work in the latest version of DF.

https://raw.github.com/angavrilov/df-structures/master/symbols.xml

So far I haven't noticed any problems, though I have only used drybuckets and fixmigrant so far.

it works with fixmigrants? GAH *Goes to update his df*
Title: Re: DFHack 0.34.10 r1
Post by: ydaraishy on June 11, 2012, 10:38:26 am
Nope, as it says in the starting thread: supported up to version 34.10.

The official version hasn't been updated to 34.11 yet but there is the a updated symbol.xml which allows it to work in the latest version of DF.

https://raw.github.com/angavrilov/df-structures/master/symbols.xml

So far I haven't noticed any problems, though I have only used drybuckets and fixmigrant so far.

I just get "invalid os-type" error and it shuts off, even though the code suggests it should work.
Title: Re: DFHack 0.34.10 r1
Post by: MarcAFK on June 11, 2012, 10:55:12 am
erm, Yeah you need to erase the OSX info at the end it seems.
Took me 3 tries before i worked out exactly what makes up a whole template. Basically erase everything from "insert apple logo"  to where it says "<!-- end osx --> including these 2 tags. " Make sure you DO NOT ERASE the last line where it says "
</data-definition>

<!--
Local Variables:
indent-tabs-mode: nil
nxml-child-indent: 4
End:
-->
"
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 11, 2012, 10:55:52 am
Nope, as it says in the starting thread: supported up to version 34.10.

The official version hasn't been updated to 34.11 yet but there is the a updated symbol.xml which allows it to work in the latest version of DF.

https://raw.github.com/angavrilov/df-structures/master/symbols.xml

So far I haven't noticed any problems, though I have only used drybuckets and fixmigrant so far.

I just get "invalid os-type" error and it shuts off, even though the code suggests it should work.

You need to edit the xml to remove the symbol tables for the other os-types, I think.


erm, Yeah you need to erase the OSX info at the end it seems.
Took me 3 tries before i worked out exactly what makes up a whole template. Basically erase everything from "insert apple logo"  to where it says "<!-- end osx -->" make sure you DO NOT ERASE the last line where it says "
</data-definition>

<!--
Local Variables:
indent-tabs-mode: nil
nxml-child-indent: 4
End:
-->
"


Get notepad++, never look back when editing text. Really, download it and open the xml, you'll see what I mean.( Also works perfectly with RAW editing as well )
Title: Re: DFHack 0.34.10 r1
Post by: TerryDactyl on June 11, 2012, 11:10:56 am
Get notepad++, never look back when editing text. Really, download it and open the xml, you'll see what I mean.( Also works perfectly with RAW editing as well )

More than perfectly. The 'find in files' function is a !!godsend!! in combination with the workflows utility.
Title: Re: DFHack 0.34.10 r1
Post by: MarcAFK on June 11, 2012, 11:13:04 am
Still fairly new winblows install so i haven't got all the good stuff installed yet, forgot about notepadplus.
Actually i just opened it in my browser so i could get a good look at the actual table structure, then edited it in notepad.
Title: Re: DFHack 0.34.10 r1
Post by: Altaree on June 11, 2012, 01:04:50 pm
Still fairly new winblows install so i haven't got all the good stuff installed yet, forgot about notepadplus.
Actually i just opened it in my browser so i could get a good look at the actual table structure, then edited it in notepad.
try out http://ninite.com for setting up a new machine.
Title: Re: DFHack 0.34.10 r1
Post by: MarcAFK on June 11, 2012, 01:07:53 pm
Pah, all that stuff'll be obsolete by the time i have to reinstall again *hopefully*
Actually yeah theres about a dozen things there i still need, i'll bookmark the page and add a note on my random utilities/reinstall disk.
Title: Re: DFHack 0.34.10 r1
Post by: Thorik on June 11, 2012, 01:23:46 pm
Ty MarcAFK and guy who gave me the new xml link I got it to work :D
Title: Re: DFHack 0.34.10 r1
Post by: LordBaal on June 11, 2012, 07:06:35 pm
There's people saying that with the xml it works... it's true then?
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 11, 2012, 07:28:55 pm
It works, but if it was perfect we would get a new release already. I think.
Title: Re: DFHack 0.34.02 r1
Post by: Rupert Rhabit on June 11, 2012, 10:24:35 pm
Now I have the problem that I can´t dig out the obsidian wall (set destination to mine, but none of my dwarves goes there and actually digs it out) and I also can´t operate the pump anymore (dwarf goes there and starts to pump, but no magma flow - I would expect the magma being pumped onto the obsidian floor, but that doesn´t happen).

It looks like part of the game (responsible for showing the map) knows about the new obsidian wall, and another part of the game (responsible for handling interaction like magma flow and dig operations) doesn´t know about the wall... just like after digging on a revealed map then unrevealing it afterwards the dug out sections need to be discovered by dwarves again (by digging near them).

    I'm having a similar problem. The answer is probably buried somewhere around here but, after an hour or so of searching, I'm no closer to the solution than when I started.
    I was using liquids to cheat fill my moat and accidentally placed an area of obsidian over an area of water already there. I removed all the water, made sure the area was properly pathed and that my dwarves could and would mine there. They will mine tiles directly next to the offending obsidian (one dwarf actually mined one of the obsidian tiles out) but now they refuse to mine the rest of the blocks in question.
    I've had similar refusals before with obsidian placed with dfhack liquids. they always involve obsidian placed on the same tile as water or magma. Does anyone have any advice?
Title: Re: DFHack 0.34.10 r1
Post by: outofpractice on June 12, 2012, 12:45:14 am
Quote
I've had similar refusals before with obsidian placed with dfhack liquids. they always involve obsidian placed on the same tile as water or magma. Does anyone have any advice?
Have you checked to see if the tile is still marked as flowing liquid or not?
Title: Re: DFHack 0.34.10 r1
Post by: zkm2erjfdb on June 12, 2012, 01:57:25 am
I almost collapsed..whithout DFHack.God bless your code passed on the first try....(I really wish)
June 12,01:30 am  but our colck is June 12,15:00pm  :'( :'( :'( :'( :'(  maybe tomorrow I  can see a good news...
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 12, 2012, 04:15:12 am
Well right now dfhack with new xml can use dfhack, cheat ceatures, use jdwarf fully, reveal/unreveal and i didn't use anything else. That's enough for me:)
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 12, 2012, 04:31:39 am
Like I said, tweaks for migrants and ghosts = gold
Prospect is nice since it saves you from embarking 100 times.
Title: Re: DFHack 0.34.10 r1
Post by: Yovatsap on June 12, 2012, 05:43:16 am
DFHack for 34.11 not released yet, right?
Title: Re: DFHack 0.34.10 r1
Post by: Bonepart on June 12, 2012, 09:24:14 am
Well right now dfhack with new xml can use dfhack, cheat ceatures, use jdwarf fully, reveal/unreveal and i didn't use anything else. That's enough for me:)

digv also works, which is the big one that I use. Well, that and clean map/all
Title: Re: DFHack 0.34.10 r1
Post by: khearn on June 12, 2012, 01:28:20 pm
Do workflow and autobutcher work? Those are what I'm finding really useful lately.
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 12, 2012, 02:39:34 pm
Hello, this is a weird question but is there any way of hacking someone to become the Monarch? It would be nice for my dead civ to be able to have a new ruler again, one that I choose.
Title: Re: DFHack 0.34.10 r1
Post by: peskyninja on June 12, 2012, 03:32:39 pm

I don't think so, but you could mod the desired noble position to be appointable.
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 12, 2012, 03:35:30 pm
Ah, right. That would involve yet another world gen though, and I really love the name my civ has at this point:"Angelic Iron"
Title: Re: DFHack 0.34.10 r1
Post by: Torrasque666 on June 12, 2012, 04:40:19 pm
Is there a reason that dfusion's simple_embark crashes when I try to use it?
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on June 12, 2012, 05:11:34 pm
Is there a reason that dfusion's simple_embark crashes when I try to use it?
I think that only works on Windows, and only if you have a really really new copy of the symbols.xml file.  AFAIK, the required offset hasn't been found for Linux or OSX.
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on June 13, 2012, 12:15:23 am
Hello, this is a weird question but is there any way of hacking someone to become the Monarch? It would be nice for my dead civ to be able to have a new ruler again, one that I choose.
I say poking through the site owner id might lead to something.
Title: Re: DFHack 0.34.10 r1
Post by: Brandon816 on June 13, 2012, 12:20:39 am
Is there a reason that dfusion's simple_embark crashes when I try to use it?
I think that only works on Windows, and only if you have a really really new copy of the symbols.xml file.  AFAIK, the required offset hasn't been found for Linux or OSX.
That symbols file just adds the offset for windows 34.11 SDL, so you also have to be using the graphics version and not legacy.
Title: Re: DFHack 0.34.10 r1
Post by: darius on June 13, 2012, 12:26:12 am
Is there a reason that dfusion's simple_embark crashes when I try to use it?
I think that only works on Windows, and only if you have a really really new copy of the symbols.xml file.  AFAIK, the required offset hasn't been found for Linux or OSX.

This needs to be found for it to work:
Code: [Select]
<global-address name='start_dwarf_count' value='???'/>
If somebody would be so kind to find it :) Search for this AFAIK:
Code: [Select]
0x24,0x14,0x07,0x00,0x00,0x00,0xeb,0x08,0x8d
then add 2 to the result (to point directly to starting dwarf count)

Edit: damnit wrong account again!
Title: Re: DFHack 0.34.10 r1
Post by: Brandon816 on June 13, 2012, 01:15:47 am
As far as what this beta symbols file CAN'T do yet, anything referencing "dfhack.maps.getTileBlock" isn't working right now. I had a script that used it before, but now it seems to be targeting blank memory space.
Title: Re: DFHack 0.34.10 r1
Post by: Andux on June 13, 2012, 07:29:24 am
Code: [Select]
0x24,0x14,0x07,0x00,0x00,0x00,0xeb,0x08,0x8d

Actually, it seems to be 0x24,0x18,0x07,0x00,0x00,0x00,0x8b,0x35 now (for the Windows version, at least).
Title: Re: DFHack 0.34.10 r1
Post by: goldengm on June 13, 2012, 08:47:01 am
I've dragged all the DFHack files into my Dwarf Fortress folder but when i run it no command line appears.
Does anyone know why this is happening?
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 13, 2012, 12:53:42 pm
I've dragged all the DFHack files into my Dwarf Fortress folder but when i run it no command line appears.
Does anyone know why this is happening?
Yes - you did it wrong. Read the instructions and try again.
Title: Re: DFHack 0.34.10 r1
Post by: Hessuu on June 13, 2012, 01:19:31 pm
Any idea how to destroy all items of specific type(leather) from the map? Autodump wouldn't work because my game is stuck on 0 FPS, so getting a bookkeeper is not possible solution. Also manually flagging each of the 5000 leather would take ages. Simply a command like "removeitem-type leather" would work perfectly, but such is not available.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 13, 2012, 03:15:36 pm
Downloaded that save. Your problem isn't leather, it is 8000 angry amphibian men in the caves. Try using reveal and look in the unit list.  :D

400000 spider webs in the 'to be removed' state don't help either presumably, but they go away if you wait out 100 frames.
Title: Re: DFHack 0.34.10 r1
Post by: Hessuu on June 13, 2012, 03:26:31 pm
Oh my... that is some crazy stuff right there.
Any ideas how to fix? :P I kinda like my save :(
Title: Re: DFHack 0.34.10 r1
Post by: Torrasque666 on June 13, 2012, 03:47:40 pm
Is there a reason that dfusion's simple_embark crashes when I try to use it?
I think that only works on Windows, and only if you have a really really new copy of the symbols.xml file.  AFAIK, the required offset hasn't been found for Linux or OSX.

This needs to be found for it to work:
Code: [Select]
<global-address name='start_dwarf_count' value='???'/>
If somebody would be so kind to find it :) Search for this AFAIK:
Code: [Select]
0x24,0x14,0x07,0x00,0x00,0x00,0xeb,0x08,0x8d
then add 2 to the result (to point directly to starting dwarf count)

Edit: damnit wrong account again!

So just re-download it? I have a Windows OS so I'm curious as to whats wrong. I want to start with a ton of dwarves so I can specialize right away.
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on June 13, 2012, 06:08:42 pm
Code: [Select]
function getChild()
local ret={}
local adv=df.global.world.units.active[0]

for k,v in pairs(df.global.world.units.active) do
  if v.relations.mother_id==adv.id or v.relations.mother_id==adv.id then
    table.insert(ret,v)
  end
end
return ret
end

function tools.childrenFollow(unit,trgunit)
local adv=df.global.world.units.active[0]
for k,v in pairs(df.global.world.units.active) do
if v.relations.mother_id==adv.id or v.relations.mother_id==adv.id then


if unit == nil then
unit=getChild()
printall(unit)
end
if unit== nil then
error("Invalid creature")
end
if trgunit==nil then
trgunit=df.global.world.units.active[0]
end
v.relations.group_leader_id=trgunit.id
local u_nem=getNemesis(v)
local t_nem=getNemesis(trgunit)
if u_nem then
u_nem.group_leader_id=t_nem.id
end
v.profession=96
if t_nem and u_nem then
t_nem.companions:insert(#t_nem.companions,u_nem.id)
end
end
end
end
function tools.healchild(unit)
local adv=df.global.world.units.active[0]
for k,v in pairs(df.global.world.units.active) do
if v.relations.mother_id==adv.id or v.relations.mother_id==adv.id then
v.body.wounds:resize(0) -- memory leak here :/
v.body.blood_count=v.body.blood_max
--set flags for standing and grasping...
v.status2.able_stand=4
v.status2.able_stand_impair=4
v.status2.able_grasp=4
v.status2.able_grasp_impair=4
--should also set temperatures, and flags for breath etc...
v.flags1.dead=false
v.flags2.calculated_bodyparts=false
v.flags2.calculated_nerves=false
v.flags2.circulatory_spray=false
v.flags2.vision_good=true
v.flags2.vision_damaged=false
v.flags2.vision_missing=false
v.counters.winded=0
v.counters.unconscious=0
for k,v in pairs(v.body.components) do
for kk,vv in pairs(v) do
v[kk]=0
end
end
end
end
end
tools.menu:add("healchild",tools.healchild)

Okay here some functions for the use of adventure mode child armies. with these you can recruit (your)children and make them fight. This is great for if you body swap into a parent or using empregnate function on your self.
Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 13, 2012, 06:12:14 pm
Oh my... that is some crazy stuff right there.
Any ideas how to fix? :P I kinda like my save :(

Auto-dump every boulder in your fort on them. Then auto-dump them back.
Title: Re: DFHack 0.34.10 r1
Post by: WillowLuman on June 13, 2012, 10:51:33 pm
Just asking, since I can't tell from digging through the thread, is there currently a version that works for .11 without serious hassle?
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 13, 2012, 10:53:34 pm
There should be a proper release in the next day or two.
Title: Re: DFHack 0.34.10 r1
Post by: slaytanic on June 13, 2012, 11:22:51 pm
Oh my... that is some crazy stuff right there.
Any ideas how to fix? :P I kinda like my save :(
You could send the A-Team down into the caves, lol. Runesmith had a "kill all selected race" button but it hasn't been updated in forever. I don't think DFHack has that feature.(yet)
Title: Re: DFHack 0.34.10 r1
Post by: mithosaurion on June 13, 2012, 11:46:18 pm
Hello, I would like to know if there is a command to give a targeted unit necromancy or vampirism.  It could be useful for my experiments.
Title: Re: DFHack 0.34.10 r1
Post by: luppolo on June 14, 2012, 04:46:29 am
is there a way to make dorf under cursor to go berserk?
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 14, 2012, 04:48:28 am
You can reveal a map and encase all those creatures in obsidian walls. And then pour some magma there:)
Title: Re: DFHack 0.34.10 r1
Post by: Hessuu on June 14, 2012, 07:47:47 am
You can reveal a map and encase all those creatures in obsidian walls. And then pour some magma there:)
Problem is the 0 FPS I'm having because of the creatures. Unless your idea can be done purely with dfhack, it won't work :( I'm assuming that the painting tool might be able to do it?

I already tried to mod them to burn, but I guess things that are already on the map won't be affected by changes to raws :( Gonna try reclaiming once more to generate a new breed of exploding creatures. Maybe they take most of the old ones with them...
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 14, 2012, 08:46:13 am
You can do it on the pause. With dfliquids. Of course it will take some time to burn them in the magma. But i think that if you drown them in magma and then unpause and wait for 30 minutes - it will help. Well i hope so. Just encasing in the obsidian won't help..... Well you can make a reservoir with magma AND lizards and put some water ABOVE it. This can kill all of them in only few frames. Which will be managamle if wait for some minutes i think.
Title: Re: DFHack 0.34.10 r1
Post by: MarcAFK on June 14, 2012, 09:49:24 am
Undesignate those webs, every designation job causes serious lag.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 14, 2012, 09:54:25 am
Yeah cancel all jobs. Undesignate everything. Unreeval map and make those idiots swim in magma with wate over thei heads. I will diffinately help:) At least it would be fun.
Title: Re: DFHack 0.34.10 r1
Post by: Hessuu on June 14, 2012, 01:13:04 pm
I modded the 20k+ animal people to have a high body temperature and they all burned. Then restored the raws to their original state. Now I just have 20k+ corpses around, and my ram usage goes over 3gb, which is more than I can handle until I get my new RAM.
I think I can work from here, thanks for the help everyone, :D especially ag who also provided good info to the bugtracker for toady to view when he gets to it. x)
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 14, 2012, 02:12:39 pm
To get rid of the corpses, try placing a dump designation over the whole cavern layer they are in, and using autodump destroy. Note that you have to run the game for 100 frames for it to take full effect.
Title: Re: DFHack 0.34.10 r1
Post by: Hessuu on June 14, 2012, 03:17:16 pm
They exist in my base and the outside mixed in with my goodies, since I had to reclaim every time I edited the raws.

EDIT: I suppose I could do it during the embark in which they burn to death... Gonna try.
Title: Re: DFHack 0.34.10 r1
Post by: AustralianWinter on June 14, 2012, 03:34:30 pm
My game crashes, even with the symbols.xml file. Is this a common issue?
Title: Re: DFHack 0.34.10 r1
Post by: Hessuu on June 14, 2012, 03:40:40 pm
Works for me. Did you edit out the parts for other OSes and df versions?
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 14, 2012, 03:41:45 pm
with wrong symbols.xml dfhack won't load at all. So i guess you either change something bad or it is a game issue. What d oyou do when game crashes? Genning a world for 1050 years with big mods might be the issue if you do it, but you gave no info at all. So can't help until you do.

btw - how can i change a part of my soil layer? I have an embark with 4 biomes on it. But only 1 soil layer with clay. Then i try to change it with CHANGELAYER it changes all of it. And i so wanted to get clay and sand in 1 embark.
Title: Re: DFHack 0.34.10 r1
Post by: AustralianWinter on June 14, 2012, 03:43:37 pm
with wrong symbols.xml dfhack won't load at all. So i guess you either change something bad or it is a game issue. What d oyou do when game crashes? Genning a world for 1050 years with big mods might be the issue if you do it, but you gave no info at all. So can't help until you do.

The game won't run, but the usual "Wrong Version of Dwarf Fortress"-error does not come up.
Title: Re: DFHack 0.34.10 r1
Post by: Hessuu on June 14, 2012, 06:20:26 pm
To get rid of the corpses, try placing a dump designation over the whole cavern layer they are in, and using autodump destroy. Note that you have to run the game for 100 frames for it to take full effect.
I placed a dump designation, used "autodump destroy", and it said "Done. 25725 items marked for destruction", but nothing has happened to the items. I have waited for a while now, and the FPS raised to 4, thanks to the fires stopping, but the items remain for some reason.  ??? Either I'm doing something wrong or we need a "proper" version for 0.34.11

EDIT: It seems the items also need to be claimed. Worked after that. FPS hasn't recovered tho, gonna need to figure out what's going on with that.  ::)
Title: Re: DFHack 0.34.10 r1
Post by: Brandon816 on June 14, 2012, 07:52:49 pm
is there a way to make dorf under cursor to go berserk?
Yes, you can easily change their mood with a custom script in dfusion.
Code: [Select]
local ox,oy,oz
ox,oy,oz=getxyz()
local unit = getCreatureAtPos(ox,oy,oz)
unit.mood=X -- replace X with the index of the mood you want, -1 is no mood (I want to say that berserk is somewhere 5-7)

Hello, I would like to know if there is a command to give a targeted unit necromancy or vampirism. It could be useful for my experiments.
To what extent do you want vampirism? Everything but the perceived changes in raw attributes like strength and agility can be easily replicated in dfusion too. I'm working on a script that can toggle between the two for a vanilla dwarf. I have absolutely no idea how to change to a necromancer though.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 15, 2012, 01:57:12 am
is there a way to make dorf under cursor to go berserk?
Yes, you can easily change their mood with a custom script in dfusion.
Code: [Select]
local ox,oy,oz
ox,oy,oz=getxyz()
local unit = getCreatureAtPos(ox,oy,oz)
unit.mood=X -- replace X with the index of the mood you want, -1 is no mood (I want to say that berserk is somewhere 5-7)

Code: [Select]
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.Berserk
[lua]# quit

One line, and no messing with dfusion. Select the unit with 'v' first. ;)

Edit: Well, actually, the 'lua' command itself is part of dfusion, but if you put that line in hack/scripts/make-berserk.lua (or whatever), it will work as a 'make-berserk' dfhack command even if there is no dfusion installed.
Title: Re: DFHack 0.34.10 r1
Post by: Rafal99 on June 15, 2012, 01:59:17 am
Yeah, DFHack has now built-in Lua support, so no need to use DFusion.
Took me a while to figure.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 15, 2012, 02:08:55 am
DFusion needs to be restructured to use the dfhack lua interpreter instance, instead of its own sandbox; then it will become just a library, and this distinction will mostly go away. Currently there are things you can do with scripts, but not dfusion; and obviously you can't use any of the dfusion functions from scripts.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 15, 2012, 04:30:09 am
And can you change a mood of the dwarf then it already struck him? or then he already went berserk? What will happen?
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 15, 2012, 01:09:02 pm

Code: [Select]
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.Berserk
[lua]# quit

One line, and no messing with dfusion. Select the unit with 'v' first. ;)

Edit: Well, actually, the 'lua' command itself is part of dfusion, but if you put that line in hack/scripts/make-berserk.lua (or whatever), it will work as a 'make-berserk' dfhack command even if there is no dfusion installed.

It makes them berserk, but they just stop working and removes them from your roster; they don't attack anything or interrupt work orders, and no one treats them as hostile.

So where does everyone go to find out what functions are available to perform with dfusion?  I haven't found a list anywhere; I've looked on the wiki and on the first posts for both dfhack and dfusion, and am currently using google's site search to try and see if it's in the middle of a thread somewhere.  Perhaps it would help to put a list or a link to a list in those places?
Title: Re: DFHack 0.34.10 r1
Post by: arclance on June 15, 2012, 03:08:46 pm
It's been awhile since I have run stonesense in dfhack and when I tried today I just get a black window which can only be closed by killing Dwarf Fortress (with die or pkill).

Here is a backtrace of stonesense crashing with dfhack v0.34.10 r1.
Code: [Select]
./dfhack -g
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /media/Linux_Data/Dwarf_Fortress/Test_Fortress/0.34.X/df_34_10_linux/df_linux/libs/Dwarf_Fortress...(no debugging symbols found)...done.
(gdb) run
Starting program: /media/Linux_Data/Dwarf_Fortress/Test_Fortress/0.34.X/df_34_10_linux/df_linux/libs/Dwarf_Fortress
ERROR: ld.so: object './hack/libdfhack.so' from LD_PRELOAD cannot be preloaded: ignored.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".

(Dwarf_Fortress:24615): Gtk-WARNING **: /usr/lib/gtk-2.0/2.10.0/engines/libaurora.so: wrong ELF class: ELFCLASS64
[New Thread 0xf45ceb70 (LWP 24630)]
[New Thread 0xf3dcdb70 (LWP 24631)]
Loading bindings from data/init/interface.txt
New window size: 1600x500
Font size: 20x20
Resizing grid to 80x25
Resizing font to 20x20

Resetting textures
[New Thread 0xf2e7db70 (LWP 24637)]
[New Thread 0xf267cb70 (LWP 24638)]
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]# [New Thread 0xf1e7bb70 (LWP 24639)]
                                             stonesense
[New Thread 0xe3cffb70 (LWP 15659)]
[New Thread 0xe34feb70 (LWP 15660)]
Stonesense launched
Using allegro version 5.0.5 r1
[DFHack]#
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xe34feb70 (LWP 15660)]
__pthread_mutex_lock (mutex=0xd2d2d2d2) at pthread_mutex_lock.c:50
50 pthread_mutex_lock.c: No such file or directory.
(gdb) bt full
#0  __pthread_mutex_lock (mutex=0xd2d2d2d2) at pthread_mutex_lock.c:50
        __PRETTY_FUNCTION__ = "__pthread_mutex_lock"
        type = <optimized out>
#1  0xf74b07d6 in pthread_mutex_lock () from /lib32/libc.so.6
No symbol table info available.
#2  0xf6aea10f in ?? () from /usr/lib32/libX11.so.6
No symbol table info available.
#3  0xf6b009c4 in XrmQGetResource () from /usr/lib32/libX11.so.6
No symbol table info available.
#4  0xf6af7f7d in XStringToKeysym () from /usr/lib32/libX11.so.6
No symbol table info available.
#5  0xf6b26c45 in _XimParseStringFile () from /usr/lib32/libX11.so.6
No symbol table info available.
#6  0xf6b30f39 in _XimLocalOpenIM () from /usr/lib32/libX11.so.6
No symbol table info available.
#7  0xf6b1df3d in _XimOpenIM () from /usr/lib32/libX11.so.6
No symbol table info available.
#8  0xf6b09f0a in XOpenIM () from /usr/lib32/libX11.so.6
---Type <return> to continue, or q <return> to quit---
No symbol table info available.
#9  0xf304880e in xkeybd_init_keyboard ()
   from ./stonesense/deplibs/liballegro.so.5.0
No symbol table info available.
#10 0xf300e05b in al_install_keyboard ()
   from ./stonesense/deplibs/liballegro.so.5.0
No symbol table info available.
#11 0xf30e0825 in stonesense_thread(ALLEGRO_THREAD*, void*) ()
   from /media/Linux_Data/Dwarf_Fortress/Test_Fortress/0.34.X/df_34_10_linux/df_linux/hack/plugins/stonesense.plug.so
No symbol table info available.
#12 0xf301328f in thread_func_trampoline ()
   from ./stonesense/deplibs/liballegro.so.5.0
No symbol table info available.
#13 0xf30469b6 in thread_proc_trampoline ()
   from ./stonesense/deplibs/liballegro.so.5.0
No symbol table info available.
#14 0xf73bdc39 in start_thread (arg=0xe34feb70) at pthread_create.c:304
---Type <return> to continue, or q <return> to quit---
        __res = <optimized out>
        __ignore1 = <optimized out>
        __ignore2 = <optimized out>
        pd = 0xe34feb70
        now = <optimized out>
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-147005452, 0,
                4001536, -481303528, -1082275920, 1459860888},
              mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0},
            data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
        not_first_call = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#15 0xf74a351e in clone () from /lib32/libc.so.6
No symbol table info available.
Title: Re: DFHack 0.34.10 r1
Post by: tofof on June 15, 2012, 03:40:30 pm
Quote
Currently, versions 0.34.08 - 0.34.11 are supported. If you need DFHack for older versions, look for older releases.
https://github.com/peterix/dfhack

There are commits that seem to increase the current version to 34.11 from 2 days ago.  https://github.com/peterix/dfhack/commit/eaac32c7652be14dc45366b9d74101ae6a38fb17

But still no actual release for download?  What gives?  I really don't want to build from source...
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 15, 2012, 03:44:41 pm
Peterix started the process of making a release for 0.34.11, but he ran into problems with some of the in-progress MacOS X support.
Title: Re: DFHack 0.34.10 r1
Post by: Eldes on June 15, 2012, 07:42:54 pm
Peterix started the process of making a release for 0.34.11, but he ran into problems with some of the in-progress MacOS X support.

Is the windows release working, and how do I get it?
Title: Re: DFHack 0.34.10 r1
Post by: Naros on June 15, 2012, 10:57:05 pm
Peterix started the process of making a release for 0.34.11, but he ran into problems with some of the in-progress MacOS X support.

Is the windows release working, and how do I get it?

I suspect they'll all be released at the same time.

Just one more way in which Apple makes the world a worse place to live in. :P
Title: Re: DFHack 0.34.10 r1
Post by: Raptor_a22 on June 16, 2012, 01:03:19 am
Just one more way in which Apple makes the world a worse place to live in. :P

Damn you Apple, delaying my acquisition of DFHack!
Title: Re: DFHack 0.34.10 r1
Post by: MarcAFK on June 16, 2012, 04:16:01 am
To hessau: Did your fps recover after Saving, quitting and reloading?
According to the FPS science thread you would need to do this after any large Autodump+destroy operation in order to see any significant Recovery of FPS.
Title: Re: DFHack 0.34.10 r1
Post by: Hessuu on June 16, 2012, 06:00:29 am
To hessau: Did your fps recover after Saving, quitting and reloading?
According to the FPS science thread you would need to do this after any large Autodump+destroy operation in order to see any significant Recovery of FPS.
Saving, quitting and reloading did not help. Stocks screen doesn't show insane amounts of stuff anymore, and all cave dwellers are gone. There is however 45k entries in the Dead/Missing section.

Here's my save.
http://dffd.wimbli.com/file.php?id=6503 (http://dffd.wimbli.com/file.php?id=6503)
Title: Re: DFHack 0.34.10 r1
Post by: MarcAFK on June 16, 2012, 07:23:30 am
...
I forgot about the dead/missing page, the single biggest unsolvable FPS issue remaining, sadly DFhack can't deal with them, and it seems the game continuse to check through that list for jobs etc, which is causing the lag. My suggestion to toady would be something that cleans up that list whenever a corpse goes missing completely from the map (atomsmash or completely destroyed some other way, perhaps decaying completely in a refuse pile) or whenever a corpse gets slabbed/buried it should remain on that list perhaps under a subheading for Buried dwarves, and after they're buried they should be hidden/forbidden from whatever process it is that's parsing through them constantly(I'm going to assume that it's the Reanimation/ghost code constantly checking for viable targets).
Title: Re: DFHack 0.34.10 r1
Post by: Hessuu on June 16, 2012, 09:15:50 am
Ouch. Sad to hear that, but still good to know.
Title: Re: DFHack 0.34.10 r1
Post by: Intrinsic on June 16, 2012, 10:11:52 am
...
I forgot about the dead/missing page, the single biggest unsolvable FPS issue remaining, sadly DFhack can't deal with them, and it seems the game continuse to check through that list for jobs etc, which is causing the lag. My suggestion to toady would be something that cleans up that list whenever a corpse goes missing completely from the map (atomsmash or completely destroyed some other way, perhaps decaying completely in a refuse pile) or whenever a corpse gets slabbed/buried it should remain on that list perhaps under a subheading for Buried dwarves, and after they're buried they should be hidden/forbidden from whatever process it is that's parsing through them constantly(I'm going to assume that it's the Reanimation/ghost code constantly checking for viable targets).

My fort was running super smooth(100/50 FPS) 260+ dwarves, and then i decided to clean up my animals(butcher) as i had hundreds to chickens and turkeys(300+ animals in fort), over 8k turkey eggs alone ;p and goblinite(melt) and it was only then that one of those two process brought everything down in FPS to about ~35 FPS. Pretty annoying ;p
Title: Re: DFHack 0.34.10 r1
Post by: Caprealis on June 16, 2012, 10:37:58 am
Placeholder for updates!
Title: Re: DFHack 0.34.10 r1
Post by: dangerPhil on June 16, 2012, 12:54:57 pm
Sometimes, I don't get DF at all. On my other computer I loaded the 34.10r1 dfhack release, changed to the actual symbol.xml, removed the OSX symbol definitions and it worked like a charm. On this computer, I did the same and DF decides to not work here. Really strange.
Title: Re: DFHack 0.34.10 r1
Post by: expwnent on June 16, 2012, 05:17:38 pm
I've been trying to build DFHack on linux, and I'm having a few problems.

First problem: when trying to run cmake, I get

Spoiler (click to show/hide)

and when I try to "make install" I get

Spoiler (click to show/hide)

I followed the instructions as best I could, but I couldn't get it to work. I also tried getting it to work on windows, but that also ran into problems. Any help on what I'm doing wrong would be appreciated.
Title: Re: DFHack 0.34.10 r1
Post by: Skitskraj on June 17, 2012, 05:36:45 am
People are responding to this thread as if DFHack works on the latest version. I must ask, does it?
I just installed the game and love it so far, but would really like having stonesense as eye-candy. Is it still working, cuz I can't get it to work. Not sure if I might be doing it wrong.
I installed the LNP, and later added DFHack to the directory. Tried running DFHack-run at command prompt, and start from there. I simply wrote "dfhack-run stonesence" but got an error saying "Could not connect to localhost 5000".

Am I doing something wrong, or isn't it working on the newest release?
Title: Re: DFHack 0.34.10 r1
Post by: EvilTwin on June 17, 2012, 05:44:20 am
People are responding to this thread as if DFHack works on the latest version. I must ask, does it?
I just installed the game and love it so far, but would really like having stonesense as eye-candy. Is it still working, cuz I can't get it to work. Not sure if I might be doing it wrong.
I installed the LNP, and later added DFHack to the directory. Tried running DFHack-run at command prompt, and start from there. I simply wrote "dfhack-run stonesence" but got an error saying "Could not connect to localhost 5000".

Am I doing something wrong, or isn't it working on the newest release?

Are you sure you have written "dfhack-run stonesence"? because that might be the problem, the command should be "dfhack-run stonesense"...
Title: Re: DFHack 0.34.10 r1
Post by: Skitskraj on June 17, 2012, 06:00:08 am
Typo in here, I wrote with an s. But you respond as if it should work? Does it? Anyone know what I'm doing wrong (not writing stonesence, but stonesense)
Title: Re: DFHack 0.34.10 r1
Post by: danaris on June 17, 2012, 07:09:05 am
People are responding to this thread as if DFHack works on the latest version. I must ask, does it?
I just installed the game and love it so far, but would really like having stonesense as eye-candy. Is it still working, cuz I can't get it to work. Not sure if I might be doing it wrong.
I installed the LNP, and later added DFHack to the directory. Tried running DFHack-run at command prompt, and start from there. I simply wrote "dfhack-run stonesence" but got an error saying "Could not connect to localhost 5000".

Am I doing something wrong, or isn't it working on the newest release?

When you open up DF, does a separate DFHack console window open with it?

Because if it doesn't, then you don't have DFHack installed properly.
Title: Re: DFHack 0.34.10 r1
Post by: Skitskraj on June 17, 2012, 08:02:11 am
People are responding to this thread as if DFHack works on the latest version. I must ask, does it?
I just installed the game and love it so far, but would really like having stonesense as eye-candy. Is it still working, cuz I can't get it to work. Not sure if I might be doing it wrong.
I installed the LNP, and later added DFHack to the directory. Tried running DFHack-run at command prompt, and start from there. I simply wrote "dfhack-run stonesence" but got an error saying "Could not connect to localhost 5000".

Am I doing something wrong, or isn't it working on the newest release?

When you open up DF, does a separate DFHack console window open with it?

Because if it doesn't, then you don't have DFHack installed properly.
Hm... No. :P Probably fucked up the install then I guess... What I have done is simply unpack the entire DFHack zip into the folder where the Lazy Newb Pack.exe is. This didn't work so I also unpacked it in the subfolder named Dwarf Fortress 0.34.11.

So, no console opens when I start the game through Lazy Newb Pack.exe or dwarf fortress.exe, and when I try the command promt and write DFHack-run stonesense, I get the error "Could not connect to localhost 5000".
Title: Re: DFHack 0.34.10 r1
Post by: cybergon on June 17, 2012, 08:32:27 am
I too am having trouble getting dfhack to work on the current version. I followed the advice on page 120 of this thread, replaced the xml file, removed the OSX info, but now the game just crashes immediately after loading both the game and the dfhack command window. I tried removing the linux info as well but the result doesn't change.

I'm on W7 btw.
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 17, 2012, 08:43:17 am
If you get the absolute latest XML from angavrilov/df-structures, it will not work because angavrilov just recently renamed a few of the variables (control_mode/game_mode -> game_mode/game_type) - you must fetch it from peterix/df-structures.
Title: Re: DFHack 0.34.10 r1
Post by: AustralianWinter on June 17, 2012, 08:43:48 am
I too am having trouble getting dfhack to work on the current version. I followed the advice on page 120 of this thread, replaced the xml file, removed the OSX info, but now the game just crashes immediately after loading both the game and the dfhack command window. I tried removing the linux info as well but the result doesn't change.

I'm on W7 btw.

Yeah, that's my problem too.
Title: Re: DFHack 0.34.10 r1
Post by: cybergon on June 17, 2012, 09:03:48 am
Got it. Thanks a lot man.

If you get the absolute latest XML from angavrilov/df-structures, it will not work because angavrilov just recently renamed a few of the variables

Why did he do that? I'm genuinely curious.
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 17, 2012, 09:05:47 am
because he does it all the time?

Not all variables are fully understood. Sometimes things get renamed when we learn more about what they're for.
Title: Re: DFHack 0.34.10 r1
Post by: AustralianWinter on June 17, 2012, 09:50:38 am
Excuse me. What must I fetch, and from where, specifically?
Title: Re: DFHack 0.34.10 r1
Post by: dangerPhil on June 17, 2012, 10:41:14 am
If you get the absolute latest XML from angavrilov/df-structures, it will not work because angavrilov just recently renamed a few of the variables (control_mode/game_mode -> game_mode/game_type) - you must fetch it from peterix/df-structures.
Thanks, that was the problem.
Title: Re: DFHack 0.34.10 r1
Post by: Skitskraj on June 17, 2012, 10:54:41 am
Excuse me. What must I fetch, and from where, specifically?
I would also like to know that =)
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 17, 2012, 11:03:46 am
Got it. Thanks a lot man.

If you get the absolute latest XML from angavrilov/df-structures, it will not work because angavrilov just recently renamed a few of the variables

Why did he do that? I'm genuinely curious.
He changed them to match the actual variable names used by Toady - those ones in particular are used by libgraphics, whose source code is available.
Title: Re: DFHack 0.34.10 r1
Post by: cybergon on June 17, 2012, 11:12:40 am
http://www.mediafire.com/?4kr1vne44j0444t

Here guys, this is the symbols.xml tweaked as I was instructed, just stuff in in the hack folder and replace. Hope that helps for now.

He changed them to match the actual variable names used by Toady - those ones in particular are used by libgraphics, whose source code is available.

Yeah but why doesn't it work now? Or is this intended for the next release of dfhack?
Title: Re: DFHack 0.34.10 r1
Post by: Skitskraj on June 17, 2012, 11:33:10 am
http://www.mediafire.com/?4kr1vne44j0444t

Here guys, this is the symbols.xml tweaked as I was instructed, just stuff in in the hack folder and replace. Hope that helps for now.

He changed them to match the actual variable names used by Toady - those ones in particular are used by libgraphics, whose source code is available.

Yeah but why doesn't it work now? Or is this intended for the next release of dfhack?
Thanks mate, but still does't work. I see the command window open, but it closes immideately =S Anyone?
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 17, 2012, 11:34:58 am
http://www.mediafire.com/?4kr1vne44j0444t

Here guys, this is the symbols.xml tweaked as I was instructed, just stuff in in the hack folder and replace. Hope that helps for now.

He changed them to match the actual variable names used by Toady - those ones in particular are used by libgraphics, whose source code is available.

Yeah but why doesn't it work now? Or is this intended for the next release of dfhack?

It does not work because you are grabbing a file directly from what is currently being worked on, which is the next release of DFhack. this file changes several times daily as work is being done.
Title: Re: DFHack 0.34.10 r1
Post by: cybergon on June 17, 2012, 11:40:52 am
Skitskraj what OS are you using? The file I posted is tweaked to be just for windy so that's kinda relevant

It does not work because you are grabbing a file directly from what is currently being worked on, which is the next release of DFhack. this file changes several times daily as work is being done.

Ah I see, yes I figured this was so, thanks for confirming.
Title: Re: DFHack 0.34.10 r1
Post by: Skitskraj on June 17, 2012, 11:42:52 am
win 7 x64. Probably just some stupid windows setting that auto-closes the commandwindow, no?
Title: Re: DFHack 0.34.10 r1
Post by: cybergon on June 17, 2012, 11:51:51 am
I dunno, I'm on an x86 laptop right now and am no guru so I don't think I'll be of help, maybe wait for Quietust's input?
Title: Re: DFHack 0.34.10 r1
Post by: darkrider2 on June 17, 2012, 02:01:57 pm
Does this work for DF 34.11? Cause I tried running it and it just crashes DF the instant I open it and gives me some error message that I cannot read because its stuck behind the DF window which doesn't respond.
Title: Re: DFHack 0.34.10 r1
Post by: Isher on June 17, 2012, 02:32:51 pm
Does this work for DF 34.11? Cause I tried running it and it just crashes DF the instant I open it and gives me some error message that I cannot read because its stuck behind the DF window which doesn't respond.

No, wait a few days for release.
Title: Re: DFHack 0.34.10 r1
Post by: Skitskraj on June 17, 2012, 02:48:09 pm
Ah, reinstalled the game and DFHack, and the symbols.xml that was linked to a few posts earlier, works now, thanks <3
Title: Re: DFHack 0.34.10 r1
Post by: vjek on June 17, 2012, 07:21:02 pm
I had the need to keep a fort alive for a very long time recently, and only had a few dwarves to work with, and some were getting pretty old.

So, I rejuvenated them!

Spoiler: rejuvenate.lua (click to show/hide)
This script can be called by targeting a dwarf in DF and simply: rejuvenate , if the script is placed into \hack\scripts\
or if you choose, with ' lua \path\to\rejuvenate.lua '

Tested in 34.10, does not appear to cause any problems with my adult dwarves, after a year of in-game time has passed, and through several saves/loads.

WARNING:  This script has NOT been tested on dwarven children.
Title: Re: DFHack 0.34.10 r1
Post by: WillowLuman on June 17, 2012, 07:23:00 pm
I had the need to keep a fort alive for a very long time recently, and only had a few dwarves to work with, and some were getting pretty old.

So, I rejuvenated them!

Spoiler: rejuvenate.lua (click to show/hide)
This script can be called by targeting a dwarf in DF and simply: rejuvenate , if the script is placed into \hack\scripts\
or if you choose, with ' lua \path\to\rejuvenate.lua '

Tested in 34.10, does not appear to cause any problems with my adult dwarves, after a year of in-game time has passed, and through several saves/loads.

WARNING:  This script has NOT been tested on dwarven children.

Well, let's remedy that shall we?
Title: Re: DFHack 0.34.10 r1
Post by: EmeraldWind on June 17, 2012, 11:12:08 pm
I had the need to keep a fort alive for a very long time recently, and only had a few dwarves to work with, and some were getting pretty old.

So, I rejuvenated them!

Spoiler: rejuvenate.lua (click to show/hide)
This script can be called by targeting a dwarf in DF and simply: rejuvenate , if the script is placed into \hack\scripts\
or if you choose, with ' lua \path\to\rejuvenate.lua '

Tested in 34.10, does not appear to cause any problems with my adult dwarves, after a year of in-game time has passed, and through several saves/loads.

WARNING:  This script has NOT been tested on dwarven children.

Well, let's remedy that shall we?

Considering how this is said to work. I would assume it adultifies the children. Their birth year would be set to current year minus 20, making them 20 years old.
Title: Re: DFHack 0.34.10 r1
Post by: WillowLuman on June 18, 2012, 01:27:52 am
Or maybe it just crashes the game.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 18, 2012, 08:13:55 am
Why not add tag NO_AGING and  be done with it? Thoug this thing might really help with that damned children:)
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 18, 2012, 11:00:31 am
Is there a reference that lists the dfusion lua functions, and explains what they each do?  I've only been able to find out about functions from other people posting their scripts.  Where do they find out about them?

For example, someone recently posted a script where one can set the mood type for dwarves, using df.mood.  Where did this person find out that df.mood was a thing and how to use it?  Searching the forums and the files in my dfhack directory turns up nothing.
Title: Re: DFHack 0.34.10 r1
Post by: Rafal99 on June 18, 2012, 12:08:32 pm
Where did this person find out that df.mood was a thing and how to use it?

Try here:
https://github.com/peterix/df-structures (https://github.com/peterix/df-structures)

the df.***.xml files define all data structures and variables that you can use with DFHack.

For example df.mood_type structure can be found in df.units.xml file.
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 18, 2012, 12:46:47 pm
Where did this person find out that df.mood was a thing and how to use it?

Try here:
https://github.com/peterix/df-structures (https://github.com/peterix/df-structures)

the df.***.xml files define all data structures and variables that you can use with DFHack.

For example df.mood_type structure can be found in df.units.xml file.

Tasty stuff there.  Thanks!  Looks like the On Break flag can be accessed there, will finally be able to kick the dwarves out of break when there's time-sensitive things going on.

Also, looks like it might be possible to induce syndromes.  It'll take me several hours to write a symptom list suitable for nobles though...
Title: Re: DFHack 0.34.10 r1
Post by: Naros on June 18, 2012, 12:54:40 pm
Good to see that people are writing scripts for DFhack. :9
Title: Re: DFHack 0.34.10 r1
Post by: MiniMacker on June 18, 2012, 01:21:07 pm
Good to see that people are writing scripts for DFhack. :9
We need a separate board thread list for DFhack scripts.
Title: Re: DFHack 0.34.10 r1
Post by: uggi on June 18, 2012, 01:26:19 pm
Can a script run through all items marked as dumped, and remove/leave the dump mark for certain types of items? That would make disarming prisoners a bit easier. I'd like to only strip their pointy objects and leave their armor on.
Title: Re: DFHack 0.34.10 r1
Post by: TerryDactyl on June 18, 2012, 03:06:06 pm
Can a script run through all items marked as dumped, and remove/leave the dump mark for certain types of items? That would make disarming prisoners a bit easier. I'd like to only strip their pointy objects and leave their armor on.

I think you can do this from the stocks screen without much trouble.
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 18, 2012, 04:19:19 pm
So it looks like stack sizes are accessible here...

Is it possible to go through all the items under the cursor, find stackable items of the same type, make one stack with the quantity matching the total, and delete the originals?

I figured that with all the people wishing for a way to combine stacks, somebody's probably already tried it.
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on June 18, 2012, 08:47:28 pm
Can a script run through all items marked as dumped, and remove/leave the dump mark for certain types of items? That would make disarming prisoners a bit easier. I'd like to only strip their pointy objects and leave their armor on.
There's already a development plugin (stripcaged) that disarms prisoners.  I just added a "keeparmor" option that causes it not to remove armor and clothing.  I should clean it up and move it into the main tree, but even so it'll be up to peterix to include it in the official release.  If it doesn't make it into 34.11r1 I can at least put the Windows plugin .dll up on github.
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on June 18, 2012, 08:49:24 pm
So it looks like stack sizes are accessible here...

Is it possible to go through all the items under the cursor, find stackable items of the same type, make one stack with the quantity matching the total, and delete the originals?

I figured that with all the people wishing for a way to combine stacks, somebody's probably already tried it.
Restacking is fairly hard; for example, two items are not stack-equivalent if they're masterworks created by different craftsdwarfs.  Implementing isRestackableWith is fairly tedious, and as of yet nobody has bothered to do it.
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 18, 2012, 10:19:32 pm
But it would work for items that were originally one stack, right?  I'm thinking mostly of consolidating recovered bolts and arrows in adventure mode.
Title: Re: DFHack 0.34.10 r1
Post by: uggi on June 19, 2012, 07:12:53 am
There's already a development plugin (stripcaged) that disarms prisoners.  I just added a "keeparmor" option that causes it not to remove armor and clothing.  I should clean it up and move it into the main tree, but even so it'll be up to peterix to include it in the official release.  If it doesn't make it into 34.11r1 I can at least put the Windows plugin .dll up on github.

Nice! While you are at it, maybe also an option for leaving their shields on, for experiments?

I think you can do this from the stocks screen without much trouble.

Well, I did it a few times, found it to be too much of a trouble and then came here to ask for a script to do it automatically.
Title: Re: DFHack 0.34.10 r1
Post by: ab9rf on June 19, 2012, 08:13:37 am
There's already a development plugin (stripcaged) that disarms prisoners.  I just added a "keeparmor" option that causes it not to remove armor and clothing.  I should clean it up and move it into the main tree, but even so it'll be up to peterix to include it in the official release.  If it doesn't make it into 34.11r1 I can at least put the Windows plugin .dll up on github.

Nice! While you are at it, maybe also an option for leaving their shields on, for experiments?
I'm fairly certain that shields are "armor".  The 'keeparmor' option ignores any object whose isClothing or isArmorNotClothing vmethods return true; that should include shields.
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on June 19, 2012, 09:31:04 am
I compiled DFhack (34.11) with the kitchen sink options for Windows

Yay!

http://www.mediafire.com/?aapoqg33p3fabqx
Title: Re: DFHack 0.34.10 r1
Post by: MarcAFK on June 19, 2012, 09:42:29 am
What are the kitchen sink options?
Edit: typo
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on June 19, 2012, 10:01:57 am
What are the kitchen skin options?

Everything
Title: Re: DFHack 0.34.10 r1
Post by: San-A on June 19, 2012, 03:14:47 pm
I compiled DFhack (34.11) with the kitchen sync options for Windows

Yay!

http://www.mediafire.com/?aapoqg33p3fabqx
What does it do actually?
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on June 19, 2012, 03:50:25 pm
I compiled DFhack (34.11) with the kitchen sync options for Windows

Yay!

http://www.mediafire.com/?aapoqg33p3fabqx
What does it do actually?

OMG, just read the "all" compile option here

https://github.com/peterix/dfhack/blob/master/COMPILE.rst#id12

btw, if anyone else sees a post that the github has been updated to latest version, but it hasn't bee released, just pm me.  I got my lappy setup to compile this stuff (cuz I was working on a plugin that I quit on).
Title: Re: DFHack 0.34.10 r1
Post by: Hamek McEisenfaust on June 19, 2012, 04:53:05 pm
Pardon my slight newbness. In order to use this, with the current LNP, what steps are needed please. Thank you for your continued assistance.
Title: Re: DFHack 0.34.10 r1
Post by: Greiger on June 19, 2012, 05:11:16 pm
rejuvenate.lua
Interesting.  I wonder if that can be modified to act as a kill function.   Wouldn't work on goblins and elves naturally but usually the only time I've ever wanted to outright kill something with a hack tool, was when it was goblin mounts that were too scared to attack the fortress.

Actually I havent really checked, is there already a kill function?  I'm not at my home computer.

EDIT: @Hamek it should be a matter of extracting DFHack onto the DF directory(the one with Dwarf Fortress.exe) and then replacing the symbols.xml file with the one on the git.  I have never used the lazy newb pack though.  I imagine it leaves the directory structure as it normally is so it should work, but I'm not 100%.   Hopefully somebody more familiar with the LNP can give more detailed information.
Title: Re: DFHack 0.34.10 r1
Post by: caddybear on June 19, 2012, 05:28:54 pm
I compiled DFhack (34.11) with the kitchen sync options for Windows

Yay!

http://www.mediafire.com/?aapoqg33p3fabqx
What does it do actually?
OMG, just read the "all" compile option here

https://github.com/peterix/dfhack/blob/master/COMPILE.rst#id12

btw, if anyone else sees a post that the github has been updated to latest version, but it hasn't bee released, just pm me.  I got my lappy setup to compile this stuff (cuz I was working on a plugin that I quit on).

Kitchen skin doesn't equal to all ( and the kitchen sink )
Title: Re: DFHack 0.34.10 r1
Post by: expwnent on June 19, 2012, 05:54:38 pm
I compiled DFhack (34.11) with the kitchen sync options for Windows

Yay!

http://www.mediafire.com/?aapoqg33p3fabqx
What does it do actually?

OMG, just read the "all" compile option here

https://github.com/peterix/dfhack/blob/master/COMPILE.rst#id12

That says precisely nothing about what the kitchen sink is.
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on June 19, 2012, 06:59:44 pm
I compiled DFhack (34.11) with the kitchen sync options for Windows

Yay!

http://www.mediafire.com/?aapoqg33p3fabqx
What does it do actually?

OMG, just read the "all" compile option here

https://github.com/peterix/dfhack/blob/master/COMPILE.rst#id12

That says precisely nothing about what the kitchen sink is.

It's an expression, meaning everything.

http://www.joe-ks.com/phrases/phrasesE.htm
Meaning:    Practically everything there is; every possible object whether needed or not.
Example:    
Origin:    This expression was born in the early 20th century and became popular after World War II (the late 1940s). The kitchen sink is heavy, connected to pipes and usually bolted down, so it’s not easily movable. But if you took everything but the kitchen sink, you’d be taking virtually all there was.

Related sayings are "From soup to nuts" and "From A to Z".
Title: Re: DFHack 0.34.10 r1
Post by: TerryDactyl on June 19, 2012, 09:11:55 pm
That gave me a chuckle.
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 19, 2012, 09:21:12 pm
rejuvenate.lua
Interesting.  I wonder if that can be modified to act as a kill function.   Wouldn't work on goblins and elves naturally but usually the only time I've ever wanted to outright kill something with a hack tool, was when it was goblin mounts that were too scared to attack the fortress.

OMG I hate those a-holes!  Is there a way to mod them so they don't do that?
Title: Re: DFHack 0.34.10 r1
Post by: thistleknot on June 19, 2012, 09:57:48 pm
btw, this version has TWO VERY AWESOME THINGS

sort by name in units screen (works for nobles, I guess it works for else)

and QUICKSAVE, no more quitting and reloading
Title: Re: DFHack 0.34.10 r1
Post by: Greiger on June 19, 2012, 11:42:43 pm
OMG I hate those a-holes!  Is there a way to mod them so they don't do that?

Possibly making all the cavern layer 1 creatures that have [MOUNT] also have whatever tag makes the ones like cave crocodiles aggressive should work.   I'm thinking it's something like [LARGE_PREDATOR], but I haven't preformed science to test it.  I generally like keeping the vanilla creatures vanilla, and adding such a tag to all the 1st cavern layer mountable creatures is more drastic than I'd like. 

That and it would be a pain to search all the raws for creatures that spawn in the first cavern layer (goblins and similar civilizations that use cave critters only ever take from cavern 1), that also have [MOUNT] that aren't already aggressive...and I'm lazy.
Title: Re: DFHack 0.34.10 r1
Post by: expwnent on June 20, 2012, 12:27:34 am
And that still doesn't describe what is in the "kitchen sink" build that is not in the "all" build. Not that it really matters.
Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 20, 2012, 12:30:20 am
OMG I hate those a-holes!  Is there a way to mod them so they don't do that?

Possibly making all the cavern layer 1 creatures that have [MOUNT] also have whatever tag makes the ones like cave crocodiles aggressive should work.   I'm thinking it's something like [LARGE_PREDATOR], but I haven't preformed science to test it.  I generally like keeping the vanilla creatures vanilla, and adding such a tag to all the 1st cavern layer mountable creatures is more drastic than I'd like. 

That and it would be a pain to search all the raws for creatures that spawn in the first cavern layer (goblins and similar civilizations that use cave critters only ever take from cavern 1), that also have [MOUNT] that aren't already aggressive...and I'm lazy.

No, goblins use [MOUNT_EXOTIC] I think...
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 20, 2012, 12:45:32 am
And that still doesn't describe what is in the "kitchen sink" build that is not in the "all" build. Not that it really matters.

Possibly some extra dev stuff that doesn't go into release. I'd have to double check to be sure.
Title: Re: DFHack 0.34.10 r1
Post by: Brandon816 on June 20, 2012, 02:00:56 am
Actually I havent really checked, is there already a kill function?  I'm not at my home computer.
Not sure, but if there isn't, I've found that setting current blood of a unit to 0 works for any creature that requires blood. It will kill any of those creatures in 1-2 frames. Outside of that (stuff like bronze colossus), I'm sure that there is a way you can flag all body parts as removed though, and that would definitely take care of any creature.
Title: Re: DFHack 0.34.10 r1
Post by: Argelle on June 20, 2012, 02:28:08 am

EDIT: @Hamek it should be a matter of extracting DFHack onto the DF directory(the one with Dwarf Fortress.exe) and then replacing the symbols.xml file with the one on the git.  I have never used the lazy newb pack though.  I imagine it leaves the directory structure as it normally is so it should work, but I'm not 100%.   Hopefully somebody more familiar with the LNP can give more detailed information.
Hello :)
For a non-lazy newb pack version, (DF34.11 vanilla, windows): does the compilation from thistleknot include a valid symbols.xml?


Quote from: thistleknot on June 19, 2012, 09:31:04 am
I compiled DFhack (34.11) with the kitchen sync options for Windows

Yay!

http://www.mediafire.com/?aapoqg33p3fabqx
Title: Re: DFHack 0.34.10 r1
Post by: orfax on June 20, 2012, 03:03:16 am
I compiled DFhack (34.11) with the kitchen sink options for Windows

Yay!

http://www.mediafire.com/?aapoqg33p3fabqx

Thank you for doing this. It works for me on Windows 7 64bit. The previous symbols.xml fiddling did not work for me.

With this I was able to remove some forgotton beast extract that was killing a few dwarves a year through syndrome bleeding. Now I can get legendary dwarves again! :)
Title: Re: DFHack 0.34.10 r1
Post by: orfax on June 20, 2012, 03:07:01 am
The symbols.xml file from that thistleknot compile can be found here: http://pastebin.com/44vKthe7
Title: Re: DFHack 0.34.10 r1
Post by: Argelle on June 20, 2012, 03:16:27 am
Okki, I'll stick to the thistleknot compile's symbols.xml :)

Another (out of pure curiosity) question:
Stonesense seems different (improved?) in the compilation (compared to the version packed with df hack 34.10). I try to get track of the version history, so, is this still stonesense version 33 or a newest, not yet posted in the stonesense thread?
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 20, 2012, 03:34:07 am
New versions don't really get posted to the thread anymore, there's just a link to here, and no, the one in the compilation is not the same as the one packed with the 34.10 version of DFhack.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 20, 2012, 03:42:16 am
How do i change XXhelmXX to helm? With changeitem i can chabge quality but can't change it's wear level.

Also is there a way to change quality of all items in a container under cursor? This would really save a lot of times for me:)
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on June 20, 2012, 04:04:13 am
rejuvenate.lua
Interesting.  I wonder if that can be modified to act as a kill function.   Wouldn't work on goblins and elves naturally but usually the only time I've ever wanted to outright kill something with a hack tool, was when it was goblin mounts that were too scared to attack the fortress.

OMG I hate those a-holes!  Is there a way to mod them so they don't do that?
uhh you could mod it so that they join the fortress. though I don't play enough fort mode to feel the need to use a hack tool to kill folks. I just simply jump into adventure mode and  run up to them with a pickaxe if I that crazy. ususally a kill on command tool will bug you into an infinite siege that you can't escape.*

*lies you just need to switch between adventure mode and fort mode.
Title: Re: DFHack 0.34.10 r1
Post by: San-A on June 20, 2012, 05:50:01 am
I compiled DFhack (34.11) with the kitchen sink options for Windows

Yay!

http://www.mediafire.com/?aapoqg33p3fabqx

Thank you for doing this. It works for me on Windows 7 64bit. The previous symbols.xml fiddling did not work for me.

With this I was able to remove some forgotton beast extract that was killing a few dwarves a year through syndrome bleeding. Now I can get legendary dwarves again! :)
How do you actually run it? I couldn't work it out :(
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 20, 2012, 06:07:59 am
Copy into DF folder, run DF?
Title: Re: DFHack 0.34.10 r1
Post by: San-A on June 20, 2012, 06:14:29 am
Copy into DF folder, run DF?
Thanks  :D I thought it was reading the memory, I didn't know it had to be copied in the main DF directory
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 20, 2012, 06:17:07 am
Nope, the reading memory thing is the old way of doing things that didn't work well.

Nowadays people read the readme file that tells you what, exactly, you are supposed to do with the files you just downloaded.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 20, 2012, 06:34:36 am
Can anybody answer my question about degraded clothing? How do i repair it with DFhack?
Title: Re: DFHack 0.34.10 r1
Post by: San-A on June 20, 2012, 06:36:57 am
Nope, the reading memory thing is the old way of doing things that didn't work well.

Nowadays people read the readme file that tells you what, exactly, you are supposed to do with the files you just downloaded.
I was quite sure it was reading the memory, so this is why I thought there was a bug. Hence I didn't read the readme (but I should have). No need to be rude mate, everyone makes mistake
Title: Re: DFHack 0.34.10 r1
Post by: Rose on June 20, 2012, 06:40:25 am
Yeah, I know, everybody makes mistakes, and I have to correct every single one of those, so it gets tedious. Anyway, DF loads up DFhack as a DLL, making memory reading much faster.
Title: Re: DFHack 0.34.10 r1
Post by: AustralianWinter on June 20, 2012, 09:30:15 am
Yeah, I know, everybody makes mistakes, and I have to correct every single one of those, so it gets tedious. Anyway, DF loads up DFhack as a DLL, making memory reading much faster.

Aww, man, you have it so hard.

At any rate, thanks for the new edition, it works like a charm.
Title: Re: DFHack 0.34.10 r1
Post by: San-A on June 20, 2012, 09:38:00 am
Yeah, I know, everybody makes mistakes, and I have to correct every single one of those, so it gets tedious. Anyway, DF loads up DFhack as a DLL, making memory reading much faster.
The duty of the master is to initiate the profane  :)
Title: Re: DFHack 0.34.10 r1
Post by: Altaree on June 20, 2012, 01:25:19 pm
Hi!
I just wrote up this script that will remove naked thoughts from all of your dwarves.  Once DFHack 0.34.11 is released this shouldn't be needed but until then, HAVE FUN!

I had a bit of trouble removing elements from the list of recent_events so I have to start over every time I find and event I want to remove.

Comments are WELCOME!
Code: [Select]
function fixnaked()
local total_fixed = 0
local total_uncovered = 0
local total_noshirt = 0
local total_noshoes = 0

for fnUnitCount,fnUnit in ipairs(df.global.world.units.all) do
    if fnUnit.race == df.global.ui.race_id then
local listEvents = fnUnit.status.recent_events
--for lkey,lvalue in pairs(listEvents) do
-- print(df.unit_thought_type[lvalue.type],lvalue.type,lvalue.age,lvalue.subtype,lvalue.severity)
--end

local found = 1
local fixed = 0
while found == 1 do
local events = fnUnit.status.recent_events
found = 0
for k,v in pairs(events) do
if v.type == 109 then
events:erase(k)
found = 1
total_uncovered = total_uncovered + 1
fixed = 1
break
end
if v.type == 110 then
events:erase(k)
found = 1
total_noshirt = total_noshirt + 1
fixed = 1
break
end
if v.type == 111 then
events:erase(k)
found = 1
total_noshoes = total_noshoes + 1
fixed = 1
break
end
end
end
if fixed == 1 then
total_fixed = total_fixed + 1
print(total_fixed, total_uncovered+total_noshirt+total_noshoes,dfhack.TranslateName(dfhack.units.getVisibleName(fnUnit)))
end
end
end
print("thought 109 = "..df.unit_thought_type[109])
print("thought 110 = "..df.unit_thought_type[110])
print("thought 111 = "..df.unit_thought_type[111])
print("Total Fixed: "..total_fixed)
print("Total thoughts removed: "..total_uncovered)
print("Total thoughts removed: "..total_noshirt)
print("Total thoughts removed: "..total_noshoes)

end
fixnaked()
create a file named fixnaked.lua in <DF>/hack/scripts
At the [DFHack] prompt run 'fixnaked'

All the names were found at https://github.com/peterix/df-structures
Thanks to angavrilov for the fat-dwarves script, it showed me the path!
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 20, 2012, 02:40:22 pm
For erasing stuff you can apply the trick Toady uses:

Code: [Select]
for k = #events-1,0,-1 do ... events:erase(k) ... end
This lets you erase the item you are looking at without disrupting the iteration.

You can also use df.unit_thought_type.Whatever instead of numbers. It works as a bi-directional mapping between numbers and strings.
Title: Re: DFHack 0.34.10 r1
Post by: Altaree on June 20, 2012, 03:14:05 pm
For erasing stuff you can apply the trick Toady uses:

Code: [Select]
for k = #events-1,0,-1 do ... events:erase(k) ... end
Thanks for the feedback!  I saw that syntax before.  Can you explain what it is doing?  It is a bit confusing to me and the docs at lua.org aren't helping :)
Title: Re: DFHack 0.34.10 r1
Post by: Rafal99 on June 20, 2012, 03:35:15 pm
Code: [Select]
for k = #events-1,0,-1 do ... events:erase(k) ... end
Thanks for the feedback!  I saw that syntax before.  Can you explain what it is doing?  It is a bit confusing to me and the docs at lua.org aren't helping :)

It is iterating from #events - 1, which is index of the last element, down to 0, which is index of the first element. The -1 is step.

Equivalent C++ code would look like:
for (int k = numEvents - 1; k >= 0; k--) {
Title: Re: DFHack 0.34.10 r1
Post by: Altaree on June 20, 2012, 08:53:36 pm
Code: [Select]
for k = #events-1,0,-1 do ... events:erase(k) ... end
Thanks for the feedback!  I saw that syntax before.  Can you explain what it is doing?  It is a bit confusing to me and the docs at lua.org aren't helping :)

It is iterating from #events - 1, which is index of the last element, down to 0, which is index of the first element. The -1 is step.

Equivalent C++ code would look like:
for (int k = numEvents - 1; k >= 0; k--) {
DOH! That makes sense! Thanks!
Title: Re: DFHack 0.34.10 r1
Post by: expwnent on June 20, 2012, 09:34:15 pm
Just remember that if you delete something, you have to say k++ or you might miss some stuff if the thing you're looking for can happen twice in a row.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 21, 2012, 01:57:37 am
Just remember that if you delete something, you have to say k++ or you might miss some stuff if the thing you're looking for can happen twice in a row.

No you don't. That's the whole reason for iterating end-to-start.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 21, 2012, 06:13:29 am
Post scripts then they are ready:) We, people without lua knowledge, will gladly use them:)
Title: Re: DFHack 0.34.10 r1
Post by: Rumrusher on June 21, 2012, 06:54:17 am
I just realize toady removed Cage traps from the list of traps you can trigger in adventure mode. Man a part of me dis like this so much, but another part kinda glad we figure out how to recreate the process in adventure mode.
Title: Re: DFHack 0.34.10 r1
Post by: telarin on June 21, 2012, 09:47:42 am
I would like to suggest an improvement to autolabor:

autolabor exclude - would exclude the currently selected dwarf from autolabor control. That way, if you have a specific dwarf you want to control labors on manually (such as your CMD) you can.
Title: Re: DFHack 0.34.10 r1
Post by: jwest23 on June 21, 2012, 09:54:59 am
I like that idea, telarin.  Expanding on it a bit, I'd have seven commands:

autolabor all
autolabor none
autolabor include <dwarf>
autolabor exclude <dwarf>
autolabor default <dwarf>
autolabor show-policy <dwarf>
autolabor show-policy

The first two commands would let you set a default policy.  autolabor all would turn on autolabor for all dwarves, including those who haven't yet come into play.  autolabor none would similarly turn it off for all dwarves.

The second two commands would let you override the default policy for individuals.  autolabor all and autolabor none would not affect them.

autolabor default would return a dwarf to the default policy, no matter what it is.

The last two commands are for interrogating the policy settings for one or all dwarves.
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 21, 2012, 12:43:25 pm
Anyone know where I might find what I need to toggle warm/wet stone cancellations on or off?  Is it even possible to control this with a script?  I think there was a hack for 40d that could do it.
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 21, 2012, 02:24:38 pm
Anyone know where I might find what I need to toggle warm/wet stone cancellations on or off?  Is it even possible to control this with a script?  I think there was a hack for 40d that could do it.

If you just want to hide the announcements, that's configurable within DF itself.

If you want to turn off the designation cancellations, then you're out of luck - that requires code modification, and DFHack generally doesn't do that.
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 21, 2012, 04:49:18 pm
Yeah, turned the announcements off, but would like to be able to dig one level below a lake or one level above the magma sea without it being one tile at a time.
Title: Re: DFHack 0.34.10 r1
Post by: Corai on June 21, 2012, 04:50:26 pm
I just realize toady removed Cage traps from the list of traps you can trigger in adventure mode. Man a part of me dis like this so much, but another part kinda glad we figure out how to recreate the process in adventure mode.

The cage traps have been off since like, 40d I think.
Title: Re: DFHack 0.34.10 r1
Post by: ResMar on June 21, 2012, 07:10:37 pm
What's eta on version 0.34.11? I upgraded everything and was surprised when it buried me in wrong version spam, even though I had managed to fool it into working before...
Title: Re: DFHack 0.34.10 r1
Post by: talysman on June 21, 2012, 07:55:10 pm
Yeah, turned the announcements off, but would like to be able to dig one level below a lake or one level above the magma sea without it being one tile at a time.
That can be configured in one of the init files now, as I recall.
Title: Re: DFHack 0.34.10 r1
Post by: Bonepart on June 21, 2012, 08:48:54 pm
Yeah, turned the announcements off, but would like to be able to dig one level below a lake or one level above the magma sea without it being one tile at a time.
That can be configured in one of the init files now, as I recall.

Can it? I don't remember ever seeing that option, but I would so turn it on!
Title: Re: DFHack 0.34.10 r1
Post by: Quietust on June 21, 2012, 10:17:29 pm
Yeah, turned the announcements off, but would like to be able to dig one level below a lake or one level above the magma sea without it being one tile at a time.
That can be configured in one of the init files now, as I recall.
You are incorrect - I already stated above that editing said init file will only hide the announcements - it will not stop the designations from being cancelled.
Title: Re: DFHack 0.34.10 r1
Post by: WillowLuman on June 21, 2012, 10:46:39 pm
Is there any way to affect items in ways such as giving them names/forcing a warrior to become attached to them?
Title: Re: DFHack 0.34.10 r1
Post by: lordnincompoop on June 21, 2012, 11:20:06 pm
Is there any way to affect items in ways such as giving them names/forcing a warrior to become attached to them?

Not built-in, no.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 22, 2012, 01:49:33 am
How can i change XXhelmXX to Helm? Changeitem doesn't seem to be able to do it. At least i can't figure how:(
Title: Re: DFHack 0.34.10 r1
Post by: telarin on June 22, 2012, 09:46:59 am
Has anyone come up with a way to get workflow to manage gem cutting? I tried "workflow amount GEM//GLASS_GREEN 50" and it happily adds the workflow entry, but it doesn't see any cut green glass jobs that I have queued in my jeweler's workshops.
Title: Re: DFHack 0.34.10 r1
Post by: GhostDwemer on June 22, 2012, 10:34:16 am
I use a little trick to dig out warm or wet areas. I reveal the map (NOT candyland), dig out the area, unreveal, and then use the flood fill reveal to re-reveal the mined out areas. If you can keep yourself from looking around the map while revealed, it isn't even really cheating.

Turning off the pause on warm/wet would eventually and inevitably lead to great fun.
Title: Re: DFHack 0.34.10 r1
Post by: Mr S on June 22, 2012, 10:54:35 am
Or, just do what I do in these situation, Long Wall Mining.  Yep, just like real life coal mining.

Once they're exposed, you can safely dig without cancellations, so when I'm under a pond or something, just designate row at a time.  Lather rinse repeat.  Not at automated, but generally safer anyway.
Title: Re: DFHack 0.34.10 r1
Post by: Greiger on June 22, 2012, 11:03:24 am
Makes me wonder if something similar would be possible with lua.  Maybe a script that looks at all the tiles designated for mining and removes the wet/hot tags from them?

Er actually now that I think about it, DF probably keeps those accurate in real time doesn't it.  Or else freshly flooded areas would never get those tags.  If that's how it works, DF would probably just change them back next tick.   Hm...there has to be some way...
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 22, 2012, 12:01:16 pm
In that case I wonder if turning temperature off would disable the hot tags...

I was thinking about suppressing those tags earlier, but I couldn't even find them in any of the structures xml files.  Maybe it's possible to do something similar to autolabor, and reassign the designation when it's cancelled...  I'm not very good at scripting though.  Need to look into how that could work.

EDIT:  Well, it's not quite the fix I would like, because it will only work for digging and not ramps, stairs, etc, but dig cancellations are most annoying for digging rooms so it will at least make things better.  It looks like one could make a plugin that, when enabled, will take warm and/or wet rock cancellation announcements, and apply the dig designation tag at the coordinates of the announcement.

Most lua scripts I've seen are one-shot deals, whereas this would require running in the background for as long as it's enabled, like autolabor.  I'm guessing it would have to be an actual DFhack plugin then. 

Maybe I can take a look at the code for autolabor and see if I can splice this in.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 22, 2012, 12:05:57 pm
Damn i am asking about how to repair XXthingsXX with DFhack for third time already and nobody even sees it:( Nobody would even say it is impossible - just silence:(
Title: Re: DFHack 0.34.10 r1
Post by: Mr S on June 22, 2012, 12:08:27 pm
To set your mind at ease, yes, I did see it.  No, I don't know how to fix it.  I'm getting my head wrapped around some modding, but haven't gotten deep enough into the data structures for things like that yet.  Srry.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 22, 2012, 12:10:07 pm
I just saw smebody saying that it is possible through changeitem command. But never figured how:(
Title: Re: DFHack 0.34.10 r1
Post by: chronicpayne on June 22, 2012, 12:13:12 pm
Ahhh thanks
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 22, 2012, 12:14:04 pm
I don't know about any wet/hot tags at all - that is most probably computed just by checking if there is water or magma in adjacent tiles.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 22, 2012, 12:16:53 pm
AG you are wrong. It is computed from temperature of a stone. So if a stone is hot and he is surrounded by other stone - then it will remain hot as in a heat sink. Dumpnes is really about adjustent water though. But i can see a lot o hot stone after i obsidian casted something. It remains there for months and years.
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 22, 2012, 12:25:19 pm
Alright, I'm going to try to look at the source for workflow and see if I can repurpose the code so it assigns dig designation flags to the coordinates of any warm or wet cancel announcement while enabled.  Unfortunately this won't preserve stair or ramp designations, but we'll at least be able to dig rooms and hallways.  Seems the easiest way to do this because I couldn't find any code dealing with the actual cancellations themselves, just the announcements.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 22, 2012, 12:34:51 pm
Why not reveal designated tiles, and only them?

Edit: Or a 'reveal rectangle' function - when the designation ui is in the middle of rectangle selection, the selection_rect global contains the coordinates of the first selected point, and cursor the current cursor position as usual.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 22, 2012, 12:44:36 pm
Revealing a tile will not change it's remperature. Reveal is just a simple flag - it has nothing to do with hot stone. You must change temperature of a tile for this. And i am not sure how can you do it.
Title: Re: DFHack 0.34.10 r1
Post by: Hugo_The_Dwarf on June 22, 2012, 12:47:16 pm
Revealing a tile will not change it's remperature. Reveal is just a simple flag - it has nothing to do with hot stone. You must change temperature of a tile for this. And i am not sure how can you do it.
But it will stop the cancelation. because you already discovered it.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 22, 2012, 12:49:20 pm
Cancellations only occur when a designated tile is revealed during digging. So, revealing them yourself immediately after designating would prevent it.

To reveal a tile from lua you can do:

Code: [Select]
dfhack.maps.getTileBlock(x,y,z).designation[x%16][y%16].hidden = false
If the number of tiles is reasonable, as would be if you only loop over a limited rectangle on one z level, it should be fast enough. For whole-map scans lua is generally too slow, since there are millions of tiles to process - but see scripts/fix/item-occupancy.lua for an example.
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 22, 2012, 12:52:17 pm
Might give that to liquids or tiletype tool:)

Also - can anybody answer my question about XXitemsXX?
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 22, 2012, 12:56:49 pm
Using a virtual method from actual DF binary:

Code: [Select]
dfhack.gui.getSelectedItem():setWear(0)

or with manual field changes

Code: [Select]
dfhack.gui.getSelectedItem().wear = 0
dfhack.gui.getSelectedItem().wear_timer = 0
Title: Re: DFHack 0.34.10 r1
Post by: khearn on June 22, 2012, 01:12:37 pm
Also - can anybody answer my question about XXitemsXX?

I strongly suspect that if anyone could answer it, they already would have. Most people don't reply to a question that they can't answer. There are lots of people who read this thread, and if they all answered to say "sorry, can't help you", the thread would be swamped. So if you ask a question and no one answers, then there's no point in asking it over and over and over again. You still won't get an answer because no one knows. That's your answer.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 22, 2012, 01:16:39 pm
I actually checked now just in case, and there are NO pre-written plugins that change wear, so the only way is to paste that line I posted into a lua script and use it. Since it only changes one item at a time, the most reasonable way to use it is by binding to a key combination; otherwise some loops and options need to be added.
Title: Re: DFHack 0.34.10 r1
Post by: Makbeth on June 22, 2012, 01:24:45 pm
Cancellations only occur when a designated tile is revealed during digging. So, revealing them yourself immediately after designating would prevent it.

To reveal a tile from lua you can do:

Code: [Select]
dfhack.maps.getTileBlock(x,y,z).designation[x%16][y%16].hidden = false
If the number of tiles is reasonable, as would be if you only loop over a limited rectangle on one z level, it should be fast enough. For whole-map scans lua is generally too slow, since there are millions of tiles to process - but see scripts/fix/item-occupancy.lua for an example.

That command returns errors whether I try using it with a single cursor or in the middle of a rectangle selection.  Says bad argument #3, number expected, got nil.
Title: Re: DFHack 0.34.10 r1
Post by: ag on June 22, 2012, 01:46:45 pm
You obviously need to initialize x, y and z with something sensible ;)

Code: [Select]
local x,y,z = pos2xyz(df.global.cursor)
dfhack.maps.getTileBlock(x,y,z).designation[x%16][y%16].hidden = false
Title: Re: DFHack 0.34.10 r1
Post by: Tierre on June 22, 2012, 02:34:59 pm
Thanks AG i will try that:) And i was looking for this Khaern;) Cause somebody said 20 pages back that it can be done - that is why i was this stubborn:)
Title: Re: DFHack 0.34.11 r1
Post by: Rose on June 22, 2012, 09:31:30 pm
Bumping this for the update.
Title: Re: DFHack 0.34.11 r1
Post by: WillowLuman on June 22, 2012, 10:10:35 pm
Yay, update! Which version do I use for mac?
Title: Re: DFHack 0.34.11 r1
Post by: Rose on June 22, 2012, 11:04:28 pm
Neither, mac isn't out yet, just heavily being worked on.
Title: Re: DFHack 0.34.11 r1
Post by: LoSboccacc on June 23, 2012, 01:14:33 am
You do mac now?  :o
Title: Re: DFHack 0.34.11 r1
Post by: Rose on June 23, 2012, 01:25:03 am
DFHack for DF 0.34.08 - 0.34.11 (release 1) (Current):
Windows version (with Stonesense and DFusion) (https://github.com/downloads/peterix/dfhack/dfhack-0.34.11-r1-Windows.zip)
Linux version (with Stonesense) (https://github.com/downloads/peterix/dfhack/dfhack-0.34.11-r1-Linux.tar.gz)

What's new:
  • Support for 0.34.11 added.
  • TEXT mode should now be properly detected and handled on Linux.
  • Work has started on an OSX port - for real this time!
  • Many bugfixes and improvements to the existing tools and plugins.

Possible problems:
  • Stonesense lacks graphics for the many new track tiles.
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on June 23, 2012, 04:49:01 am
Are there any mirror links for the windows version? The link provided is causing my browser to crash, and I don't have any alternatives right now.
Title: armoks_blessing, new lua script for dfhack 34.10
Post by: vjek on June 23, 2012, 04:13:02 pm
I've requested a user page on the wiki, but apparently those requests all go through a single user, and none of the last half dozen user pages have content, so I'm not sure it's actually being done.  In any case, this will have to do until I can get a user page there.

This script...
... is for 34.10 (yes, I know 34.11 was just released)
... combines a bunch of functionality from my previous scripts, but does not replace them.
... will make changes to ALL YOUR DWARVES.  All of them.  Not just one.  All.

If the script is executed without any arguments, it runs the equivalent of rejuvenate, elevate_physical, elevate_mental, and brainwash on all dwarves currently on the map.  It will only rejuvenate dwarves 21 years or older.

If the script has been copied into /df_install_dir/hack/scripts/ , you'll see the following

[DFHack]# ls
...
scripts:
  armoks_blessing       - Adjust all attributes, personality, age and skills of all dwarves in play

Now running the script by itself
 
[DFHack]# armoks_blessing
No skillname supplied, no skills will be adjusted.  Pass argument 'list' to see a skill list, 'classes' to show skill classes, or use 'all' if you want all skills legendary.
Adjusting Nil Laruzol
Adjusting Sibrek Sarveshtangath
Adjusting Aban Oltarmörul
Adjusting Olon Kolakmam
Adjusting Edzul Isonzas
Adjusting Ast Mamotiden
Adjusting Doren Aranònul
[DFHack]#

I ran that on a new embark with just the starting seven.  What it did:
The script will accept arguments.  Use 'list' or 'classes' to see them, but the most common ones will be:
all
Normal
MilitaryDefense
MilitaryAttack
MINING
CARPENTRY
etc

all - this makes all your dwarves legendary in all skills. All.  Every single one.
Normal - this makes your dwarves legendary in the common labour skills plus a few extras (exactly shown with 'list' )
MilitaryDefense - the defensive military skills (dodge, armor, shield) are all made legendary
MilitaryAttack - the offensive military skills (weapons, fighting, biting, etc) are all made legendary.
MINING - all dwarves are made into legendary miners.

Example:
[DFHack]# armoks_blessing CARPENTRY
Adjusting Nil Laruzol
nil is now a Legendary Carpenter
Adjusting Sibrek Sarveshtangath
sibrek is now a Legendary Carpenter
Adjusting Aban Oltarmörul
aban is now a Legendary Carpenter
Adjusting Olon Kolakmam
olon is now a Legendary Carpenter
Adjusting Edzul Isonzas
edzul is now a Legendary Carpenter
Adjusting Ast Mamotiden
ast is now a Legendary Carpenter
Adjusting Doren Aranònul
doren is now a Legendary Carpenter
[DFHack]#


Another example:

[DFHack]# armoks_blessing Normal
Adjusting Nil Laruzol
Skill Mining is type: Normal and is now Legendary for nil
...
Skill Wax Working is type: Normal and is now Legendary for nil
Adjusting Sibrek Sarveshtangath
Skill Mining is type: Normal and is now Legendary for sibrek
...
Skill Wax Working is type: Normal and is now Legendary for sibrek
Adjusting Aban Oltarmörul
Skill Mining is type: Normal and is now Legendary for aban
...
Skill Wax Working is type: Normal and is now Legendary for aban
Adjusting Olon Kolakmam
Skill Mining is type: Normal and is now Legendary for olon
...
Skill Wax Working is type: Normal and is now Legendary for olon
Adjusting Edzul Isonzas
Skill Mining is type: Normal and is now Legendary for edzul
...
Skill Wax Working is type: Normal and is now Legendary for edzul
Adjusting Ast Mamotiden
Skill Mining is type: Normal and is now Legendary for ast
...
Skill Wax Working is type: Normal and is now Legendary for ast
Adjusting Doren Aranònul
Skill Mining is type: Normal and is now Legendary for doren
...
Skill Wax Working is type: Normal and is now Legendary for doren
[DFHack]#


The previous scripts work on single dwarves, this one works on all the dwarves currently on the map.
You should be REALLY REALLY sure you want to affect ALL YOUR DWARVES before you even copy this script into your /hack/scripts/ directory, and you should definitely have a backup/save ready in case you make changes you weren't expecting.

I would also recommend pausing the game before you run it.  Enjoy!  And please PM me if you find any problems with using this script in DF/dfhack 34.10.

Spoiler: armoks_blessing.lua (click to show/hide)
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on June 24, 2012, 10:42:08 am
vjek will it accept a digit as an argument on how much to change all stats? Like armol_blessin 5000 will change everyone to 5000 in all stats?
Title: Re: DFHack 0.34.11 r1
Post by: thistleknot on June 24, 2012, 10:58:46 am
yay for the update.

Is there a way to spawn a creature at cursor using lua?

I want to see if my fort is up enough for a creature of a type (kind of like free training), but so far, I have no idea how to spawn one without going into arena mode.

Second question, where are the lua scripts supposed to be placed when I run from the lua command?  apparently the df\hack\scripts folder isn't right?
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on June 24, 2012, 12:15:30 pm
Is there a way to spawn a creature at cursor using lua?
Theoretically, it can be done, but properly creating a new creature from scratch is a rather complicated process whose steps are not all properly known - if you miss a step, you might end up crashing the game.

Second question, where are the lua scripts supposed to be placed when I run from the lua command?  apparently the df\hack\scripts folder isn't right?
The hack/scripts folder is the correct place to put them - if they're not showing up, perhaps you forgot to give them the ".lua" extension?
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on June 24, 2012, 12:27:09 pm
How can i heal a creature (pet) using a script dfhack? Or does DFhack has some tool for that already?
My stupid 7 dwarves are drinking while all my dogs are massacred by swan skeletons:( I want to make those pets live long enough until those idiots complete drinking:(
Title: Re: DFHack 0.34.11 r1
Post by: thistleknot on June 24, 2012, 12:58:32 pm
Is there a way to spawn a creature at cursor using lua?
Theoretically, it can be done, but properly creating a new creature from scratch is a rather complicated process whose steps are not all properly known - if you miss a step, you might end up crashing the game.

Second question, where are the lua scripts supposed to be placed when I run from the lua command?  apparently the df\hack\scripts folder isn't right?
The hack/scripts folder is the correct place to put them - if they're not showing up, perhaps you forgot to give them the ".lua" extension?

apparently I don't need to type lua before the script name, just the name of the script (got the hint from quicksave)
Title: Re: DFHack 0.34.11 r1
Post by: vjek on June 24, 2012, 03:11:28 pm
vjek will it accept a digit as an argument on how much to change all stats? Like armol_blessin 5000 will change everyone to 5000 in all stats?

Not this version, no.  But if that's what you want, just change the 'demigod' variable assignment to whatever value you desire (change 2600 to 5000).  Easy!  PM me if you want more specifics.
Title: Re: DFHack 0.34.11 r1
Post by: Boes on June 24, 2012, 04:02:19 pm
Has anybody else gotten this error when trying to start dfusion.    DF 34.11,  dfhack 0.34.11 r1,  lazy newbie pack,  windows 7 x64
Code: [Select]
[color=red]dfusion/common.lua:45:  .Text region not found!
stack traceback:
   [C]: in function 'error'
   dfusion/common.lua:45: in function 'GetTextRegion'
   dfusion/common.lua:89: in function 'unlockDF'
   dfusion/init.lua:66: in main chunk[/color]

i get the above error message when i attempt to use dfusion in the dfhack console window while still on the screen to select the embark location, as i need to be to use simple embark.   It did work previously with the kitchen sink release a few pages back and i just unzipped the new version right on top of the old one, telling it to overwrite any files needed.

from reading the changelog, if i had to guess it would have something to do with the os detection thinking it was in linux instead windows,   but I'm not a programer nor do i play on on tv.
Title: Re: DFHack 0.34.11 r1
Post by: thistleknot on June 24, 2012, 05:26:55 pm
is there a way to hotkey, or autohotkey certain dfhack commands, I'd love to have the sort-units name as a hotkey
Title: Re: DFHack 0.34.11 r1
Post by: Boes on June 24, 2012, 05:50:39 pm
is there a way to hotkey, or autohotkey certain dfhack commands, I'd love to have the sort-units name as a hotkey

look into the keybindings command. it will allow you to bind commands for instance like sort-units to a key
Title: Re: DFHack 0.34.11 r1
Post by: uggi on June 24, 2012, 06:30:05 pm
i get the above error message when i attempt to use dfusion in the dfhack console window while still on the screen to select the embark location, as i need to be to use simple embark.

Same error here, trying to run DFusion. It runs fine in the previous version of DFHack (0.34.10-r1) with updated symbols file. Win 7.

Title: Re: DFHack 0.34.11 r1
Post by: ag on June 25, 2012, 02:13:47 am
Find this line in dfusion/common.lua, and replace ".text" with "Dwarf Fortress.exe":

Code: [Select]
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")
Title: Re: DFHack 0.34.11 r1
Post by: Brandon816 on June 25, 2012, 04:46:07 am
Same issue here with the new official version. The kitchen sink version a few pages back works just fine, and has the same offsets, so just use that one if you are having this issue too. The fix posted before my post doesn't seem to work too.
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on June 25, 2012, 08:55:04 am
vjek sorry for late reply and thanks for help. I have already changed all the skills and attributes and soul traits to what i prefer;) I just asked a question if it works like previous versions before digging into the script myself:)
Title: Re: DFHack 0.34.11 r1
Post by: telarin on June 25, 2012, 12:21:50 pm
Does anyone have a LUA script to fix traps (make them passable to wagons again)? Preferrably a script that can fix all traps, but one that can just fix the selected trap would be acceptable as well if an all-trap fix is not practical.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 25, 2012, 01:58:39 pm
Here's a script to significantly raise the attribute cap on any selected unit, if you want to be HolisticDetective or something.

Probably very poor coding by most people's standards, and I apologize for that, but this is my first time working with lua. 

Code: [Select]
unit=dfhack.gui.getSelectedUnit()
unit.status.souls[0].mental_attrs[0].max_value=8000
unit.status.souls[0].mental_attrs[1].max_value=8000
unit.status.souls[0].mental_attrs[2].max_value=8000
unit.status.souls[0].mental_attrs[3].max_value=8000
unit.status.souls[0].mental_attrs[4].max_value=8000
unit.status.souls[0].mental_attrs[5].max_value=8000
unit.status.souls[0].mental_attrs[6].max_value=8000
unit.status.souls[0].mental_attrs[7].max_value=8000
unit.status.souls[0].mental_attrs[8].max_value=8000
unit.status.souls[0].mental_attrs[9].max_value=8000
unit.status.souls[0].mental_attrs[10].max_value=8000
unit.status.souls[0].mental_attrs[11].max_value=8000
unit.status.souls[0].mental_attrs[12].max_value=8000
unit.body.physical_attrs[0].max_value=8000
unit.body.physical_attrs[1].max_value=8000
unit.body.physical_attrs[2].max_value=8000
unit.body.physical_attrs[3].max_value=8000
unit.body.physical_attrs[4].max_value=8000
unit.body.physical_attrs[5].max_value=8000
Title: Re: DFHack 0.34.11 r1
Post by: vjek on June 25, 2012, 03:34:55 pm
Ah ha!  So that's what the .unk1 was changed to, .value .max_value. :)  That'll make a 34.11 version easy when I get around to it.
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on June 25, 2012, 03:40:16 pm
Using the kitchen sink build from a few pages back, the scripts to edit stats wouldn't work until I changed "unk1" at the end of each stat's line to "value". Just in case people start having troubles. Running vanilla 34.11 (plus dfhack of course). 

Example:  unit.body.physical_attrs.STRENGTH.value=demigod

Got the "value" from looking at the dfhack includes header files.  I believe there was a script somewhere that used "unk3", which also became "value" in this new version. 


Also, unrelated question, is there a way to get workflow to process automatic "cut gems"?  It's annoying to have my dudes pick up a bin with rough gems, cut one, and suspend the task because he hasn't put the bin back down yet so he thinks the rest are unavailable. Plus having to specify gem-by-gem is annoying.  The manager would need a specific number that's subject to change as my miners dig.  Do I just set "workflow count" for cut gems ridiculously high? And will I need a workshop for each distinct gem type?


Edit: max_value is for the caps, i think for manual training. value works despite the caps to just set the dwarf's skill to demigod.
Title: Re: DFHack 0.34.11 r1
Post by: vjek on June 25, 2012, 03:43:34 pm
Understood, thanks for the clarification.
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on June 25, 2012, 09:32:08 pm
Has anyone written a script that will allow me to simply retire a fort and then later unretire it? I know the procedure to retire one (change to adventurer, die) and unretire *should work* (go to site, change to Fortress Mode, but all your dwarves need to be swapped to members of the Fortress and so as soon as you unpause, your fortress crumbles--changing dwarf allegiance isn't one of those simple DFHack things) but I'd really love if there was a "retirefort" script and a "unretirefort" script. Or at the very least detailed instructions on how to do it.
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on June 26, 2012, 02:26:40 am
Has anyone written a script that will allow me to simply retire a fort and then later unretire it? I know the procedure to retire one (change to adventurer, die) and unretire *should work* (go to site, change to Fortress Mode, but all your dwarves need to be swapped to members of the Fortress and so as soon as you unpause, your fortress crumbles--changing dwarf allegiance isn't one of those simple DFHack things) but I'd really love if there was a "retirefort" script and a "unretirefort" script. Or at the very least detailed instructions on how to do it.
you can unretire a fort by either just going back to the fort via reclaim it or just use this script which if you select on a citizen will remove the is resident flag on all the citizens.
Slso you don't need to die now when Dfhack had figure out how to get body swap characters to retire in the fort.

so here the return to fort functions I made then remade and ported for 34.10 dfusion I haven't upgraded to 34.11 but I guess there nothing that drastically different between the two.
Code: [Select]
function tools.Zomb(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit.flags2.resident==true then
unit.flags2.resident=false
end
end
tools.menu:add("Return2fort",tools.Zomb)
function tools.Homb(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit.flags2.resident==false then
unit.flags2.resident=true
end
end
tools.menu:add("leavefort",tools.Homb)
function tools.Zomb2(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end

for k,v in pairs(df.global.world.units.active) do
if v.civ_id==unit.civ_id then
if v.flags2.resident==true then
v.flags2.resident=false
end
end
end
end
tools.menu:add("Return2fortall",tools.Zomb2)
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on June 26, 2012, 03:37:39 am
For the attribute points - you can make them mor ethan max_value with vjek's script. They won't be growing by training but that's not a problem:) And the safe max value for this is 32000. Somewhere near 32500 it goes in negative numbers:( But with 32000 of strength your dwarfes easily move most boulders (still gold and platinum is too heave for them).
Title: Re: DFHack 0.34.11 r1
Post by: Rose on June 26, 2012, 04:16:46 am
32767 would be the max, because that's the maximum size of a signed integer.
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on June 26, 2012, 04:38:33 am
seems right:) But i am still useing 32000 just to be on the safe side:)
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 26, 2012, 12:13:50 pm
Not sure if anyone's posted this before, but if you want a safe way to kill something, use this:

unit=dfhack.gui.getSelectedUnit()
unit.body.blood_count=0

Obviously this only works on creatures that need blood to survive.  For undead, I think that removing the tags that keep them alive despite the shape their body is in might work, especially if followed by the above command.  Sort of an undeath-to-death spell I guess.

For mineral and other unusual material creatures, will need to do more !!SCIENCE!!.

Title: Re: DFHack 0.34.11 r1
Post by: WillowLuman on June 26, 2012, 12:22:25 pm
Even hacking cannot save you from the towering elephant made of granite. Unless you use dfLiquids of course.
Title: Re: DFHack 0.34.11 r1
Post by: TwilightWalker on June 26, 2012, 01:04:49 pm
Not sure if anyone's posted this before, but if you want a safe way to kill something, use this:

unit=dfhack.gui.getSelectedUnit()
unit.body.blood_count=0

Obviously this only works on creatures that need blood to survive.  For undead, I think that removing the tags that keep them alive despite the shape their body is in might work, especially if followed by the above command.  Sort of an undeath-to-death spell I guess.

For mineral and other unusual material creatures, will need to do more !!SCIENCE!!.

So, for someone who has absolutely no idea on how to use that little snippet, what do I do?
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 26, 2012, 01:12:34 pm
It looks like wounds can be added manually, but the challenge is figuring out what type of wound you're adding and what body part you're applying it to.  It might be possible to gray out every body part, which ought to kill even sponges.  Still not sure how that would affect undead, since they don't work the same way.  A universal kill script would probably need to:

1)remove any undead tags
2)drain all blood
3)gray out the head if there is one
4)gray out the body if it's one mass

As for adding neighbors, I have not looked into it, but there is stuff you can do with the world map and region with lua.  At the very least, I'm pretty sure you can toggle biome features like corpse animation.  I'm pretty sure that somewhere there'd be a flag you can toggle to change which neighbors you have.

Check out https://github.com/peterix/df-structures/tree/c381884664c71adefbec44258a734def2c88dacc (https://github.com/peterix/df-structures/tree/c381884664c71adefbec44258a734def2c88dacc), especially the map, world, and world data xmls.  Might want to download them and search their contents for keywords pertaining to your goal.

Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 26, 2012, 01:16:26 pm
Not sure if anyone's posted this before, but if you want a safe way to kill something, use this:

unit=dfhack.gui.getSelectedUnit()
unit.body.blood_count=0

Obviously this only works on creatures that need blood to survive.  For undead, I think that removing the tags that keep them alive despite the shape their body is in might work, especially if followed by the above command.  Sort of an undeath-to-death spell I guess.

For mineral and other unusual material creatures, will need to do more !!SCIENCE!!.

So, for someone who has absolutely no idea on how to use that little snippet, what do I do?

Copy the two lines of script.

Open your text editor of choice.

Paste the text and save as drainblood.lua or whatever name you want, and put it in the scripts folder of your DFhack directory. 

In dwarf mode, you only need to highlight the unit with v.  In adventure mode, you'll need to use l to look at the unit and then select that unit from the a/b/c/d/e list so you're viewing the creature's status screen. 

In the DFhack console, make sure you're in the root menu and not in liquids, dfusion or lua mode.  Type drainblood or whatever name you used for the script.

Nothing will seem to have happened, but the creature will be a corpse as soon as time advances.



Be aware that if you fail to properly select the unit and somehow unit=your adventurer or one of your dwarves from a previous script, this will apply to you or the dwarf instead.
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on June 26, 2012, 02:05:08 pm
you could just use this.
Code: [Select]
function tools.frozen(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
print("which flag")
unit.flags1.projectile=true
end
tools.menu:add("freeze",tools.frozen)

this will freeze them in place until you want to deal with them. though to use this you have to go into your dfusion/tools folder and find the init.lua file.
Title: Re: DFHack 0.34.11 r1
Post by: guitarxe on June 26, 2012, 09:04:01 pm
Hi, I notice that DF2Minecraft command seems to be gone in the current version, but there's no mention of it in the change logs. The last mention of it was in 34.05 where it "came back".
Has this been dropped?
Title: Re: DFHack 0.34.11 r1
Post by: Rose on June 26, 2012, 09:14:28 pm
I reached the point where it would be more work to update it than to write a new one entirely.
Title: Re: DFHack 0.34.11 r1
Post by: guitarxe on June 26, 2012, 10:04:55 pm
Ah. Well, there doesn't seem to be much interest in it, it seems, but I've recently got interested in minecraft again (what with all the new changes) and I'd love to be able to explore my DF forts in minecraft. Heck, maybe even convert some of my friends that see the awesome fort that I made  ;D
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on June 27, 2012, 01:17:36 am
Is the dfusion command working? When I type dfusion into the console I get

Code: [Select]
dfusion/common.lua:45: .Text region not found!
I tried reinstalling DFHack and it didn't change anything.
Title: Re: DFHack 0.34.11 r1
Post by: darius on June 27, 2012, 01:41:54 am
Is the dfusion command working? When I type dfusion into the console I get

Code: [Select]
dfusion/common.lua:45: .Text region not found!
I tried reinstalling DFHack and it didn't change anything.

Find this line in dfusion/common.lua, and replace ".text" with "Dwarf Fortress.exe":

Code: [Select]
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on June 27, 2012, 02:25:08 am
Thanks, that worked.
Title: Re: DFHack 0.34.11 r1
Post by: Sutremaine on June 27, 2012, 03:31:46 pm
Probe doesn't work properly in the arena. It seems to be returning the proper statistics for a given tile, but once it does that it causes DF to crash with the standard Windows 'program has stopped working, Windows is checking for a solution to the problem' error.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on June 27, 2012, 03:53:47 pm
It looks like it was trying to fetch biome/region information from a nonexistent world map tile. It should be fixed in the next release.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on June 27, 2012, 09:48:06 pm
Is there a way to get the material of a tile in lua? I've been trying to figure it out without any luck. dig.cpp just uses MapExtras::MapCache, but I can't seem to find an lua equivalent to that.
Title: Re: DFHack 0.34.11 r1
Post by: bat_trapper on June 28, 2012, 02:55:04 am
Find this line in dfusion/common.lua, and replace ".text" with "Dwarf Fortress.exe":

Code: [Select]
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")

Does this require you to excess the lua file? Because I dont know how to do that.
Title: Re: DFHack 0.34.11 r1
Post by: ag on June 28, 2012, 03:08:17 am
Is there a way to get the material of a tile in lua? I've been trying to figure it out without any luck. dig.cpp just uses MapExtras::MapCache, but I can't seem to find an lua equivalent to that.

There isn't any: lua is generally too slow to be doing much with tiles due to the sheer amount of them, so I didn't bother. Plus, C++ MapCache itself needs some API redesigning.
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on June 28, 2012, 03:39:10 am
Is it possible to change temperature of a tile at all? Then using liquids command i usually destroy pools with 1unit of magma above water. This leads to temperature traps which lower fps in long term. They never dissipate:(.
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on June 28, 2012, 05:04:30 am
[ignore.]
Title: Re: DFHack 0.34.11 r1
Post by: Rose on June 28, 2012, 06:02:12 am
That would be the workflow plugin, which isn't really meant to do things on it's own. but you can just get rid of that particular plugin by looking for something similar to workflow.dll (I don't know the exact name) and get rid of just that.
Title: Re: DFHack 0.34.11 r1
Post by: khearn on June 28, 2012, 10:52:03 am
Does anyone know how to specify wool in workflow? I've got sheep that I want to be sheared under workflow's control, but I can't figure out how to specify it. I've figured out that yarn is THREAD/YARN, if anyone needs that.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 28, 2012, 11:13:04 am
Is it possible to change temperature of a tile at all? Then using liquids command i usually destroy pools with 1unit of magma above water. This leads to temperature traps which lower fps in long term. They never dissipate:(.

I'm sure there is, but not sure exactly what code to write for it.  Why not use liquids to set the water level to 0?
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on June 28, 2012, 03:11:40 pm
Maybe he wants to turn murky pools into normal dirt tiles, as well as getting rid of the water.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on June 28, 2012, 07:26:41 pm
Can someone explain to me how to use make_sort_order defined in utils.lua? I don't understand the documentation. What is key supposed to do? Are you supposed to pass it an array of sorting data tables as the second argument?
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on June 29, 2012, 03:08:16 am
I don't like how obsidian walls and floors work in liquids and so i try to do it naturals way - by combining water and magma. But unfortunately this leaves tiles with hot stone. Which is strange as we have only obsidian slab surrounded by clay or sand. But they are hot and they never turn normal. I can swap them with obsidian of course and this actually changes temperature to normal. But there is a fact of DF game that it sometimes has temperature traps - then a stone or two inside earth are hot and never cool down.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on June 29, 2012, 03:14:41 am
Have you tried putting magma a few extra z-levels above where you want it? Sometimes that helps.
Title: Re: DFHack 0.34.11 r1
Post by: ag on June 29, 2012, 03:33:25 am
Can someone explain to me how to use make_sort_order defined in utils.lua? I don't understand the documentation. What is key supposed to do? Are you supposed to pass it an array of sorting data tables as the second argument?

Look how sort plugin works. That's the thing it was written for.

Edit: Basically, it implements something like an SQL ORDER BY clause, i.e. sorting based on a sequence of expressions with associated orderings, applied from left to right. The result is expressed as a lookup index table, instead of reordering the original array, so that you can apply it to multiple arrays in unison, which is what the sort plugin does all the time.
Title: Re: DFHack 0.34.11 r1
Post by: danaris on June 29, 2012, 09:59:00 am
Good news, everyone!

After much rigamarole and trying various options, we finally have a build of DFHack for Mac OS X that should work for most people.

You can get it here for now (http://topazgryphon.org/~tcollett/df/dfhack-0.34.11-r1-Darwin.zip).

Please try it out, and let us know if it works for you.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 29, 2012, 11:23:26 am
I don't like how obsidian walls and floors work in liquids and so i try to do it naturals way - by combining water and magma. But unfortunately this leaves tiles with hot stone. Which is strange as we have only obsidian slab surrounded by clay or sand. But they are hot and they never turn normal. I can swap them with obsidian of course and this actually changes temperature to normal. But there is a fact of DF game that it sometimes has temperature traps - then a stone or two inside earth are hot and never cool down.

If you're making obsidian, why are you dumping magma into water instead of the other way around?  The water won't create heat traps, and it should cool the magma below it.
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on June 29, 2012, 12:58:54 pm
2 things - firstly water sometimres evaporate before dumping into magma:) and secondly then i kill murky pool it already has water.... so making it into magma and them dropin water is kind of perverted:)
Title: Re: DFHack 0.34.11 r1
Post by: malvado on June 29, 2012, 02:58:34 pm
Think it could be possible to change the point of view when playing fortress mode? Ie North to South etc?
Title: Re: DFHack 0.34.11 r1
Post by: HraTaika on June 29, 2012, 03:57:03 pm
Good news, everyone!

After much rigamarole and trying various options, we finally have a build of DFHack for Mac OS X that should work for most people.

You can get it here for now (http://topazgryphon.org/~tcollett/df/dfhack-0.34.11-r1-Darwin.zip).

Please try it out, and let us know if it works for you.



Muchos Gracias, will try it out and return with info.
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on June 29, 2012, 04:32:40 pm
Would it be possible to write the 'quicksave' command with an argument that specifies a new folder name?  A couple times now I've had DF crash on saving and had to go back to a previous save.  It'd be nice to have a couple save "slots" in case one gets corrupt like that.  The vanilla program does this somehow with one of the init backup options, but it'd be nice to have more control. :).
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 29, 2012, 05:50:01 pm
Think it could be possible to change the point of view when playing fortress mode? Ie North to South etc?

I'm betting that's among the hardest of hardcoded things in the game.  Almost certainly not.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on June 29, 2012, 06:11:58 pm
Think it could be possible to change the point of view when playing fortress mode? Ie North to South etc?

I'm betting that's among the hardest of hardcoded things in the game.  Almost certainly not.

It might technically be possible to just rotate the entire damn map by changing EVERYTHING in memory but it would be extremely difficult to do and would probably be slow.
Title: Re: DFHack 0.34.11 r1
Post by: khearn on June 29, 2012, 09:11:19 pm
Think it could be possible to change the point of view when playing fortress mode? Ie North to South etc?

I'm betting that's among the hardest of hardcoded things in the game.  Almost certainly not.

It might technically be possible to just rotate the entire damn map by changing EVERYTHING in memory but it would be extremely difficult to do and would probably be slow.
And it would possibly break a lot of tracks that are based on directions. Your NE track might now need to be SW.
Title: Re: DFHack 0.34.11 r1
Post by: WillowLuman on June 29, 2012, 09:18:03 pm
Basically, probably not worth it.
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on June 29, 2012, 10:42:52 pm
Heh I'm completely new to lua and am only mildly experienced in Python as my only programming background, but I've been spending a couple days straining my eyes decoding these structures and figuring out why stuff works and what doesn't.  Anyway, finally got a working command to change all your clothing on all your dwarves to 0 wear.

Code: [Select]
--THIS WILL SET ALL YOUR DWARVES' EQUIPMENT TO NO WEAR
for k,v in ipairs(df.global.world.items.all) do
if v.flags.owned and (v:getType() >= 25 and v:getType() <= 29 or v:getType() == 58) then
v:setWear(0)
v.wear_timer = 0
end
end

The conditionals for item type checks might not be strictly necessary for wear alone, but I was also tweaking with item quality which breaks on some quality-less item types. But the script here only resets wear and the incrementing timer. If you want max-quality equips too, just add v:setQuality(5) after the wear_timer line.

Note: I don't know how to make it so the equipment doesn't wear ever.  Probably like the modest mod does with setting armor quality to a certain level but this works for me.

Someone else posted a snippet here that did the wear stuff one item at a time so I just had to figure out how to iterate it :P. I think I got the feel for some of it now though.  Thank goodness. Maybe now I can actually play :P.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 29, 2012, 10:47:58 pm
It's been an interesting night.  I have extremely limited knowledge of lua and how everything is structured, but I recently found out where the raws live in memory after world-generation, among several other exciting things, and have found the generated interactions.  While I'm grateful to finally be able to mod the procedural interactions after worldgen, for now I'm trying to figure out how to apply it to my adventurer.  I could have sworn that while digging around in unit.status or something that I found a place for active interactions, but I don't see it now.

Things are getting very fun.  It also appears that I may be able, with some effort, to print out a map of curious structure locations for the whole world.  I need to gain a few levels in lua scripting first though.

EDIT:

So, I've identified a syndrome that causes vampirism.  It is in df.global.world.raws.syndromes.all as syndrome 479, with the value <syndrome: 0x1b0490a8>.  (I know the exact values are meaningless to anyone without the save file, just using them for reference)

I'm trying to make unit.syndromes.active[0] equal the vampire syndrome.  This is a brand new adventurer, so his syndromes table started empty.  I was able to figure out how to add a null entry with unit.syndromes.active:changesize(1), but have been unable to set the first syndrome in the table to the vampire syndrome.  I've tried the following commands, posted with the errors they brought up:

Code: [Select]
[lua]# unit.syndromes.active[0]=df.global.world.raws.syndromes.all[479]
(interactive):1: Cannot write field vector<unit_syndrome*>.0: incompatible point
er type.
stack traceback:
        [C]: in function '__newindex'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        ....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:267: in func
tion <....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:193>



[lua]# unit.syndromes.active[0]=syndrome: 0x1b0490a8
(interactive):1: <name> expected near '0x1b0490a8'



[lua]# unit.syndromes.active[0]=0x1b0490a8
(interactive):1: Cannot write field vector<unit_syndrome*>.0: incompatible point
er type.
stack traceback:
        [C]: in function '__newindex'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        ....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:267: in func
tion <....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:193>



[lua]# unit.syndromes.active[0]=unit_syndrome: 0x1b0490a8
(interactive):1: <name> expected near '0x1b0490a8'



[lua]# unit.syndromes.active[0]=<syndrome: 0x1b0490a8>
(interactive):1: unexpected symbol near '<'



[lua]# unit.syndromes.active[0]=479
(interactive):1: Cannot write field vector<unit_syndrome*>.0: incompatible point
er type.
stack traceback:
        [C]: in function '__newindex'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        ....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:267: in func
tion <....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:193>



[lua]# unit.syndromes.active[0]=df.global.world.raws.syndromes.all[479]
(interactive):1: Cannot write field vector<unit_syndrome*>.0: incompatible point
er type.
stack traceback:
        [C]: in function '__newindex'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        ....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:267: in func
tion <....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:193>



[lua]# unit.syndromes.active[0]=df.global.world.raws.syndromes.all[479].type
(interactive):1: Cannot read field syndrome.type: not found.
stack traceback:
        [C]: in function '__index'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        ....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:267: in func
tion <....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:193>



[lua]# unit.syndromes.active[0]=<syndrome: 0x1b0490a8>
(interactive):1: unexpected symbol near '<'



[lua]# unit.syndromes.active[0]=syndrome: 0x1b0490a8
(interactive):1: <name> expected near '0x1b0490a8'



[lua]# nit.syndromes.active[0]=df.global.world.raws.syndromes.all[479].syn_name
(interactive):1: Cannot write field vector<unit_syndrome*>.0: incompatible point
er type.
stack traceback:
        [C]: in function '__newindex'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        ....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:267: in func
tion <....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:193>



[lua]# unit.syndromes.active[0]=syndrome: df.global.world.raws.syndromes.all[479
(interactive):1: function arguments expected near '.'

I must be missing something about the basic syntax of adding an element to a table in lua.  Can anyone point me in the right direction?
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on June 30, 2012, 12:32:46 am
I'm not entirely sure about it since I haven't touched the memory locations directly, but there are some functions that seem pretty useful for that in utils.lua.  Specifically the assign(tgt,src) and at the bottom insert_or_update(vector,item,field,cmp).  I'm still a lua noob but they seem like they pertain ;). From what I've seen in other scripts people just add a

utils = require 'utils'
utils.function()

into their scripts. i'm not sure if it's loaded at runtime and the require assignment is unnecessary but it works :P. 
Title: Re: DFHack 0.34.11 r1
Post by: WillowLuman on June 30, 2012, 12:52:12 am
Mac build isn't working for me:

Code: [Select]
Last login: Fri Jun 29 21:11:28 on ttys000
/Users/home/Desktop/FrontierFortress/dfhack ; exit;
new-host-5:~ home$ /Users/home/Desktop/FrontierFortress/dfhack ; exit;
dyld: could not load inserted library: ./hack/libdfhack.dylib

/Users/home/Desktop/FrontierFortress/dfhack: line 15:   727 Trace/BPT trap          ./dwarfort.exe
logout

[Process completed]


Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on June 30, 2012, 02:28:09 am
Would it be possible to write the 'quicksave' command with an argument that specifies a new folder name?  A couple times now I've had DF crash on saving and had to go back to a previous save.  It'd be nice to have a couple save "slots" in case one gets corrupt like that.  The vanilla program does this somehow with one of the init backup options, but it'd be nice to have more control. :).
this, though this kinda means I need to jump out of 34.10 to use it. I wonder what slightly new content I should study. hmm maybe introducing magical slabs that if built will convert any one near it with the secret it has on it. kinda adding an adventure mode feature to fort mode.
Title: Re: DFHack 0.34.11 r1
Post by: ag on June 30, 2012, 03:15:58 am
Would it be possible to write the 'quicksave' command with an argument that specifies a new folder name?  A couple times now I've had DF crash on saving and had to go back to a previous save.  It'd be nice to have a couple save "slots" in case one gets corrupt like that.  The vanilla program does this somehow with one of the init backup options, but it'd be nice to have more control. :).

No, it's not possible, otherwise it would've been done. Filename processing is completely hardcoded in the game. In fact, quicksave has to temporarily disable that backup option, because otherwise it overwrites the last backup too.

Well, you might be able to force it by overwriting the current opened savegame name temporarily, but it is dangerous. And unlikely to work at all, since there are raws and stuff that need to be copied over.
Title: Re: DFHack 0.34.11 r1
Post by: ag on June 30, 2012, 07:23:38 am
Mac build isn't working for me:

What os version, hardware, any other potentially relevant setup details?
Title: Re: DFHack 0.34.11 r1
Post by: uggi on June 30, 2012, 07:43:23 am
No, it's not possible, otherwise it would've been done. Filename processing is completely hardcoded in the game. In fact, quicksave has to temporarily disable that backup option, because otherwise it overwrites the last backup too.

Can DFHack access the filesystem directly, i.e. check if files/directories exist and be able to rename them? I know it can export XML files, so I'm thinking this might work then:
1: the existing save directory is called "testfortress"
2: user wants to quicksave
3: DFHack first renames the existing save directory to "testfortress_backup_001" or similar, checking if previous backups exist and increasing the number
4: DFHack lets DF to save the game, I'm guessing DF automatically creates a new "testfortress" directory for it, if not then create it first
5: ?
6: profit!
Title: Re: DFHack 0.34.11 r1
Post by: ag on June 30, 2012, 07:50:16 am
Well, I suppose you could copy the current savegame dir contents elsewhere before telling DF to quicksave. Saving seems to be largely incremental, i.e. it only overwrites the files that need changing, so you can't move data.
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on June 30, 2012, 11:50:01 am
Heh yeah I've got lots of .rars in there. Takes a bit to pack though so I was just curious ;P.  Though a packed at "Best" compression makes the file smaller than when the game's default compression is on.   7z is even smaller :P.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 30, 2012, 03:44:59 pm
So there's explanations of how to use basic lua commands, but none on using the functions tailored to DF, like utils.insert_or_replace.  I'm trying to figure it out but I feel like I'm spinning my wheels here.  I see vjek use it in his make_legendary script as

utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillnum, rating = 20 }, 'id')

So unit.status.current_soul.skills is vector, but I don't understand how to use the arguments item, field, and cmp here.  Is all of the stuff between the {} item, and 'id' the field?  Is cmp not required?

insert.table also doesn't work.  Says unit.syndromes.active is userdata, not a table.

This seems harder than it should be.  All I need is to add the info for a syndrome to the active syndromes list for the unit.
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on June 30, 2012, 07:15:56 pm
Yeah I've been working on your problem all day heh.  I do wish all this had more documentation and especially examples.  Scouring google yields a result now and then, but overall it's tough to understand for those with absolutely no C++ or lua background.

The unit.status.current_soul.skills vector contains sub-tables for different skills.  So if unit is dfhack.gui.getSelectedUnit() then unit.status.current_soul.skills[0] would be his first skill.  Each skill has subvalues of id, rating, experience, etc.

 Lua assigns tables apparently with { field = value, field = value, etc }. 

The insert_or_update function looks like it first tries to insert a value, but the insert function first searches to see if the field exists and, if it does, tells the insert_or_update to update the value in the field instead.

After about an hour of fiddling it looks like the cmp argument is nil in the make_legendary script.  The {} section are all part of the item argument. The 'id' is the field.  So in his case, the script searches a selected character to see if it has a certain 'id' number (which corresponds to a specific skill).  If it has it, then it changes the id to whatever skill number you input, puts a 'new' field in, and changes the rating field to 20.

In your case, I'm not sure what the subfields would be called, if any, since my dwarves don't have any syndromes at the moment. One very useful function is "printall(table)" though.  It's how I found all those sub-tables.  printall(unit.status.current_soul.skills) lists index numbers for whichever skill the particular dwarf has.   Then, printall(unit.status.current_soul.skills[0]) prints all the fields of that subtable (like id, rating, experience, etc.) 

Hopefully you can piece together which fields are important ;D.  And I was writing this post over the course of the day so hopefully it makes sense >.>

Edit: well, not sure about the 'new = true' field actually...can't binsearch for a boolean and if you change the true to 1 it says that 'new' is a function, so it's somethin :P. It looks like the "recursive table assignment" section has something to do with it but my brain already hurts.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on June 30, 2012, 08:02:08 pm
Well, it's been a fun couple days, but now it's just taking too much time for too little benefit.  As fun as it was to pick up DF again for a few weeks, there are still way too many problems with dwarf and adventure mode, and it's stopped being enjoyable.  I was hoping to work around some of those problems with DFhack, but so far I've only figured out how to cheat, not to fix what's broken.  Thanks to those who did take the time to offer advice, I appreciate it.  Good luck with your own projects.
Title: Re: DFHack 0.34.11 r1
Post by: Stungun on July 01, 2012, 01:47:06 am
Hey, I found something out and I figured I could be helpful. We don't have a list of the possible shapes for tiletypes, but it can accept a number as an argument; and this means if you input "paint sh 1", it'll accept that and you'll see that it changes its shape to "WALL". So you can use this to probe around and find the names of the constants it'll accept.

I've made a list of shapes and what it paints. But first, some notes:

Just using shape without defining a material (or sometimes, the material without defining the shape), CANNOT change a tile into something that the material can't be (for example, you can't turn floor fungus or soil floors into walls or boulders, and can't turn trees into walls made of wood). If you want to change floor fungus into a wall of solid rock, you'll need to both set the material and the shape in one go. Otherwise the tile simply won't change.
Also, the SPECIAL state will be preserved if possible (the SPECIAL state determines whether something is smoothed, furrowed, a river source, etc.). For example if you use a WALL shape on a smoothed FLOOR, it will turn into a smoothed WALL.
You can use -1 to reset any of the options. (e.g. paint sh -1 will remove the SHAPE setting)

Code: [Select]
0: EMPTY <Empty space; only works on tiles that are a form of empty space, e.g. a downwards ramp>
1: FLOOR <Cavern floor; this will effectively mine out wall tiles. This covers both smoothed and rough stone>
2: BOULDER <Creates a rock boulder, e.g. the kind you see on the surface and can only remove by smoothing; seems to set the tile as smoothed>
3: PEBBLES <Can turn stone into a floor tile named '(material) pebbles'
4: WALL <Turns stuff back into natural walls, can be smoothed or rough. Note that smoothed walls will not automatically connect with each other, and thus you can get pillars adjacent to each other>
5: FORTIFICATION <Turns something into a fortification, and sets the tile to a smoothed state>
6: STAIR_UP <Upward staircase, smooths tile>
7: STAIR_DOWN <Downward staircase>
8: STAIR_UPDOWN <Take a wild guess>
9: RAMP <An upwards ramp; does NOT change the tile above it>
10: RAMP_TOP <Downwards ramp; can only be used on empty space>
11: BROOK_BED <Only seems to work on water, appears to erase the water; I can't figure out what it does but I assume it has to do with brooks>
12: BROOK_TOP <Only seems to work on water again, can't figure this out, erases water>
13: TREE <Only works on vegitation, creates a tree out of the selected plant material, even shrubs! You can have wild strawberry "trees", not sure what happens if you cut one down though. The vegitation maintains its alive/dead state, so creating a tree out of a dead shrub may leave you with a "dead longland grass" tree, for example. This can be used to insta-grow saplings>
14: SAPLING <Vegitation only, turns it into a sapling of the given vegetable>
15: SHRUB <Turns vegitation into a shrub of itself, again it even works on trees>
16: ENDLESS_PIT <Creates a chasm out of empty space, just like the one in Arena Mode; amusingly, you can create one in midair several Z-levels above the ground, I guess it creates a wormhole or something... Combine this with the HFS material to create an eerie glowing pit!>

And here's a list of materials, which can allow you to set things specifically and for example, turn a rock wall into a wooden tree or empty space. Some notes first.

It doesn't seem possible to define a specific material; whatever world you're using appears to have the materials of any given location on the map hardcoded, e.g. based on the veins and stone layers. So you can't just create admantine out of thin air, but you can use this to replenish mined-out veins. (paint sh WALL, paint m MINERAL)

Code: [Select]
0: AIR [Used for downward ramps, EMPTY, chasms, and so forth.]
1: SOIL [Silt Loam, etc. Seems to turn dead floor fungus into furrowed silt loam]
2: STONE
3: FEATURE [Admantine veins; you can't use this to create admantine just anywhere, if you attempt to, it will show up as 'unknown material'. It can only be used thus where an admantine vein is present]
4: LAVA_STONE [Creates obsidian, independent of the layer stone]
5: MINERAL [If it's part of a vein of non-layer stone (e.g. microcline), it'll turn the stone into that mineral, otherwise it'll just turn it into the layer's stone]
6: FROZEN_LIQUID [Creates ice, but it won't freeze water...]
7: CONSTRUCTION [Doesn't seem to work, but if used on floor fungus, creates "Muddy  Floor" (Yes, the material is blank and that's two spaces)]
8: GRASS_LIGHT [Allows you to make grassy floors (or fungal floors in caverns)]
9: GRASS_DARK [Same, except the tile is colored darker than GRASS_LIGHT]
10: GRASS_DRY [Same as above, except it says "Dry (grass type)"]
11: GRASS_DEAD [Same as above, except dead]
12: PLANT [Only used for trees and shrubs]
13: HFS [Creates 'glowing floors', walls turn into 'glowing barriers'. Use this with the CHASM shape for an Eerie Glowing Pit.]
14: CAMPFIRE [Creates campfires out of floor tiles; described as 'ashes']
15: FIRE [Creates burning floor tiles; described as 'ashes']
16: ASHES [Creates ashes, which have the same icon as spent arrows]
17: MAGMA [Semi-molten rock and magma flows]
18: DRIFTWOOD [turns the ground into 'driftwood', which has the same tile as bars]
19: POOL [Creates murky pools]
20: BROOK [Only placeable on water, seems to replace it with Brook tiles... I think now that this is what the BROOK_TOP shape is for]
21: RIVER [Creates waterfalls and rivers; it created 'waterfall' tiles when I used them on mossy cavern floors, 'river' when I used them in underground cavern lakes]

The following SPECIAL values can be used:

Code: [Select]
0: NORMAL <Nothing special about this. You can use this to unsmooth stone though>
1: RIVER_SOURCE
2: WATERFALL
3: SMOOTH <Works on walls and floors, determines whether it's smoothed or not>
4: FURROWED <Makes a floor furrowed, e.g. after you build and then later remove a paved road>
5: WET
6: DEAD <My guess: Controls whether trees and shrubs are dead or not>
7: WORN_1
8: WORN_2
9: WORN_3
10: TRACK

Not sure what all of them do, but this is at least a good list of values you can use.

Other information: If you turn walls into empty space and it leads into unexplored territory, that unexplored territory will only be revealed when the map is updated (e.g. you dig out a tile somewhere nearby).

I hope this information is helpful, and hasn't already been posted somewhere.

Knowing how this tool works is vital if you accidentally use liquids with the of (obsidian floor), set on block mode, and wind up accidentally paving over your magma smelter's magma-hole... like I did. That said, have fun rewriting your world.
Title: Re: DFHack 0.34.11 r1
Post by: ag on July 01, 2012, 02:11:17 am
We don't have a list of the possible shapes for tiletypes

https://github.com/peterix/df-structures/blob/master/df.tile-types.xml (https://github.com/peterix/df-structures/blob/master/df.tile-types.xml)

Edit: well, not sure about the 'new = true' field actually...can't binsearch for a boolean and if you change the true to 1 it says that 'new' is a function, so it's somethin :P. It looks like the "recursive table assignment" section has something to do with it but my brain already hurts.

What that new does is allow vector:insert('#',{new=true,...}) to allocate a new C++ object to insert into the vector. Otherwise it signals an error, so as to avoid unanticipated silent memory leaks.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on July 01, 2012, 08:16:14 am
Protip: in tiletypes, you can type "help shape", "help mat", "help special", "help variant", etc. to get a full list of all valid types.
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on July 01, 2012, 01:57:09 pm
One thing I've been trying to figure out. Is it possible to print out the value of a string at a pointer through Lua? When I was working on the syndromes problem, I got to a point where scouring through sub-tables led me to syn_immune_class. When I printed that out, it was a bunch of <string> vectors, but I couldn't print a value.  Of course, opening Cheat Engine (so useful for debugging) and going to one of the pointers gave me the string [GENERAL_POISON] so I know the value's there. Just wanted to know if there's a native way in the Lua wrapper to pull the value of the pointer from C without having to open another CPU/memory intensive program.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 01, 2012, 03:26:44 pm
I would try the "print" and "printall" commands.
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on July 01, 2012, 04:01:02 pm
Yeah that's what I mean. Those only return the <vector: <string: 0xaddress>> line instead of the actual content.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 01, 2012, 04:32:20 pm
Code: [Select]
print(df.global.world.raws.syndromes.all[50 or whatever].syn_affected_class[0].value)
Figured it out by doing

Code: [Select]
printall(df.global.world.raws.syndromes.all[50 or whatever].syn_affected_class[0])
Title: Re: DFHack 0.34.11 r1
Post by: Ery_Kray on July 01, 2012, 04:35:56 pm
I'm somewhat in trouble with dfusion.
I want to start a game with just two dwarves - male and female - almost without items. It's a challenge, yeap. I found an information that if i use dfusion, i can change initial dwarf number (the following commands in prompt: dfusion, 1, 2). It works until i start to embark: i see only two dwarves. But when i try to embark a game crashes.

I play DF rather rarely, so i might have missed smth. I use DF_Phoebus_34_11v00 with dfhack 0.34... copied into a game folder and ".text" being substituted by "Dwarf Fortess.exe" in common.lua file within dfusion folder. System is Win 7 x64.
So what's wrong?
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 01, 2012, 04:45:00 pm
I tried the same thing, and I got the same problem. Maybe it only works if you want to increase the number of starting dwarves.
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on July 02, 2012, 03:13:22 am
I heard many times that decreasing number of dwarfes is always crushing game. No way around found yet.
Title: Re: DFHack 0.34.11 r1
Post by: peterix on July 02, 2012, 05:50:56 am
Just embark with 7 and remove the extra dwarves...
Title: Re: DFHack 0.34.11 r1
Post by: Ery_Kray on July 02, 2012, 05:58:14 am
Thnx, people.

Just embark with 7 and remove the extra dwarves...
Yeap, i seems that there's no way to avoid it.
Title: Re: DFHack 0.34.11 r1
Post by: emeralis00 on July 02, 2012, 12:10:36 pm
I have a minor question.  What do the numbers in prospect all mean?  Are they the locations of the stone and ores?
Title: Re: DFHack 0.34.11 r1
Post by: orius on July 02, 2012, 03:23:45 pm
A typical prospector line:

Code: [Select]
     TETRAHEDRITE :     30441 Z:  42..103
This means there are 30,441 tiles of tetrahedrite ore on the map.  Z: 42...103 means they are located from z-levels 42 to 103.  This does not mean they are on every level from 42 to 103 though, it just means the uppermost vein(s) are on 103 and the lowermost on 42.  You could very well have something like 20 levels in between somewhere that does not have the substance in question.  There's also the column you get when you ask for value, that states the material value of the item.

Careful reading of the prospect all report can help you determine where the caverns and magma are on the map:  the highest point for tower-caps and fungiwoods will give you an idea of where cavern 1 is, and the lowest point should be near the bottom of cavern 2.  The location of plants like nether-caps will tell you where cavern 3 is.  The listing for magma near the top will tell you how far down you have to dig to get some.
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on July 02, 2012, 07:42:40 pm
A quick script for those tired of noble demands/mandates. Save raw editing didn't seem to work for those who were already nobles, but this takes care of their max demands/mandates >.>.  It takes care of all nobles at once. Searches your dwarves to see who's a noble, in those dwarves it filters which positions they have, and then it searches each position to see if it has max demands or mandates greater than 0 and sets them to 0.  I don't think it'll help if there's already a demand/mandate in effect but it pre-empts future ones.
Code: [Select]
for k,v in ipairs(df.global.world.units.all) do
if dfhack.units.getNoblePositions(v) then
for kk,vv in pairs(dfhack.units.getNoblePositions(v)) do
local mmax = dfhack.units.getNoblePositions(v)[kk].position.mandate_max
local dmax = dfhack.units.getNoblePositions(v)[kk].position.demand_max
if mmax >= 1 or dmax >= 1 then
dfhack.units.getNoblePositions(v)[kk].position.mandate_max = 0
dfhack.units.getNoblePositions(v)[kk].position.demand_max = 0
end
end
end
end
Title: Re: DFHack 0.34.11 r1
Post by: vjek on July 02, 2012, 09:08:36 pm
A quick script for those tired of noble demands/mandates. Save raw editing didn't seem to work for those who were already nobles, but this takes care of their max demands/mandates >.>.  It takes care of all nobles at once. Searches your dwarves to see who's a noble, in those dwarves it filters which positions they have, and then it searches each position to see if it has max demands or mandates greater than 0 and sets them to 0.  I don't think it'll help if there's already a demand/mandate in effect but it pre-empts future ones.
Code: [Select]
for k,v in ipairs(df.global.world.units.all) do
if dfhack.units.getNoblePositions(v) then
for kk,vv in pairs(dfhack.units.getNoblePositions(v)) do
local mmax = dfhack.units.getNoblePositions(v)[kk].position.mandate_max
local dmax = dfhack.units.getNoblePositions(v)[kk].position.demand_max
if mmax >= 1 or dmax >= 1 then
dfhack.units.getNoblePositions(v)[kk].position.mandate_max = 0
dfhack.units.getNoblePositions(v)[kk].position.demand_max = 0
end
end
end
end

Nice!  That is a great script, Hesuchia, well done.
Title: Re: DFHack 0.34.11 r1
Post by: iTreefish on July 02, 2012, 09:44:14 pm
Hello!

Trying to get the workflow command figured out but when I try (for instance):
Code: [Select]
workflow count DRINK 120 30
I get an error in the Dwarf Fortress message log stating
Quote
Cannot produce: drink

Am I doing something wrong? I'm quite inexperienced with DFHack & Dwarf Fortress so it wouldn't be unheard of! :)
As far as I know I have all necessary ingredients for the drinks.
I'm playing Dwarf Fortress 0.34.11 & the most recent version of DFHack.

TIA
Title: Re: DFHack 0.34.11 r1
Post by: cainiao on July 02, 2012, 11:25:35 pm
Hello!

Trying to get the workflow command figured out but when I try (for instance):
Code: [Select]
workflow count DRINK 120 30
I get an error in the Dwarf Fortress message log stating
Quote
Cannot produce: drink

Am I doing something wrong? I'm quite inexperienced with DFHack & Dwarf Fortress so it wouldn't be unheard of! :)
As far as I know I have all necessary ingredients for the drinks.
I'm playing Dwarf Fortress 0.34.11 & the most recent version of DFHack.

TIA
create a job to brew drinks and set it on repeat.
Title: Re: DFHack 0.34.11 r1
Post by: Jiri Petru on July 03, 2012, 02:40:46 am
Hi, I was wondering...

how far have we come with the ability to change game modes? Last time I checked I was able to change from dwarf mode to adventurer mode, taking one of my dwarves to an adventure. But once I left the fortress, it was impossible to come back and play the fortress again - it was like if it were abandoned. Have there been any new developments? Can we get back to playing the fortress now?

Thanks.
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on July 03, 2012, 03:23:13 am
Hi, I was wondering...

how far have we come with the ability to change game modes? Last time I checked I was able to change from dwarf mode to adventurer mode, taking one of my dwarves to an adventure. But once I left the fortress, it was impossible to come back and play the fortress again - it was like if it were abandoned. Have there been any new developments? Can we get back to playing the fortress now?

Thanks.
well we already found out how to switch back and forth between modes. Way back when mode came out. what happen development wise is that the guys how knew kinda posted how in the thread and it got swallowed by new posts. let a lone switching back to a fort kinda complicated since you need to jump into a recent fort mode made Fort, any other forts will give you about a ingame week before ending it. you can cheeze this by jumping in and out of the site after the week is up but it's more a pain than just going to the last retire/abandon fort. next is that you need to be a member of the fort to safely switch back, if not then you must either retire there as a dwarf and try again, use dfusion to set the character up or un-toggle the is resident flag on the citizens. once you even do that if you care about the site structure you need to remove all new designations that pop up from the switching. once that done your in fort mode now! oh and if you had any companions they will follow the adventure around.
I posted the script needed to remove the is resident flag on citizens for the new dfhack I couple a pages back.
Title: Re: DFHack 0.34.11 r1
Post by: iTreefish on July 03, 2012, 03:26:06 am
cainiao Thank you!
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on July 03, 2012, 03:40:02 am
Nice!  That is a great script, Hesuchia, well done.

Heh thanks ^^. It's always nice to type something into the console and not have it spit red back at you :P.  Though I just noticed I could have replaced those =0 settings with the vars mmax and dmax >.>. Ah well ;).
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 03, 2012, 12:06:04 pm
I get an error in the Dwarf Fortress message log stating
Quote
Cannot produce: drink

Am I doing something wrong? I'm quite inexperienced with DFHack & Dwarf Fortress so it wouldn't be unheard of! :)
As far as I know I have all necessary ingredients for the drinks.
I'm playing Dwarf Fortress 0.34.11 & the most recent version of DFHack.

TIA
create a job to brew drinks and set it on repeat.

This isn't the same. That job will get cancelled when you run out of brewable plants.

The brew drink job is hardcoded into the game. I suspect that's why it doesn't work with workflow. You could try making a custom brewery building with a custom brew drink command that uses the brewing skill and manage that with workflow.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 03, 2012, 12:29:39 pm
I've done some memory research. I have discovered what unit.body.unk_4b8 does. It controls head/face appearance (eye closeness, head wideness, etc). I would like to put this information into the xml files, but I am uncertain of how to proceed.

If it were as simple as unk_4b8[0] controls eye closeness and unk_4b8[12] controls iris size, I would know what to do in dfhack/library/xml/df.units.xml. However, it is not that simple. In different species, different elements control different things. I have discovered the pattern, but I don't know how to encode it into the xml file.

Ideally, I'd like this information to be (somehow) available to lua, but even if that's not possible, I would like to put detailed documentation of it somewhere. I am not sure of the rules on where documentation files go. Is it ok if I put it in the xml folder?

It would be a shame to let this knowledge go unrecorded. It took quite a long time to find and thoroughly confirm the pattern.



Roughly, the pattern works like this: there is a constant set of facial traits that can exist, regardless of species. However, different species have a different number of eyes, heads, etc. The order of the traits listed is always the same (though some may have zero elements, for example if a species has no eyes). Eye wide-setness is first, followed by eye depth. If a creature has n eyes, the first n elements in the vector will determine eye wide-setness, but only the first will be used for in game descriptions. The next n elements control eye depth, and again, only the first is used for in-game descriptions.

A note on in-game descriptions: only the first is used, but sometimes it will specify this in game (and sometimes not). For example, it will never say that a dwarf's left eye has large irises. However, it might say that an ettin's left head is very broad. In this case, it will never make any comment about the ettin's right head.

I have the full list written down but it is too long for this margin.
Title: Re: DFHack 0.34.11 r1
Post by: Rose on July 03, 2012, 12:37:31 pm
I recommend getting into #DFhack on freenode. That's where all the juicy dev talk happens.
Title: Re: DFHack 0.34.11 r1
Post by: ag on July 03, 2012, 01:32:35 pm
create a job to brew drinks and set it on repeat.

This isn't the same. That job will get cancelled when you run out of brewable plants.

Just enabling workflow prevents cancellations of all repeat jobs in workshops (except maybe some weird ones like shear).

Re body info: did you correlate it with stuff in the raws? I have only very vague idea about what's there. Anyway, paste this info somewhere online to start with. :)
Title: Re: DFHack 0.34.11 r1
Post by: tahujdt on July 03, 2012, 06:24:55 pm
Where can I find a repository of lua scripts, like the make legendary and instakill ones?
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on July 03, 2012, 06:39:50 pm
well either at dfusion wiki page, or this thread.
here's two commands that allows one to shove all your companions into a cart with you,
though to use this you need to look at your cart you're riding on then activate the function.
Code: [Select]
function compin2(unit,item)
  adv=df.global.world.units.active[0]
  for k,v in pairs(df.global.world.units.active) do
  if v.relations.group_leader_id==adv.id then

--[[if unit==nil then
unit=getCreatureAtPos(getxyz())
end]]--
--r=getline()
if item==nil then
item=getItemAtPos(getxyz())
end

v.riding_item_id=item.id
ref=df.general_ref_unit_riderst:new()
ref.unit_id=v.id
item.itemrefs:insert("#",ref)
end
end
end
function compin3(unit,item)
  adv=df.global.world.units.active[0]
  for k,v in pairs(df.global.world.units.active) do
  if v.relations.mother_id==adv.id then
if item==nil then
item=getItemAtPos(getxyz())
end

v.riding_item_id=item.id
ref=df.general_ref_unit_riderst:new()
ref.unit_id=v.id
item.itemrefs:insert("#",ref)
end
end
end
tools.menu:add("bandwagon",compin2)
tools.menu:add("bandwagon2",compin3)
Title: Re: DFHack 0.34.11 r1
Post by: HiEv on July 03, 2012, 07:24:51 pm
I don't like how obsidian walls and floors work in liquids and so i try to do it naturals way - by combining water and magma. But unfortunately this leaves tiles with hot stone. Which is strange as we have only obsidian slab surrounded by clay or sand. But they are hot and they never turn normal. I can swap them with obsidian of course and this actually changes temperature to normal. But there is a fact of DF game that it sometimes has temperature traps - then a stone or two inside earth are hot and never cool down.

This is a known bug that happens with obsidian farming when you have TEMPERATURE:NO set in d_init.txt .  Change that to TEMPERATURE:YES and the tiles will be able to cool down.

Bug #6033 (http://www.bay12games.com/dwarves/mantisbt/view.php?id=6033): Areas once covered in magma seemingly not being cleared for pathfinding across
Title: Re: DFHack 0.34.11 r1
Post by: vjek on July 03, 2012, 09:44:28 pm
Where can I find a repository of lua scripts, like the make legendary and instakill ones?
There are quite a few Lua scripts in this thread, now.

Can't speak for anyone else, but I've updated mine for df/dfhack 34.11 here (http://dwarffortresswiki.org/index.php/User:Vjek). (same link in my sig) 

If you find any bugs/problems/issues, PM me.
Title: Re: DFHack 0.34.11 r1
Post by: WillowLuman on July 03, 2012, 09:55:21 pm
Is it possible to retire an adventurer to a lair as a bandit?
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 04, 2012, 12:06:33 am
I was playing with mode set and when I was back in Fortress Mode I noticed I no longer had the option to Save Game, instead all I had was the option to Abort Game, at which point it dropped me out quickly and didn't save anything.

Any idea how to force a Save in Fortress Mode?
Title: Re: DFHack 0.34.11 r1
Post by: SammyLiimex on July 04, 2012, 12:27:53 am
Does this mod have a funtion that allows healing of body parts, or changing the number of items in a stack (Like changing 1 bolt into 25)? Or spawning items?
Title: Re: DFHack 0.34.11 r1
Post by: Tierre on July 04, 2012, 02:26:52 am
I think it is a good idead to do a repository of dfhack scripts. Because finding them in this thread is insane:)
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on July 04, 2012, 05:26:43 am
I was playing with mode set and when I was back in Fortress Mode I noticed I no longer had the option to Save Game, instead all I had was the option to Abort Game, at which point it dropped me out quickly and didn't save anything.

Any idea how to force a Save in Fortress Mode?

Did you try the "quicksave" dfhack command?
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 04, 2012, 11:51:07 am
I was playing with mode set and when I was back in Fortress Mode I noticed I no longer had the option to Save Game, instead all I had was the option to Abort Game, at which point it dropped me out quickly and didn't save anything.

Any idea how to force a Save in Fortress Mode?

Speaking of which, is it possible to force an "Abort Game"? It'd be nice to have an alternative to the "die" command.
Title: Re: DFHack 0.34.11 r1
Post by: Andux on July 04, 2012, 04:14:29 pm
I was playing with mode set and when I was back in Fortress Mode I noticed I no longer had the option to Save Game, instead all I had was the option to Abort Game, at which point it dropped me out quickly and didn't save anything.

Any idea how to force a Save in Fortress Mode?

Speaking of which, is it possible to force an "Abort Game"? It'd be nice to have an alternative to the "die" command.

I'm not sure how to get at it from DFHack, but there is a flag in memory which controls whether you can save; it's at offset 0x0165288E in DF 0.34.11 SDL (5 bytes before pause_state).
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 04, 2012, 04:39:51 pm
Alright, I've got a quick question:

I just reclaimed a fortress of mine, and all 114 my old dwarves are still alive and wandering around in it. And drinking all my damn booze as soon as I unpaused.

They're listed as 'friendly' under the 'other' section of the unit screen, and as such they're just useless booze-hogs. I embarked under the same civilization as I did when I built this fort. Is there any way, through DFhack, to convince them to actually start acting as proper members of my fortress rather than as parasites? If not, everyone will die of thirst/hunger as the massive horde of useless dwarves consumes food and booze faster than it can be produced.

To make matters worse, they don't appear to be putting the barrels down after drinking from them...
Title: Re: DFHack 0.34.11 r1
Post by: WillowLuman on July 04, 2012, 04:43:15 pm
Alright, I've got a quick question:

I just reclaimed a fortress of mine, and all 114 my old dwarves are still alive and wandering around in it. And drinking all my damn booze as soon as I unpaused.

They're listed as 'friendly' under the 'other' section of the unit screen, and as such they're just useless booze-hogs. I embarked under the same civilization as I did when I built this fort. Is there any way, through DFhack, to convince them to actually start acting as proper members of my fortress rather than as parasites? If not, everyone will die of thirst/hunger as the massive horde of useless dwarves consumes food and booze faster than it can be produced.

To make matters worse, they don't appear to be putting the barrels down after drinking from them...
I'm sorry, but that made me rofl
Title: Re: DFHack 0.34.11 r1
Post by: RanDomino on July 04, 2012, 09:52:25 pm
I don't know if I would be able to play DF without digv.
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 04, 2012, 10:04:04 pm
How do you discover the civ_id of the owner of a site you're looking at?
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on July 04, 2012, 10:05:49 pm
How do you discover the civ_id of the owner of a site you're looking at?
Why would you need the civ_id that owns the site? There's already a variable that tells you the ID of your civilization - ui.civ_id (and ui.group_id, for the local government).
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 04, 2012, 10:15:37 pm
Why would you need the civ_id that owns the site? There's already a variable that tells you the ID of your civilization - ui.civ_id (and ui.group_id, for the local government).

Because I'm testing out functionality of restarting fortresses I've retired, and I want to know why resetting the resident flags on the dwarves at a fortress is not restoring them to active dwarves in fortress mode, which has worked so far except isn't in my most recent test. So, my guess is that the civ_id of the site has changed (maybe as a result of setting the Lair flag), and I need to check it in fortress/adventure mode (and not on the selector map).
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 04, 2012, 11:30:17 pm
As a heads-up for anyone else doing the same kind of work, this is what happened, the integer value of the civ_id for the site seems to have changed as a result of the founding of a new fortress.

In lua, what's the syntax to check the attributes of the site object? Or, better yet, is there any documentation of all the attributes of units and sites that can be accessed using lua?
Title: Re: DFHack 0.34.11 r1
Post by: Jiri Petru on July 05, 2012, 01:29:56 am
Hi all,

I just wanted to let you know that TildeATH over at Something Awful wrote this amazing tutorial to game mode switching (http://forums.somethingawful.com/showthread.php?threadid=3466523&pagenumber=213#post405296998) - how to switch from fortress mode to adventurer mode, go adventuring, then come back and play fortress mode again. It's very in-depth and seems easy to follow.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 05, 2012, 09:12:47 am
In lua, what's the syntax to check the attributes of the site object? Or, better yet, is there any documentation of all the attributes of units and sites that can be accessed using lua?

You can figure out a lot of it with printall. Otherwise, there's always this: https://github.com/angavrilov/df-structures
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 05, 2012, 11:03:21 am
You can figure out a lot of it with printall. Otherwise, there's always this: https://github.com/angavrilov/df-structures

Printall would be great if someone could tell me what form the site object takes in Fortress/Adventure mode.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 05, 2012, 11:59:33 am
Code: [Select]
printall(df.global); //many things, world looks useful
printall(df.global.world); //world_data looks promising: could be about global map stuff (hint: it is)
printall(df.global.world.world_data); //sites is a variable!
printall(df.global.world.world_data.sites)

Just letting you know how I figured it out so that you can figure out similar things in the future.
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 05, 2012, 12:03:36 pm
Any ideas about forcing these dorfs to become proper members of my fort? Sounds like cardinal is working on something similar...
Title: Re: DFHack 0.34.11 r1
Post by: ag on July 05, 2012, 12:16:22 pm
This C++ function almost precisely reproduces the conditions used by the game to detect citizens:

https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L692 (https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L692)

Check the flags and the values of unit.civ_id vs df.global.ui.civ_id (while in fort mode).
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 05, 2012, 01:45:07 pm
Oh ok... I have no idea what to do with it, though. I am not good with scripting :P
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 05, 2012, 03:39:06 pm
Code: [Select]
printall(df.global); //many things, world looks useful
printall(df.global.world); //world_data looks promising: could be about global map stuff (hint: it is)
printall(df.global.world.world_data); //sites is a variable!
printall(df.global.world.world_data.sites)

Just letting you know how I figured it out so that you can figure out similar things in the future.

Ah, but of course, hadn't thought about it that way. Thanks for this.
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 05, 2012, 03:41:21 pm
Any ideas about forcing these dorfs to become proper members of my fort? Sounds like cardinal is working on something similar...

You can force merchants and Friendly dwarves into becoming Civilized by setting their flags1.merchant tag to false, their flags2.resident tag to false, and their civ_id to the civ_id of the site. I have some stranded dwarf merchants hauling lumber right now. If you want to be picky, you can also change their occupation designation, but that's a bit more involved.
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 05, 2012, 04:02:13 pm
Oh ok... I have no idea what to do with it, though. I am not good with scripting :P

Me neither, but you'll have to do a bit if you want to fix this. I'll try to give it to you step by step, and keep in mind that the way I do it may be less convenient than some of the guys here who are more familiar with DFHack.

First, type 'lua' and you should be switched from DFHack to the lua scripting interface in DFHack.

Now, enter the following six lines of code, the code won't run until you type 'end' and hit enter, so you can add them line by line:
Code: [Select]
for k,v in pairs(df.global.world.units.active) do
print("**")
print(v.name.first_name)
print(v.civ_id)
print(v.flags2.resident)
end

This is going to give you a giant list of data, which will basically look like this:
**
Urist
283
false
**
etc..

What you're trying to do is find the numerical identifier for the proper civ_id of your site, because what you're going to do is set the civ_id of your Friendly dwarves to this number. You're also looking for the civ_id of your Friendly dwarves, because you need to know the number you're replacing. How can you tell the civ_id of your site (or your "civilized" dwarves)? Well, it's kind of a pain in the ass, but you should see a block of 7 (or however many civilized dwarves you have) with the same civ_id and a "false" resident tag and first names that you recognize. Ignore all the -1 civ_id creatures, that's just wild animals. How can you tell the civ_id of your Friendly dwarves? It'll be the number that's repeated 117 (or however many you said there were) times. Once you have these two ids (did I mention you should make a copy of your save before you do this? you really should) then you can run the following:

Code: [Select]
for k,v in pairs(df.global.world.units.active) do
if v.civ_id==999 then
v.civ_id=111
v.flags2.resident=false
v.flags1.merchant=false
end
end

Notice there are two 'end' commands, because you have to end the if statement as well as end the for loop. Replace 999 with the number of the civ_id of your FRIENDLY dwarves. Replace 111 with the number of the civ_id of your CIVILIZED dwarves. I added the merchant reset just in case you had any on the map.

I know it seems like a pain, but you just need to dive in and get accustomed to writing a little code. First off, it makes you wealthier. Second, there's a lot of cool stuff you can do with it in Dwarf Fortress, and we can't leave it all to the stuffed shirt, pocket protector-wearing, nerdy LISP wizards (no offense, guys, thanks for building this, really, but you have to admit, those pocket protectors do make you look a little dorky).
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 05, 2012, 05:18:58 pm
When i try to enter the second set of code it gives me an error like this:

Code: [Select]
(interactive):3: syntax error near '=='

after entering the line

Code: [Select]
v.civ_id==5630
5630 being my civ's number. it is identical to the number of all the previous residents because I reclaimed under the same flag i did when I embarked.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 05, 2012, 05:34:42 pm
That should be just "=". "=" is for assignment, "==" is for comparison.
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 05, 2012, 06:04:02 pm
Thanks. They're all on the "citizens" tab of the unit screen now. I guess just keep going as per normal from here?
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 05, 2012, 06:09:48 pm
Thanks. They're all on the "citizens" tab of the unit screen now. I guess just keep going as per normal from here?

Yup.

Thanks for catching the ==, expwnent.
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 05, 2012, 07:16:06 pm
Problem:

None of the old dwarves can be appointed to military/noble positions. I have a lot of good soldiers, and not a lot of replacements for them at the moment. With the population being 155 (I don't even know where the extra ~20 came from) I'm concerned that goblins will show up before the first spring. :o

Any idea how to get over that hurdle as well?
Title: Re: DFHack 0.34.11 r1
Post by: Corai on July 05, 2012, 07:31:08 pm
Problem:

None of the old dwarves can be appointed to military/noble positions. I have a lot of good soldiers, and not a lot of replacements for them at the moment. With the population being 155 (I don't even know where the extra ~20 came from) I'm concerned that goblins will show up before the first spring. :o

Any idea how to get over that hurdle as well?

You cant get attacked until year2, only risk you have will be a necromancer.
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 05, 2012, 07:44:16 pm
Well, I actually expect them to show up with the elven caravan in spring... And I do ahvea  necromancer tower right next door, so that's a concern too.
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 05, 2012, 08:40:57 pm
Problem:

None of the old dwarves can be appointed to military/noble positions. I have a lot of good soldiers, and not a lot of replacements for them at the moment. With the population being 155 (I don't even know where the extra ~20 came from) I'm concerned that goblins will show up before the first spring. :o

Any idea how to get over that hurdle as well?

What's the "profession" of your soldiers? Are they listed as civilian professions or military professions? I've been playing around with things and I found I needed to transform all my merchants into peasants and so you may need to do that to your swordsdwarf/macedwarf/etc. They still aren't available for assignment to noble positions, though, so I'm not sure what's causing that.

Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 05, 2012, 09:47:59 pm
Actually it would seem that I can indeed make any of the old troops soldiers, just not in their captain/commander positions. Looks like I didn't have any active soldiers when I abandoned. Problem solved, I suppose.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 05, 2012, 10:02:40 pm
I've found that dwarves who are in the military, then die, then are resurrected with an interaction (not raised, resurrected), cannot join the military or become nobles. Is there any fix to this?
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on July 05, 2012, 10:08:24 pm
what I learn from retired sites and switching back to them is that any military you assign will more or less still be able to control when you return, the only issue I can see form this is using reclaim.
you also get control over your military dwarves if you don't alter the is resident flag. which means you can set up patrol points on your retired fort. the noble issue has plague us way back when we found retiring forts. I guess it has to do with either fort mode being desync. Though you should be able to stick them in as recruits just not captains.  But this is kinda back then and toady did update military so could be he made a "failsafe" to prevent any other who not apart of the civ fully.

I've found that dwarves who are in the military, then die, then are resurrected with an interaction (not raised, resurrected), cannot join the military or become nobles. Is there any fix to this?
Check your interactions to see if it doesn't change their race or remove a tag.
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 05, 2012, 10:13:58 pm
Oh! I've got a thought!

I just reviewed the profile of my old manager, who is apparently still a manager. My manager, however, is the expedition leader of my reclaim team.

Anyway, the old manager is manager of "The Granite Citadels," while my reclaim team are members of "The Bent Plank." These are local government names. Can't recall if the Granite Citadels was the original local government of my fortress, or if it is the government installed after I abandoned, but I'd wager that's the reason the dwarves can't be assigned noble positions, but still hold noble positions seemingly of their own accord. They're actually part of a different government entity, outside the player's jurisdiction.

It's almost as if Toady secretly updated my game to 34.12... :P

Edit: Actually, a lot of the old dwarves are members of both "The Crypt of Weavers" and "The Granite Citadel."
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 05, 2012, 10:32:44 pm
Oh! I've got a thought!

I just reviewed the profile of my old manager, who is apparently still a manager. My manager, however, is the expedition leader of my reclaim team.

Anyway, the old manager is manager of "The Granite Citadels," while my reclaim team are members of "The Bent Plank." These are local government names. Can't recall if the Granite Citadels was the original local government of my fortress, or if it is the government installed after I abandoned, but I'd wager that's the reason the dwarves can't be assigned noble positions, but still hold noble positions seemingly of their own accord. They're actually part of a different government entity, outside the player's jurisdiction.

It's almost as if Toady secretly updated my game to 34.12... :P

Edit: Actually, a lot of the old dwarves are members of both "The Crypt of Weavers" and "The Granite Citadel."

I think you're onto something. I still haven't figured out what determines "membership". There's a "civ_id" trait and a "population_id" trait, and I've set these to the same values for my merchants but that just affects citizenship. I'm not sure what affects membership and have yet to see some trait in the units or the flags that seems to hold that value.
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on July 06, 2012, 02:56:02 am
Wait did someone in SA just figure out how to switch from fort mode to adventure mode using the old way of switching?

Eric try messing with the reclaim modes my guess is one of them will reclaim as the same group from before, and the other is reclaiming as a different group of dwarves. Also you can use a pointer and lua to set someone as an adventurer in fort mode so that when you switch over you don't have to jump as many hoops.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on July 06, 2012, 07:30:39 am
I think you're onto something. I still haven't figured out what determines "membership". There's a "civ_id" trait and a "population_id" trait, and I've set these to the same values for my merchants but that just affects citizenship. I'm not sure what affects membership and have yet to see some trait in the units or the flags that seems to hold that value.
The "population_id" trait is only for wild animals. What you're looking for is within the unit's historical_figure record: entity links.
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 06, 2012, 12:19:36 pm
The "population_id" trait is only for wild animals. What you're looking for is within the unit's historical_figure record: entity links.

It seems like civilized dwarves have population_id values, though, any idea why?

Also, I'm looking at the df.global.world.history.figures.entity_links, is that what you mean? The dwarves that are members of local government have two entity_link values, whereas my newly civilized merchant has only one, but the values are unique, they are not simple integers like civ_id. How are they handled?
Title: Re: DFHack 0.34.11 r1
Post by: ag on July 06, 2012, 01:11:52 pm
It seems like civilized dwarves have population_id values, though, any idea why?

Also, I'm looking at the df.global.world.history.figures.entity_links, is that what you mean? The dwarves that are members of local government have two entity_link values, whereas my newly civilized merchant has only one, but the values are unique, they are not simple integers like civ_id. How are they handled?

There are entity populations too - no idea what are they used for; maybe that's where the 'hill dwarves' will be handled in the future, and whatever similar there is already in legends & adventure modes (like maybe all the nameless citizens in towns, etc). That population_id field is actually entity populations - animals use a whole structure with multiple fields to select one of the many possible populations they can come from (see unit.unknown4.population).

Links are objects - they have fields and methods.
Title: Re: DFHack 0.34.11 r1
Post by: Cardinal on July 06, 2012, 01:48:56 pm
Links are objects - they have fields and methods.

Could you give me quick tutorial or point me at something that describes how to work with them?
Title: Re: DFHack 0.34.11 r1
Post by: Miskav on July 06, 2012, 04:11:27 pm
After reading some posts here having the same problem, I haven't found a solution yet.

I put the DFhack stuff together with the corresponding DF version and upon starting DF a second screen doesn't popup.
This is on win7 64x.

Any ideas?
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on July 07, 2012, 12:17:07 am
I found out how to reset patrol anger to zero for individual dorfs, and thought it would be nice to make a script to do it to all dorfs.  Not sure how to cycle through just the units in one's fortress though.

This might be running before I've learned to walk, but a true fix for this would be to trigger the function whenever they go from active to inactive status.  Is that possible?

Title: Re: DFHack 0.34.11 r1
Post by: mordrax on July 07, 2012, 07:42:20 am
i'm at a loss on how to set the dyer to dye all my dimple cups using workflow. i've been crawling through the object and entity files but haven't found how to set a watch on the dye. anyone know? or can direct me on where to look?
Title: Re: DFHack 0.34.11 r1
Post by: Mr S on July 07, 2012, 01:57:59 pm
A walkthrough of workflow would be handy.  As detailed or generalized as can be.  I'll be trying it out for the first time on the fortress I'm just getting going.  Haven't used workflow before, just been abusing the Manager, lol.  As I understand it, it "suspends" then "un-suspends" work orders set to repeat in a workshop?  Will the un-suspension be put back to the workshop it was taken from?  If so, what about the case where said workshop is removed, destroyed, inaccessible, covered in magma, etc.?  Handy for cases such as glass works where you have a couple next to the surface for gathering, then a magma glass works at the sea for actually making things.

The README give syntax, but no real detail about Theory of Operation, which is what I really need for all of these Hax.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on July 07, 2012, 02:12:40 pm
Alright, I think I might have something:


Code: [Select]
local index = 0
local total = #(df.global.world.units.active)
local max = total-1

for index=0,max do

unit=df.global.world.units.active[index]

if dfhack.units.isCitizen(unit) then

unit.military.patrol_timer=0

end

This will (I hope) get the list of active units, check each one to see if it's a live, sane member of your fort.  If so, it resets their patrol timer to 0.  It's my attempt to counteract the long patrol duty bug.

This is my first real script, and I'm not sure if there's something I don't know that could cause memory leaks or some sort of data corruption here if I was clumsy, though it seems like it should work.  Could someone please verify that for me?

How much trouble can I create for myself by using the lua console anyway?  Is it limited to corrupting my save files or can I actually cause permanent damage to my operating system or PC?  How hard is that to do and what sort of things would lead to that?
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on July 07, 2012, 02:38:50 pm
The worst I've ever done with the lua console is crash my game. It's probably best to quicksave beforehand (though sometimes I'm lazy and reckless :P).

you could also do something like

Code: [Select]
for k, v in pairs(df.global.world.units.active) do
if dfhack.units.isCitizen(v) then
v.military.patrol_timer=0

so you won't have to worry about an index value.  You could also do "units.all" instead of "units.active" so you don't have to worry about what "active" might mean. It'll still just iterate through your own civs.

The for k, v in pairs(blah) splits "blah" into a table of key/value pairs. In this case an index number and a pointer to a specific unit, so the index would already be accounted for.  It's a handy shortcut that I use for pretty much everything :P.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on July 07, 2012, 02:50:11 pm
I've seen that a lot of places but had no idea what it does.  Thanks!
Title: Re: DFHack 0.34.11 r1
Post by: Hesuchia on July 07, 2012, 03:07:58 pm
No problem. If you want to actually see the pairs it'll split into, you can use the "printall" command.  printall(df.global.world.units.active) will show the k and the v for the units in that last example.  Really, really useful for exploring code structures.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 07, 2012, 05:37:58 pm
In general with LUA, I'm pretty sure the worst that could happen is you lose your save or the game crashes. I guess if you WANTED to screw up other stuff you might do it with file operations, but that won't happen accidentally.

You won't cause memory leaks unless you're actually allocating memory, which you aren't. You're just changing existing memory.
Title: Re: DFHack 0.34.11 r1
Post by: Hugo_The_Dwarf on July 07, 2012, 06:24:12 pm
what was the command/plugin that hides all tiles that are not pathable?

like if I sealed up the caves then moved my mouse cursor to the surface and used it. everything beyound that seal would be hidden.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on July 07, 2012, 06:59:20 pm
I think revflood is what you're looking for.  Don't think it'll do what you want it to though, since it considers constructions transparent.
Title: Re: DFHack 0.34.11 r1
Post by: Hugo_The_Dwarf on July 07, 2012, 08:07:35 pm
Thanks that was it, and yes if ignores constructions :/ I remember in older versions it counted constructed walls. Never the less nothing DFliquid can't fix with obsidain walls. Good think obsidian is the same color as my decorating theme.

How hard would it be to make a revflood script/plugin that would count constructions?
Title: Re: DFHack 0.34.11 r1
Post by: Rose on July 07, 2012, 09:32:12 pm
Revflood was intentionally made to ignore constructions for a reason, which is becase deconstructing things doesn't actually reveal areas, while digging does, so if you wanted to go through that wall later, you wouldn't be able to because behind it would still be hidden.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on July 07, 2012, 09:38:19 pm
You can download the source for DFhack, modify the code for a plugin, and then compile a copy of it.  I'm betting that since revflood used to not ignore constructions, you'll be commenting a chunk of code out instead of putting a new one in.

I did that to dfliquids once to refill candy tubes, but soon after that tubefill came out and did it better.
Title: Re: DFHack 0.34.11 r1
Post by: Hugo_The_Dwarf on July 07, 2012, 09:47:03 pm
is the a way to make a constructed wall into a natural wall? for digging? without turning it into obsidian with "liquids"
Title: Re: DFHack 0.34.11 r1
Post by: mordrax on July 07, 2012, 11:05:31 pm
A walkthrough of workflow would be handy.  As detailed or generalized as can be.  I'll be trying it out for the first time on the fortress I'm just getting going.  Haven't used workflow before, just been abusing the Manager, lol.  As I understand it, it "suspends" then "un-suspends" work orders set to repeat in a workshop?  Will the un-suspension be put back to the workshop it was taken from?  If so, what about the case where said workshop is removed, destroyed, inaccessible, covered in magma, etc.?  Handy for cases such as glass works where you have a couple next to the surface for gathering, then a magma glass works at the sea for actually making things.

The README give syntax, but no real detail about Theory of Operation, which is what I really need for all of these Hax.

it took me about a week to get used to it and now i cannot live without it just as i can't live without DT.

i grabbed this script off someone else on the forums when first learning workflow:
Spoiler (click to show/hide)

workflow works by finding a job that matches your command e.g my
workflow amount CHAIR 20
will match the first repeatable chair job that i create in either the wood, metal, stone or glass workshops and once matched, it will save that job number and monitor your stock levels of that item, if your workshop gets destroyed, the workflow order still exists but just doesn't have a job number to match until you create another workshop with a repeated chair order.

as to the "How-To" guide, this is what i do now, after 2 weeks of trial and error.
when i embark, i load the whole workflow script using the script command in dfhack. at the start none of the workflow orders can find jobs so u get all these yellow errors about cannot find job or something.
then i setup each of my industries and let workflow find the jobs
e.g, for furniture: build a carpenter, create a repeatable bed job. if you pause the game here and run workflow again, you'll see that the bed job has been found and there's a current count of beds: 0 and a target amount 20. in the mason, setup repeatable table, throne, armorstand, etc etc...
and that's it, ur mason and carpenter will continuously create these furniture until it reaches the target amount and when it does the job auto suspends.
so then i've dug out some living spaces and used quickfort to assign 20 bedrooms with a macro and off they go, all furniture is now used. you'll see in announcements that the jobs which were suspended are now 'resuming production: bed' etc etc...

i do this for food/drinks, clothing, metal bars + charcoal, containers (bins, buckets etc etc) so i rarely use the manager anymore... used to get RSI from manager spamming.

but with all my figuring out, i still haven't figured out how to do dying continuously... is that spelt right?
Title: Re: DFHack 0.34.11 r1
Post by: telarin on July 08, 2012, 08:28:38 am
I posted this once before, but I know this thread gets busy and occasionally posts get overlooked. Anyway, is it possible with LUA to access traps (and possibly tracks, which I believe are implemented as traps), and fix them so that they are passable by wagons again?
Title: Re: DFHack 0.34.11 r1
Post by: Rose on July 08, 2012, 08:35:21 am
Tracks are not traps. Tracks are floors.
Title: Re: DFHack 0.34.11 r1
Post by: crazysheep on July 08, 2012, 08:50:39 am
but with all my figuring out, i still haven't figured out how to do dying continuously... is that spelt right?
Dying continuously is easy. Dyeing continuously, on the other hand, might be tricky.
Title: Re: DFHack 0.34.11 r1
Post by: Makbeth on July 08, 2012, 11:54:12 am
is the a way to make a constructed wall into a natural wall? for digging? without turning it into obsidian with "liquids"

Use tiletypes.  Using "paint shape wall", you can turn the shape of the tile into a wall of whatever material the tile was to begin with.  Might want to look in the DFhack readme first, and also look at how to use hotkeys with the command.

I posted this once before, but I know this thread gets busy and occasionally posts get overlooked. Anyway, is it possible with LUA to access traps (and possibly tracks, which I believe are implemented as traps), and fix them so that they are passable by wagons again?

My guess is that something changed in the hardcode to make all buildings block wagons, or at least classes of buildings including traps.  Nothing in the raws or structures seems to offer a way to fix it.

I simply started changing my designs.  You can make an effective trapped entrance using the following facts:

1) Wagons will go wherever they have to, as far as they have to, to use a clear route to your fort.

2) Gobbos and some megabeasts will take the fastest path to your fort, whether it passes through traps or not.

My solution is to just outline a long clear path with cage traps.  I then install weapon traps outside those.  The wagons take the path, everything else tries to cut across the sides and gets shredded or captured.  I also use pastures with tame dangerous animals inside the enclosure with my trade depot, but in front of the actual fort entrance.

Oh, I'm not sure if it's a problem with my raws, but every couple years the migrants bring a tame giant cave spider.  If you get them as well, don't put them in the defensive pasture.  Not only are they completely ineffective against helmed foes, they spray webs everywhere, including over the traps.  I didn't lose any dwarves in the fighting, but I lost several when the mechanics came out to clean the traps and got webbed while standing over them.  Blind cave bears work much better than GCSs.
Title: Re: DFHack 0.34.11 r1
Post by: Rose on July 08, 2012, 12:27:25 pm
The giant spider isn't a raw issue. Somebody, at some point in your civ's history, went and tamed one, and since then, they have had them as pets.
Title: Re: DFHack 0.34.11 r1
Post by: meowmix on July 10, 2012, 06:07:34 pm
where do we get and how do we use the ruby plugin to use commands like removebadthoughts?  I am assuming that the ruby plugin doesn't come with the download since the commands don't work.
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 10, 2012, 06:13:10 pm
maybe you have to invoke "ruby" first, then the commands associated with it? Or did you try that?
Title: Re: DFHack 0.34.11 r1
Post by: meowmix on July 10, 2012, 06:17:42 pm
maybe you have to invoke "ruby" first, then the commands associated with it? Or did you try that?

how do you "invoke" it? The readme doesn't really say anything except that the plugin is required.
Title: Re: DFHack 0.34.11 r1
Post by: Eric Blank on July 10, 2012, 07:08:24 pm
Well, the only thing on the entirety of the DF forums is this thread and another mod that mentions "ruby" and then "plugin" sometime later. That is probably the shortest list of search results you could ever hope to get.


Anyway, I clearly have no idea what I'm talking about anyway. I was thinking it may be like liquids, where you ahve to type "liquids," then press enter before you can start using the commands that depend on the liquids plugin.
Title: Re: DFHack 0.34.11 r1
Post by: meowmix on July 10, 2012, 07:47:19 pm
Well, the only thing on the entirety of the DF forums is this thread and another mod that mentions "ruby" and then "plugin" sometime later. That is probably the shortest list of search results you could ever hope to get.


Anyway, I clearly have no idea what I'm talking about anyway. I was thinking it may be like liquids, where you ahve to type "liquids," then press enter before you can start using the commands that depend on the liquids plugin.
I'm talking about these functions. 
https://github.com/peterix/dfhack/blob/master/README.rst#id176

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on July 10, 2012, 08:01:35 pm
If you want the ruby plugin, you'll need to download the sources and compile DFHack yourself - the next release will probably include it.
Title: Re: DFHack 0.34.11 r1
Post by: Thrall on July 11, 2012, 07:21:18 am
Hello,

first many thx to Peterix for his awesome work.
One question, the old DFHack was a version with so many of separated commandline utilities now there is one console with all the commands available. But I used a GUI programm to start those small programms and now this is not working.
Is there a way to call all the new commands from a GUI process and may be hiding the console window?

Best regards

Thrall
Title: Re: DFHack 0.34.11 r1
Post by: danaris on July 11, 2012, 08:21:55 am
Hello,

first many thx to Peterix for his awesome work.
One question, the old DFHack was a version with so many of separated commandline utilities now there is one console with all the commands available. But I used a GUI programm to start those small programms and now this is not working.
Is there a way to call all the new commands from a GUI process and may be hiding the console window?

Best regards

Thrall

You can call any of the DFHack commands from outside DF using the "dfhack-run" script. For instance, to run "reveal", you would open up a console, change to the DF directory, and run "dfhack-run reveal".

Hopefully you can retrofit your GUI program to use this method.
Title: Re: DFHack 0.34.11 r1
Post by: Mr S on July 11, 2012, 10:33:35 am
Well, this seems as likely a thread as any to ask.  I see that some of the modders on here use Interactive Disassembler (IDA) for patching bugs.  I looked at IDA's official page but I think I pooped a little when I saw the price tag of $550.

I'm guessing few of the people using disassemblers are using a full price version, so what are you using?  LIDA?  Something else?  Got some links?
Title: Re: DFHack 0.34.11 r1
Post by: Rose on July 11, 2012, 11:07:26 am
Quietust uses an older version of Ida. I don't know what anybody else uses.
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on July 11, 2012, 01:01:09 pm
Code: [Select]
print(df.global.world.raws.syndromes.all[50 or whatever].syn_affected_class[0].value)
Figured it out by doing

Code: [Select]
printall(df.global.world.raws.syndromes.all[50 or whatever].syn_affected_class[0])
I saw this and the sun shone through the leaves...

Then I wrote this script:
Code: [Select]
function showhidden()

for fnUnitCount,fnUnit in ipairs(df.global.world.units.all) do
    if (fnUnit.race ~= df.global.ui.race_id) then
if fnUnit.flags1.dead ==false then
if fnUnit.flags1.hidden_in_ambush then
print(fnUnit.flags1.hidden_in_ambush,fnUnit.race,fnUnit.pos.x,fnUnit.pos.y,fnUnit.pos.z,df.global.world.raws.creatures.all[fnUnit.race].creature_id, dfhack.TranslateName(dfhack.units.getVisibleName(fnUnit)))
end
end
end
end
print(df.global.world.raws.syndromes.all[2].syn_affected_class[0].value)
print("--")
printall(df.global.world.raws.syndromes.all[2].syn_affected_class)
print("--")
printall(df.global.world.raws.syndromes.all[2].syn_affected_class[0])
print("--")
printall(df.global.world.raws.syndromes.all[2])
print("--")
printall(df.global.world.raws.creatures.all[641])
print(df.global.world.raws.creatures.all[641].name[0])
print("--------------------")
print("-- dfhack")
printall(dfhack)
print("--------------------")
print("-- dfhack.gui")
printall(dfhack.gui)
print("--------------------")
print("-- dfhack.units")
printall(dfhack.units)
print("--------------------")
print("-- dfhack.event")
printall(dfhack.event)
print("--------------------")
print("-- dfhack.job")
printall(dfhack.job)
print("--------------------")
print("-- df.global")
printall(df.global)
print("--------------------")
print("-- df.global.ui")
printall(df.global.ui)
print("--------------------")
print("-- df.global.world")
printall(df.global.world)
end

showhidden()


Title: Re: DFHack 0.34.11 r1
Post by: Iysif on July 11, 2012, 02:27:24 pm
It was recommended to me that I put my script request here.

I'd like to be able to disable and reenable [can_speak] tag of a creature in adventure mode. The goal here is to butcher your sentient enemies (say, elves) after killing them to make armor out of them. The [intelligence] tag might work too? I don't know much about memory editing, but apparently my obsession can only be solved by a lua script, removing the tag before butchering, and then putting it back, (I think it would be can_speak or intelligence), to continue playing the game.

I would very much appreciate if anyone has the spare time the help me out. If not, any scripting resources that would help me accomplish this would be very helpful. Thanks to anyone willing to help make adventure mode just a little more dwarfy! Elf leather quivers for everyone!
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on July 11, 2012, 02:39:26 pm
It was recommended to me that I put my script request here.

I'd like to be able to disable and reenable [can_speak] tag of a creature in adventure mode. The goal here is to butcher your sentient enemies (say, elves) after killing them to make armor out of them. The [intelligence] tag might work too? I don't know much about memory editing, but apparently my obsession can only be solved by a lua script, removing the tag before butchering, and then putting it back, (I think it would be can_speak or intelligence), to continue playing the game.

I would very much appreciate if anyone has the spare time the help me out. If not, any scripting resources that would help me accomplish this would be very helpful. Thanks to anyone willing to help make adventure mode just a little more dwarfy! Elf leather quivers for everyone!

I thought this was handled through a race's ethics.
Title: Re: DFHack 0.34.11 r1
Post by: Iysif on July 11, 2012, 04:52:27 pm
Unfortunately not for adventure mode. The actual eating and crafting is ethics I believe, but you have to be starving to butcher sentients or you get the message "You are not hungry enough for that."
Title: Re: DFHack 0.34.11 r1
Post by: Thrall on July 13, 2012, 08:31:12 am
Hello,

first many thx to Peterix for his awesome work.
One question, the old DFHack was a version with so many of separated commandline utilities now there is one console with all the commands available. But I used a GUI programm to start those small programms and now this is not working.
Is there a way to call all the new commands from a GUI process and may be hiding the console window?

Best regards

Thrall

You can call any of the DFHack commands from outside DF using the "dfhack-run" script. For instance, to run "reveal", you would open up a console, change to the DF directory, and run "dfhack-run reveal".

Hopefully you can retrofit your GUI program to use this method.

Hello,

thx Danaris for the fast answer, it works like a charm.
But here is the next question, is there a way to hide the DFHack console window (which is automatically opened with DF)?

Best regards

Thrall
Title: Re: DFHack 0.34.11 r1
Post by: NineFourEightSeven on July 13, 2012, 03:27:44 pm
Minimize it?
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on July 16, 2012, 01:57:53 pm
I am trying to check the status of some eggs. 
When I try this:
Code: [Select]
printall(item.unk_cc)I get
Code: [Select]
--------------------unk_cc
anon_1                   = -1
anon_2                   = -1
anon_3                   = -1
anon_4                   = -1
anon_5                   = -1
anon_6                   = -1
anon_7                   = 0

Across many eggs only anon_7 changes from 0 to -1.

Does anyone know what these values mean? In the dfusion package I found this code but don't know what to do with it :
Code: [Select]
function items.eggs()
myoff=offsets.getEx("Items") -- first find out where "item vector" is
vector=engine.peek(myoff,ptr_vector) --  get list of items
for i=0,vector:size()-1 do --look at each item
rti=engine.peek(vector:getval(i),ptr_item.RTI)
if ptr_item.getname(nil,rti)=="item_eggst" then
egg=engine.peek(vector:getval(i),ptr_subitems["item_eggst"])
egg.isfertile=1
egg.hatchtime=0xffffff
--egg.race=123 -- change race for fun times
engine.poke(vector:getval(i),ptr_subitems["item_eggst"],egg)
end
end
end

I have a feeling this part is REALLY outdated.
Title: Re: DFHack 0.34.11 r1
Post by: ag on July 16, 2012, 02:02:59 pm
Does anyone know what these values mean?

If somebody knew, they wouldn't've been called "unk" and "anon" - well, unless somebody does know, but keeps mighty quiet about it ;)
Title: Re: DFHack 0.34.11 r1
Post by: Warmist on July 16, 2012, 03:52:24 pm
oh heh... it appears yet another thing from dfusion is outdated :<
maybe this could be useful (maybe more so for ag)
Code: [Select]
ptr_subitems["item_eggst"]={}
ptr_subitems["item_eggst"].race={off=0x78,rtype=DWORD}
ptr_subitems["item_eggst"].isfertile={off=0xa0,rtype=DWORD} --0 or 1
ptr_subitems["item_eggst"].hatchtime={off=0xa4,rtype=DWORD}
unfortunately I'm not sure for witch version it is... I guess for some of the older ones... Also offsets are from start of class. But i guess if race=0 (from xmls)
so it should be:
Code: [Select]
race=0 -- from xmls
isfertile=0x28
hatchtime=0x2c
Also i find it quite strange that there is no pointer to traits that is needed for pregnancy... It should be there somewhere.
Title: Re: DFHack 0.34.11 r1
Post by: vjek on July 16, 2012, 04:53:56 pm
So, in this fashion:

[lua]# print(df.item_type[5])
WOOD

[lua]# print(df.item_type.WOOD)
5

What is the reverse syntax (if any) for:

[lua]# print(dfhack.matinfo.decode(421,41))
<material 421:41 PLANT:GRASS_TAIL_PIG:SEED>

?  I've tried a few variations, but can't get any results, if it is similar.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on July 16, 2012, 05:43:34 pm
Try this:
Code: [Select]
[lua]# ~dfhack.matinfo.find("PLANT:GRASS_TAIL_PIG:SEED")
<material 421:41 PLANT:GRASS_TAIL_PIG:SEED>
index                    = 41
material                 = <material: 0x0a358680>
plant                    = <plant_raw: 0x0a3574b8>
type                     = 421
mode                     = plant
subtype                  = 2
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on July 16, 2012, 05:48:47 pm
Unfortunately not for adventure mode. The actual eating and crafting is ethics I believe, but you have to be starving to butcher sentients or you get the message "You are not hungry enough for that."
wellllll it gets tricker but I think you can write up an adventure interaction that removes their can_speak tag so you can butcher them easily.
Title: Re: DFHack 0.34.11 r1
Post by: thistleknot on July 16, 2012, 06:36:14 pm
feature requests:

sort rooms (R) command by unit name

also...

sort inventory menu by item name
Title: Re: DFHack 0.34.11 r1
Post by: vjek on July 16, 2012, 11:16:04 pm
Try this:
Code: [Select]
[lua]# ~dfhack.matinfo.find("PLANT:GRASS_TAIL_PIG:SEED")
<material 421:41 PLANT:GRASS_TAIL_PIG:SEED>
index                    = 41
material                 = <material: 0x0a358680>
plant                    = <plant_raw: 0x0a3574b8>
type                     = 421
mode                     = plant
subtype                  = 2

Perfecto, that'll do the job.  Thanks, Quietust.
Title: Re: DFHack 0.34.11 r1
Post by: tahujdt on July 17, 2012, 04:26:44 pm
vjek, have you updated your scripts yet?
Title: Re: DFHack 0.34.11 r1
Post by: vjek on July 17, 2012, 06:19:49 pm
vjek, have you updated your scripts yet?
If you mean for 34.11, yep, did that on July 4th.  They're on the wiki (http://dwarffortresswiki.org/index.php/User:Vjek) now, and all updates will be there from now on.
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on July 18, 2012, 09:47:32 am
I am trying to check the status of some eggs. 
When I try this:
Code: [Select]
printall(item.unk_cc)I get
Code: [Select]
--------------------unk_cc
anon_1                   = -1
anon_2                   = -1
anon_3                   = -1
anon_4                   = -1
anon_5                   = -1
anon_6                   = -1
anon_7                   = 0

Across many eggs only anon_7 changes from 0 to -1.

After a bit of testing, only eggs with anon_7 == -1 hatch.
Title: Re: DFHack 0.34.11 r1
Post by: vjek on July 18, 2012, 11:30:33 am
Heh I'm completely new to lua and am only mildly experienced in Python as my only programming background, but I've been spending a couple days straining my eyes decoding these structures and figuring out why stuff works and what doesn't.  Anyway, finally got a working command to change all your clothing on all your dwarves to 0 wear.

Code: [Select]
--THIS WILL SET ALL YOUR DWARVES' EQUIPMENT TO NO WEAR
for k,v in ipairs(df.global.world.items.all) do
if v.flags.owned and (v:getType() >= 25 and v:getType() <= 29 or v:getType() == 58) then
v:setWear(0)
v.wear_timer = 0
end
end

The conditionals for item type checks might not be strictly necessary for wear alone, but I was also tweaking with item quality which breaks on some quality-less item types. But the script here only resets wear and the incrementing timer. If you want max-quality equips too, just add v:setQuality(5) after the wear_timer line.

Note: I don't know how to make it so the equipment doesn't wear ever.  Probably like the modest mod does with setting armor quality to a certain level but this works for me.

Someone else posted a snippet here that did the wear stuff one item at a time so I just had to figure out how to iterate it :P. I think I got the feel for some of it now though.  Thank goodness. Maybe now I can actually play :P.
Just wanted to mention, this has been working well, with one small bug.  Item type 58 is for TOTEMS, while 59 is for PANTS.  I suspect it was just a typo.  In any case, I noticed only the trousers on my dwarves were wearing out, and tracked this down.  Changing the last type from 58 to 59 solved the problem.
Title: Re: DFHack 0.34.11 r1
Post by: ag on July 18, 2012, 01:48:30 pm
Just wanted to mention, this has been working well, with one small bug.  Item type 58 is for TOTEMS, while 59 is for PANTS.  I suspect it was just a typo.  In any case, I noticed only the trousers on my dwarves were wearing out, and tracked this down.  Changing the last type from 58 to 59 solved the problem.

Why use any magic constants, when there are df.item_type.PANTS etc? ;)

Also, I believe setWear actually resets the timer field too - I saw something like that in its disassembly.
Title: Re: DFHack 0.34.11 r1
Post by: Sutremaine on July 18, 2012, 04:25:40 pm
Is there a quickstart guide to the language DFHack uses? I'd like to add a variable to the rejuvenate function so that I can use it on animals without editing the .lua file each time.
Title: Re: DFHack 0.34.11 r1
Post by: peterix on July 18, 2012, 05:46:36 pm
Is there a quickstart guide to the language DFHack uses? I'd like to add a variable to the rejuvenate function so that I can use it on animals without editing the .lua file each time.
Here's one: http://luatut.com/crash_course.html

I'm sure there's more to be found around the net too. Just google for them ;)

The DFHack-specific extensions over base LUA are documented here: https://github.com/peterix/dfhack/blob/master/LUA_API.rst
Title: Re: DFHack 0.34.11 r1
Post by: Hanslanda on July 18, 2012, 11:07:43 pm
Is DFusion not updated for .34.11 yet? When I try to use it, I get errors. One moment and I'll post the exact errors.

Okay, typed in 'dfusion' sans apostraphes, and it gives me this:

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r1
Post by: Warmist on July 19, 2012, 01:11:48 am
Is DFusion not updated for .34.11 yet? When I try to use it, I get errors. One moment and I'll post the exact errors.

Okay, typed in 'dfusion' sans apostraphes, and it gives me this:

Spoiler (click to show/hide)
The fix is still not included in this version. To fix it manualy:
Find this line in dfusion/common.lua, and replace ".text" with "Dwarf Fortress.exe":

Code: [Select]
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")
Title: Re: DFHack 0.34.11 r1
Post by: Hanslanda on July 19, 2012, 09:32:18 pm
Thank you. :)
Title: Re: DFHack 0.34.11 r1
Post by: Dr_Scallion on July 22, 2012, 06:07:54 am
The "friendship" in DFusion doesn't seems to work, too :/

I have some errors messages when I try to enable it...

Title: Re: DFHack 0.34.11 r1
Post by: ptb_ptb on July 22, 2012, 09:46:56 am
Slayrace doesn't seem to be recognized in the DFHack I'm using (that bundled with the LazyNewbPack).  Just in case I'm downloading and installing from the link in the first post.

[EDIT] It's a DFusion thingy? Eh, I'm not sure how to get that to work.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on July 22, 2012, 12:15:07 pm
Slayrace is not part of DFusion - it's a Ruby script, which means it requires the (not yet released) Ruby plugin.
Title: Re: DFHack 0.34.11 r1
Post by: ptb_ptb on July 22, 2012, 01:29:19 pm
Slayrace is not part of DFusion - it's a Ruby script, which means it requires the (not yet released) Ruby plugin.

Ah. That would explain why it didn't work then. Thanks.
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on July 23, 2012, 08:46:46 am
What happened to the dfstatus tool as listed here:
https://github.com/peterix/dfhack/blob/v0.31.25/tools/supported/dfstatus.cpp
Title: Re: DFHack 0.34.11 r1
Post by: telarin on July 23, 2012, 10:05:57 am
Is there any way to get workflow to manage gem cutting? I have tried "workflow amount GEM//GLASS_GREEN 50" to get it to keep 50 cut green glass in stock, and it happily adds the job to workflow, but it cannot see cutting jobs at my jeweler's workshops. Is this another one of those instances like CRAFT where a special case would need to be added to workflow, or is there a different item designation I should be using?
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on July 23, 2012, 10:52:25 am
Just bashed up a quick script to replace dfstatus:

Code: [Select]
function exitem()
local item = dfhack.gui.getSelectedItem()
if(item) then
if(item.flags.owned) then
print ("OWNED")
end
printall(item)
printall(item.itemrefs)
local itemClass = item:getType()
print("---------")
print(itemClass,df.item_type[itemClass])
print("---------")
print(item:getSubtype())
print("---------")
print(item:getMaterial())
print(item:getMaterialIndex())
print("-- df.global")
printall(df.global.world.raws.inorganics[168])
--print("-----")
--printall(dfhack.matinfo)
print("----- decode")
printall(dfhack.matinfo.decode(item).material)
print("----- find")
printall(dfhack.matinfo.find("COAL"))
print("-----")
print(dfhack.items.getDescription(item,-1,false))
print("-----gettoken")
printall(dfhack.matinfo.getToken(item))
end
local drinks=0
local drink=0
local roasts=0
local roastMeals=0
local meat=0
local meatMeals=0
local ironB=0;
local pigIronB=0;
local steelB = 0;
local mithB=0
local wmithB=0
local goldB=0
local silverB=0
local copperB=0
local bronzeB=0
local cokeB=0

local iron=dfhack.matinfo.find("IRON").index
local pigIron=dfhack.matinfo.find("PIG_IRON").index
local steel=dfhack.matinfo.find("STEEL").index
local mith=dfhack.matinfo.find("MITHRIL").index
local wmith=dfhack.matinfo.find("PATTERN_MITHRIL").index
local gold=dfhack.matinfo.find("GOLD").index
local silver=dfhack.matinfo.find("SILVER").index
local copper=dfhack.matinfo.find("COPPER").index
local bronze=dfhack.matinfo.find("BRONZE").index
local coke=dfhack.matinfo.find("COAL").type

for k,v in ipairs(df.global.world.items.all) do
if(v:getType()==df.item_type.DRINK) then
drinks = drinks + v.stack_size
drink= drink+1
elseif(v:getType() == df.item_type.FOOD) then
roastMeals = roastMeals + v.stack_size
roasts= roasts+1
elseif(v:getType() == df.item_type.MEAT) then
meatMeals = meatMeals + v.stack_size
meat= meat+1
elseif(v:getType() == df.item_type.BAR) then
if(v:getMaterialIndex()==iron) then
ironB=ironB+1
elseif(v:getMaterialIndex()==pigIron) then
pigIronB=pigIronB+1
elseif(v:getMaterialIndex()==steel) then
steelB=steelB+1
elseif(v:getMaterialIndex()==mith) then
mithB=mithB+1
elseif(v:getMaterialIndex()==wmith) then
wmithB=wmithB+1
elseif(v:getMaterialIndex()==gold) then
goldB=goldB+1
elseif(v:getMaterialIndex()==silver) then
silverB=silverB+1
elseif(v:getMaterialIndex()==copper) then
copperB=copperB+1
elseif(v:getMaterialIndex()==bronze) then
bronzeB=bronzeB+1
elseif(v:getMaterial()==coke) then
cokeB=cokeB+1
end
end
end

print("Drinks",drink,drinks)
print("Food",roasts,roastMeals)
print("Meat",meat,meatMeals)

print("Iron Bars",ironB)
print("Pig Iron Bars",pigIronB)
print("Steel Bars",steelB)
print("Mithril Bars",mithB)
print("W Mithril Bars",wmithB)
print("Gold Bars",goldB)
print("Silver Bars",silverB)
print("Copper Bars",copperB)
print("Bronze Bars",bronzeB)
print("Coke Bars",cokeB)
end
exitem()

caveats:
1) Yes, I am running Masterwork.
2) the stuff in the first if is how I examined the items to get the right flags - It is not the prettiest part of the code but it worked.
3) save this to exitem.lua in your df/hack/scripts directory and then type exitem at the dfhack prompt.
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on July 26, 2012, 08:22:58 am
Testing, Testing, is this thing on?

Are there any other items that it would be useful to count in a status list?


Even better question: what makes a dwarf not want to put on their uniform.  Two of the king's guards won't wear anything other than 2 gauntlets and a set of greaves (!).  The other folks in their squads are doing just fine.  I am hoping this is just a stat I can set.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on July 26, 2012, 09:27:16 am
what makes a dwarf not want to put on their uniform.  Two of the king's guards won't wear anything other than 2 gauntlets and a set of greaves (!).  The other folks in their squads are doing just fine.
Are they wearing other clothes (which might get in the way of putting on additional armor)?
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on July 26, 2012, 10:41:19 am
the little buggers are taking off their clothes and storing them in their cabinents, then getting 2 gauntlets and some leggings to wear... very strange.
Title: Re: DFHack 0.34.11 r1
Post by: Raufgar on July 26, 2012, 11:26:41 am
the little buggers are taking off their clothes and storing them in their cabinents, then getting 2 gauntlets and some leggings to wear... very strange.

Well, if one of them buggers starts grabbing lotsa cloaks, hoods and mittens, you've got a new Dungeon Master (http://dwarffortresswiki.org/index.php/40d:Dungeon_master) on your hands :D
Title: Re: DFHack 0.34.11 r1
Post by: Mr S on July 26, 2012, 12:07:57 pm
Or, they may just be Spartan, in which case the buggering IS part of the sparring.

I'll just leave that there.
Title: Re: DFHack 0.34.11 r1
Post by: parlor_tricks on July 27, 2012, 12:42:41 am
Hey: I'd like to take over a human fort which I have found in adventure mode, adventuring as a dwarf.

So far I've tried the mode set system mentioned on the SA forums, and read through the earlier posts here as well, yet the game crashes once I switch to fortress mode and unpause.

This is possibly because after the mode shift, citizens at the site are 0 - all the humans and the adventurer count as others.  Some of whom are hostile. (Changing the resident tag should fix this)

I've been trying to figure out site_id s and civ_id s and see if the issue is there, (hence discovering lua :P).

Despite everyone having the same civ_id, and then forcing the resident flag to false, they still stay as "others".


Also, can anyone explain why the resident flag should be set to false? I would assume that it should be set to true - "does unit reside at site? true"

Any suggestions on what I can do to fix this?


Also: Thanks for the great body of work done on Df Hack by the creator and contributors!
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on July 27, 2012, 09:50:03 am
RE: Dwarves not equiping their uniforms.
Off topic (a bit) but I started this question here so I thought I would provide my research and solution.

I have been using the splintermind version of DT to assign my dwarves to squads.  There seems to be a problem where you can't go to the (M)ilitary screen and remove a dwarf from a squad.  I have to go the the dwarf himself, us v->p->x to remove him from the squad.  Notice in the military screen that the dwarf is still in the squad.  Save the game.  Reload.  Look at the military screen and see the dwarf is now out of the squad.  Then I can reassign the dwarf to a squad and he will go get his stuff.  I am using my "fixnaked" script to find dwarves with "naked" thoughts to find dwarves that need fixing.  Just to keep things on topic, here is my script:

Code: [Select]
function fixnaked()
local total_fixed = 0
local total_uncovered = 0
local total_noshirt = 0
local total_noshoes = 0

for fnUnitCount,fnUnit in ipairs(df.global.world.units.all) do
    if fnUnit.race == df.global.ui.race_id then
local listEvents = fnUnit.status.recent_events
--for lkey,lvalue in pairs(listEvents) do
-- print(df.unit_thought_type[lvalue.type],lvalue.type,lvalue.age,lvalue.subtype,lvalue.severity)
--end

local found = 1
local fixed = 0
while found == 1 do
local events = fnUnit.status.recent_events
found = 0
for k,v in pairs(events) do
if v.type == 109 then
events:erase(k)
found = 1
total_uncovered = total_uncovered + 1
fixed = 1
break
end
if v.type == 110 then
events:erase(k)
found = 1
total_noshirt = total_noshirt + 1
fixed = 1
break
end
if v.type == 111 then
events:erase(k)
found = 1
total_noshoes = total_noshoes + 1
fixed = 1
break
end
end
end
if fixed == 1 then
total_fixed = total_fixed + 1
print(total_fixed, total_uncovered+total_noshirt+total_noshoes,dfhack.TranslateName(dfhack.units.getVisibleName(fnUnit)))
end
end
end
print("thought 109 = "..df.unit_thought_type[109])
print("thought 110 = "..df.unit_thought_type[110])
print("thought 111 = "..df.unit_thought_type[111])
print("Total Fixed: "..total_fixed)
print("Total thoughts removed: "..total_uncovered)
print("Total thoughts removed: "..total_noshirt)
print("Total thoughts removed: "..total_noshoes)

end
fixnaked()

yup, a repost but it is a nice script for mood fixing.
Title: Re: DFHack 0.34.11 r1
Post by: DrStalker on July 28, 2012, 08:03:30 am
Where is the best place to get details on the various functions and attributes that can be manipulated with dfusion LUA scripting, and is there any good repository of sample scripts?  I can see scripts scattered through this thread but that's not a great way to hunt for information.

Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on July 28, 2012, 08:19:21 am
well there's the old dfusion threads, and dfusion entry in DFwiki, or asking for a script here would lead to the creator/someone reposting it.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on July 28, 2012, 09:54:48 am
Use the interactive lua mode and the "print" and "printall" functions. printall(df.global) is a good place to start.
Title: Re: DFHack 0.34.11 r1
Post by: Argelle on July 29, 2012, 08:35:13 am
Hello there :)
I've got a crash of DF 34.11 (it's repeatable) when using the "sort-units name" comand from DFhack onto the list of animals to assign to a built cage.
Code: [Select]
Signature du problème :
  Nom d’événement de problème: APPCRASH
  Nom de l’application: Dwarf Fortress.exe
  Version de l’application: 0.0.0.0
  Horodatage de l’application: 4fcc9488
  Nom du module par défaut: Dwarf Fortress.exe
  Version du module par défaut: 0.0.0.0
  Horodateur du module par défaut: 4fcc9488
  Code de l’exception: c0000005
  Décalage de l’exception: 003c7f94
  Version du système: 6.1.7600.2.0.0.256.48
  Identificateur de paramètres régionaux: 1036
  Information supplémentaire n° 1: 0a9e
  Information supplémentaire n° 2: 0a9e372d3b4ad19135b953a78882e789
  Information supplémentaire n° 3: 0a9e
  Information supplémentaire n° 4: 0a9e372d3b4ad19135b953a78882e789
Is this the right place to report this?
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on July 29, 2012, 09:25:02 pm
Hey: I'd like to take over a human fort which I have found in adventure mode, adventuring as a dwarf.

So far I've tried the mode set system mentioned on the SA forums, and read through the earlier posts here as well, yet the game crashes once I switch to fortress mode and unpause.

This is possibly because after the mode shift, citizens at the site are 0 - all the humans and the adventurer count as others.  Some of whom are hostile. (Changing the resident tag should fix this)

I've been trying to figure out site_id s and civ_id s and see if the issue is there, (hence discovering lua :P).

Despite everyone having the same civ_id, and then forcing the resident flag to false, they still stay as "others".


Also, can anyone explain why the resident flag should be set to false? I would assume that it should be set to true - "does unit reside at site? true"

Any suggestions on what I can do to fix this?


Also: Thanks for the great body of work done on Df Hack by the creator and contributors!

okay first issue is fort mode can only work on player fort sites you need to change the site into a player one.
second if you notice in fort mode normally resident flag is false on your dwarves. having it off returns them to a dwarf fortress citizen though you need to have the civ number to be the same as the fort you're playing on.
third if you want to take over you need to embark over the site and toggle resident for your adventurer.
Fourth you might need to run dfusion's friendship or change the fort control race to the type you want to control.
Title: Re: DFHack 0.34.11 r1
Post by: Replica on July 30, 2012, 12:52:02 pm
Appearently finding magma of any kind with "reveal" enabled breaks the game and makes it impossible for you to build magma powered workshops and furnaces.

Anyone else had this kind of problem before?
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on July 30, 2012, 01:14:36 pm
Appearently finding magma of any kind with "reveal" enabled breaks the game and makes it impossible for you to build magma powered workshops and furnaces.

Anyone else had this kind of problem before?
It's a well-known issue, enough so that I wrote the feature plugin specifically to fix it. Type "feature list" to get a list of all map features, then type "feature show [n]" to mark that feature as 'discovered'. Discovering a magma-related map feature is what allows you to build magma workshops, and discovering a cavern layer is what allows its plants to start growing within your fortress.
Title: Re: DFHack 0.34.11 r1
Post by: peterix on August 03, 2012, 05:25:49 am
Hello there :)
I've got a crash of DF 34.11 (it's repeatable) when using the "sort-units name" comand from DFhack onto the list of animals to assign to a built cage.
Is this the right place to report this?
I can't reproduce this with a fresh embark. Can you upload your fort somewhere?
Title: crash with DFHack 0.34.11 r1
Post by: Argelle on August 03, 2012, 07:09:37 am
Thanks for looking at it, peterix. I'll just reproduce the crash with this save http://dl.free.fr/uHLK8vBbS (same fortress as my initial message, but older). I'll also paste an screenshot before the crash: I used the cage to set a gobelin inside. It crash on the second attempt ("Q" on cage, "a" assign, switch to DF hack "sort by...").

DF 34.11
DT splinter's 16
Phoebus graphic for 34.11
DFHack 34.11 r1
Win 7, 32 bits

(http://tof.canardpc.com/preview/3572e87c-6cf4-4917-84af-0a96355c3543.jpg) (http://tof.canardpc.com/view/3572e87c-6cf4-4917-84af-0a96355c3543.jpg)
Title: Re: crash with DFHack 0.34.11 r1
Post by: peterix on August 03, 2012, 09:17:53 am
Thanks for looking at it, peterix. I'll just reproduce the crash with this save http://dl.free.fr/uHLK8vBbS (same fortress as my initial message, but older).
It should be fixed in the next release :)
Title: Re: DFHack 0.34.11 r1
Post by: pokeinstein on August 04, 2012, 07:04:31 pm
hello im new to df and i recently installed dfhack but when i start it up and use the stonesense command a screen pops up with the stonesense logo and does nothing when i go back to the game and open a world i get this error

stonesense\buildings\shop.xml: Is generic - game_subtype missing.: building <line 5>
stonesense\buildings\Blueprint.xml: <building> Is generic - game_subtype missing .:building <line 5>
Cannot load image: stonesense: stonesense\vegetation\DT_trees\trees.png
Failure in reading stonesense: stonesense\vegetation\DT_trees\dt_trees.xml
stonesense shutdown.

i installed it like it said in the instructions and everything else seems to work any assistance would be appreciated
Title: Re: DFHack 0.34.11 r1
Post by: DrStalker on August 05, 2012, 06:54:54 am
Here is a little script to reset the "Created an Artifact" flag on all dwarves:

Code: [Select]
-- Reset the flag that indicates a dwarf had previously been moody
-- Written by DrStalker 20120805

local count_had_mood=0
local count_total=0

for fnUnitCount,fnUnit in ipairs(df.global.world.units.all) do
if fnUnit.race == df.global.ui.race_id then
--    if fnUnit.race == df.global.ui.race_id then
count_total=count_total+1
if fnUnit.flags1.had_mood==true then
count_had_mood=count_had_mood+1
print ("had_mood flag detected; clearing")
fnUnit.flags1.had_mood=false

end
end
end

print (count_had_mood.." ouf of "..count_total.." dwarves had been moody")

Does anyone know how to change the counter for the next mood?  The wiki talks about an internal counter that starts at 1000 and goes down by 1 every 100 ticks, but I can't this anywhere (including snooping with Cheat Engine)

Title: Re: DFHack 0.34.11 r1
Post by: Helgoland on August 05, 2012, 11:40:39 am
Hi,
Is there a way to find out what weather your current evil biome has? The 'feature' thing, perhaps?
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 05, 2012, 11:48:39 am
Does anyone know how to change the counter for the next mood?  The wiki talks about an internal counter that starts at 1000 and goes down by 1 every 100 ticks, but I can't this anywhere (including snooping with Cheat Engine)
Try df.global.ui.mood_cooldown.

Hi,
Is there a way to find out what weather your current evil biome has? The 'feature' thing, perhaps?
We don't know how the game keeps track of region-specific weather, but we do know that it has nothing to do with map features.
Title: Re: DFHack 0.34.11 r1
Post by: DrStalker on August 06, 2012, 03:05:19 pm
Thanks Quietust.

How do I add entries into an array?  For example, I have two items:

Code: [Select]
[lua]# printall(df.global.world.artifacts.all[0].item.itemrefs)
0                        = <general_ref_is_artifactst: 0x15f1d720>
1                        = <general_ref_contained_in_itemst: 0x15f1d740>
[lua]# printall(df.global.world.artifacts.all[6].item.itemrefs)
0                        = <general_ref_contained_in_itemst: 0x1c349be0>

How do I add an extra entry to df.global.world.artifacts.all[6].item.itemrefs?  Trying to just create without doing anything special doesn't work:

Code: [Select]
[lua]# df.global.world.artifacts.all[6].item.itemrefs[1]=general_ref_is_artifactst
(interactive):1: Cannot write field vector<general_ref*>.1: index out of bounds.

Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 06, 2012, 03:25:05 pm
First of all, that's a vector, not an array, so you need to use :insert(index,value) to add new stuff.

Second, you need to create a new object when inserting it - df.general_ref_is_artifactst:new(). Once you create it, you'll then have to actually populate its artifact ID.
Title: Re: DFHack 0.34.11 r1
Post by: xavious on August 07, 2012, 07:13:27 pm
Is it possible to edit an adventurers skills and if so, how? I lost all my skill in reading and I've been trying to find a way to restore it.

Sorry for the noob questions. I'm new to modding and not quite sure where to begin on my own.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 07, 2012, 07:32:12 pm
Yes, it is possible. Exactly how, I don't recall - search through this thread and you should find something (there's a "brainwash"-type script which alters skills).
Title: Re: DFHack 0.34.11 r1
Post by: assasin on August 08, 2012, 07:55:06 am
everytime i use the dfusion easy_embark is crashes and shuts down. Yet I've read somewhere its one of the few things that works. Can anyone help?

edit-typo
Title: Re: DFHack 0.34.11 r1
Post by: assasin on August 09, 2012, 01:32:24 am
just to confirm, this is to get different numbers of dwarves on embark in dfusion. and theres no bugs in th coding if it is.

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r1
Post by: Warmist on August 09, 2012, 04:36:18 am
just to confirm, this is to get different numbers of dwarves on embark in dfusion. and theres no bugs in th coding if it is.

Spoiler (click to show/hide)

Did you try this?:
The fix is still not included in this version. To fix it manualy:
Find this line in dfusion/common.lua, and replace ".text" with "Dwarf Fortress.exe":

Code: [Select]
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")

Also small change:
Spoiler (click to show/hide)
It does not work with less than 7 dwarves, small hack is not sufficient to account for whatever DF does with those dwarves...
Title: Re: DFHack 0.34.11 r1
Post by: assasin on August 09, 2012, 10:26:43 pm

Quote from: assasin on Today at 01:32:24 am

just to confirm, this is to get different numbers of dwarves on embark in dfusion. and theres no bugs in th coding if it is.



Spoiler (click to show/hide)



















Did you try this?:


Quote from: Warmist on July 19, 2012, 01:11:48 am

The fix is still not included in this version. To fix it manualy:


Quote from: ag on June 25, 2012, 02:13:47 am

Find this line in dfusion/common.lua, and replace ".text" with "Dwarf Fortress.exe":


Code: [Select]
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")




Also small change:


Spoiler (click to show/hide)
















thanks
Title: Re: DFHack 0.34.11 r1
Post by: DrStalker on August 10, 2012, 12:13:10 am
I'm starting to build a little library of minor scripts (make everyone happy, control who gets the next mood, convert all iron to steel, that sort of thing)

Where is the best place to upload them so others can use them as a reference?  So far the only script collection I've found has been vjek's userpage on the wiki.


Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on August 10, 2012, 01:09:28 am
I usually dump my collection in either Dfusion's thread or make a pastebin dump.
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on August 10, 2012, 08:43:54 am
I'm starting to build a little library of minor scripts (make everyone happy, control who gets the next mood, convert all iron to steel, that sort of thing)

Where is the best place to upload them so others can use them as a reference?  So far the only script collection I've found has been vjek's userpage on the wiki.
You could fork the github repository, add your files and submit a pull request to the project.
Title: Re: DFHack 0.34.11 r1
Post by: ASnogarD on August 11, 2012, 02:56:13 pm
Probably been mentioned but just in case...

I use DFHACK with the Lazy Newb Pack, when I run DF from the pack it starts dfhack properly, then I run Stonesense with no issue.
The issue is with the DF's Hotkeys, for some reason the Hotkeys names are typed as commands in dfhack... I am sure this is not intended.

software running :

Win7 64 bit
DF 34.11
DFHack 34.11.r1
Lazy Newb Pack v 13

from the pack I use Therepist and Soundsense.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 11, 2012, 03:44:33 pm
Known issue - can't remember whether or not it's been fixed.
Title: Re: DFHack 0.34.11 r1
Post by: peterix on August 11, 2012, 05:41:06 pm
Heh. It's not a bug, it's a feature ;)

Anyway, making it look for some prefix character to accept the hotkey as command could be better.

Something like
Code: [Select]
:commandwould be recognized, while
Code: [Select]
commandwouldn't.
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on August 13, 2012, 01:44:58 pm
I'm having some trouble figuring out how to pass arguments to lua scripts from DFHack. Here's what I've tried:

In DFHack:
Code: [Select]
myScriptNameWithoutDotLua doom1 doom2

Code: [Select]
print('print ...');
print(...)
print('printall ...');
printall(...);
--print('print ...[0]');
--print(...[0]); --this line causes a syntax error
local bob = ...;
local jim = ...;
print('print bob');
print(bob);
print('printall bob');
printall(bob);
print('print jim');
print(jim);
print('printall jim');
printall(jim);

Output:
Code: [Select]
print ...
doom1   doom2
printall ...
print bob
doom1
printall bob
print jim
doom1
printall jim

How do I access the arguments other than the first? "quasivariable" doesn't show up in any LUA documentation I can find.
Title: Re: DFHack 0.34.11 r1
Post by: Warmist on August 13, 2012, 02:09:58 pm
I'm having some trouble figuring out how to pass arguments to lua scripts from DFHack. Here's what I've tried:
<...>
How do I access the arguments other than the first? "quasivariable" doesn't show up in any LUA documentation I can find.
I think it was
Code: [Select]
local stuff={...}
local first=stuff[1]
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on August 13, 2012, 02:29:09 pm
Thanks, that worked!
Title: Re: DFHack 0.34.11 r1
Post by: Snateraar on August 15, 2012, 04:59:01 am
Hello,
I just removed an older version of DFHack from 0.34.10 according to the original post, then installed the latest version.
Yet when I try to use certain commands(such as slayrace) it says the command is not recognized.
Do these commands only work for 34.11, or didn't I uninstall it properly?

I am using 34.10 because the tileset hasn't updated to .11 yet, by the way.
Title: Re: DFHack 0.34.11 r1
Post by: Rose on August 15, 2012, 05:40:38 am
You're using an older version, yes.

And your tileset probably doesn't need to be upgraded, because it's already compatible.
Title: Re: DFHack 0.34.11 r1
Post by: MightyDorf on August 15, 2012, 06:59:14 am
Hello. I have an issue with the dfhack's fonction "reveal/unreveal". I think I saved my game while the "reveal" fonction was on. I closed DF last night and re-opened it today. The map was still revealed, but when I try to revert it, it doesn't work. DFhack says : "there's nothing to revert !", whereas the map is revealed. Is there a way to revert it into its normal state ?
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on August 15, 2012, 07:35:38 am
You can probably do it with revflood. If you haven't opened up the caverns, it'll be exactly what you want. If you have, it'll also reveal the caverns.
Title: Re: DFHack 0.34.11 r1
Post by: MightyDorf on August 15, 2012, 08:09:33 am
It works, thank you very much.  :D
Title: Re: DFHack 0.34.11 r1
Post by: Altaree on August 15, 2012, 09:11:23 am
How do you look at the stats of a caste?  I have been able to find the element on a unit where the id of the caste is stored. I can't figure out how to get to the definition of the caste so that I can get things like name and how the caste changes physical/mental attributes.

Thanks!
Title: Re: DFHack 0.34.11 r1
Post by: Iceflame on August 17, 2012, 01:58:13 am
Is there a way to modify the happyness of my dwarfes?
I need to do some testing, and this would save massive amounts of time.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 17, 2012, 06:16:22 am
Is there a way to modify the happyness of my dwarfes?
I need to do some testing, and this would save massive amounts of time.
Yes - add some happy thoughts or delete their unhappy thoughts. Simply setting the "happiness" value will not work, since that gets recalculated whenever a new thought happens.
Title: Re: DFHack 0.34.11 r1
Post by: Iceflame on August 17, 2012, 07:19:58 am
Tis exactly looks like what I need. Thanks.
Now I just have to figure out the 'how'
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on August 17, 2012, 09:29:05 am
If you're just testing stuff, you could just give them [NOEMOTION].
Title: Re: DFHack 0.34.11 r1
Post by: vjek on August 17, 2012, 09:44:05 am
Tis exactly looks like what I need. Thanks.
Now I just have to figure out the 'how'

This works for very happy/stable dwarves:

Spoiler (click to show/hide)

That's a cut/paste out of my brainwash script.
Title: Re: DFHack 0.34.11 r1
Post by: Mapleguy555 on August 18, 2012, 10:59:41 pm
No more df2minecraft?
D:
Title: Re: DFHack 0.34.11 r1
Post by: Rose on August 18, 2012, 11:02:49 pm
DF2Minecraft needs a complete re-write from the ground up.
Title: Re: DFHack 0.34.11 r1
Post by: Greendogo on August 19, 2012, 12:13:33 am
Hey, just to make sure I didn't make an untrue conjecture/statement somewhere else, can DFHack be used to pass all of DF's menu and GUI commands back to DF from another program?  For a very specific example, could someone alter Stonesense (or another visualizer) so that you could lay a mining designation from the Stonesense application, and then automatically pass that information back to DF without switching back to it?
Title: Re: DFHack 0.34.11 r1
Post by: Meph on August 19, 2012, 12:57:18 am
Hey guys,

I think it would be possible to write a dfhack plugin that run scripts automatically by reading the gamelog. So if I would say... do a reaction in the temple that is called: Invoke the spell of insight, and the gamelog says: dwarf1 has transformed into a dwarf struck by a vision... and dfhack reads that in the gamelog, and automatically runs reveal, and after 30 secons unreveal, than that would be awesome. Using dfhack as a game-feature :)

I just need a friendly dfhack-developer that know about lua-plugins to cooperate with me, to write a handful of scripts/spells/prayers. Please let me know if the idea is realistic, and if someone has interest in helping out :)
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on August 19, 2012, 07:49:42 am
You can certainly have the script run every so often (based on number of ticks, unpaused ticks, days, months, or years) and check, but that would kill your framerate. I don't think there's an event for the announcements yet, but it should be possible.

Edit: it probably wouldn't kill your framerate. You can do something like this:

Code: [Select]
dfhack.timeout(1,'days',functionName);
where functionName checks the announcements list for the event you want. Make sure to reregister the function inside it or it'll only get called once.
Title: Re: DFHack 0.34.11 r1
Post by: Rose on August 19, 2012, 08:52:26 am
There are already plugins that do checks every frame or so, and have no appreciable effect on FPS.
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on August 19, 2012, 09:51:00 am
I think warmist and I have been working on functions that did this for most of last year to this year, kinda stop when DFhack swallowed dfusion and had to rewrite most of the old code, though now this just means recreating the on function. hey looks like I just found the "func.PrintMessage_()" function warmist work on before jumping on the on function function. if I'm luckly I can set up commands that will check if the game internally and send out a message into the game. This means I can set up hotkeys then code in the game to prompt that hotkey is pressed through dfuse.
Title: Re: DFHack 0.34.11 r1
Post by: Meph on August 19, 2012, 04:50:27 pm
Thanks, so it is possible. So all I need is to give a keyword and the script will find it ?

In my example I said "transformed into a dwarf struck by a vision" and as soon as "vision" appears in the gamelog, the script runs? I would still very much like to ask someone to write this for me, I only have a netbook and not much time at hand. Otherwise I do it myself in a few weeks, when I am back at a PC. I would just give a small list of keywords and the effect/script that should be run. I hope it doesnt take too much of your time.
Title: Re: DFHack 0.34.11 r1
Post by: terkiey on August 19, 2012, 05:12:33 pm
Is anyone getting problems where this is found to be a trojan dropper?
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 19, 2012, 08:04:39 pm
Thanks, so it is possible. So all I need is to give a keyword and the script will find it ?

In my example I said "transformed into a dwarf struck by a vision" and as soon as "vision" appears in the gamelog, the script runs?
If you want to detect stuff in the gamelog, it's probably easier to just look in world.status.reports and/or world.status.announcements (i.e. get it directly from the Announcements screen).
Title: Re: DFHack 0.34.11 r1
Post by: Rose on August 19, 2012, 08:17:45 pm
That said, if you are worried about speed issues, you may want to write the plugin directly in C++, rather than lua, but somebody who knows more than me on the subject would have to verify that.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 19, 2012, 10:02:06 pm
As an example of how long things take to do in Lua, I wrote a simple "reveal" script and ran it on a 4x4 embark with 88 Z-levels. On my system (Core 2 Quad 2.4GHz), it took 1 minute and 6 seconds to reveal the entire map, while DFHack's "reveal" plugin (written in C++) takes a tiny fraction of a second even though it does even more stuff (checking each map block for local features [adamantine tubes] and global features [Hell] to see if it's safe to reveal, and saving a backup copy of every single tile's 'hidden' state for the "unreveal" command).

Code: [Select]
for i,j in pairs(df.global.world.map.map_blocks) do
    for x=0,15 do
        for y=0,15 do
            j.designation[x][y].hidden = 0
        end
    end
end
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on August 19, 2012, 10:16:03 pm
Yes, C++ is faster, but also more difficult.

Meph: I'll look into it and we'll see how far I get. No promises about having time to work on it in the future, but I'll try.
Title: Re: DFHack 0.34.11 r1
Post by: ag on August 20, 2012, 02:09:13 am
The best balance is probably C++ for stuff that needs to do a lot of boring work quickly, and lua for controlling what to do and when. Here it may be a c++ plugin that monitors logs, and then invokes a lua callback once it finds something.

P.S. In that reveal example above, I suspect a large percent of the time is memory allocation and garbage collection - it creates tons and tons of wrapper objects around native structures.
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on August 20, 2012, 04:40:06 am
okay so with onfunction you can hook up a function to a callback ie

Code: [Select]
onfunction.SetCallback("ReactionFinish",Reaction)
though this means you only get 1 function per callback, though you could set up a function folder to store all the other functions you want to hook up to the callback ie
Code: [Select]
function Reactionfolder()
     spawndog
     spawncat
     teleport
     transmuteitem
end

onfunction.SetCallback("ReactionFinish",Reactionfolder)

dfusion will read the folder and do all the functions in said folder when ever someone finish a reaction. so combine this with dfuse hotkeys and you can have dfusion onfunctions running behind the scenes with little use of looking at dfusion or dfhack.
 

oh wait looks like I'm wrong both onfunction and triggers are severely outdated
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 21, 2012, 09:21:15 pm
Some exciting new stuff has been added to DFHack over the past few days - thanks to angavrilov, it's now possible to override virtual methods on classes, and some new helper code has been added for manipulating the screen buffers. So far, 3 tools have been written making use of this:

1. A simple development plugin which overrides viewscreen_titlest::render() in order to superimpose the DFHack version on the title screen.
2. A Lua script which, when triggered under the appropriate circumstances (in Dwarf mode, using the [q] cursor, and hovering over a lever or a triggerable building), creates an overlay which lets you browse which buildings are linked to a particular lever (or which levers are linked to a particular building, depending on what you selected).
3. A plugin which hooks viewscreen_unitlistst::feed(...) and checks for presses of the [l]abors key (as used from the [v] cursor), at which point it opens a new viewscreen which implements a very simple (and currently incomplete) Therapist-style labor manager within Dwarf Fortress itself.

Stay tuned for further developments.
Title: Re: DFHack 0.34.11 r1
Post by: vjek on August 21, 2012, 10:48:14 pm
... 2. A Lua script which, when triggered under the appropriate circumstances (in Dwarf mode, using the [q] cursor, and hovering over a lever or a triggerable building), creates an overlay which lets you browse which buildings are linked to a particular lever (or which levers are linked to a particular building, depending on what you selected). ...

The other two are nifty, but that one right there is a big ol' bag of AWESOME-SAUCE!
Well done!
Title: Re: DFHack 0.34.11 r1
Post by: DoctorOr on August 22, 2012, 04:24:25 am
Is there a way to set designations (digging, channeling, etc) from lua?
Title: Re: DFHack 0.34.11 r1
Post by: Rose on August 22, 2012, 04:26:37 am
There is, but if you want to do lots of them, it's better to write a plugin for whatever you're trying to do.
Title: Re: DFHack 0.34.11 r1
Post by: DoctorOr on August 22, 2012, 05:41:50 am
It's more about getting all the fiddly bits correct than about any mass designations that would take awhile. Plus, I don't have a windows build environment, or a linux game environment.

So how is it done in lua? I was unable to find a way in the documentation.
Title: Re: DFHack 0.34.11 r1
Post by: Warmist on August 22, 2012, 07:31:45 am
Some exciting new stuff has been added to DFHack over the past few days - thanks to angavrilov, it's now possible to override virtual methods on classes, and some new helper code has been added for manipulating the screen buffers. So far, 3 tools have been written making use of this:

1. A simple development plugin which overrides viewscreen_titlest::render() in order to superimpose the DFHack version on the title screen.
2. A Lua script which, when triggered under the appropriate circumstances (in Dwarf mode, using the [q] cursor, and hovering over a lever or a triggerable building), creates an overlay which lets you browse which buildings are linked to a particular lever (or which levers are linked to a particular building, depending on what you selected).
3. A plugin which hooks viewscreen_unitlistst::feed(...) and checks for presses of the [l]abors key (as used from the [v] cursor), at which point it opens a new viewscreen which implements a very simple (and currently incomplete) Therapist-style labor manager within Dwarf Fortress itself.

Stay tuned for further developments.

Cool progress!
Title: Re: DFHack 0.34.11 r1
Post by: Mr S on August 22, 2012, 08:08:30 am
Wholeheartedly agree with vjek about the industrial grade awesome-sauce dripping all over this development.

Also, allow me to offer my thanks to the countless hours spent adding !!FUN!! by the bushel basket by all of the DFHack developers.  My Kitten Ichor coated -<*Pig Tail Fiber Cap*>- goes off to all of you!
Title: Re: DFHack 0.34.11 r1
Post by: Rose on August 23, 2012, 03:59:56 am
3. A plugin which hooks viewscreen_unitlistst::feed(...) and checks for presses of the [l]abors key (as used from the [v] cursor), at which point it opens a new viewscreen which implements a very simple (and currently incomplete) Therapist-style labor manager within Dwarf Fortress itself.

Stay tuned for further developments.
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r1
Post by: espenhw on August 23, 2012, 04:23:35 am
Good news, everyone!

After much rigamarole and trying various options, we finally have a build of DFHack for Mac OS X that should work for most people.

You can get it here for now (http://topazgryphon.org/~tcollett/df/dfhack-0.34.11-r1-Darwin.zip).

Please try it out, and let us know if it works for you.


Returning to DF after a long hiatus, this is ... like ... the best news EVER!   :)

This build works fine for me (MBPro with 10.7.4)
Title: Re: DFHack 0.34.11 r1
Post by: Aerval on August 23, 2012, 12:04:20 pm
@Japa amazing, true dwarf fortress style.

Some exciting new stuff has been added to DFHack over the past few days - thanks to angavrilov, it's now possible to override virtual methods on classes, and some new helper code has been added for manipulating the screen buffers.
Does this mean you finally could translate the in game menues by overriding them? I mean thats was has been asked so very often...
Title: Re: DFHack 0.34.11 r1
Post by: Rose on August 23, 2012, 12:25:40 pm
translating the menus would mean re-making every single one, because we can't modify existing screens, only add new ones.

And it's not dwarf-fortress style, it's a hacked-in ingame menu.
Title: Re: DFHack 0.34.11 r1
Post by: Aerval on August 23, 2012, 08:27:55 pm
Nala, Gorzad, Runti, Durar, Chalo, Nalraka, Belisch, Durni, Dwinina, Gilunn, Thorin, Caltri, Gruala, Balak, Munnos  and Boflin: This and many more (total of 2200 female and 2200 male) first names can be generated with the following lua script, providing every Dwarf with an individual Name.

Why this?
->More remarkable Dwarven Names (not every fourth Dwarf is called "Inod" but every 4000th)
->Gender distinguishable by name (female ending on -a, -e or -i)
->easy expandable

Code: [Select]
--Nameparts by http://jtevans.kilnar.com/rpg/dnd/tools/dwarf.php, Aerval
local firstnamepart = {"Ar", "At", "B", "Bal", "Bel", "Bil", "Bof", "Bol", "Bul", "Cal", "Chal", "D", "Dal", "Dor", "Dw", "Far", "Gil", "Gim", "Grun", "Ing", "In", "Kil", "Kl", "Mor", "Nal", "Nor", "Ov", "Th", "Thor", "Thr", "Bar", "Bro", "Dim", "Dru", "Dur", "Dwin", "Fim", "Gar", "Gom", "Gor", "Gri", "Gro", "Gru", "Grun", "Ha", "Har", "Her", "Ket", "Mun", "Rag", "Run", "Sim", "Stor", "Thin", "Ur", "Thar"};
local female_secondpart = {"a", "ala", "ana", "ia", "ila", "ina", "ola", "ona", "goli", "dina", "kka", "e", "fine", "i", "zadi", "ondi", "umma", "undi", "unni", "kona", "gini", "mina", "raka", "bari", "bura", "ili", "rundi", "rimi", "tri", "tria", "gari", "tila", "dria", "nia", "ria", "dri", "ni", "ri", "grima", "ti"};
local male_secondpart = {"aim", "ain", "ak", "ard", "eff", "ip", "ar", "im", "in", "isch", "lin", "hold", "oco", "o", "or", "ur", "gol", "din", "kk", "nos", "ond", "od", "zad", "ond", "um", "und", "unn", "kon", "gin", "min", "on", "rak", "bar", "bur", "il", "rund", "rim", "gar", "til", "grim", "van"};

local dwarfRace = df.global.ui.race_id;
math.randomseed(dwarfRace)
for index,unit in pairs(df.global.world.history.figures) do --Renaming all the historical dwarves
if ( unit.race == dwarfRace ) then
if (unit.sex ~= 0) then
unit.name.first_name = firstnamepart[math.random(#firstnamepart)]..male_secondpart[math.random(#male_secondpart)];
else
unit.name.first_name = firstnamepart[math.random(#firstnamepart)]..female_secondpart[math.random(#female_secondpart)];
end
--unit.name.words[0] = -1;
--unit.name.words[1] = -1;
end
end
for index,unit in pairs(df.global.world.units.all) do --Renaming pretty much everyone else
if ( unit.race == dwarfRace ) then
if (unit.sex ~= 0) then
unit.name.first_name = firstnamepart[math.random(#firstnamepart)] .. male_secondpart[math.random(#male_secondpart)];
else
unit.name.first_name = firstnamepart[math.random(#firstnamepart)].. female_secondpart[math.random(#female_secondpart)];
end
--unit.name.words[0] = -1;
--unit.name.words[1] = -1;
end
end
print("firstnamepart: "..#firstnamepart.."\nfemale: "..#female_secondpart.."\nmale: "..#male_secondpart);

Credits:
expwnent for his DwarvenHeritage script (both scripts can be combined)
http://jtevans.kilnar.com/rpg/dnd/tools/dwarf.php -> Dwarven Name generator
Dfhack and DFusion crew

Title: Re: DFHack 0.34.11 r1
Post by: Helgoland on August 24, 2012, 06:44:59 am
3. A plugin which hooks viewscreen_unitlistst::feed(...) and checks for presses of the [l]abors key (as used from the [v] cursor), at which point it opens a new viewscreen which implements a very simple (and currently incomplete) Therapist-style labor manager within Dwarf Fortress itself.

Stay tuned for further developments.
Spoiler (click to show/hide)
This is a glorious day for all of B12.

But why no Professor Farnsworth reference? "Good news, everyone!"
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on August 24, 2012, 11:07:55 am
Aerval: that script can give inconsistent names for dwarves that are both historical and local. That might cause issues with reclaim or later forts in the same world.
Title: Re: DFHack 0.34.11 r1
Post by: Lyons on August 24, 2012, 09:18:13 pm
Hello all! (first time posting here, long time lurker)

After using the fastdwarf plugin for DFHack after some time, I get the message "Migrants were too nervous to travel to your fortress this season" (Not the exact words, but you get my drift). Has anybody else gotten this message? What's it caused by, and how do I get rid of it?

(Also: I don't know if this is a cause, but I had revealed the map using reveal all, saved the game, and when I went back, everything was revealed, and wouldn't revert after unreveal. Are the migrants too scared of the subterranean creatures that are being detected as present creatures?)
Title: Re: DFHack 0.34.11 r1
Post by: Hesperid on August 25, 2012, 07:30:42 am
Quote
After using the fastdwarf plugin for DFHack after some time, I get the message "Migrants were too nervous to travel to your fortress this season" (Not the exact words, but you get my drift). Has anybody else gotten this message? What's it caused by, and how do I get rid of it?

If your fortress racks up an enormous death-toll and runs out of supplies, the migrant wave generated by factors that attract them (generated wealth etc) can get completely negated and nobody wants to come to your fort. This is different from when you just haven't made enough progress to get new people (the message then is "Your fortress failed to attract any migrants this season.")

So this is a normal game feature. How it could be caused by fastdwarf I have no idea, but there it is. It's not a message that's actually generated by fastdwarf or DFhack though.
Title: Re: DFHack 0.34.11 r1
Post by: LoSboccacc on August 27, 2012, 03:54:55 am
is there a command to unhide missing dwarf bodies?

I have three that died, became ghost and got memorialized, but I'm curious as where it happened because I've sent my woodchopper to clean trees everywhere from caverns to mountains and they did not found any body.

Spoiler (click to show/hide)

Title: Re: DFHack 0.34.11 r1
Post by: Smashness on August 27, 2012, 11:40:15 am
I tried using the DFusion Embark Anywhere tool, and it just crashes my game. It doesn't give me a message or anything, just crashes it.
Title: Re: DFHack 0.34.11 r1
Post by: Rose on August 27, 2012, 12:46:49 pm
is there a command to unhide missing dwarf bodies?

I have three that died, became ghost and got memorialized, but I'm curious as where it happened because I've sent my woodchopper to clean trees everywhere from caverns to mountains and they did not found any body.

Spoiler (click to show/hide)

You can find those under corpses in the stocks screen.
Title: Re: DFHack 0.34.11 r1
Post by: zenerbufen on August 28, 2012, 06:58:21 am
Good news, everyone!

After much rigamarole and trying various options, we finally have a build of DFHack for Mac OS X that should work for most people.

You can get it here for now (http://topazgryphon.org/~tcollett/df/dfhack-0.34.11-r1-Darwin.zip).

Please try it out, and let us know if it works for you.



Returning to DF after a long hiatus, this is ... like ... the best news EVER!   :)

This build works fine for me (MBPro with 10.7.4)

Works great on Mountain Lion for me. One quick question, There is no stonesense, was this removed/separate/or not available on mac? Thanks for all you guys do!

edit:
woops don't know why I did that. Thanks, also love your avatar. :)
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 28, 2012, 10:15:20 am
Good news, everyone!

After much rigamarole and trying various options, we finally have a build of DFHack for Mac OS X that should work for most people.

You can get it here for now (http://topazgryphon.org/~tcollett/df/dfhack-0.34.11-r1-Darwin.zip).

Please try it out, and let us know if it works for you.

Returning to DF after a long hiatus, this is ... like ... the best news EVER!   :)

This build works fine for me (MBPro with 10.7.4)
Works great on Mountain Lion for me. One quick question, There is no stonesense, was the removed/separate/or not available on mac? Thanks for all you guys do!
Fixed that for you - you're supposed to put your comments outside of everyone else's quotes, otherwise your post doesn't make any sense.
Title: Re: DFHack 0.34.11 r1
Post by: DoctorOr on August 29, 2012, 10:00:14 pm
I am trying to check the status of some eggs. 
When I try this:
Code: [Select]
printall(item.unk_cc)I get
Code: [Select]
--------------------unk_cc
anon_1                   = -1
anon_2                   = -1
anon_3                   = -1
anon_4                   = -1
anon_5                   = -1
anon_6                   = -1
anon_7                   = 0

Across many eggs only anon_7 changes from 0 to -1.

After a bit of testing, only eggs with anon_7 == -1 hatch.

I was curious about this so I did some poking, and the above statement is definitely not true. I've observed hatching regardless of the state of anon_7 and also failed hatchings regardless of its state.

What I have discovered is that egglayers are treated by the game much as mammals. If the mother is "pregnant", with a complete relations.pregnancy_ptr and a set relations.pregnancy_timer when she lays the eggs, and then remains on the eggs, the eggs will hatch at the end of that pregnancy_timer.

Using DFusions "make pet pregnant" code directly fails, because it sets the timer to only 10 ticks. The timer must remain above zero for the three months of hatching. A _ptr must exist at the time of egg laying, and the timer must be above 0 when its time to hatch.

To accomplish parthenogenesis, create a pregnancy_ptr like dfusion does - you can even use the dfusion tool - and then set the timer to something higher than 10000

You can probably reduce the time to near instant by increasing the .age of the egg item, but I haven't tried this.

Mothers get "pregnant" regardless of the availability of a nest box, but having a box and laying eggs before getting pregnant means the eggs won't ever hatch.

Letting the timer run down to 0 with no nest box sometimes "breaks" the bird, who will never get pregnant again. Other times they just get re-pregnant.  You can move a bird, away from a nest box and back again and still have a hatching, so long as the bird is back before the time to hatch.  You can also change the number of eggs, and all will hatch.
Title: Re: DFHack 0.34.11 r1
Post by: Kaos on August 30, 2012, 09:33:56 pm
How did you manage to do the fix for bringing back the human and elves diplomats? I thought the only way to do this was by adding the tags to the entity file and that always required a regen, but by using the command in dfhack you get them on an ongoing fort?
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 30, 2012, 09:58:26 pm
How did you manage to do the fix for bringing back the human and elves diplomats? I thought the only way to do this was by adding the tags to the entity file and that always required a regen, but by using the command in dfhack you get them on an ongoing fort?
Simple - I dug through DF's code in a disassembler until I found the part that took the position definitions in the raws (which are used as templates during worldgen) and actually instantiated them within each individual civilization (i.e. part of the worldgen code for creating new entities), then I wrote a DFHack plugin to create those same structures and add them to each entity during actual gameplay. It took several tries to get it right, mainly because it took a while for me to find all of the necessary structures (there's entity_position_raw within entity raws, entity_position within historical_entity, and also entity_position_assignment within the same entity) and figure out how they all worked.
Title: Re: DFHack 0.34.11 r1
Post by: Aerval on August 31, 2012, 10:50:40 am
Simple
:-\
Title: Re: DFHack 0.34.11 r1
Post by: eataTREE on August 31, 2012, 11:18:32 am
Good news, everyone!

After much rigamarole and trying various options, we finally have a build of DFHack for Mac OS X that should work for most people.

You can get it here for now (http://topazgryphon.org/~tcollett/df/dfhack-0.34.11-r1-Darwin.zip).

Please try it out, and let us know if it works for you.


Returning to DF after a long hiatus, this is ... like ... the best news EVER!   :)

This build works fine for me (MBPro with 10.7.4)

Works great on Mountain Lion for me. One quick question, There is no stonesense, was this removed/separate/or not available on mac? Thanks for all you guys do!

edit:
woops don't know why I did that. Thanks, also love your avatar. :)

Works great for me on an iMac with 10.7.4. Thanks so much for this; every DF tool I use is now Mac-native!
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on August 31, 2012, 02:01:17 pm
Simple
:-\
Perhaps a better term would've been "straightforward" - once you figure out how the game does something (in this case, creating a new position during worldgen, whether from the raws, from a parent civ, or from a historical figure creating a special position such as "law-maker" or "master" from scratch), duplicating that logic within DFHack is just a matter of allocating memory, filling in the appropriate values, and inserting that memory correctly into Dwarf Fortress's own data structures.

If you want to see how it's actually done, look at the source code (https://github.com/peterix/dfhack/blob/master/plugins/fixpositions.cpp) for the plugin itself.
Title: Re: DFHack 0.34.11 r1
Post by: malvado on September 01, 2012, 09:17:43 am
Lately I've had a few false positives (I asume they where) with MSE , the culprints are the .exe (dfunreveal , dfvdig ) , but since I also recently had a nasty infection I put them in Quarantine to be sure untill I had time to test a new version of Dfhack and compare the files.

Anyone else run into their AV flagging these as false positives? Right now they where flagged as : Backdoor: Win32 / Bisar!rts   
Title: Re: DFHack 0.34.11 r1
Post by: Rose on September 01, 2012, 11:27:15 am
You are using a very very old-ass version of DFhack.

the new version does not have this issue.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on September 01, 2012, 01:39:32 pm
You're also running an old version of DF itself - the last version of DF supported by that old DFHack was v0.31.25.
Title: Re: DFHack 0.34.11 r1
Post by: malvado on September 01, 2012, 04:58:36 pm
You're indeed right.
Seems I didn't read the entire MSE log, there it said clearly 31.25 so the version I'm currently using is definitely not reporting that problem.
Sorry for the inconvenience.

( I tend to keep older versions of Dwarf Fortress and Dfhack in their own folders).
Title: Re: DFHack 0.34.11 r1
Post by: Rose on September 01, 2012, 09:23:43 pm
So do I.

Anyway, yes, the older DFhack version used the same method of talking to DF as many viruses use, which makes them get flagged.
Title: Re: DFHack 0.34.11 r1
Post by: Mythologique on September 04, 2012, 04:01:54 am
Is anyone using seedwatch successfully in the new version? If I type "seedwatch all 30" it just shows the seedwatch menu again. It doesn't start or accept any commands, just the menu over and over no matter what is typed.
Title: Re: DFHack 0.34.11 r1
Post by: BriseRotule on September 04, 2012, 06:21:58 am
Hi,

I'd like to see the combat log (if any) stocked in the memory, is there a way to read all the DF memory, using DFHack ?

As anyone worked on that matter before hand ? The aim is to write a soft allowing to see real time combat log.
Title: Re: DFHack 0.34.11 r1
Post by: Rose on September 04, 2012, 10:16:00 am
Combat logs are readable, yes.
Title: Re: DFHack 0.34.11 r1
Post by: BriseRotule on September 05, 2012, 04:36:40 am
@Japa, that is a short answer....
Do you know how to locate the combat log in the memory using DFHack ?
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on September 05, 2012, 09:50:41 am
Do you know how to locate the combat log in the memory using DFHack ?
Yes - df::global::world->status.reports[]. If you want reports for a specific unit, then you'll need to look in (unit)->reports.* to get the relevant IDs.
Title: Re: DFHack 0.34.11 r1
Post by: BriseRotule on September 06, 2012, 03:04:19 am
Thank you a lot kind sir :)
Title: Re: DFHack 0.34.11 r1
Post by: Neerti on September 09, 2012, 12:50:16 am
Dfusion seems to be having issues for me.  I don't know what's wrong but I've tried updating and didn't help.  Using latest version of DF.

Quote
dfusion/common.lua:45: .Text region not found!
stack traceback:
   [C]: in function 'error'
   dfusion/common.lua:45: in function 'GetTextRegion'
   dfusion/common.lua:89: in function 'unlockDF'
   dfusion/init.lua:66: in main chunk
Whenever I type dfusion in the console it spits the error out.  Any workarounds to this?
Title: Re: DFHack 0.34.11 r1
Post by: SpecialCookies on September 09, 2012, 01:01:20 am
Dfusion seems to be having issues for me.  I don't know what's wrong but I've tried updating and didn't help.  Using latest version of DF.

Quote
dfusion/common.lua:45: .Text region not found!
stack traceback:
   [C]: in function 'error'
   dfusion/common.lua:45: in function 'GetTextRegion'
   dfusion/common.lua:89: in function 'unlockDF'
   dfusion/init.lua:66: in main chunk
Whenever I type dfusion in the console it spits the error out.  Any workarounds to this?

The workaround should probably be added to the first post or some place easily accessible for those less initiated. See quoted message below:

Is DFusion not updated for .34.11 yet? When I try to use it, I get errors. One moment and I'll post the exact errors.

Okay, typed in 'dfusion' sans apostraphes, and it gives me this:

Spoiler (click to show/hide)
The fix is still not included in this version. To fix it manualy:
Find this line in dfusion/common.lua, and replace ".text" with "Dwarf Fortress.exe":

Code: [Select]
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")
Title: Re: DFHack 0.34.11 r1
Post by: Neerti on September 09, 2012, 08:51:45 am

The workaround should probably be added to the first post or some place easily accessible for those less initiated. See quoted message below:

Is DFusion not updated for .34.11 yet? When I try to use it, I get errors. One moment and I'll post the exact errors.

Okay, typed in 'dfusion' sans apostraphes, and it gives me this:

Spoiler (click to show/hide)
The fix is still not included in this version. To fix it manualy:
Find this line in dfusion/common.lua, and replace ".text" with "Dwarf Fortress.exe":

Code: [Select]
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")

This did the trick, thank you.
Title: Re: DFHack 0.34.11 r1
Post by: person012345 on September 11, 2012, 07:22:58 pm
"The program can't start because MSVCP100.dll is missing from your computer. Try reinstalling the program to fix this problem."

Help?

Edit; hang on it might have extracted to the wrong folder, standby...

Double edit: Yeah, the extractor put it into a folder inside the DF folder, got it working now.
Title: Re: DFHack 0.34.11 r1
Post by: Tarran on September 15, 2012, 06:24:25 pm
Is it possible to disable DFHack hotkey connections with the F1-F8 keys? I'm using them to zoom to places, and it's kind of annoying to have red text spamming the console every time I use them.
Title: Re: DFHack 0.34.11 r1
Post by: ag on September 16, 2012, 02:13:05 am
Does anybody still use that legacy F1-F8 system? It can be removed altogether if not.
Title: Re: DFHack 0.34.11 r1
Post by: telarin on September 17, 2012, 04:14:10 pm
So I was told that there is a lua script available that can clean up "uninteresting" units from the units list in fortress mode, but search as I might, I cannot seem to find anything relevant on the forums. Is anyone aware of such a script, and if so, could you please post it or point me in the correct direction?
Title: Re: DFHack 0.34.11 r1
Post by: ag on September 17, 2012, 11:57:46 pm
With latest released dfhack, just type "fix/dead-units".
Title: Re: DFHack 0.34.11 r1
Post by: DNK on September 18, 2012, 04:50:08 am
For ~PROSPECT~ on embark

How does it know the likely resources of each tile?

Is there any way for DF Hack to create a map of any given mineral, stone, etc, using this prospect tool for the entire world? It would make finding sites with certain combinations a lot easier since the game itself doesn't allow you to search for specific mineral types other than flux (like iron or coal).
Title: Re: DFHack 0.34.11 r1
Post by: ag on September 18, 2012, 08:50:19 am
It does NOT know resources for each tile. But it knows how many rock layers of what rock there will be, and what kind of veins with what probability will they contain. Include some multiplying and adding up, and in most cases you arrive at numbers with the right order of magnitude.
Title: Re: DFHack 0.34.11 r1
Post by: DNK on September 19, 2012, 05:41:06 am
It does NOT know resources for each tile. But it knows how many rock layers of what rock there will be, and what kind of veins with what probability will they contain. Include some multiplying and adding up, and in most cases you arrive at numbers with the right order of magnitude.
Basically, same question:
How does it know the rock layers?
Is there a table that tells likelihood of minerals per rock layer for a certain mineral_scarcity?

Additionally, does it account for varying mineral_scarcity?



Is there a way to create some macro or something that takes a 1x1 embark tile and uses prospect all for every tile in the game and outputs it to XML or something?
Title: Re: DFHack 0.34.11 r1
Post by: ag on September 19, 2012, 07:21:14 am
There is a permanently resident table of that data for every 16x16 embark tile region. Also, when you select a region in the embark screen, it zooms it in to the embark tile level. Everything more detailed is guesswork disguised as statistics.
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on September 19, 2012, 10:36:00 pm
How does it know the rock layers?
It looks in world->world_data->region_map(x)(y) to get the "geo_index" value for a particular biome, then it fetches the corresponding entry from world->world_data.geo_biomes[], and that record contains all of the stone and soil layers for that region...

Is there a table that tells likelihood of minerals per rock layer for a certain mineral_scarcity?

Additionally, does it account for varying mineral_scarcity?
...including a complete list of all minerals that the game deposited there during worldgen (according to the mineral scarcity settings you specified) and which it will attempt to place in the map when you embark.

Is there a way to create some macro or something that takes a 1x1 embark tile and uses prospect all for every tile in the game and outputs it to XML or something?
You could write a Lua script to do it, but it would produce WAY too much data.
Title: Re: DFHack 0.34.11 r1
Post by: DNK on September 20, 2012, 09:52:21 am
Quote from: Q
Quote from: DNK
Is there a way to create some macro or something that takes a 1x1 embark tile and uses prospect all for every tile in the game and outputs it to XML or something?
You could write a Lua script to do it, but it would produce WAY too much data.
Well, let's say we control it so we just look for one specific thing, like iron? That's basically one value per tile. Or output it as a grayscale map image.
Title: Re: DFHack 0.34.11 r1
Post by: telarin on September 20, 2012, 10:07:14 am
Is there a way to get workflow to manage yarn production? I have tried:

workflow amount THREAD/YARN 50

but it is unable to see the spinnning jobs at a farmers workshop. I am wondering if this is because the material type of yarn thread is something other than yarn perhaps. Any thoughts, or is this something that would require a special case be added into DFHack similar to crafts?
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on September 22, 2012, 06:21:35 am
Code: [Select]
function CompN1()
  adv=df.global.world.units.active[1]
  --for k,v in pairs(df.global.world.units.active) do
  --if adv.relations.group_leader_id==adv.id then
local sx,sy,sz
sx=adv.pos.x
sy=adv.pos.y
sz=adv.pos.z
print("Current coords:"..sx.." "..sy.." "..sz)
tx,ty,tz=sx,sy-3,sz
print("Warp to coords:"..tx.." "..ty.." "..tz)
adv.path.dest.x=tx
adv.path.dest.y=(ty)
adv.path.dest.z=tz
adv.old_pos.x=tx
adv.old_pos.y=ty
adv.old_pos.z=tz
--end
--end
end

function CompS1()
  adv=df.global.world.units.active[1]
  --for k,v in pairs(df.global.world.units.active) do
  --if v.relations.group_leader_id==adv.id then
local sx,sy,sz
sx=adv.pos.x
sy=adv.pos.y
sz=adv.pos.z
print("Current coords:"..sx.." "..sy.." "..sz)
tx,ty,tz=sx,sy+3,sz
print("Warp to coords:"..tx.." "..ty.." "..tz)
adv.path.dest.x=tx
adv.path.dest.y=(ty)
adv.path.dest.z=tz
adv.old_pos.x=tx
adv.old_pos.y=ty
adv.old_pos.z=tz
--end
--end
end

function CompE1()
  adv=df.global.world.units.active[1]
  --for k,v in pairs(df.global.world.units.active) do
  --if v.relations.group_leader_id==adv.id then
local sx,sy,sz
sx=adv.pos.x
sy=adv.pos.y
sz=adv.pos.z
print("Current coords:"..sx.." "..sy.." "..sz)
tx,ty,tz=sx+3,sy,sz
print("Warp to coords:"..tx.." "..ty.." "..tz)
adv.path.dest.x=tx
adv.path.dest.y=(ty)
adv.path.dest.z=tz
adv.old_pos.x=tx
adv.old_pos.y=ty
adv.old_pos.z=tz
--end
--end
end

function CompW1()
  adv=df.global.world.units.active[1]
  --for k,v in pairs(df.global.world.units.active) do
  --if v.relations.group_leader_id==adv.id then
local sx,sy,sz
sx=adv.pos.x
sy=adv.pos.y
sz=adv.pos.z
print("Current coords:"..sx.." "..sy.." "..sz)
tx,ty,tz=sx-3,sy,sz
print("Warp to coords:"..tx.." "..ty.." "..tz)
adv.path.dest.x=tx
adv.path.dest.y=(ty)
adv.path.dest.z=tz
adv.old_pos.x=tx
adv.old_pos.y=ty
adv.old_pos.z=tz
--end
--end
end
Here's a rough draft of my 2 player controls
You kinda need to Hotkey them on to make them work but you can totally have you and a bud walk around in adventure mode with this... or walk around in fort mode.
Code: [Select]
keybinding set Shift-I "dfuse CompN1"
keybinding set Shift-J "dfuse CompW1"
keybinding set Shift-L "dfuse CompE1"
keybinding set Shift-K "dfuse CompS1"
Though each movement takes up of 3 tiles and hitting walls will cause them to path around it.
Title: Re: DFHack 0.34.11 r1
Post by: Putnam on September 23, 2012, 04:26:12 pm
Yo, can I use this for Fortbent? I need it for some stuff I'm thinking of.

EDIT: In related news, does the init accept any DFHack command?
Title: Re: DFHack 0.34.11 r1
Post by: ag on September 26, 2012, 11:35:20 am
It does, but since it is executed before there is even any chance for a save to load, most commands are useless. So in the end you are left with keybindings (and in the latest source code version, also enabling some stateless bugfix hooks into DF code).
Title: Re: DFHack 0.34.11 r1
Post by: DarthMetool on September 27, 2012, 11:24:03 pm
Downloaded DFhack to match the version of DF I have (0.34.11), extracted DFhack, clicked to activate while correct DF version is open.  Window briefly flashes into existence and disappears.  No DFhack.  Wut?
Title: Re: DFHack 0.34.11 r1
Post by: Putnam on September 27, 2012, 11:31:21 pm
It should open when DF opens.
Title: Re: DFHack 0.34.11 r1
Post by: DarthMetool on September 27, 2012, 11:45:13 pm
It should open when DF opens.

Figured out the problem.  Thanks.   :)
Title: Re: DFHack 0.34.11 r1
Post by: Sorcerer on September 28, 2012, 06:11:41 am
So, a question for the DFHack gods then. My mod is plagued with nakedness issues, is it possible to make a script that  tricks a creature into believing it's wearing something to remove the bad thoughts from nakedness? I found the remove fixnaked script earlier in this thread but that only removes bad thoughts for a few seconds before they start reoccuring.
Title: Re: DFHack 0.34.11 r1
Post by: Gaybarowner on September 28, 2012, 07:45:48 am
Wondering if there is a copypaste type digging like a already set dig that was a already copied [D]ig command anyway to do this on DFHACK?
Title: Re: DFHack 0.34.11 r1
Post by: expwnent on September 28, 2012, 09:22:06 am
I'm not sure exactly what you mean, but maybe you want something like QuickFort?
Title: Re: DFHack 0.34.11 r1
Post by: Quietust on September 28, 2012, 11:22:42 am
So, a question for the DFHack gods then. My mod is plagued with nakedness issues, is it possible to make a script that  tricks a creature into believing it's wearing something to remove the bad thoughts from nakedness? I found the remove fixnaked script earlier in this thread but that only removes bad thoughts for a few seconds before they start reoccuring.
Nope - the only way to make a creature think it's not naked to actually make it not naked.
Title: Re: DFHack 0.34.11 r1
Post by: Rumrusher on September 28, 2012, 11:35:12 am
So, a question for the DFHack gods then. My mod is plagued with nakedness issues, is it possible to make a script that  tricks a creature into believing it's wearing something to remove the bad thoughts from nakedness? I found the remove fixnaked script earlier in this thread but that only removes bad thoughts for a few seconds before they start reoccuring.
Nope - the only way to make a creature think it's not naked to actually make it not naked.
or remove the tag that causes them to think that... which is I guess [clothed] though I don't know if toady was that dead set in making dwarves cover up their shame and hardcoded it?
Title: Re: DFHack 0.34.11 r1
Post by: Sorcerer on September 28, 2012, 11:58:15 am
hrm, I was afraid of that, the [CLOTHING] tag unfortunately does nothing.
Title: Re: DFHack 0.34.11 r1
Post by: Gaybarowner on September 28, 2012, 03:56:00 pm
I'm not sure exactly what you mean, but maybe you want something like QuickFort?
When you make digging designations you can copy it and repeat the same layout onto the world so you dont have to redo it again like making rooms?
Title: Re: DFHack 0.34.11 r1
Post by: Velak on September 29, 2012, 08:01:13 am
You want quickfort.
Title: Re: DFHack 0.34.11 r1
Post by: Helgoland on September 29, 2012, 12:38:18 pm
You want quickfort.
You want macros. They're surprisingly powerful, but surprisingly little-known.
Title: Re: DFHack 0.34.11 r1
Post by: splinteredmind on September 29, 2012, 02:02:49 pm
Do you think it would be possible to create a version of Copy Stockpile that could copy workshop profiles? Would save me a hell of a lot of fiddling about.
Title: Re: DFHack 0.34.11 r1
Post by: Velak on September 30, 2012, 04:29:46 am
You want quickfort.
You want macros. They're surprisingly powerful, but surprisingly little-known.

I agree. For some very simple jobs, macros can work fine, and I use them every day. Macros aren't the correct solution for laying out my forts, though.

I personally tend to plan my forts before I ever strike the earth, and with QuickFort I can do anything from simple rooms, to laying out massive multi-z-level complete forts if you want to.  You can set up something, and have to automatically designate down (or up) z-levels. You can have it rotate your designs, and have them auto-repeat in any direction (N, S, E, W, up and down).

The macro editor in DF writes way too much code. I personally find it limited, and not very clean.

But, again, I agree with you. Depending on what you want to do, Macros could be a solution.
Title: Re: DFHack 0.34.11 r1
Post by: Rose on September 30, 2012, 05:33:51 am
next version of DFhack coming out any say now will have an inbuilt version of quickfort, which, unlike quickfort, is instant.
Title: Re: DFHack 0.34.11 r1
Post by: Velak on September 30, 2012, 07:00:20 am
Sweet. I'm looking forward to it!
Title: Re: DFHack 0.34.11 r1
Post by: Gaybarowner on September 30, 2012, 10:01:17 am
Oh thank armok!
Title: Re: DFHack 0.34.11 r1
Post by: peterix on September 30, 2012, 06:33:23 pm
Hello!

Got a massive update for 0.34.11. Lots of very nice things, including support for ruby scripting, extending the game UI and to some extent messing with game logic. Along with that, more new tools than you can shake a stick at and even more improvements to the old ones.

Enjoy :D

/me thanks everyone involved in making this release possible. For a full list of those awesome people, check this file. (https://github.com/peterix/dfhack/blob/master/Contributors.rst)
Title: Re: DFHack 0.34.11 r1
Post by: Urist McFumbler on September 30, 2012, 10:29:09 pm
Hello!

Got a massive update for 0.34.11. Lots of very nice things, including support for ruby scripting, extending the game UI and to some extent messing with game logic. Along with that, more new tools than you can shake a stick at and even more improvements to the old ones.

Enjoy :D

/me thanks everyone involved in making this release possible. For a full list of those awesome people, check this file. (https://github.com/peterix/dfhack/blob/master/Contributors.rst)

Thank you everyone that contributed to the release, every release is more awesome then the last.
Title: Re: DFHack 0.34.11 r2
Post by: Velak on October 01, 2012, 04:36:18 am
Thanks to all contributors! I've been eagerly awaiting this release. :)

Extra Special thanks for whoever came up with 'rename' for stockpiles and zones!

Now I can actually find them again in the view rooms/buildings menu. (So they're not just listed as 'stockpile #42' or 'zone').

Awesome!
Title: Re: DFHack 0.34.11 r2
Post by: Akjosch on October 01, 2012, 07:24:04 am
Finally I can rename my dwarves (somewhat) easily! Thanks a lot. :)

For the record, those are my current Lua scripts for the surname and family name:


Title: Re: DFHack 0.34.11 r2
Post by: ag on October 01, 2012, 07:35:57 am
That won't work for vampires with false identities. See how dfhack changes nicknames: https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L553 (https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L553)
Title: Re: DFHack 0.34.11 r2
Post by: Akjosch on October 01, 2012, 07:41:01 am
That won't work for vampires with false identities. See how dfhack changes nicknames: https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L553 (https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L553)

"This won't work" as in "only the true vampiric identity will be changed, not what's displayed" or as in "only the displayed identity will be changed, not the vampiric one"? Because the second variant is totally what I want to happen.
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 01, 2012, 07:46:53 am
"This won't work" as in "only the true vampiric identity will be changed, not what's displayed" or as in "only the displayed identity will be changed, not the vampiric one"? Because the second variant is totally what I want to happen.

It will change the true identity. To get the vampiric one you can use dfhack.units.getIdentity(unit) in lua - its implementation is just above Units::setNickname in that Units.cpp file. There also is Units::getVisibleName below it.

Basically if you want to only change the visible name, you could probably try something like this, only with more error checking and stuff:

Code: [Select]
local vname = dfhack.units.getVisibleName(unit)
modify(vname)
if vname == unit.name then
  unit.status.current_soul.name:assign(vname)
  df.historical_figure.find(unit.hist_figure_id).name:assign(vname)
end
Title: Re: DFHack 0.34.11 r2
Post by: Akjosch on October 01, 2012, 07:57:55 am
So basically I have to go and modify ...status.current_soul.name instead of ...name. Oh well, I'll play with it when I'll actually get some vampire in the fort. Thanks for the pointer.
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 01, 2012, 08:23:36 am
So basically I have to go and modify ...status.current_soul.name instead of ...name. Oh well, I'll play with it when I'll actually get some vampire in the fort. Thanks for the pointer.

No, you need to modify what getVisibleName returns. Plus, if it returns just unit.name (i.e. there is no false identity), you need to modify the soul and the histfig of the unit.
Title: Re: DFHack 0.34.11 r2
Post by: Akjosch on October 01, 2012, 09:23:32 am
So basically I have to go and modify ...status.current_soul.name instead of ...name. Oh well, I'll play with it when I'll actually get some vampire in the fort. Thanks for the pointer.

No, you need to modify what getVisibleName returns. Plus, if it returns just unit.name (i.e. there is no false identity), you need to modify the soul and the histfig of the unit.

getVisibleName() returns the "name" field of the historical figure of unit.hist_figure_id if there is one (and I modify that already) for normal dwarves. Good enough for now (and works well), I'll deal with vampires, ghosts and the like when I'll actually get any. :)

To be more precise: It returns df::assumed_identity::find(df::historical_figure::find(unit->hist_figure_id)->info->reputation->cur_identity)->name, which for everyone with just one identity is exactly the same as above.
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 01, 2012, 09:38:39 am
To be more precise: It returns df::assumed_identity::find(df::historical_figure::find(unit->hist_figure_id)->info->reputation->cur_identity)->name, which for everyone with just one identity is exactly the same as above.

No, only vampires and demons who pretend that they are gods have assumed identities, so for everybody else it returns &unit->name.
Title: Re: DFHack 0.34.11 r2
Post by: Akjosch on October 01, 2012, 09:41:33 am
To be more precise: It returns df::assumed_identity::find(df::historical_figure::find(unit->hist_figure_id)->info->reputation->cur_identity)->name, which for everyone with just one identity is exactly the same as above.

No, only vampires and demons who pretend that they are gods have assumed identities, so for everybody else it returns &unit->name.

.. in other words, it's even more useless for my needs. I change unit->name directly already.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on October 01, 2012, 06:41:25 pm
Ok DFHack guys I realized halfway through an overhaul of the way my god tiers work that the new way would make them unable to do labors etc. in fort mode because they're transforming into a different creature, so is there a way to allow other intelligent creatures to do labors, join the military etc. without having migrants of other intelligent races come in?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on October 01, 2012, 10:20:37 pm
Ok DFHack guys I realized halfway through an overhaul of the way my god tiers work that the new way would make them unable to do labors etc. in fort mode because they're transforming into a different creature, so is there a way to allow other intelligent creatures to do labors, join the military etc. without having migrants of other intelligent races come in?
uhh friendship. Though just make the migrant cycle be other god tiers.
Title: Re: DFHack 0.34.11 r2
Post by: falconne on October 02, 2012, 04:27:57 am
I hope someone can point out what I'm doing wrong here. I just started using the autobutcher function, which is very useful, except that it stopped working and I can't figure out why. Everything was fine the first time I ran it, it sent all the excess animals to slaughter. However, after I came back to my saved game the next day, I noticed no animals were getting slaughtered even though they'd gone above their thresholds, so I typed "autobutcher start" into the console and then "autobutcher list", which told me the status was "not enabled" and "race list is empty".

I had already exported the list from the first run, so I tried running that from a batch file, which successfully added all my animals into the watch list, but the status was still "not enabled".

No matter what I try, doing an "unwatch all", "forget all", "stop", re-add everything, "start", the status is still "not enabled". And running "start" always clears my race list. Here's the typical result I get:

Code: [Select]
[DFHack]# autobutcher list
Autobutcher status: not enabled, noautowatch, sleep: 6000
Default setting for new races: fk=8 mk=8 fa=5 ma=2
The autobutcher race list is empty.


[DFHack]# autobutcher target 8 8 5 2 WATER_BUFFALO
Setting new target count for race(s): WATER_BUFFALO
[DFHack]# autobutcher watch WATER_BUFFALO
Start watching race(s): WATER_BUFFALO

[DFHack]# autobutcher target 8 8 5 2 ALPACA
Setting new target count for race(s): ALPACA
[DFHack]# autobutcher watch ALPACA
Start watching race(s): ALPACA

[DFHack]# autobutcher start
Starting autobutcher.

[DFHack]# autobutcher list
Autobutcher status: not enabled, noautowatch, sleep: 6000
Default setting for new races: fk=8 mk=8 fa=5 ma=2
The autobutcher race list is empty.


I'm probably doing something obvious wrong... anyone know?
Title: Re: DFHack 0.34.11 r2
Post by: LoSboccacc on October 02, 2012, 04:30:21 am
full support for Mac OS X.

does this means stonesense too?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on October 02, 2012, 05:25:31 am
full support for Mac OS X.

does this means stonesense too?

I /think/ so, but don't quote me on that.
Title: Re: DFHack 0.34.11 r2
Post by: LoSboccacc on October 02, 2012, 05:26:36 am
full support for Mac OS X.

does this means stonesense too?

I /think/ so, but don't quote me on that.

ok!

ops.
Title: Re: DFHack 0.34.11 r2
Post by: telarin on October 02, 2012, 09:04:34 am
The update list says that you can now set the percentage of haulers in autolabor, however, the help file has not been updated with the syntax to do so.
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on October 02, 2012, 09:21:33 pm
It should be noted, to those who are not aware, that copying Hack_34.11_r2 over Hack_34.11.r1 will lead to some wierdness.  There will be version mismatch messages and who knows what else.

Word to the wise, remove your old copy of DFHack THEN re-apply the new version.

Again, thanks to all of the wonderful developers and maintainers of this project.
Title: Re: DFHack 0.34.11 r2
Post by: peterix on October 03, 2012, 12:57:33 am
It should be noted, to those who are not aware, that copying Hack_34.11_r2 over Hack_34.11.r1 will lead to some wierdness.  There will be version mismatch messages and who knows what else.

Word to the wise, remove your old copy of DFHack THEN re-apply the new version.

Again, thanks to all of the wonderful developers and maintainers of this project.
The compiled plugins check if they were built with the same version you try to run them with and won't initialize if they aren't the same. Scripts don't check that...

So, if you have any custom scripts, it would be a good idea to check if they work on a test world first.
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 03, 2012, 03:05:06 am
Yes, normally an outdated script would fail with an exception at some point, but since that can leave the game data structures in an inconsistent state, it is best to try them for the first time after an update in a state where you won't mind to 'die' and reload from save. The 'quicksave' script can probably help with that.
Title: Re: DFHack 0.34.11 r2
Post by: JosephWongKS on October 03, 2012, 05:44:40 am
Crossposting from the Masterwork Dwarf Fortress mod thread, as my query relates to DFHack as well.


EDIT:  My armor savant dwarf just got a fey mood and took over a metalsmith's forge.  He duly collected a patternwelded mithril bar, a log, a magnetite rock, two rough gems and a cut gem.  He then stopped collecting items but didn't begin construction of the artifact. 

I checked his requests and it says he also wants "yarn cloth". 

I have plenty of both wool thread and wool cloth, none of which are forbidden, and the dwarf is not subject to any burrow restrictions.  What the hell does this moody idiot want from me?


EDIT2:  I tried weaving fresh wool cloth to see if that would satisfy the selfish jerk, and lo and behold my weaver tells me that he cancelled the job because he needs 1 "unused collected yarn thread", even though I have more of 10 wool threads lying around the place.  Or are "yarn threads" and "yarn cloth" different from "wool threads" and "wool cloth" in this mod?


You can butcher horses or other furred animals to obtain it, then use the "Spin" order in the farmers workshop to get it.

I tried this, but it just gets me "horse hair" and then "hair thread", which doesn't seem to meet the dwarf's requirements.

EDIT:  Double-checked the DF Wiki, and it says I need to shear a sheep to get "wool", which can then be spun into "yarn" at a farmer's workshop.  This suggests that the wool thread and wool cloth I've been buying are not "yarn".  I have one remaining lamb in my pasture (having already butchered its parents in a mass slaughtering campaign to increase FPS), and I'm in late spring which means the elf merchant will be coming by soon.  Fingers crossed, either the lamb will grow to maturity before the dwarf hits the time limit for his mood, or the elves will bring along some adult sheep for shearing.

EDIT2:  YES the lamb just became an ewe!  Now I can get the lamb sheared for its wool and spin the wool into yarn to give to the dwarf so he can make his artifact armor and avoid dying on me.  This game truly is the most amazing thing.

EDIT3:  Shearing the ewe gave me "ewe hair", not wool.  Hmm.

EDIT4:  Aaaand spinning the ewe hair produced more hair thread, not yarn.  Is there any way, any way at all, to produce "yarn" in this game?  I don't want my dwarf to die right when he is about to produce an artifact armor.


Desperate times call for desperate measures.  Using the "job" function in DFHack reveals the following materials required for the mood:

(http://i.imgur.com/4puFW.png) (http://imgur.com/4puFW)

Is there any way to change the material for Item 7 into silk or plant fibre?  The "job item-material" function doesn't work because it's a "flag" rather than of "material", apparently.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on October 03, 2012, 06:23:28 am
Just so you know, there's actually a special command designed to describe strange moods - "showmood".

Also, the job command currently does not allow modification of job item flags.
Title: Re: DFHack 0.34.11 r2
Post by: Helgoland on October 03, 2012, 10:07:50 am
Can't you just slap the necessary [YARN] (or something like that :P ) tag onto, say, bones? I think people've been using that for shells for ages.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on October 03, 2012, 01:56:03 pm
Can't you just slap the necessary [YARN] (or something like that :P ) tag onto, say, bones? I think people've been using that for shells for ages.
You could certainly add it to bones, but it wouldn't do you a bit of good unless you can somehow weave those bones into cloth. If you're going to add [YARN] to a material, you need to pick one that's already a type of cloth - that's what I did in 0.31.25 with a fortress that predated 0.31.19 and thus had no types of wool...
Title: Re: DFHack 0.34.11 r2
Post by: ArKFallen on October 05, 2012, 08:11:22 pm
I'm not at all acquainted with DFHack or its language, but I've been trying to make a function that tells you a unit's specific attributes and have managed to make it show all attributes by mad-doctoring Vjek's elevation_x scripts. So my question is how can I make it show a specific attribute by typing check_attr insertattribute?
Spoiler: Current Script (click to show/hide)
And how to make it print the last name after the first? Assistance appreciated!
Title: Re: DFHack 0.34.11 r2
Post by: DNK on October 05, 2012, 11:38:24 pm
Is there any way to use hack (currently or possible-in-future) to get information about the entire world outside the fortress? I assume this "worldgen-esque" process of historymaking is ongoing throughout fortress mode play, but perhaps not? It would be nice to get "the news" about what's happening "out there". Could have the info fed into another program like legends viewer to watch the ongoing wars and such in realtime.
Title: Re: DFHack 0.34.11 r2
Post by: crazysheep on October 06, 2012, 12:45:53 am
Is there any way to use hack (currently or possible-in-future) to get information about the entire world outside the fortress? I assume this "worldgen-esque" process of historymaking is ongoing throughout fortress mode play, but perhaps not? It would be nice to get "the news" about what's happening "out there". Could have the info fed into another program like legends viewer to watch the ongoing wars and such in realtime.
Not possible, history-making stops as soon as fort mode starts.
Title: Re: DFHack 0.34.11 r2
Post by: falconne on October 06, 2012, 12:58:59 am
I hope someone can point out what I'm doing wrong here. I just started using the autobutcher function, which is very useful, except that it stopped working and I can't figure out why. Everything was fine the first time I ran it, it sent all the excess animals to slaughter. However, after I came back to my saved game the next day, I noticed no animals were getting slaughtered even though they'd gone above their thresholds, so I typed "autobutcher start" into the console and then "autobutcher list", which told me the status was "not enabled" and "race list is empty".

I had already exported the list from the first run, so I tried running that from a batch file, which successfully added all my animals into the watch list, but the status was still "not enabled".

No matter what I try, doing an "unwatch all", "forget all", "stop", re-add everything, "start", the status is still "not enabled". And running "start" always clears my race list.

Just answering my own question, I compiled my own copy of dfhack to step through and find out what was going on. It looks like what happens is that if you "stop" autobutcher, save the game and come back to it later, you can't ever "start" it again. The problem is that although the "start" routine sets the variable "enable_autobutcher" to true to begin with, it then goes on to read the autobutcher config from the save file in "init_autobutcher". As part of reading the config, it also reads the saved value for "enable_autobutcher", which, if you had saved while autobutcher is stopped, will be "false". That overwrites the value in memory back to false, so basically the plugin is in a permanent stop state now.

I fixed it in my copy by changing zone.cpp:3454 (init_autobutcher) from:
Code: [Select]
enable_autobutcher = config_autobutcher.ival(0);to
Code: [Select]
enable_autobutcher = enable_autobutcher || config_autobutcher.ival(0);
I think that's how it should be.
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 06, 2012, 03:54:20 am
I think that's how it should be.

I rather think this is the  correct fix: https://github.com/angavrilov/dfhack/commit/6fefd0907281b41bbcbe27df1bea113ab8c46c1b (https://github.com/angavrilov/dfhack/commit/6fefd0907281b41bbcbe27df1bea113ab8c46c1b)

The reason being, init_autobutcher is also called when a new save is loaded to see if it should be disabled or enabled.
Title: Re: DFHack 0.34.11 r2
Post by: DNK on October 06, 2012, 04:10:04 am
Not possible, history-making stops as soon as fort mode starts.
Eh, k.

Is it planned to have it running in parallel sometime in the future? Seems like something that Toady could multicore pretty easily since it's basically unconnected to the actual Fortress mode (though it could be integrated), and that would have only a minimal-nonexistent FPS impact.
Title: Re: DFHack 0.34.11 r2
Post by: falconne on October 06, 2012, 04:15:13 am
I think that's how it should be.

I rather think this is the  correct fix: https://github.com/angavrilov/dfhack/commit/6fefd0907281b41bbcbe27df1bea113ab8c46c1b (https://github.com/angavrilov/dfhack/commit/6fefd0907281b41bbcbe27df1bea113ab8c46c1b)

The reason being, init_autobutcher is also called when a new save is loaded to see if it should be disabled or enabled.

Yeah you're right... I only spent a little while in the code long enough to fix it for myself. Should have realised the enabled state isn't saved to disk after the first time.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on October 06, 2012, 05:06:34 am
Not possible, history-making stops as soon as fort mode starts.
Eh, k.

Is it planned to have it running in parallel sometime in the future? Seems like something that Toady could multicore pretty easily since it's basically unconnected to the actual Fortress mode (though it could be integrated), and that would have only a minimal-nonexistent FPS impact.

If you've payed any attention to the devlogs, you would see immediately that this is literally what he's working on right now.
Title: Re: DFHack 0.34.11 r2
Post by: DNK on October 06, 2012, 07:30:41 am
I do not know of these devlogs, but I see he just responded to the future of the fortress and said so, and came here to say "hey, Toady already answered me," but here we are. Cool.
Title: Re: DFHack 0.34.11 r2
Post by: Raul on October 06, 2012, 09:51:01 am
I do not know of these devlogs

Devlogs (http://www.bay12games.com/dwarves/)
Title: Re: DFHack 0.34.11 r2
Post by: DNK on October 06, 2012, 12:27:43 pm
Oh, that's my bookmarked page. Odd I've not heard of this before.
Title: Re: DFHack 0.34.11 r2
Post by: whitecold on October 06, 2012, 04:31:22 pm
I have some questions to the plugins.
Does the steam-engine plugin require to generate a new world?
Also how do i use inject-raws?

thank you
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 07, 2012, 02:55:09 am
As a rule you don't use inject-raws unless you know how to troubleshoot and fix possible breakage - it is a development tool. So assume that it does require a new world.

Spoiler (click to show/hide)

I have a question to everybody: how much an increase in FPS did you observe with tweak stable-temp and tweak fast-heat in old forts nearing FPS death? I have observed +50%, and another dfhack developer reported an increase from 15 to 30 (+100%), but it would be nice to have more data to add to the bug report :)

Note that the increase is gradual after they are activated; setting fast-heat to something like 100 or even 50 would speed this up noticeably.
Title: Re: DFHack 0.34.11 r2
Post by: jomen on October 07, 2012, 08:30:46 am
Hi ,

I have a question , i read that it is possible to enslave captured goblins and others with DfHacK But how can i do ?
Title: Re: DFHack 0.34.11 r2
Post by: Akjosch on October 07, 2012, 04:08:41 pm
Small bug report about the new awesome "u-l" job screen: It shows the true name of the vampires, not the one they are currently using.
Title: Re: DFHack 0.34.11 r2
Post by: Alu on October 07, 2012, 05:04:13 pm
I'm kind of curious if there is a anti-tantrum-spiral hack? Like, roundhouse-kick all unhappy dwarfs to at least contempt or something? Would improve my game experience massively I believe.
don't want every single game end with a tantrum spiral, it gets boring.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on October 07, 2012, 05:35:25 pm
Small bug report about the new awesome "u-l" job screen: It shows the true name of the vampires, not the one they are currently using.
Nice catch - it should now display the unit's assumed identity if it has one.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on October 07, 2012, 08:59:13 pm
I'm kind of curious if there is a anti-tantrum-spiral hack? Like, roundhouse-kick all unhappy dwarfs to at least contempt or something? Would improve my game experience massively I believe.
don't want every single game end with a tantrum spiral, it gets boring.
Why don't you switch over to adventure mode, then run off into the woods and kill stuff? That way the fort will end differently than on a tantrum spiral.
Title: Re: DFHack 0.34.11 r2
Post by: jjdf on October 08, 2012, 02:51:55 pm
I'm kind of curious if there is a anti-tantrum-spiral hack? Like, roundhouse-kick all unhappy dwarfs to at least contempt or something? Would improve my game experience massively I believe.
don't want every single game end with a tantrum spiral, it gets boring.

You can run the 'removebadthoughts' command to boost everyone's happiness.
Title: Re: DFHack 0.34.11 r2
Post by: sadron on October 11, 2012, 02:20:56 pm
Readme's page is broken.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on October 11, 2012, 04:17:51 pm
Readme's page is broken.
Could you be a bit more specific? It looks fine to me in both the Windows and Linux 0.34.11 r2 downloads...
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on October 11, 2012, 05:21:53 pm
I have no issues with it in WinXP
Title: Re: DFHack 0.34.11 r2
Post by: peterix on October 11, 2012, 07:06:46 pm
Readme's page is broken.
Fixed now :)
Title: Re: DFHack 0.34.11 r1
Post by: Sutremaine on October 12, 2012, 07:46:57 am
Does anybody still use that legacy F1-F8 system? It can be removed altogether if not.
I use it. It make navigating my vertically-oriented fortresses quicker.

You can stop the text spam by removing the hotkey names, though if you do this you either need to remember where each hotkey leads or set them in a regular pattern. Every 5 or 10 levels is what I use in general.
Title: Re: DFHack 0.34.11 r1
Post by: danaris on October 12, 2012, 07:56:39 am
Does anybody still use that legacy F1-F8 system? It can be removed altogether if not.
I use it. It make navigating my vertically-oriented fortresses quicker.

You can stop the text spam by removing the hotkey names, though if you do this you either need to remember where each hotkey leads or set them in a regular pattern. Every 5 or 10 levels is what I use in general.

I thought he meant the legacy F1-F8 system for activating DFHack scripts.
Title: Re: DFHack 0.34.11 r1
Post by: ag on October 12, 2012, 01:35:43 pm
I thought he meant the legacy F1-F8 system for activating DFHack scripts.

Yes, that. Most new commands can't even be used with it due to the 9 char limit.
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on October 12, 2012, 10:01:19 pm
Quick question:

Can fix/population-cap be applied retroactively?

For instance, if I decided I wanted more dwarven immigrants after the dwarven liason has left, can I exit, change the pop cap in the init, load and apply fix/population-cap to lure more suckers honored citizens to my gulag delightful little slice of Dwarven Heaven?
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 13, 2012, 08:30:11 am
The population cap number is always used exactly as specified in init; it's the current population count that is tied to caravans and therefore lags behind.

The fix/population-cap script updates that lagging current population count variable to the actual count in your fort, so you need to run it when your actual population increases.
Title: Re: DFHack 0.34.11 r2
Post by: Naros on October 13, 2012, 08:49:20 pm
Good evening!

Sorry if this has been asked before, but I'm a bit of a perfectionist, and I want ten layers of my fort to just be obsidian.
changelayer does this for the layer stone, and while I don't care if there's metal veins, the cluster stones (icky! blinding blue!) are an issue for me.
So I was wondering if it was possible to change those all in one go, rather than having to spam changevein about a hundred times per layer. Even with the command hotkeyed, this gets very tedious very fast. :P

If there isn't, is it possible to write a LUA script for DFusion that does it? I know DFusion is way slower, but if it'll get the job done, I'll be happy. :)
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on October 13, 2012, 09:13:16 pm
I think I can identify some of the unknowns in the unit_wound structure (i.e. one appears to be the pain associated with the wound), but I'm having trouble accessing the content of the vectors unk_14, unk_24, unk_34. Is there a way in dfhack to obtain this data?

See https://github.com/angavrilov/df-structures/blob/master/df.units.xml for reference

Here's my first attempt at lua:
----EDIT----
Figured out the problem on my own. The vectors do contain data under certain circumstances.

I've figured out about 33% of the unknowns in the wound structure so far.
Title: Re: DFHack 0.34.11 r2
Post by: Zanedale on October 15, 2012, 01:04:23 am
Ok this is going to sound a bit stupid. I've downloaded the most recent lazy newb pack, and have decided to use 'migrant' and 'friendship' to make a multi racial fortress. I've made the necessary changes to the 'migrant' and 'friendship' races text files to get the distribution I want, but I don't know what to enter into DFHack to run 'migrant' and 'friendship'.

Except for the changes to the 'migrant' and 'friendship' races text files my DFHack is basically vanilla, could someone tell me what to punch in?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on October 15, 2012, 01:07:26 am
migrant and friendship are dfusion commands you need to go into dfusion to run those.
Title: Re: DFHack 0.34.11 r2
Post by: Zanedale on October 15, 2012, 01:35:42 pm
migrant and friendship are dfusion commands you need to go into dfusion to run those.

I understand that part but I don't even know how to get into dfusion let alone run stuff in it.  :(
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on October 15, 2012, 03:39:16 pm
migrant and friendship are dfusion commands you need to go into dfusion to run those.

I understand that part but I don't even know how to get into dfusion let alone run stuff in it.  :(
you get into dfusion through typing dfusion, then typing the number next to the menu to navigate through the program.
Title: Re: DFHack 0.34.11 r2
Post by: Zanedale on October 15, 2012, 04:06:26 pm
you get into dfusion through typing dfusion, then typing the number next to the menu to navigate through the program.

Ok I tried that but I get some kind of error that says (in red text):

dfusion/common.lua.45: .Text region not found!
stack traceback:
           [C]: in function 'error'
           dfusion/common.lua:45: in function 'GetTextRegion'
           dfusion/common.lua:89: in function 'unlockDF'
           dfusion/int.lua:66: in main chunk


Did I get a bad deployment or something?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on October 15, 2012, 04:15:32 pm
Yeah, did you update DFhack?
Title: Re: DFHack 0.34.11 r2
Post by: Zanedale on October 15, 2012, 04:25:11 pm
Yeah, did you update DFhack?

I just Downloaded  the Lazy New pack and used the DFhack that came with it.
Title: Re: DFHack 0.34.11 r2
Post by: Rose on October 15, 2012, 04:35:17 pm
In that case, update DFhack.
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on October 15, 2012, 04:45:52 pm
And please note, as stated in previous posts, to remove old install before pushing new install in, to avoid version conflicts in scripts.
Title: Re: DFHack 0.34.11 r2
Post by: iTreefish on October 15, 2012, 08:48:39 pm
Hello, I've read up on all the workflow stuff but one thing still confuses me. What's the difference between workflow count & workflow amount? From what I can tell amount is total number of items, count is total number of stacks. Is this correct?
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on October 15, 2012, 10:46:22 pm
Not exactly.  Amount is used for things that are made in stacks, whether they're currently in stacks or not.  Case in point: Bolts

If I want 900 bolts on hand at any time, I'd use Amounts set to 900.

When bolts get fired during combat or training, they're seperated from the stack that generated them and, if they survive being fired, are still counted against the total.

So, if I still have 500 in stacks of 25, 175 in the quivers of my squads, 85 as individual bolts on the stockpile(s) and 55 scattered across the map, Workflow would now queue up production orders of 25 bolt stacks until the current stocked level was over 900, regardless of whether they're stacked or not.

I'm still a bit hazy on whether items fired, but still marked as {forbidden} count or not.  However, items in your squads inventories, such as in the example above, will not be counted toward the total available.

If I had set up Count at ((900bolts)/(25bolts/stack)) 36 stacks, then I'd have anywhere from 900 to 36 bolts, since it would be counting bolt "stacks" even if a stack had only one individual bolt, i.e. fired already.
Title: Re: DFHack 0.34.11 r2
Post by: tyrannus007 on October 16, 2012, 04:31:38 pm
How well does adv-bodyswap work? Can I just switch to another character and play a full game as them, or are there limitations?
Title: Re: DFHack 0.34.11 r2
Post by: peterix on October 17, 2012, 01:34:32 am
Added the OSX version :)

Test it, see if it works on your system.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on October 17, 2012, 04:49:42 am
How well does adv-bodyswap work? Can I just switch to another character and play a full game as them, or are there limitations?
There limitations better off using the bodyswap in dfusion. Which allows you to switch even if you don't have a nemesis on the character.
Oh yeah you can play the full game as the character or any character using bodyswap just that traveling with out the person having attached to a nemesis hook caused the game to jump to another person. adv-bodyswap is more restrictive in that it won't let you switch unless you use adv-bodyswap force permanent on someone and even then you need to talk or know the person you want to jump into.
Title: Re: DFHack 0.34.11 r2
Post by: Broken on October 17, 2012, 12:18:47 pm
Is posible to make a command that allows to blind/unblind dwarfs as needed? It will be really useful.
Title: Re: DFHack 0.34.11 r2
Post by: tyrannus007 on October 17, 2012, 01:25:12 pm
How well does adv-bodyswap work? Can I just switch to another character and play a full game as them, or are there limitations?
There limitations better off using the bodyswap in dfusion. Which allows you to switch even if you don't have a nemesis on the character.
Oh yeah you can play the full game as the character or any character using bodyswap just that traveling with out the person having attached to a nemesis hook caused the game to jump to another person. adv-bodyswap is more restrictive in that it won't let you switch unless you use adv-bodyswap force permanent on someone and even then you need to talk or know the person you want to jump into.
Thanks for the help. What do you mean by nemesis?
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 17, 2012, 01:27:41 pm
Thanks for the help. What do you mean by nemesis?

Nemesis is the data structure used by the game to track which files units should be loaded and saved to. Which means that if you bodyswap into a unit without a nemesis record, it will disappear as soon as you save & exit, fast travel or sleep. This is why adv-bodyswap won't let you swap into such units in the first place.

The name 'nemesis' is what Toady himself apparently uses, considering e.g. the well known "Nemesis Unit Load Failed" error.
Title: Re: DFHack 0.34.11 r2
Post by: tyrannus007 on October 17, 2012, 04:32:35 pm
So, anyone who isn't a companion or historical figure?
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 18, 2012, 02:50:24 am
Yes, the ovewhelming majority of units you see in adventure mode aren't permanent nemesis units; they are auto-generated as needed and discarded when you leave the area. The main exception is various lords, bandit leaders, titans etc. Also, talking to somebody actually creates nemesis and historical figure object on the spot.
Title: Re: DFHack 0.34.11 r2
Post by: Sidhien on October 18, 2012, 05:39:08 am
Sorry if this has been answered before but my mediocre search skills didn't turn up anything. There are a few points in my fortress where I've accidentally dug into a soil layer. I've replaced the walls with constructions and would like to hide the soil tiles behind them, thus creating the appearance that it was all rock to begin with.

Here's a picture of what I'm talking about:
Spoiler (click to show/hide)

From reading the readme it seems that I would want to use the tiletypes command, but I couldn't figure out exactly what sequence of commands would do the job (as opposed to hiding all soil tiles everywhere, for example). Can anyone help?
Title: Re: DFHack 0.34.11 r2
Post by: Urist McFumbler on October 18, 2012, 06:39:39 am
Sorry if this has been answered before but my mediocre search skills didn't turn up anything. There are a few points in my fortress where I've accidentally dug into a soil layer. I've replaced the walls with constructions and would like to hide the soil tiles behind them, thus creating the appearance that it was all rock to begin with.

Here's a picture of what I'm talking about:
Spoiler (click to show/hide)

From reading the readme it seems that I would want to use the tiletypes command, but I couldn't figure out exactly what sequence of commands would do the job (as opposed to hiding all soil tiles everywhere, for example). Can anyone help?

Type k, point it to any one of those rooms and type in revflood in dfhack. That should solve your problem
Title: Re: DFHack 0.34.11 r2
Post by: Rose on October 18, 2012, 06:44:42 am
It won't, as revflood ignores constructions, for various reasons relating to how the game works.
Title: Re: DFHack 0.34.11 r2
Post by: iTreefish on October 18, 2012, 07:06:16 am
Not exactly.  Amount is used for things that are made in stacks, whether they're currently in stacks or not.  Case in point: Bolts

Thanks for the explaination, I sort of get it now!

So really only things that are made in stacks work best with amount? Therefore really only bolts, coins, and bones (looking at the Stacks Wiki-page (http://dwarffortresswiki.org/index.php/Stack) (and of course there are no coins at the moment)?
Title: Re: DFHack 0.34.11 r2
Post by: Urist McFumbler on October 18, 2012, 09:09:26 am
Sorry if this has been answered before but my mediocre search skills didn't turn up anything. There are a few points in my fortress where I've accidentally dug into a soil layer. I've replaced the walls with constructions and would like to hide the soil tiles behind them, thus creating the appearance that it was all rock to begin with.

Here's a picture of what I'm talking about:
Spoiler (click to show/hide)

From reading the readme it seems that I would want to use the tiletypes command, but I couldn't figure out exactly what sequence of commands would do the job (as opposed to hiding all soil tiles everywhere, for example). Can anyone help?

Type k, point it to any one of those rooms and type in revflood in dfhack. That should solve your problem

It won't, as revflood ignores constructions, for various reasons relating to how the game works.

in that case you can do it the hard way by using tiletypes

remove all the constructed wall
type k and point at the floor
type in dfhack "tiletypes"
type in your range for example the long part of the vertical wall on the first image would be
1) range press enter
2) 1 press enter
3) 6 press enter
4) 1 press enter
5 ) filter shape floor press enter
6) filter material stone press enter
7) paint shape wall press enter
make sure the cursor in df is pointing at the offending floor right beside the soil wall
press enter in dfhack
do the same for all the corners using "point" instead of "range"
use revflood again

:D
Title: Re: DFHack 0.34.11 r2
Post by: Funkymatic on October 18, 2012, 09:26:13 pm
Where does the dwarfexport command save the exported xml file(s)?
Title: Re: DFHack 0.34.11 r2
Post by: Hamsmagoo on October 18, 2012, 11:44:12 pm
Added the OSX version :)

Test it, see if it works on your system.
I downloaded the osx version.

copied everything into the df folder

not quite sure how to get it to work
Title: Re: DFHack 0.34.11 r2
Post by: espenhw on October 19, 2012, 03:11:51 am
Where does the dwarfexport command save the exported xml file(s)?

Where you tell it to; it takes a filename as its only argument.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on October 19, 2012, 05:55:11 am
Added the OSX version :)

Test it, see if it works on your system.
I downloaded the osx version.

copied everything into the df folder

not quite sure how to get it to work

Open Terminal. Perform the following:
Code: [Select]
$ cd /path/to/DF
$ ./dfhack
Title: Re: DFHack 0.34.11 r2
Post by: Hamsmagoo on October 19, 2012, 04:22:37 pm
Added the OSX version :)

Test it, see if it works on your system.
I downloaded the osx version.

copied everything into the df folder

not quite sure how to get it to work

Open Terminal. Perform the following:
Code: [Select]
$ cd /path/to/DF
$ ./dfhack
clearly something is going over my head.
when I type those commands into the terminal I get "no such file or directory"
when I type those commands and DF is open, nothing happens at all
Title: Re: DFHack 0.34.11 r2
Post by: werty892 on October 20, 2012, 07:37:46 am
 Erm, I kinda have a problem I was hoping you could help me solve. I use reveal whenever I come across veins, to make mining them out easy and not a fit of micromanagement. But yesterday I was playing DF and used reveal. Then, I had to go, saved, while the map is still revealed, and came back today to find the map still revealed and I cant find a way to unreveal it. Can someone help? I have tired unreveal, but that wont work.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on October 20, 2012, 07:39:23 am
I dont know about the reveal thing, but why not use digv to dig veins ? thats what it is for.
Title: Re: DFHack 0.34.11 r2
Post by: Rose on October 20, 2012, 07:48:54 am
Use revflood to unreveal things you shouldn't be able to see.
Title: Re: DFHack 0.34.11 r2
Post by: Gaybarowner on October 20, 2012, 11:05:21 am
Random question but does macroing liquids work? Been looking around for it but couldnt find anything since going back and forth grows annoying
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 20, 2012, 01:05:35 pm
Use gui/liquids - you can use DF macros within the screen (although you can't enter it through a macro).
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on October 20, 2012, 03:18:13 pm
For DFHack developers:

Currently in https://github.com/angavrilov/df-structures/blob/master/df.units.xml the unit_wound structure looks like this:

Code: [Select]
<struct-type type-name='unit_wound' key-field='id'>
        <int32_t name="id"/>
        <stl-vector name="parts">
            <pointer>
                <int32_t name="unk_0"/>
                <int16_t name="body_part_id"/>
                <int16_t name="layer_idx"/>
                <int32_t name="unk_8"/>
                <int16_t name="unk_c"/>
                <int32_t name="unk_10"/>
                <stl-vector name="unk_14" type-name='int16_t'/>
                <stl-vector name="unk_24" type-name='int16_t'/>
                <stl-vector name="unk_34" type-name='int16_t'/>
                <int16_t name="unk_44"/>
                <int32_t name="unk_48"/>
                <int32_t name="unk_4c"/>
                <int32_t name="unk_50"/>
                <int32_t name="unk_54"/>
                <int32_t name="unk_58"/>
                <int32_t name="unk_5c"/>
                <int32_t name="unk_60"/>
                <int32_t name="unk_64"/>
                <int32_t name="unk_68"/>
                <int32_t name="unk_6c"/>
                <int16_t name="unk_70"/>
                <int16_t name="unk_72"/>
                <int32_t name="unk_74"/>
            </pointer>
        </stl-vector>
        <int32_t name="unk_14"/>
        <int32_t name="unk_18"/>
        <int32_t name="unk_1c"/>
        <int32_t name="unk_20"/>
        <int32_t name="unk_24"/>
        <int32_t name="unk_28"/>
        <int32_t name="unk_2c"/>
        <int32_t name="unk_30"/>
        <int32_t name="unk_34"/>
        <int32_t name="unk_38"/>
        <int32_t name="unk_3c"/>
        <pointer name="unk_40"/>
    </struct-type>

Through experimentation I have discovered the following about the unknown values:

Code: [Select]
unk_0
An index based on all layers on all body parts in a creature (i.e. 0-600)

body_part_id
An index based on all body parts in a creature (i.e. 0-200)

layer_idx
An index based on layers in a specific body part (i.e. 0-3)

unk_8
Contact area of the wound. Is initially the lesser of the weapon or body part contact areas.
It grows with cumulative hits. Body parts and non-weapon items have contact=(size/10)^(2/3).

unk_c
This is a 0-100 percentage of the surface area on the body part covered by the wound.

unk_10
This is strain. For skin/muscle/fat it is usually around 50000, and for bone 100-113.
This number heals over time towards 0. A wound that only has strain is called "dented".

unk_14
A vector of 0-100 percentages related to bruises and other effects on body parts.

unk_24
A vector of 0-100 percentages related to bruises and other effects on body parts.

unk_34
A vector of integers that choose the "flavor" of the unk_14 and unk_24 vectors.
Known values are: 0 bruise, 1 burn (heatdam), 2 frostbite (colddam), 4 melting, 6 freezing,
8 necrosis, 9 blister.

unk_44
A random percentage from 0-100, only for edged damage cases. Otherwise 0.

unk_48
Flags related to tissue damage:
1 [2^0] cut apart/open, 2 [2^1] needs setting, 64 [2^6] tendon torn, 512 [2^9] ligament torn,
1024 [2^10] motor nerve severed, 2048 [2^11] sensory nerve severed, 4096 [2^12] edged damage,
8192 [2^13] smashed apart, 16384 [2^14] major artery, 32768 [2^15] spilled guts,
268435456 [2^28] compound fracture (jamming), 1073741824 [2^30] artery,
2147483648 [2^31] overlapping fracture (joint/shoulder/elbow/wrist/hip/knee/ankle)

unk_4c
Unknown, but observed values are 0, 2, and 3. The value 3 seems to appear when a bone is damaged.

unk_50
This number is proportional to how vascular a tissue is, if an artery is damaged, and it reduces over time.

unk_54
This number is proportional to the pain sensitivity of tissue, and reduces over time.

unk_58
?

unk_5c
?

unk_60
?

unk_64
This number is related to numbness

unk_68
This 0-100 percentage is related to swelling

unk_6c
This number is related to impaired function

unk_70
This 0-100 percentage is related to cumulative damage. In cases where multiple axe hacks are necessary
for severing a limb, it must reach 100 before severing occurs. In cases where a weapon can't completely
penetrate a tissue, it is related to the weapon's penetration number. This percentage heals towards 0 over time.

unk_72
The same as unk_70, except that this number never heals over time. It appears to show the all-time maximum.

unk_74
?

unk_14
The age of the wound, given in some kind of time unit.

unk_18
The index of the creature who caused the wound.

unk_1c
The index of the historical figure who caused the wound. This includes creatures possessed in the arena.

unk_20
Flags:
1 severed body part, 2 mortal wound, 4 weapon stuck in wound.
So 6 might mean that a dagger is stuck in the heart.

unk_24
The index of the syndrome that caused the wound.

unk_28
?

unk_2c
?

unk_30
?

unk_34
?

unk_38
related to numbness, nervous damage, or paralysis

unk_3c
?

unk_40
?

Questions?
Title: Re: DFHack 0.34.11 r2
Post by: danaris on October 20, 2012, 08:11:00 pm
Added the OSX version :)

Test it, see if it works on your system.
I downloaded the osx version.

copied everything into the df folder

not quite sure how to get it to work

Open Terminal. Perform the following:
Code: [Select]
$ cd /path/to/DF
$ ./dfhack
clearly something is going over my head.
when I type those commands into the terminal I get "no such file or directory"
when I type those commands and DF is open, nothing happens at all

You can't just type "cd /path/to/DF". That's a placeholder. I don't know what directory you have Dwarf Fortress installed in. If you don't know how to use the terminal to find out, then do this:

1) In the Finder, locate the folder with DF in it.
2) Open the Terminal.
3) Type "cd " (that's with a space at the end). Do not hit Enter.
4) Drag the folder with DF in it from the Finder into the Terminal window. This will place the full path to the DF directory in the Terminal window.
5) Hit Enter.
6) Type "./dfhack" and hit Enter.

If this doesn't work, then either you're doing it wrong ;D , or you have an odd installation of DF, or DFHack isn't installed correctly.
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 21, 2012, 10:27:27 am
Through experimentation I have discovered the following about the unknown values:

Here, added your data to the definitions, with some further guesses from myself :)

https://github.com/angavrilov/df-structures/compare/2330b98...453452e87b (https://github.com/angavrilov/df-structures/compare/2330b98...453452e87b)
Title: Re: DFHack 0.34.11 r2
Post by: Hamsmagoo on October 21, 2012, 03:04:53 pm
Added the OSX version :)

Test it, see if it works on your system.
I downloaded the osx version.

copied everything into the df folder

not quite sure how to get it to work

Open Terminal. Perform the following:
Code: [Select]
$ cd /path/to/DF
$ ./dfhack
clearly something is going over my head.
when I type those commands into the terminal I get "no such file or directory"
when I type those commands and DF is open, nothing happens at all

You can't just type "cd /path/to/DF". That's a placeholder. I don't know what directory you have Dwarf Fortress installed in. If you don't know how to use the terminal to find out, then do this:

1) In the Finder, locate the folder with DF in it.
2) Open the Terminal.
3) Type "cd " (that's with a space at the end). Do not hit Enter.
4) Drag the folder with DF in it from the Finder into the Terminal window. This will place the full path to the DF directory in the Terminal window.
5) Hit Enter.
6) Type "./dfhack" and hit Enter.

If this doesn't work, then either you're doing it wrong ;D , or you have an odd installation of DF, or DFHack isn't installed correctly.
lol, I was literally typing /path/to/df

but, even typing out the actual path, or dragging in the folder gives me "no such file or directory"

I might have extracted dfhack wrong, but it's more likely I have a weird install of dwarf fortress.  I always just download a folder and leave it on my desktop and never installed anything.  I trash it and re-download it a lot.

I'll keep playing around with it.  At least it makes sense to me, now.  Thanks.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on October 21, 2012, 03:09:40 pm
lol, I was literally typing /path/to/df

but, even typing out the actual path, or dragging in the folder gives me "no such file or directory"

I might have extracted dfhack wrong, but it's more likely I have a weird install of dwarf fortress.  I always just download a folder and leave it on my desktop and never installed anything.  I trash it and re-download it a lot.

I'll keep playing around with it.  At least it makes sense to me, now.  Thanks.

Oh! *facepalm* I think I know the problem.

In step 3-5, you need to surround the path to the DF directory in quotes (put one quote before you drag it in, and one before you hit Enter). My guess would be it has at least one space in it ;D
Title: Re: DFHack 0.34.11 r2
Post by: Hamsmagoo on October 21, 2012, 04:09:17 pm
lol, I was literally typing /path/to/df

but, even typing out the actual path, or dragging in the folder gives me "no such file or directory"

I might have extracted dfhack wrong, but it's more likely I have a weird install of dwarf fortress.  I always just download a folder and leave it on my desktop and never installed anything.  I trash it and re-download it a lot.

I'll keep playing around with it.  At least it makes sense to me, now.  Thanks.



Oh! *facepalm* I think I know the problem.

In step 3-5, you need to surround the path to the DF directory in quotes (put one quote before you drag it in, and one before you hit Enter). My guess would be it has at least one space in it ;D
It worked!  The problem was actually that I forgot to put a space in between cd and the path.  But now it's saying "could not load inserted library: ./hack/libdfhack.dylib" probably because I have to re-download and extract again.  I tossed those files everywhere in a fit of hectic, clueless troubleshooting.

At least I'm getting somewhere.  I am so code illiterate.

EDIT: update-- after some troubleshooting, I now know that I extracted dfhack wrong.  Turns out that double-clicking the dfhack icon does the same thing as manually typng what you told me to type

each time, i get that "could not load" error followed by:
/path/to/df hack : line 15: 502 Trace/BPT trap (if I click the icon)
and
./dfhack: line 15: 480Trace/BPT trap (when I type everything manually)
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on October 23, 2012, 01:29:05 am
I was doing some testing and noticed that flows are stored in memory even after they disappear.

Code: [Select]
count=0
for k,v in pairs(df.global.world.map.map_blocks) do
for kk,vv in pairs(df.global.world.map.map_blocks[k].flows) do
count = count + 1
end
end
print(count)

A dragon on a burnination rampage can quickly rack up thousands of stored flows in memory, even though the flames disappear moments after being created.

I started a test fort, and verified that there were 0 flows on the map in the first few seconds. I then set the top of a small hill on fire with dfhack. After the smoke and flames were all gone, there were 1580 flows in memory. After saving the game, quitting DF, and then loading the game, there were still 1580 flows in memory.

This might mean that flows contribute to the FPS death of the game by accumulating to large numbers that each have to be checked for activity.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on October 23, 2012, 01:35:32 am
I was doing some testing and noticed that flows are stored in memory even after they disappear.
<...>
Actually it's an optimization. It's more expensive to create/delete them, instead they are reused. How much performance is gained idk. But e.g. in waterfalls and mist generators it's quite logical that this approach is better than creating/deleting each flow.
Title: Re: DFHack 0.34.11 r2
Post by: Rose on October 23, 2012, 01:44:05 am
Yeah, those flows are most likely just being re-used
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 23, 2012, 01:44:34 am
Might be a good idea to check if that reuse logic actually works though; it could be buggy.
Title: Re: DFHack 0.34.11 r2
Post by: HARD on October 23, 2012, 04:03:35 pm
Hey i need a script to remove strange mood from the dwarf
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on October 23, 2012, 04:55:23 pm
Hey a need a script to remove strange mood from the dwarf
Why exactly do you need to cancel a Strange Mood job? If it's due to lack of materials, it would be far simpler to just use changeitem to give the dwarf what he needs.
Title: Re: DFHack 0.34.11 r2
Post by: HARD on October 24, 2012, 07:48:42 am
Hey a need a script to remove strange mood from the dwarf
Why exactly do you need to cancel a Strange Mood job? If it's due to lack of materials, it would be far simpler to just use changeitem to give the dwarf what he needs.

Yep thats it, he needs a 'rough color' it says, well not sure what he needs exacly
Title: Re: DFHack 0.34.11 r2
Post by: crazysheep on October 24, 2012, 07:55:49 am
He needs rough gems.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on October 24, 2012, 08:39:01 am
There's actually a "showmood" command in DFHack which will tell you exactly what your moody dwarf wants.
Title: Re: DFHack 0.34.11 r2
Post by: Akjosch on October 24, 2012, 09:19:43 am
There's actually a "showmood" command in DFHack which will tell you exactly what your moody dwarf wants.

"Urist McGoth wants a hug."
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on October 24, 2012, 10:29:10 am
There's actually a "showmood" command in DFHack which will tell you exactly what your moody dwarf wants.

"Urist McGoth wants a hug."
Pop into adventure mode, use this dfusion script
Code: [Select]
function spar(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
entry=getline()
targ=getCreatureAtPos(getxyz())
end
unit.flags2.sparring=true
targ.flags2.sparring=true
unit.job.hunt_target=targ
targ.job.hunt_target=unit
end
adv_tools.menu:add("spar another",spar)
To set spar flag on urist Mcgoth and current unit you're playing, walk up and wrestle both arms over Mcgoth.
Title: Re: DFHack 0.34.11 r2
Post by: Alexander86 on October 27, 2012, 06:42:09 pm
I've tried serching to no avail, how do i turn on the option for fastdwarf for the dwarves to teleport to their destination?
Title: Re: DFHack 0.34.11 r2
Post by: thistleknot on October 27, 2012, 08:06:54 pm
is it possible to sort job priorities using dfhack (I know it's not a plugin right now, I'm just asking what would need to be done).
Title: Re: DFHack 0.34.11 r2
Post by: Clover Magic on October 27, 2012, 08:08:17 pm
I've tried serching to no avail, how do i turn on the option for fastdwarf for the dwarves to teleport to their destination?

You can find it on the readme.  fastdwarf now takes two number options, like so -> fastdwarf 1 1.  The first is traditional fastdwarf, the second is teledwarf.  0 is off, 1 is on.
Title: Re: DFHack 0.34.11 r2
Post by: Alexander86 on October 27, 2012, 08:36:22 pm
You can find it on the readme.  fastdwarf now takes two number options, like so -> fastdwarf 1 1.  The first is traditional fastdwarf, the second is teledwarf.  0 is off, 1 is on.
[/quote]

tyvm :)
Title: Re: DFHack 0.34.11 r2
Post by: PlumpHelmetDwarf on October 28, 2012, 02:07:02 pm
Mac dfhack report:

Initially, it didn't work for me. No errors, it'd just open dwarffort and then freeze. I managed to get it working by commenting out the

export DYLD_FORCE_FLAT_NAMESPACE=1

line from the command file. It then runs fine as far as I can tell. The only error I've come across is not being able to load stonesense (ie, as dfhack is starting up, it gives an error "Can't load plugin ~/df_34_11_m/hack/plugins/stonesense.plug.so").
Potentially there are other errors brought on by commenting that out, but I haven't come across them yet. All the commands I've tried worked fine.

Edit: This is on Mac OS 10.6.8, snow leopard.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on October 28, 2012, 07:45:39 pm
Mac dfhack report:

Initially, it didn't work for me. No errors, it'd just open dwarffort and then freeze. I managed to get it working by commenting out the

export DYLD_FORCE_FLAT_NAMESPACE=1

line from the command file. It then runs fine as far as I can tell.

What version of Mac OS X are you running?

Quote
The only error I've come across is not being able to load stonesense (ie, as dfhack is starting up, it gives an error "Can't load plugin ~/df_34_11_m/hack/plugins/stonesense.plug.so").
Potentially there are other errors brought on by commenting that out, but I haven't come across them yet. All the commands I've tried worked fine.

Stonesense needs some more work before it will run properly on a machine other than the build machine. It's got library issues.
Title: Re: DFHack 0.34.11 r2
Post by: Bradahkiin on October 29, 2012, 04:37:19 am
I've had the same 'could not load plugin' problem.
Not trying to rush the modders, I know that stuff can be hard work and its 'a library problem', but it would be cool if that could somehow be fixed soon.  :)
Title: Re: DFHack 0.34.11 r2
Post by: Bradahkiin on October 29, 2012, 04:38:55 am
Also, version of mac is 10.7.4 (Lion).
Title: Re: DFHack 0.34.11 r2
Post by: Ideocl4st on October 29, 2012, 09:25:14 pm
Mac OS user here.
Pretty much everything EXCEPT stonesense works on Mid-2012 MBP with Mountain Lion using DF that was installed with Dwarf Builder.
"Can't load plugin ~/hack/plugins/stonesense.plug.so" happens here too, with some helpful error messages in stderr.log about which libraries are missing in where.

The thing is, when I looked at the folder that supposed to have the missing files, the files were there - but with broken aliases.
(i.e. when stonesense needed X.dylib, the file in that folder was X.6.0.dylib with X.dylib as broken alias.)

However, placing actual files at the places that stonesense was looking for didn't help as it crashes DF when I managed to get everything in place.

Quote
./dfhack: line 15:   707 Bus error: 10
This was the error message on Terminal
Quote
dwarfort.exe(707,0xb0289000) malloc: *** error for object 0x156d4b30: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
dwarfort.exe(707,0xb0289000) malloc: *** error for object 0x156d4b30: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
and this was logged in stderr.log.

Edit - Urgh, I knew people would've already reported this...Should've checked after sleeping :P
Edit2 - I'll try to see if I can get it working SOMEHOW, which should help identifying why it would work differently with the build computer...
But after a full backup. I just got a whole system crashing on me.
Title: Re: DFHack 0.34.11 r2
Post by: Taigi on October 29, 2012, 10:00:34 pm
I am attempting to implement the solution found here (http://www.bay12forums.com/smf/index.php?topic=100377.msg2973250#msg2973250) to resurrect a creature in Dwarf Fortress mode to no avail.

I pasted the code into a new lua file in the adv_tools folder (as mentioned above that post) and made a menu item to call the (sic) ressurect method.  I am greeted with the following:
dfusion/adv_tools/init.lua:53: attempt to index global 'vector' <a nil value>
stack traceback:
         dfusion/init.lua:7: in function '__index'
etc.. etc..

Would anyone have a better, more thorough answer on resurecting and healing up a dead creature (in this case a Tiger Man who accidentally starved to death)?

Edit:
After reading the above post more carefully, I added the portions of the script in the script box to the init.lua script file in the tools directory, along with menu items.  This seems to be more likely what was being attempted in the post.

Now however, I am greeted with the following:
dfusion/common.lua:262:attempt to call field '?' <a nil value>
stack traceback:
        dfusion/init.lua:7: in function '?'
        dfusion/common.lua:262: in function 'display'
        dfusion/tools/plugin.lua:7 in main chunk
        [C]: in function 'xpcall'
        dfusion/init.lua:12: in function 'dofile'
        dfusion/init.lua:45: in function 'mainmenu'
        dfusion/init.lua:99: in main chunk



dfusion/init.lua:7 does not correspond to a function named '?' to my understanding, nor does dfusion/common.lua:262 have a field named '?'. 

Caveat:
I am not versed yet in lua, so please enlighten.  I can read some of this stuff, but I don't have a hold of the syntax quite yet.  By day I am a .NET/Java developer.
Tigey
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on October 30, 2012, 01:21:31 am
I am attempting to implement the solution found here (http://www.bay12forums.com/smf/index.php?topic=100377.msg2973250#msg2973250) to resurrect a creature in Dwarf Fortress mode to no avail.
<...>
Actually it's quite outdated. Although same principle could work the dfhack (and dfusion that is a part of it) went through a lot of changes.
I have semi working resurrect script at home (not sure if it does anything strange) but generally you can now add scripts to hack/script dir and use them straight from dfhack console.
Title: Re: DFHack 0.34.11 r2
Post by: Taigi on October 30, 2012, 08:31:49 am
Yeah, I have had moderate success with that.  I figured that referenced post was outdated.  It was like a year ago, and there have been 2 or 3 released since then.

 I would be very appreciative if I could get that script you have.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on October 30, 2012, 08:41:46 am
Yeah, I have had moderate success with that.  I figured that referenced post was outdated.  It was like a year ago, and there have been 2 or 3 released since then.

 I would be very appreciative if I could get that script you have.

After some search found it online:https://gist.github.com/2345207 (https://gist.github.com/2345207)
Put in scripts directory in e.g. file named "resunit.lua"
then append this to that script:
Code: [Select]
local pos=df.global.cursor
for k,v in pairs(df.global.world.units.active) do
  if v.pos.x==pos.x and v.pos.y==pos.y and v.pos.z==pos.z then
    heal(v)
  end
end
disclaimer: code is untested and could fail. Cursor (with watch/look/designate) should be on tile that creature was last alive.
To use type "resunit" in dfhack.
This could be improved by finding unit by id, from corpse pieces.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on October 30, 2012, 09:45:20 am
oh I just rez units by finding where they died, or just make a rez by checking all active units if they have the dead flag on.
oh wait that's my post here's the new ressurect code.

Code: [Select]
function tools.heal2(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
unit.body.wounds:resize(0) -- memory leak here :/
unit.body.blood_count=unit.body.blood_max
--set flags for standing and grasping...
unit.status2.able_stand=4
unit.status2.able_stand_impair=4
unit.status2.able_grasp=4
unit.status2.able_grasp_impair=4
--should also set temperatures, and flags for breath etc...
unit.flags1.dead=false
unit.flags2.calculated_bodyparts=false
unit.flags2.calculated_nerves=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.flags2.breathing_good=true
unit.counters.winded=0
unit.counters.unconscious=0
for k,v in pairs(unit.body.components) do
for kk,vv in pairs(v) do
v[kk]=0
end
end
end
tools.menu:add("heal2",tools.heal2)

the issue was the kk,vv in the old code was broken.
though this is also good for healing units also just that to revive any one you need to know where they died last.
Title: Re: DFHack 0.34.11 r2
Post by: Taigi on October 30, 2012, 10:02:28 am
Terrific!  Thanks a lot.  The Tiger Man lives and can now consume a lot of meat.  He thanks you too.
Title: Re: DFHack 0.34.11 r2
Post by: Box on October 30, 2012, 06:13:51 pm
Is there any way to use dfhack to put dwarves into a sort of REVERSIBLE stasis where none of the stats change, they're immobile, stay happy, don't get needs, etc?

Basically, I'm looking to do a low population game for survival challenges against sieges, but dealing with migrants is the biggest problem.  I can either slaughter them all and resort to pregnancy, or lock them down until I need them.  The latter is by far the best choice because it means I will have migrant waves in the future should I need them.

I've got extremely little experience with dfhack, unfortunately, but I'd be willing to try pretty much anything.
Title: Re: DFHack 0.34.11 r2
Post by: Hyphe on October 31, 2012, 06:32:08 am
Just downloaded the OSX version of this - it's fantastic, thank you all so so much for the work you've put into this.

Using OSX Mountain Lion (10.7.5) with the Mac Newbie pack (running DF through DFHack, using MacNewbie just for the initial setup & starting Therapist). I only want DFHack to fix bugs, since the binary patch isn't available for Mac.

Everything is working with no problems, except for tweaks that can be enabled / disabled.

Attempting to turn on "tweak patrol-duty" results in the error message "Could not activate tweak patrol-duty". Turning it off does not give an error (but I suspect it's not doing anything anyway). I have tried running "tweak patrol-duty" on it's own, and with a variety of arguments such as 1, true, on, enabled, etc.

Attempting to turn on "tweak stable-temp" outputs "Could not activate tweak stable-temp" twice, for some strange reason.

Tweaks that don't take a param seem to work fine (I tried makeown, though it did take me forever to work out which menu I was supposed to "select" the unit with).

When DFHack is loading, the terminal logs
"Could not insert Dwarf Manipulator hooks!
Can't load plugin /Applications/MacNewbie/Dwarf Fortress/hack/plugins/stonesense.plug.so
"
but they don't stop things running.

Is something in my install broken? Or am I just in the wrong menu / view / location to run the commands?
Title: Re: DFHack 0.34.11 r2
Post by: Ideocl4st on October 31, 2012, 07:43:15 am
Attempting to turn on "tweak patrol-duty" results in the error message "Could not activate tweak patrol-duty". Turning it off does not give an error (but I suspect it's not doing anything anyway). I have tried running "tweak patrol-duty" on it's own, and with a variety of arguments such as 1, true, on, enabled, etc.

Attempting to turn on "tweak stable-temp" outputs "Could not activate tweak stable-temp" twice, for some strange reason.

Tweaks that don't take a param seem to work fine (I tried makeown, though it did take me forever to work out which menu I was supposed to "select" the unit with).

When DFHack is loading, the terminal logs
"Could not insert Dwarf Manipulator hooks!
Can't load plugin /Applications/MacNewbie/Dwarf Fortress/hack/plugins/stonesense.plug.so
"
but they don't stop things running.

Is something in my install broken? Or am I just in the wrong menu / view / location to run the commands?
I'm using a build that came with Dwarf Builder (Like I said above), and can activate tweaks with parameters without errors.
(although stable-temp does give me confirmation message *twice*)

I think everyone is having problem with stonesense (there are others like us when you go back a few pages) due to libraries that are in different places compared to the computer that built the OS X version, so that isn't just your problem for sure. :)
Title: Re: DFHack 0.34.11 r2
Post by: Hyphe on October 31, 2012, 08:28:10 am
Thankyou, Ideocl4st! I had not heard of Dwarf Builder, and it has fixed my problem!
Title: Re: DFHack 0.34.11 r2
Post by: ag on October 31, 2012, 08:31:22 am
The tweaks are a bit quick and dirty, so they do give either confirmation or error messages multiple times, once for each hook it installs or removes.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on October 31, 2012, 08:33:55 am
Using OSX Mountain Lion (10.7.5) with the Mac Newbie pack (running DF through DFHack, using MacNewbie just for the initial setup & starting Therapist). I only want DFHack to fix bugs, since the binary patch isn't available for Mac.

Wait...are you on OS X Lion (10.7.5) or OS X Mountain Lion (10.8.2)?
Title: Re: DFHack 0.34.11 r2
Post by: Hyphe on October 31, 2012, 09:12:53 am
Wait...are you on OS X Lion (10.7.5) or OS X Mountain Lion (10.8.2)?
Lion, because my fingers get ahead of me sometimes. :)
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on October 31, 2012, 01:56:23 pm
Is there any way to use dfhack to put dwarves into a sort of REVERSIBLE stasis where none of the stats change, they're immobile, stay happy, don't get needs, etc?

Basically, I'm looking to do a low population game for survival challenges against sieges, but dealing with migrants is the biggest problem.  I can either slaughter them all and resort to pregnancy, or lock them down until I need them.  The latter is by far the best choice because it means I will have migrant waves in the future should I need them.

I've got extremely little experience with dfhack, unfortunately, but I'd be willing to try pretty much anything.
resident flag is what you need to fiddle with, turning it off on a dwarf will make them not ask for needs and freeze their happiness in place. slap that on a military unit and you can still issue commands to them.
Title: Re: DFHack 0.34.11 r2
Post by: CaptainArchmage on October 31, 2012, 09:28:37 pm
How do you install this on a Mac? Do you just drag and drop all the files?

Loading up from dfhack after this doesn't produce anything and the process just hangs. I'm on OSX 10.6. Am I doing something wrong?
Title: Re: DFHack 0.34.11 r2
Post by: Box on November 01, 2012, 12:41:00 am
I... uh... accidentally(?) painted obsidian all over some candy tubes.

What would I have to do with tiletypes to paint natural candy walls?  I can't find a way to paint a specific type of material such as galena, quartzite, ruby, platinum, etc.


Honestly, the documentation on this entire tool is really bad.

Title: Re: DFHack 0.34.11 r2
Post by: peterix on November 01, 2012, 03:08:59 am
I... uh... accidentally(?) painted obsidian all over some candy tubes.

What would I have to do with tiletypes to paint natural candy walls?  I can't find a way to paint a specific type of material such as galena, quartzite, ruby, platinum, etc.


Honestly, the documentation on this entire tool is really bad.
Paint FEATURE WALL - and only where the adamantine actually was. You can't paint materials directly. It's simply impossible without a few extra layers of abstraction nobody wrote yet.

There's a good reason why it prints out ``THIS TOOL CAN BE DANGEROUS. YOU'VE BEEN WARNED.'' every time you run it. If that's not enough indication that you should backup your stuff and proceed only then, I don't know what else to put there short of removing the tool entirely.

Also, have you seen this? https://github.com/peterix/dfhack#tiletypes
Title: Re: DFHack 0.34.11 r2
Post by: danaris on November 01, 2012, 07:06:55 am
How do you install this on a Mac? Do you just drag and drop all the files?

Loading up from dfhack after this doesn't produce anything and the process just hangs. I'm on OSX 10.6. Am I doing something wrong?

At present, 10.6 is unsupported.

However, you may be able to get it to work by opening up the dfhack script and changing this line

Code: [Select]
DYLD_FORCE_FLAT_NAMESPACE=1

to this:

Code: [Select]
#DYLD_FORCE_FLAT_NAMESPACE=1

Please try that and let us know.
Title: Re: DFHack 0.34.11 r2
Post by: Box on November 01, 2012, 07:43:14 am
removing the tool entirely.

HA HA NO

It's a useful tool.  However, that warning doesn't display for 'liquids', which is what I used to obsidian-ize a layer of the world.

Thanks for the info, though.  I found a little bit of a workaround involving changevein to get some other results I wanted, too.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 01, 2012, 05:24:44 pm
But shouldn't Dfhack just have a subtitle saying "THESE TOOLS CAN BE DANGEROUS. YOU'VE BEEN WARNED."
Title: Re: DFHack 0.34.11 r2
Post by: Devast on November 01, 2012, 09:05:37 pm
Is there a way to change oceans from water into lava?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 01, 2012, 09:18:23 pm
dfusion has that option.
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on November 01, 2012, 09:48:10 pm
oh I just rez units by finding where they died, or just make a rez by checking all active units if they have the dead flag on.
oh wait that's my post here's the new ressurect code.

Code: [Select]
function tools.heal2(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
unit.body.wounds:resize(0) -- memory leak here :/
unit.body.blood_count=unit.body.blood_max
--set flags for standing and grasping...
unit.status2.able_stand=4
unit.status2.able_stand_impair=4
unit.status2.able_grasp=4
unit.status2.able_grasp_impair=4
--should also set temperatures, and flags for breath etc...
unit.flags1.dead=false
unit.flags2.calculated_bodyparts=false
unit.flags2.calculated_nerves=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.flags2.breathing_good=true
unit.counters.winded=0
unit.counters.unconscious=0
for k,v in pairs(unit.body.components) do
for kk,vv in pairs(v) do
v[kk]=0
end
end
end
tools.menu:add("heal2",tools.heal2)

the issue was the kk,vv in the old code was broken.
though this is also good for healing units also just that to revive any one you need to know where they died last.

Instead of causing a memory leak with unit.body.wounds:resize(0), you could go into the wounds structure and zero some of the specific items (but leave the wounds in place), which would leave the wounds as harmless scars (or even have them vanish later due to deallocation and garbage collection). This might have to wait until the next dfhack version or update though, as the wounds structure was only recently documented.
Title: Re: DFHack 0.34.11 r2
Post by: Box on November 02, 2012, 11:11:05 pm
Is there any way at all to use dfusion or dfhack to fool the game into thinking I have 80 dwarves so I qualify for invasions?

I just learned I can't be invaded without 80 dwarves but I want to try and take on invasions using only 20 or so, and I've already carved out a fort prepped for them.  Would I really have to regenerate my entire world and edit some kind of civ tag just to be invaded at that point?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 02, 2012, 11:25:55 pm
oh I just rez units by finding where they died, or just make a rez by checking all active units if they have the dead flag on.
oh wait that's my post here's the new ressurect code.

Code: [Select]
function tools.heal2(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
unit.body.wounds:resize(0) -- memory leak here :/
unit.body.blood_count=unit.body.blood_max
--set flags for standing and grasping...
unit.status2.able_stand=4
unit.status2.able_stand_impair=4
unit.status2.able_grasp=4
unit.status2.able_grasp_impair=4
--should also set temperatures, and flags for breath etc...
unit.flags1.dead=false
unit.flags2.calculated_bodyparts=false
unit.flags2.calculated_nerves=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.flags2.breathing_good=true
unit.counters.winded=0
unit.counters.unconscious=0
for k,v in pairs(unit.body.components) do
for kk,vv in pairs(v) do
v[kk]=0
end
end
end
tools.menu:add("heal2",tools.heal2)

the issue was the kk,vv in the old code was broken.
though this is also good for healing units also just that to revive any one you need to know where they died last.

Instead of causing a memory leak with unit.body.wounds:resize(0), you could go into the wounds structure and zero some of the specific items (but leave the wounds in place), which would leave the wounds as harmless scars (or even have them vanish later due to deallocation and garbage collection). This might have to wait until the next dfhack version or update though, as the wounds structure was only recently documented.
I think this could be possible in Dfusion/dfhack now, I just posted an modern version of the heal command because the one the guy was referencing was really outdated.
Title: Re: DFHack 0.34.11 r2
Post by: Aerval on November 03, 2012, 10:17:11 am
Rumrusher, do you have a collection of your various dfusion skripts (and techniques) ? I know you post them from time to time on the forum but I can't find them when I need them.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 03, 2012, 12:17:19 pm
well I keep a large collection of them in the dfusion thread though I could drop a pastebin of my recent folder.
though its filled with stuff that might break your game due to either I was testing something or I half way work on something, or use an modified common.lua.
Title: Re: DFHack 0.34.11 r2
Post by: Aerval on November 03, 2012, 02:24:58 pm
Okay, that was the point I was asking for: Whether you have kept your scripts in a way that would allow other players to run them out of the box without much figuring out on their own, just like normal dfhack plugins. But in this case, never mind. Nevertheless many thanks for sharing them occasionally (and your sig)
Title: Re: DFHack 0.34.11 r2
Post by: Lopezruy on November 03, 2012, 09:56:46 pm
Okay so, I am trying to install scripts for DFHack, but it won't load up the scripts. I've tried reload PLUGIN and reload all. Help?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 04, 2012, 02:36:40 am
oh and all the scripts are for Dfusion and you need to dump them into the tools folder.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on November 04, 2012, 09:25:15 am
Okay so, I am trying to install scripts for DFHack, but it won't load up the scripts. I've tried reload PLUGIN and reload all. Help?

What, exactly, are you trying, and what, exactly, is it telling you when you do?
Title: Re: DFHack 0.34.11 r2
Post by: Tharg on November 04, 2012, 02:15:54 pm
I'm trying to get autobutcher to work but no luck.  This is in my Workflow.txt :

Code: [Select]
autobutcher unwatch all
autobutcher forget all
autobutcher noautowatch
autobutcher stop

autobutcher target 2 2 10 2 CAVY PIG
autobutcher target 5 2 20 2 SHEEP
autobutcher target 0 0 0 0 RABBIT
autobutcher watch CAVY PIG SHEEP RABBIT
autobutcher start

but

Code: [Select]
[DFHack]# autobutcher list
Autobutcher status: not enabled, noautowatch, sleep: 6000
Default setting for new races: fk=50 mk=50 fa=50 ma=50
The autobutcher race list is empty.

If I change the script to

Code: [Select]
autobutcher unwatch all
autobutcher forget all
autobutcher noautowatch
autobutcher stop
autobutcher start
autobutcher target 2 2 10 2 CAVY PIG
autobutcher target 5 2 20 2 SHEEP
autobutcher target 0 0 0 0 RABBIT
autobutcher watch CAVY PIG SHEEP RABBIT

I get

Code: [Select]
[DFHack]# autobutcher list
Autobutcher status: not enabled, noautowatch, sleep: 6000
Default setting for new races: fk=50 mk=50 fa=50 ma=50
Races on autobutcher list:
watched: PIG fk=2 mk=2 fa=10 ma=2
watched: CAVY fk=2 mk=2 fa=10 ma=2
watched: SHEEP fk=5 mk=2 fa=20 ma=2
watched: RABBIT fk=0 mk=0 fa=0 ma=0

and nothing is butchered.

Oddly, if I try the example

Code: [Select]
autobutcher target 0 0 0 0 new
autobutcher autowatch
autobutcher start

I get

Code: [Select]
[DFHack]# autobutcher list
Autobutcher status: not enabled, autowatch, sleep: 6000
Default setting for new races: fk=0 mk=0 fa=0 ma=0
Races on autobutcher list:
watched: GIANT_KEA fk=0 mk=0 fa=0 ma=0
watched: BIRD_PEAFOWL_BLUE fk=0 mk=0 fa=0 ma=0
watched: PIG fk=0 mk=0 fa=0 ma=0
watched: SHEEP fk=0 mk=0 fa=0 ma=0
watched: CAT fk=0 mk=0 fa=0 ma=0
watched: BIRD_GUINEAFOWL fk=0 mk=0 fa=0 ma=0
watched: DOG fk=0 mk=0 fa=0 ma=0
watched: RABBIT fk=0 mk=0 fa=0 ma=0
watched: CAVY fk=0 mk=0 fa=0 ma=0
watched: MINK fk=0 mk=0 fa=0 ma=0
watched: GIANT_BARN_OWL fk=0 mk=0 fa=0 ma=0
watched: BIRD_TURKEY fk=0 mk=0 fa=0 ma=0

But everything is market for slaughter

I have the top Windows version of dfhack from here :

https://github.com/peterix/dfhack/downloads

Looking back a few pages in this thread I see this linked :

https://github.com/angavrilov/dfhack/commit/6fefd0907281b41bbcbe27df1bea113ab8c46c1b

which seems to be what I need ... But I don't know if it's included in what I have, or if not, how to add it.

Thanks in advance for any help! 

dfhack has been very useful, I have most of my workshop production automated nicely.  As a future feature request, how about auto-rotate-war training?  So I can somehow select, say, 30 dwarves and then have them each train a different dog.
Title: Re: DFHack 0.34.11 r2
Post by: T86g on November 04, 2012, 04:51:44 pm
If you use version 0.34.11-r2 (posted in this thread) the patch is not yet included. If you compiled dfhack from the repository (yourself), it should be included.


How is it possible to process plants (to bag, barrel, vial)? Commands like
Code: [Select]
workflow count LEAVES//BUSH_QUARRY 1000
workflow count POWDER_MISC//MUSHROOM_CUP_DIMPLE:MILL 1000
are accepted, but the no jobs are found. Producing thread from pig tails (THREAD) works fine.

Thank you for your help!
And thank you for dfhack. Especially workflow and autobutcher are great tools.
Title: Re: DFHack 0.34.11 r2
Post by: Tharg on November 04, 2012, 05:07:31 pm
If you use version 0.34.11-r2 (posted in this thread) the patch is not yet included. If you compiled dfhack from the repository (yourself), it should be included.

Thanks!  Guess I'll be trying to get that to work ...

How is it possible to process plants (to bag, barrel, vial)? Commands like
Code: [Select]
workflow count LEAVES//BUSH_QUARRY 1000
workflow count POWDER_MISC//MUSHROOM_CUP_DIMPLE:MILL 1000
are accepted, but the no jobs are found. Producing thread from pig tails (THREAD) works fine.

Thank you for your help!
And thank you for dfhack. Especially workflow and autobutcher are great tools.

For the quarry bushes You have to select the workshop and do :

Code: [Select]
job item-material 1 BUSH_QUARRY
which I think locks the material to the workshop.  Then you can do, e.g,

Code: [Select]
workflow count LEAVES//BUSH_QUARRY:LEAF 50 10
Might be a similar story with the powder.
Title: Re: DFHack 0.34.11 r2
Post by: T86g on November 04, 2012, 05:25:40 pm
Thank you, this worked!
Title: Re: DFHack 0.34.11 r2
Post by: Tharg on November 04, 2012, 07:46:40 pm
Thank you, this worked!

And thank you also, I managed to build dfhack with the butcher fix, it seems. 

I could have done something wrong but it seems to me that the latest on

https://github.com/peterix/dfhack

that I got with git did not have the fix in.  So I edited the zone.cpp file as per the other link, and now all seems good.  I think this is the first time I've ever managed to build anything successfully on windows.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on November 04, 2012, 07:55:50 pm
Is there a way to have announcements in the gamelog.txt activate plugins and such? (Just in case I feel like coming up with something good later)

EDIT: And by that I mean have a plugin running that will do something when a certain announcement shows up, of course.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on November 05, 2012, 10:17:10 am
Yes. Even a few things that don't visibly show up in the announcements show up in the announcements data structure. You can make something that's triggered by any dwarf standing up, if you want.
Title: Re: DFHack 0.34.11 r2
Post by: thistleknot on November 05, 2012, 10:23:08 am
what happened to the compile instructions on the 1st post?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on November 05, 2012, 12:41:57 pm
https://github.com/peterix/dfhack/blob/master/Compile.rst
Title: Re: DFHack 0.34.11 r2
Post by: armeggedonCounselor on November 05, 2012, 08:34:20 pm
I was told to ask in here about whether DFHack can fix a stuck siege. I've routed everybody on the surface, but I'm still in siege mode. I haven't breached the caverns yet, so I doubt I was invaded through there as well. So... can DFHack fix it?
Title: Re: DFHack 0.34.11 r2
Post by: Blakmane on November 05, 2012, 09:59:11 pm
Is there any way at all to use dfusion or dfhack to fool the game into thinking I have 80 dwarves so I qualify for invasions?

I just learned I can't be invaded without 80 dwarves but I want to try and take on invasions using only 20 or so, and I've already carved out a fort prepped for them.  Would I really have to regenerate my entire world and edit some kind of civ tag just to be invaded at that point?

I don't think anyone noticed your post, but:

IIRC there isn't a hard pop cap on goblin invasions. The triggers are all OR, not AND, so if you just export/create enough wealth you should have goblin invasions even with a low population. This is certainly my experience in-game.
Title: Re: DFHack 0.34.11 r2
Post by: TeleDwarf on November 06, 2012, 10:35:15 am
I am not sure if this is the right thread, but how do I setup milking, shearing and spinning in workflow plugin?
Title: Re: DFHack 0.34.11 r2
Post by: walberg on November 06, 2012, 12:37:09 pm
I was told to ask in here about whether DFHack can fix a stuck siege. I've routed everybody on the surface, but I'm still in siege mode. I haven't breached the caverns yet, so I doubt I was invaded through there as well. So... can DFHack fix it?

Does your Units screen show any remaining invaders? It's possible you have a goblin with a flying mount hanging out somewhere above you... If so, marksdwarves can fix that (or you could (ab-)use dfhack's liquids to drop a block of obsidian on his head or something...).
Title: Re: DFHack 0.34.11 r2
Post by: armeggedonCounselor on November 06, 2012, 06:11:31 pm
I was told to ask in here about whether DFHack can fix a stuck siege. I've routed everybody on the surface, but I'm still in siege mode. I haven't breached the caverns yet, so I doubt I was invaded through there as well. So... can DFHack fix it?

Does your Units screen show any remaining invaders? It's possible you have a goblin with a flying mount hanging out somewhere above you... If so, marksdwarves can fix that (or you could (ab-)use dfhack's liquids to drop a block of obsidian on his head or something...).

No invaders in my units screen.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on November 08, 2012, 01:13:32 pm
Is there any way at all to use dfusion or dfhack to fool the game into thinking I have 80 dwarves so I qualify for invasions?

I just learned I can't be invaded without 80 dwarves but I want to try and take on invasions using only 20 or so, and I've already carved out a fort prepped for them.  Would I really have to regenerate my entire world and edit some kind of civ tag just to be invaded at that point?

I don't think anyone noticed your post, but:

IIRC there isn't a hard pop cap on goblin invasions. The triggers are all OR, not AND, so if you just export/create enough wealth you should have goblin invasions even with a low population. This is certainly my experience in-game.
Agreed.  If you get to 21+ dwarves, have had at least one visit from the liaison, and your manager has gone into "normal mode" from "first year mode", you should start to get sieges with regularity.  I've done extensive testing in this area, and found this to be true.

However, there are geographical considerations.  If goblins can't reach you, you'll never get sieges.  Isolated mountain valleys, islands, and the like can cause this.  The higher dwarven population is only required for the county/duchy/monarch plot line, from what I've seen.

If you're not getting goblins/invasions, and all the above is true, dfhack won't help.  But if you can post/PM a save, Box, I'd be happy to look at it to see what's up.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 09, 2012, 02:00:14 am
You could just take a bunch of dwarves out of fort mode and pillage some towns if you want bloodshed.
Title: Re: DFHack 0.34.11 r2
Post by: Nokao on November 09, 2012, 07:19:35 am
Hi ! I have a series of scripts on that list, that is not installed correctly or not work. How do I fix this?
(I'm on windows, the error is "XXX is not a recognized command")

An example:

Also, I did not understand if the fixes have to be installed or not.
Is the game bugged and that fixes are necessary ?

I'm talking about:

What about gui/mechanisms, gui/workshop-job, gui/workflow, etc ?
Why this fixes are not being inserted in the original game by Toady/programmers instead of using external patches made by fans ?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on November 09, 2012, 07:25:49 am
<...>
Why this fixes are not being inserted in the original game by Toady/programmers instead of using external patches made by fans ?
i can answer this: because these fixes have been discovered quite recently and Toady is currently developing next version (and thus is not releasing bug-fix versions). Also they might be a bit different to what Toady (the only programmer working with DF) intends (i.e. he might have different plans for that specific thing).
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on November 09, 2012, 07:28:22 am
I remember reading about a command for adding the specific castes to the Embark group, say, with antmen, two warriors, one queen, and four workers. How do I do that?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on November 09, 2012, 07:39:06 am
I remember reading about a command for adding the specific castes to the Embark group, say, with antmen, two warriors, one queen, and four workers. How do I do that?
afair it was dfusion->embark and then dfusion->tools. but first you need to edit dfusion/embark/races.txt and dfusion/friendship/races.txt
The one for embark has syntax for each line RACE:CASTE_ID and for friendship(so that those races could work) RACE

It should be noted that those plugins work only on windows and can crash. Embark should be used in the site selection menu.
Title: Re: DFHack 0.34.11 r2
Post by: Nokao on November 09, 2012, 09:45:07 am
Quote
... Toady is currently developing next version (and thus is not releasing bug-fix versions). Also they might be a bit different to what Toady (the only programmer working with DF) ...

Ok, so this explains many things.

I got very passioned with DF 1 week ago, and I didn't do anything else than to play with it so I really like it so much.
But of course I have seen it's huge limits of the game interface and game graphics

It's a miracle that sound, utilities, and some fan-made graphics made it a playable game,
but I think that if this was an open-source game it would have been very better.
A good example is what they did with "The Battle for Wesnoth".

I don't want to make a troll/flame with this post,
I really think that the 2 developers of DF are geniuses,
but I also would like (for the love I'm feeling for that game now) that this in the future will became open source,
allowing hundreds of fans and programmers to make it a better game, only in the game interface, graphics, and other "secondary" stuff that actually are it's only flaw.
I think it's just impossible with 2 programmers to do it better, because it must be a really really huge project, and that makes me sad because I would like to play it 10 years from now and see a totaly modern kick-assing game like it seems, digging inside, and not on the surface.

Expecially if the game is going to be a free game, I don't see the reason to keep the code for themselves,
considering that there are a lot of licenses that protect copyright out there.

In the meantime, I'll just keep going in understanding this beautiful game and install 15+ other plugins/software to play it better.

p.s. So much thanks to Tarn and Zach Adams for this amazing game.
Title: Re: DFHack 0.34.11 r2
Post by: AutomataKittay on November 09, 2012, 10:14:28 am
Just nitpicking, there're only one programmer, and he's not willing to open or let others works with him in the codes, because it's something he enjoys very much to work with :D
Title: Re: DFHack 0.34.11 r2
Post by: Nokao on November 09, 2012, 10:23:21 am
Just nitpicking, there're only one programmer, and he's not willing to open or let others works with him in the codes, because it's something he enjoys very much to work with :D

I'm sure of it, there was not intention of critics here, this is HIS game and it always will be.

But I'm also an experienced programmer (not of this kind of stuff, but other kind of) and I can tell for sure that making this an open-code software,
expecially because there is a lot of interest here on the forum and a really passionate community (most of wich are nerds and programmers like me),
the game would flourish becoming really good and famous in 1-2 years.

Staying closed, it will always be the same, never change, and need hundreds of fan patch/utilities/fixes to be playable.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on November 09, 2012, 10:40:04 am
Actually, open-sourcing the game would fracture the community as dozens of forks would show up and each go in their own separate direction.

This has been discussed more times than I can remember, and it really doesn't need to be discussed again.
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 09, 2012, 11:25:15 am
I have a problem with steam engine. The "stoke boiler" reaction does not appear in the workshop. It comes from the way it's painted somehow (if I change the tiles workshop uses, the reaction appears).
Title: Re: DFHack 0.34.11 r2
Post by: Nokao on November 09, 2012, 11:43:36 am
This has been discussed more times than I can remember, and it really doesn't need to be discussed again.

Yes I'll stop bothering, I'm the last arrived here and I don't want to flame.
However I still think that one programmer is not enough to make a good game out of this.

From the final result it's clear that he loves to code the "nerd-law-of-phisics-game-engine" part and not the graphics, GUI, gameplay, and so on.
I will still play it, tough, but my friends when I send the link of this game I love, just don't understand how can I play it.
I would like it to be more "for anyone" instead of "for nerds".

SO, I change argument.

Can someone help me understand why only 50% of my DFhack is working ?

For example, autobutcher and clean map works,
fast-trading, siren, magmasource don't.

Also, I still have to understand if I need and how to activate all this (not active):
gui/mechanisms
gui/workshop-job
gui/workflow
gui/assign-rack
fix/population-cap
fix/armory
Title: Re: DFHack 0.34.11 r2
Post by: ag on November 09, 2012, 12:36:19 pm
For example, autobutcher and clean map works,

DFHack 0.34.11-r1 stuff.

tweak fast-trading, siren, magmasource
gui/mechanisms
fix/population-cap

DFHack 0.34.11-r2 stuff.

gui/workshop-job
gui/workflow
gui/assign-rack
fix-armory

Not released yet.

It would seem you have an old version installed.
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 09, 2012, 12:44:05 pm
Is there something not installed properly that causes that behaviour with Steam Engine? Who's the creator of it? I would like to talk to him, maybe in PM. I cannot figure out why does the reaction suddenly disappear as soon as I change the tiles to the ones coming with DFHack.
Title: Re: DFHack 0.34.11 r2
Post by: Nokao on November 09, 2012, 01:28:22 pm
It would seem you have an old version installed.

That was it, thanks.

Someone should re-do the lazy newb pack with DFhack R2.
Title: Re: DFHack 0.34.11 r2
Post by: ag on November 09, 2012, 01:42:46 pm
Is there something not installed properly that causes that behaviour with Steam Engine? Who's the creator of it? I would like to talk to him, maybe in PM. I cannot figure out why does the reaction suddenly disappear as soon as I change the tiles to the ones coming with DFHack.

That's me - but it's time to sleep here :) Can you upload the file that works, and the one that doesn't so that I could have a look tomorrow?

The appearance of the engine is actually used for some things, like determining which tiles should change color based on power, and which ones can connect to machines; but I have no idea how can it affect reactions. What do you mean by saying that it "disappears" btw?
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 09, 2012, 02:16:08 pm
I just inserted the code you supply with dfhack into my entity, building and reaction files. If I select the engine, the reaction is not there. If I change the engine display tiles, the reaction appears.
Title: Re: DFHack 0.34.11 r2
Post by: ag on November 10, 2012, 03:00:25 am
I just inserted the code you supply with dfhack into my entity, building and reaction files. If I select the engine, the reaction is not there. If I change the engine display tiles, the reaction appears.

It seems to work perfectly in my test save that I used for development, so can you upload yours somewhere?
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 10, 2012, 05:23:31 am
This is the save with a built steam engine which lacks any reactions inside.

Note that it comes from the way the tiles are arranged, I don't know why, it probably has something to do with dfhack.

http://dffd.wimbli.com/file.php?id=7119
Title: Re: DFHack 0.34.11 r2
Post by: ag on November 10, 2012, 06:24:46 am
As the documentation says, the steam engine must be built over a down stair leading to liquid water, sort of like magma workshops do. Otherwise it has nothing to run on.

If you remove the gear tiles, the plugin won't detect the steam engine, so it won't check water, but it won't work otherwise either.

Edit: If you construct a down stair on top of that brook, and place an engine on it, it works perfectly. Maybe it should also support being placed directly on top of a brook too, but currently it needs a hole.
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 10, 2012, 06:50:04 am
Then it was me not noticing instructions. Thank you very much!
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 10, 2012, 06:55:33 am
That worked amazingly, thank you!

Now I wonder if there's a dfhack library which allows to make certain workshops to require power. The existing ones are just a few, and I would love to make my sawmills and soul infusers to require power.
Title: Re: DFHack 0.34.11 r2
Post by: ag on November 10, 2012, 09:27:06 am
No library; I suppose you could copy & paste a part of steam engine. However, it will have the same problems as steam engines (see docs), which can't be resolved without Toady. I think it shouldn't be too hard for him to add some custom workshop tags to define which tiles can be connected to machines, and how much power it draws.
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 10, 2012, 02:26:55 pm
I don't see a way to work with the siege engine plugin.

The front end does not list a key to activate it, can someone help me with this one?
The instructions say to "bind it to a key", but where can I bind it? Same with other things like power meter.
Title: Re: DFHack 0.34.11 r2
Post by: Dibber6 on November 10, 2012, 03:18:36 pm
Hey, guys. I was told I should come here to ask about a problem I was having while trying to run the genesis mod. When I try to run the genesis mod, it says "The program can't start because fmodelx.dll is missing from your computer. Try reinstalling the program to fix this problem." Thanks for the help in advance.
Title: Re: DFHack 0.34.11 r2
Post by: Naros on November 10, 2012, 06:57:01 pm
Would this be the place to ask for DFhack / Dfusion / lua scripting help?

I'm trying to give every dwarf in the fort level 5 weapon smithing.
I know it has something to do with
"unit.status.current_soul.skills.FORGE_WEAPON" .. but do I then do "= 5" behind it? Or the XP?

I know there's a way to get all dwarves targeted when doing this, but I've forgotten.
I'm really failing to wrap my head around this. Help, please? :)
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 10, 2012, 09:29:20 pm
you might need the number where FORGE_WEAPON resides in. then do the '= 5' next to it.
To get all dwarves targeted you need to set up 'k,v in pairs (df.global.world.active) do' which pulls all units then set up V to filter out all those units down to your dwarves.
Title: Re: DFHack 0.34.11 r2
Post by: ag on November 10, 2012, 10:05:31 pm
I don't see a way to work with the siege engine plugin.

The front end does not list a key to activate it, can someone help me with this one?
The instructions say to "bind it to a key", but where can I bind it? Same with other things like power meter.

See dfhack.init-example. If renamed to dfhack.init, it will be loaded when DF starts.
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 11, 2012, 08:04:33 am
How did I not use dfhack for so long? I became immediately addicted.

Can someone direct me to more amazing plugins which are not linked in the first post? I.e. Rumrusher gave me Companion order plugin, and it is a must-have for me now.

Are there more plugins which allow extended modding like the steam engine?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on November 11, 2012, 09:57:48 am
How did I not use dfhack for so long? I became immediately addicted.

Can someone direct me to more amazing plugins which are not linked in the first post? I.e. Rumrusher gave me Companion order plugin, and it is a must-have for me now.

Are there more plugins which allow extended modding like the steam engine?
Next version probably will have a reactions that trigger lua scripts (e.g. you make a sword and it displays a message)
Also if you are using companion order, please post or pm all the suggestions bug reports etc...
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 11, 2012, 12:43:11 pm
I would like to be able to order my companions to drop only what they have in hands. If I want them to swap weapons, I don't want to strip them.

Also it looks like they don't like to wear quivers, they carry them in hands instead.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on November 11, 2012, 03:16:47 pm
I would like to be able to order my companions to drop only what they have in hands. If I want them to swap weapons, I don't want to strip them.

Also it looks like they don't like to wear quivers, they carry them in hands instead.

Try this: New version (https://raw.github.com/warmist/dfhack/master/scripts/gui/companion-order.lua)
Although all functionality will not be available till next release (those parts that use dfusion, namely heal/powerup) but those are cheats anyway.
Title: Re: DFHack 0.34.11 r2
Post by: Aerval on November 11, 2012, 05:47:34 pm
How did I not use dfhack for so long? I became immediately addicted.

Can someone direct me to more amazing plugins which are not linked in the first post? I.e. Rumrusher gave me Companion order plugin, and it is a must-have for me now.

Are there more plugins which allow extended modding like the steam engine?

There was a Dwarf renaming script by expwnent that would rename every dwarf, so that they inherit their last names from their parents. So you could give your Dwarves (and possibly other races) an unique name inherting path. (thats not extended modding but can be part of a mod :)
Title: Re: DFHack 0.34.11 r2
Post by: Naros on November 11, 2012, 06:46:46 pm
you might need the number where FORGE_WEAPON resides in. then do the '= 5' next to it.
To get all dwarves targeted you need to set up 'k,v in pairs (df.global.world.active) do' which pulls all units then set up V to filter out all those units down to your dwarves.

Thanks, I'll have a fiddle with it later and see if I can figure it out. :)
Title: Re: DFHack 0.34.11 r2
Post by: Feyd on November 12, 2012, 12:56:51 pm
Quote
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.Berserk
[lua]# quit

And the inverse? How can get a dwarf to normality?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 12, 2012, 02:23:16 pm
Quote
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit

And the inverse? How can get a dwarf to normality?
that's how.
Title: Re: DFHack 0.34.11 r2
Post by: Weaselcake on November 12, 2012, 02:40:54 pm
How do I set up the Siege Engine plugin? I noticed it uses the GUI, what GUI?

I want to bring some military spice into my fort that isn't just the boring ol' swordmaster squad.
Title: Re: DFHack 0.34.11 r2
Post by: Nokao on November 12, 2012, 04:27:55 pm
DFhack became a very important software for my DF games,
expecially because it resolves with patch(s) many bugs.

Is there a link that I can go or a RSS I can subscribe to be updated about updates ?
Not a forum link, because as you already did it the link can change.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on November 12, 2012, 04:35:50 pm
DFhack became a very important software for my DF games,
expecially because it resolves with patch(s) many bugs.

Is there a link that I can go or a RSS I can subscribe to be updated about updates ?
Not a forum link, because as you already did it the link can change.
this could help: atom link to peterix's github (https://github.com/peterix/dfhack/commits/master.atom)
Title: Re: DFHack 0.34.11 r2
Post by: Nokao on November 12, 2012, 05:16:56 pm
DFhack became a very important software for my DF games,
expecially because it resolves with patch(s) many bugs.

Is there a link that I can go or a RSS I can subscribe to be updated about updates ?
Not a forum link, because as you already did it the link can change.
this could help: atom link to peterix's github (https://github.com/peterix/dfhack/commits/master.atom)

Thanks. And next question will be:

considering this is very beta stuff,
but also works on making the "present" in the game better and don't edit the "past" (saving new items or stuff like that in the savegames),
is it safe to keep it updated ?
even if it's very very new ?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 12, 2012, 05:53:20 pm
well you update when ever you see a new addon that you want or if toady updates his game and we have to come out with a patch.
other than that no mandatory update system needed.
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on November 12, 2012, 08:44:41 pm
And, as with any "experimental" pre-Alpha feature, or add-on, Back-up, Back-up, Back-up!!
Title: Re: DFHack 0.34.11 r2
Post by: Nokao on November 12, 2012, 09:07:50 pm
ok, thanks

I played with lazy newb pack, until now I discovered this masterwork megapack.

Is dfhack also inside masterwork, right ?
Title: Re: DFHack 0.34.11 r2
Post by: Dibber6 on November 12, 2012, 09:14:26 pm
Whoops wrong forum. Ignore this.
Title: Re: DFHack 0.34.11 r2
Post by: Deon on November 12, 2012, 11:16:22 pm
ok, thanks

I played with lazy newb pack, until now I discovered this masterwork megapack.

Is dfhack also inside masterwork, right ?
DFHack is there, I think not all plugins are enabled, but you can do it yourself.

How do I set up the Siege Engine plugin? I noticed it uses the GUI, what GUI?

I want to bring some military spice into my fort that isn't just the boring ol' swordmaster squad.
Rename "dfhack.init-example" to "dfhack.init", now it tells DFHack which plugins to load. Open it with notepad, you can remove lines of fixes/plugins you don't want.
For siege engine scroll down, you will see:
Quote
# siege engine control
keybinding add Alt-A@dwarfmode/QueryBuilding/Some/SiegeEngine gui/siege-engine
It shows that the siege engine front end is now bound to Alt-A, you can change it if you want.
Title: Re: DFHack 0.34.11 r2
Post by: Master Catfish on November 13, 2012, 02:01:38 pm
Is it possible to force a dwarf to go berserk or to change loyalty in fortress mode? If so, how? Also, can it be done to an existing game which does not yet have DF hack installed?
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on November 13, 2012, 05:16:10 pm
Quote
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.Berserk
[lua]# quit

This discussing just a few days ago describes setting the Berserk flag.  Search a bit further back regarding setting membership flags, which would affect loyalties.  However, once they're Berserk, all loyalties go out the window.

Also, you can install DFHack over an existing DF game without having to regen worlds.  As always, make backups as YMMV.
Title: Re: DFHack 0.34.11 r2
Post by: Master Catfish on November 13, 2012, 05:30:57 pm
Great. That was exactly what I was hoping for. Thanks very much!
Title: Re: DFHack 0.34.11 r2
Post by: Feyd on November 14, 2012, 03:56:51 am
Quote
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.Berserk
[lua]# quit

This discussing just a few days ago describes setting the Berserk flag.  Search a bit further back regarding setting membership flags, which would affect loyalties.  However, once they're Berserk, all loyalties go out the window.

Also, you can install DFHack over an existing DF game without having to regen worlds.  As always, make backups as YMMV.

Yes, I read this, but how to get normal?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 14, 2012, 04:31:01 am
Code: [Select]
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit

or Nil

oh here's the highly experimental Gm-editor Warmist made for slow testing around dwarf fortress (https://raw.github.com/warmist/dfhack/experimental-dontmerge/scripts/gui/gm-editor.lua)
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on November 14, 2012, 11:01:25 pm
Code: [Select]
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.NONE
[lua]# quit

or Nil
Actually, neither NONE nor Nil will work:
1. Nil isn't a number - if it was, it'd be 0, and 0 means "Fey".
2. "NONE" isn't a valid enum value for df.mood_type - it's case-sensitive, so you have to use "None".
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on November 14, 2012, 11:40:22 pm
Wow, that DF Engine is one picky bitch  :P

In a related note, if I, say, set a dwarf to Macabre Fey, will they, in turn claim a workshop and "materials" and make something artifact-y?

Dwarven child care may be taking a whole new angle, muahahahaha!!!!
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on November 15, 2012, 07:23:01 am
In a related note, if I, say, set a dwarf to Macabre Fey, will they, in turn claim a workshop and "materials" and make something artifact-y?
Certainly not - it won't do anything unless you actually create and assign a Strange Mood job (which includes specifying all of the required items).
Title: Re: DFHack 0.34.11 r2
Post by: Captain Man on November 15, 2012, 03:17:16 pm
Hey I'm trying to learn how to use the job and job-* commands but I'm having difficulty. The reason I wanted to is because a dwarf is screaming about silk (fey mood) and I don't have any and neither do the elves at the depot. I'm trying to change the job to use any cloth... is this possible? Am I going about it wrong? job list displays this...

Code: [Select]
Job 20925: StrangeMoodWeaver (special)
  Input Item 1: cloth; quantity=20000; min_dimension=10000
    flags2: silk
  Input Item 2: bar
    material: rock
  Input Item 3: none
    flags2: bone body_part
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on November 15, 2012, 03:45:19 pm
The job command cannot modify the flags for job items - what you want to do is use the changeitem command to change some plant cloth into silk.
Title: Re: DFHack 0.34.11 r2
Post by: Captain Man on November 15, 2012, 04:47:25 pm
I'm having a little trouble figuring the right syntax on this, I'm guessing I want to do m instead of s but... what is the raw for silk? I've never done anything with raws and it's somewhat daunting. The only thing I can find is the silk template from material_template_default. No matter what I try with
Code: [Select]
changeitem m "raws here" info I get no such material errors. I tried changing it to pig tail just to practice with
Code: [Select]
changeitem m PLANT:GRASS_TAIL_PIG:THREAD and it says that the subtypes don't match... I'm lost, help!

I just want to change something, anything, into a silk cloth so Urist McPicky will shut up.

EDIT: never mind, I think I got it. CREATURE:SPIDER_CAVE_GIANT:SILK force worked. now I'm changing that copper bar to silver... stupid dorf.

EDIT 2: *Mireddance* This is a giant cave spider silk short skirt.  :o All craftdwarfship is of the highest quality. It is decorated with giant cave spider silk and wolverine bone and encircled with bands of silver. It is made from giant cave spider silk cloth. The object menaces with spikes of giant cave spider silk.
Title: feature request(s) {Re: DFHack 0.34.11 r2}
Post by: Bo-Rufus CMVII on November 17, 2012, 02:08:21 pm
If you have time to consider feature requests, it would be nice to have some "change all" commands that generalize changelayer and changevein, e.g. to change all orthoclase to something easier on the eye, or all of some crummy ore to something useful.

And while we're on the topic...

1) Do you have an official mechanism for submitting suggestions / feature requests?

2) Is the feature suggested above something that an experienced programmer could do pretty easily by modifying your code for changelayer/changevein, or would it require a steep learning curve on DF internals?

Thanks.
Title: Re: DFHack 0.34.11 r2
Post by: EngineerFromHell on November 18, 2012, 04:19:44 am
Is there/will there be a plugin that allows change of tile flags (e.g. "occupied", "inside", "underground")?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 18, 2012, 04:20:37 am
tilestypes edit: tiletype can set and alter the types of tiles. just it's under the special brush settings.

here's the original jump command,
Code: [Select]
function tools.JUMP(unit)
--if unit==nil then
-- unit=getAdv()
--end
--if vic==nil then
--vic=getVecAtPos(x,y,z)
--end
--Cart=unit.riding_item_id

printall(df.global.world.vehicles.active)
--S=0+getline()
printall(df.global.world.vehicles.active[0])
--df.global.world.vehicles.active[0].speed_y=(-900000)
df.global.world.vehicles.active[0].offset_z=(100000)
--df.global.world.vehicles.active[0].speed_z=(-90000000)
end
tools.menu:add("FLIGHT",JUMP)
and here's the new jump
note the new jump will lift all vehicles so it doesn't matter if you aren't in the right cart.
Code: [Select]
function tools.JUMPALL()
print("Jumped")
for k,v in pairs(df.global.world.vehicles.active) do

--printall(df.global.world.vehicles.active)
--S=0+getline()
--printall(df.global.world.vehicles.active[0])
--df.global.world.vehicles.active[0].speed_y=(-900000)
v.offset_z=(100000)
--df.global.world.vehicles.active[0].speed_z=(-90000000)
end
end
tools.menu:add("FLIGHT2",JUMPALL)
here the code for keybinding it
Code: [Select]
keybinding set Shift-J "dfuse tools.JUMPALL(unit)now you can make 1 z level ramps/walls eat your dust as you jump over them. great for parlor tricks and jumping huge gaps... not so great when there no sky tiles for you to jump up.
Title: Re: DFHack 0.34.11 r2
Post by: EngineerFromHell on November 18, 2012, 10:20:37 am
tilestypes edit: tiletype can set and alter the types of tiles. just it's under the special brush settings.

There's no option to change occupancy flag under special brush settings.
Title: Re: DFHack 0.34.11 r2
Post by: RanDomino on November 18, 2012, 03:10:24 pm
Quote
digtype: designates every tile of the same type of vein on the map for 'digging' (any dig designation).
jawfloor
this is going to save so much trouble- instead "dig that vein and that vein and that vein" we can just say "dig all gold and iron ores and coal"? too good to be true
Title: Re: DFHack 0.34.11 r2
Post by: Crux on November 21, 2012, 05:07:44 am
The downside of digtype is that it also digs out stuff on z-levels where rooms have already been designated.
Did I overlook an option to make it dig only on the current z-level?
If not, it would be nice to have such an option or an option to designate all ore on the current z-level.
Title: Re: DFHack 0.34.11 r2
Post by: CaptainArchmage on November 21, 2012, 09:55:18 am
The downside of digtype is that it also digs out stuff on z-levels where rooms have already been designated.
Did I overlook an option to make it dig only on the current z-level?
If not, it would be nice to have such an option or an option to designate all ore on the current z-level.

I was also going to say that there are some places you want to reserve for rooms. Might it be possible to designate a cube where any veins of a specific type would be dug out?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on November 21, 2012, 07:28:51 pm
One option would be to only designate hidden tiles, not visible ones, that way it'll always skip existing rooms.
Title: Re: DFHack 0.34.11 r2
Post by: Syreniac on November 24, 2012, 06:44:43 am
I'm trying to use digfort right now, and it's throwing out this error at me:

Code: [Select]
Invoking: digfort tower_stairs.csv
E: NoMethodError: undefined method `shape_basic' for nil:NilClass
 ./hack/scripts/digfort.rb:22
 ./hack/scripts/digfort.rb:20:in `each'
 ./hack/scripts/digfort.rb:20
 ./hack/scripts/digfort.rb:18:in `each'
 ./hack/scripts/digfort.rb:18
 (eval):23:in `load'
 (eval):23

How can I fix this?
Title: Re: DFHack 0.34.11 r2
Post by: Justyn on November 24, 2012, 11:43:16 pm
Forgive me if this has been brought up before, but I don't know what to search for, and the thread is over 100 pages.

I tried embarking on a fort of my home civilization (Embark Anywhere utility), and found the guards there were initially hostile, so I used DFhack to convert them and the present Lady, who was listed as friendly I should note, with the "tweak makeown" command, and rather than being full members, were listed as "tame" despite being on the citizens page.

Is there any way to make them full members so I can have a decent military right off the bat?

EDIT: I think I figured out the problem: I'm using the Masterwork mod, and I think I embarked on a Chaos Dwarf fort.

EDIT par deux: I tried doing this in a new site making sure it was the same civ as the dwarves I was embarking with, and while they seem to be full citizens, but I can't put these new citizens into military squads, nor can I give them noble positions.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on November 25, 2012, 02:34:30 pm
Forgive me if this has been brought up before, but I don't know what to search for, and the thread is over 100 pages.

I tried embarking on a fort of my home civilization (Embark Anywhere utility), and found the guards there were initially hostile, so I used DFhack to convert them and the present Lady, who was listed as friendly I should note, with the "tweak makeown" command, and rather than being full members, were listed as "tame" despite being on the citizens page.

Is there any way to make them full members so I can have a decent military right off the bat?

EDIT: I think I figured out the problem: I'm using the Masterwork mod, and I think I embarked on a Chaos Dwarf fort.

EDIT par deux: I tried doing this in a new site making sure it was the same civ as the dwarves I was embarking with, and while they seem to be full citizens, but I can't put these new citizens into military squads, nor can I give them noble positions.
oh that's normal I guess you need to find the noble list and manually insert them
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on November 25, 2012, 07:48:02 pm
There any chance in hell this will run on OSX 10.5.8?
Title: Re: DFHack 0.34.11 r2
Post by: danaris on November 25, 2012, 08:31:20 pm
There any chance in hell this will run on OSX 10.5.8?

If you follow the Mac OS X build instructions, you might be able to get it to work, but I can't promise anything. Leopard is pretty old—and if you're trying to get it to work on a PowerPC machine, you're almost certainly out of luck.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on November 26, 2012, 11:54:36 am
Recently, I've been working on an interesting project: porting "modern" DFHack to older versions of Dwarf Fortress. About a week ago I successfully got it running in version 0.28.181.40d (not any of the "OpenGL optimized" versions), and several days ago I got it running in version 0.23.130.23a (the final 2D version).

Just as with version 0.34, it loads into DF's address space, but it does not load on startup - instead, a separate "loader" application needs to be run after starting DF so it can inject code to load itself and insert several hooks. Sometimes DF crashes during this (possibly from it suspending DF while it's executing an instruction that's about to be patched), though most of the time it works just fine.

Full Lua scripting is supported, though existing scripts are unlikely to be compatible, and Ruby scripting is probably even less reliable (especially in 23a). Existing plugins have been altered to work where possible (and where it actually makes sense), while others have been removed. Stonesense is not available at this time, though I'd like to see if I can get it working eventually.

If you're interested, you can try out these test builds:
* DFHack-40d (http://www.qmtpro.com/~quietust/df/dfhack-0.28.181.40d-r1-Windows.7z)
* DFHack-23a (http://www.qmtpro.com/~quietust/df/dfhack-0.23.130.23a-r1-Windows.7z)
Title: Re: DFHack 0.34.11 r2
Post by: falsefaith on November 30, 2012, 08:47:22 pm
Would anyone explain the steps to compile Windows plugins to be used in OSX?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on December 01, 2012, 12:01:21 am
Pretty sure none of the plugins are 'windows' per se, and just get compiled for whichever OS DFhack is compiled for, at the same time.
Title: Re: DFHack 0.34.11 r2
Post by: falsefaith on December 01, 2012, 10:33:08 am
There are these plugins here: http://www.bay12forums.com/smf/index.php?topic=119575.0

They only works with windows dfhack at the moment and need to be compiled to work with OSX and I do not really understand that process.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on December 01, 2012, 10:57:14 am
Without looking too deeply into it, my guess would be you should clone the git repo into the plugins/ subdirectory of the DFHack source directory, then just build DFHack as normal and it should pick them up automatically.
Title: Re: DFHack 0.34.11 r2
Post by: yovannyX on December 01, 2012, 10:34:27 pm
Hi,

i got a little problem here

i'm using de lazynewbpack for version 0.34.11, i downloaded the DFhack for 34.11 r2 and unzip it so it can have the new revision, besides that, i also used the Legends of Forlorn Realms mod in it too,  here's the problem:

i use DFusion embark multirace embark, it always have only 1 dwarf to start, so i use the simple embark to have 7, my race starts alway as kobolds (don't know why) so i change them to dwarf, after this i save run current world's init.lua (i asume it save my new changes, but apparently it does not) and i embark, i always have 2 dwarves, the rest ant man/women, how do i stop the antmen/women to appear? my embark are all dwarves, elves and humans, not antman?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 02, 2012, 07:16:48 am
Hi,

i got a little problem here

i'm using de lazynewbpack for version 0.34.11, i downloaded the DFhack for 34.11 r2 and unzip it so it can have the new revision, besides that, i also used the Legends of Forlorn Realms mod in it too,  here's the problem:

i use DFusion embark multirace embark, it always have only 1 dwarf to start, so i use the simple embark to have 7, my race starts alway as kobolds (don't know why) so i change them to dwarf, after this i save run current world's init.lua (i asume it save my new changes, but apparently it does not) and i embark, i always have 2 dwarves, the rest ant man/women, how do i stop the antmen/women to appear? my embark are all dwarves, elves and humans, not antman?
see dfusion/embark/races.txt thats where you set which races units to embark with.
Title: Re: DFHack 0.34.11 r2
Post by: yovannyX on December 02, 2012, 01:11:29 pm
Hi,

i got a little problem here

i'm using de lazynewbpack for version 0.34.11, i downloaded the DFhack for 34.11 r2 and unzip it so it can have the new revision, besides that, i also used the Legends of Forlorn Realms mod in it too,  here's the problem:

i use DFusion embark multirace embark, it always have only 1 dwarf to start, so i use the simple embark to have 7, my race starts alway as kobolds (don't know why) so i change them to dwarf, after this i save run current world's init.lua (i asume it save my new changes, but apparently it does not) and i embark, i always have 2 dwarves, the rest ant man/women, how do i stop the antmen/women to appear? my embark are all dwarves, elves and humans, not antman?
see dfusion/embark/races.txt thats where you set which races units to embark with.

eh, did that already, was the first thing i did actually, yet, i still have ant women each time i embark
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on December 02, 2012, 10:02:07 pm
Where can I find the description for 'body_component_info'?
See https://github.com/angavrilov/df-structures/blob/master/df.units.xml for reference.

My current lua code is as follows:
Code: [Select]
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

printall(unit.body.components)

Compounds like unit_wound are documented, but I can't seem to find the documentation for body_component_info.
Title: Re: DFHack 0.34.11 r2
Post by: gefer8 on December 02, 2012, 10:41:06 pm
misery enable 900

siren

siren

siren

siren...

Edit: Oh Armok.
http://i.imgur.com/3SWX6.png
Title: Re: DFHack 0.34.11 r2
Post by: the_game_hunt on December 02, 2012, 11:01:31 pm
misery enable 900

siren

siren

siren

siren...

Edit: Oh Armok.
http://i.imgur.com/3SWX6.png
HA, Thats pretty funny.
I want to do that in a 300 population fort.
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 03, 2012, 12:32:47 am
Where can I find the description for 'body_component_info'?
See https://github.com/angavrilov/df-structures/blob/master/df.units.xml for reference.

Compounds like unit_wound are documented, but I can't seem to find the documentation for body_component_info.

https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L724 (https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L724)
Title: Re: DFHack 0.34.11 r2
Post by: DuineAnaithnid on December 03, 2012, 09:32:51 am
I've been trying to build DFHack on linux, and I'm having a few problems.

First problem: when trying to run cmake, I get

Code: [Select]
-- Could NOT find Threads (missing:  Threads_FOUND)
-- Configuring done
-- Generating done
-- Build files have been written to: /home/expwnent/df/dfhack/build

and when I try to "make install" I get
Code: [Select]
[ 15%] Built target lua
Linking CXX shared library libprotobuf.so
/usr/bin/ld: cannot find -lz
collect2: ld returned 1 exit status
make[2]: *** [depends/protobuf/libprotobuf.so] Error 1
make[1]: *** [depends/protobuf/CMakeFiles/protobuf.dir/all] Error 2
make: *** [all] Error 2



I followed the instructions as best I could, but I couldn't get it to work. I also tried getting it to work on windows, but that also ran into problems. Any help on what I'm doing wrong would be appreciated.

I am having this same problem (the second half anyway) when I do make install after using cmake. Has anyone found a solution?

EDIT: It seems like it is trying to parse option flags as a file to look for, so where can I find the call to this so I can check to see if it is being called correctly?

EDIT2: Looks like I just did not have all the dev libraries I needed

had to add:
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on December 03, 2012, 11:14:25 am
EDIT: It seems like it is trying to parse option flags as a file to look for, so where can I find the call to this so I can check to see if it is being called correctly?

EDIT2: Looks like I just did not have all the dev libraries I needed

had to add:
  • lib32z1-dev
  • libxml-libxslt-perl
The "z" in "-lz" isn't an option flag, but a library name - it tells it to include "libz".
Title: Re: DFHack 0.34.11 r2
Post by: falsefaith on December 03, 2012, 12:24:39 pm
I'm trying to build dfhack on osx and ran into this error:

[ 73%] Building CXX object plugins/CMakeFiles/automaterial.dir/automaterial.cpp.o
/Users/williamreichelt/dfhack/plugins/automaterial.cpp: In function 'bool move_material_to_top(MaterialDescriptor&)':
/Users/williamreichelt/dfhack/plugins/automaterial.cpp:220:49: error: invalid initialization of non-const reference of type 'MaterialDescriptor&' from an rvalue of type 'MaterialDescriptor'
/Users/williamreichelt/dfhack/plugins/automaterial.cpp:153:13: error: in passing argument 1 of 'void set_last_moved_material(MaterialDescriptor&)'
make[2]: *** [plugins/CMakeFiles/automaterial.dir/automaterial.cpp.o] Error 1
make[1]: *** [plugins/CMakeFiles/automaterial.dir/all] Error 2
make: *** [all] Error 2
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 03, 2012, 12:47:01 pm
/Users/williamreichelt/dfhack/plugins/automaterial.cpp:220:49: error: invalid initialization of non-const reference of type 'MaterialDescriptor&' from an rvalue of type 'MaterialDescriptor'
/Users/williamreichelt/dfhack/plugins/automaterial.cpp:153:13: error: in passing argument 1 of 'void set_last_moved_material(MaterialDescriptor&)'

https://github.com/angavrilov/dfhack/commit/e7905a5cff2b6174d92527ab6bbdd8358b98b877#L6L140 (https://github.com/angavrilov/dfhack/commit/e7905a5cff2b6174d92527ab6bbdd8358b98b877#L6L140)
Title: Re: DFHack 0.34.11 r2
Post by: falsefaith on December 03, 2012, 01:03:39 pm
https://github.com/angavrilov/dfhack/commit/e7905a5cff2b6174d92527ab6bbdd8358b98b877#L6L140 (https://github.com/angavrilov/dfhack/commit/e7905a5cff2b6174d92527ab6bbdd8358b98b877#L6L140)

I'm not sure what to do with that...all this technical stuff is not my area of expertise.
Title: Re: DFHack 0.34.11 r2
Post by: falconne on December 03, 2012, 01:53:52 pm
https://github.com/angavrilov/dfhack/commit/e7905a5cff2b6174d92527ab6bbdd8358b98b877#L6L140 (https://github.com/angavrilov/dfhack/commit/e7905a5cff2b6174d92527ab6bbdd8358b98b877#L6L140)

I'm not sure what to do with that...all this technical stuff is not my area of expertise.

This is to do with my plugin, not base dfhack. I'll help you out when I get back from work.
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on December 03, 2012, 04:19:37 pm

Typical ghost data https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L867
Code: [Select]
type                     = 9
unk_2                    = 9
unk_4                    = 5
unk_8                    = 113
unk_pos                  = <coord: 0x11c77644>
unk_14                   = 403200
unk_18                   = 0
unk_1c                   = 0
unk_20                   = 4510
unk_24                   = 4533
unk_28                   = 145

Verified type changes the displayed ghost type.

unk_4 is the ghost's "mission". Most of the time it is -1. When a ghost is on the move and going to do something, it has another value. Known values:
Code: [Select]
0  X has been scared to death by the G
1  G paralyzes X / G makes X convulse and retch / G stuns X / G causes a spell of dizziness in X
2  G batters X
3  X is throwing a tantrum, possessed by G
4  ?
5  <victim thought "haunted by dead"
6  <victim thought "tormented by dead" or "tormented in nightmares by dead"
7+ ?


unk_8 is the id of the current (if the ghost is inbound) or most recent victim of the ghost. For example, my test dwarves were 113, 114, 115, 116, 117, 118, 119. I set unk_8 to 119 and unk_4 to 0 on a restless haunt, and it immediately flew over to scare the targeted dwarf to death. It then resumed its normal haunting (on a counter of some sort, the mission is set to 5 and the new victim is chosen).

I don't know what the others do, but unk_pos may be static at -30000,-30000,-30000 while there may be another coord in the data afterwards. Unk_14 changes often, but only when the ghost is moving. Unk_20 and Unk_24 were very close but slightly different for two dwarves that were crushed by the same drawbridge.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 03, 2012, 04:32:49 pm
some research on advmode to fortmode switching:
this script does just that:
https://gist.github.com/4198190
todo: add units to positions so you could appoint squads etc...
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 04, 2012, 02:43:25 am
unk_4 is the ghost's "mission". Most of the time it is -1. When a ghost is on the move and going to do something, it has another value. Known values:

unk_8 is the id of the current (if the ghost is inbound) or most recent victim of the ghost. For example, my test dwarves were 113, 114, 115, 116, 117, 118, 119. I set unk_8 to 119 and unk_4 to 0 on a restless haunt, and it immediately flew over to scare the targeted dwarf to death. It then resumed its normal haunting (on a counter of some sort, the mission is set to 5 and the new victim is chosen).

I don't know what the others do, but unk_pos may be static at -30000,-30000,-30000 while there may be another coord in the data afterwards. Unk_14 changes often, but only when the ghost is moving. Unk_20 and Unk_24 were very close but slightly different for two dwarves that were crushed by the same drawbridge.

Added: https://github.com/angavrilov/df-structures/commit/784e72cc441a7602af4a4acc559d898ed675cf3b (https://github.com/angavrilov/df-structures/commit/784e72cc441a7602af4a4acc559d898ed675cf3b)
Title: Re: DFHack 0.34.11 r2
Post by: thistleknot on December 06, 2012, 03:12:17 am
can't build latest iteration of dfhack

C:\Games\dfdev\dfhack\pre\dfhack\build>generate-MSVC-all.bat

C:\Games\dfdev\dfhack\pre\dfhack\build>IF EXIST DF_PATH.txt SET /P _DF_PATH= 0<D
F_PATH.txt

C:\Games\dfdev\dfhack\pre\dfhack\build>IF NOT EXIST DF_PATH.txt SET _DF_PATH=C:\
Games\dfdev\dfhack\pre\dfhack\build\DF

C:\Games\dfdev\dfhack\pre\dfhack\build>mkdir VC2010
A subdirectory or file VC2010 already exists.

C:\Games\dfdev\dfhack\pre\dfhack\build>cd VC2010

C:\Games\dfdev\dfhack\pre\dfhack\build\VC2010>echo generating a build folder
generating a build folder

C:\Games\dfdev\dfhack\pre\dfhack\build\VC2010>cmake ..\.. -G"Visual Studio 10" -
DCMAKE_INSTALL_PREFIX="C:\Games\dfdev\dfhack\pre\df_34_11_win" -DBUILD_DEVEL=1 -
DBUILD_DEV_PLUGINS=1 -DBUILD_DF2MC=1 -DBUILD_DFUSION=1 -DBUILD_STONESENSE=1 -DBU
ILD_SERVER=1
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at depends/clsocket/CMakeLists.txt:50 (MESSAGE):
  Using unknown WIN32 compiler...  NOT.  Please add to build system.

however, my generate.bat file works on a prior version...
Title: Re: DFHack 0.34.11 r2
Post by: thistleknot on December 06, 2012, 11:17:47 am
can someone post new instructions to build ag's version of dfhack...

I followed the instructions last night to no avail, to jump onto the freenode dfhack irc channel to find out peterix is outdated, that I need to do these witchcraft commands to pull the ag's build and work from it.
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on December 08, 2012, 02:06:32 am
Using this lua code:
Code: [Select]
local race

for k,v in pairs(df.global.world.populations) do
if (df.global.world.populations[k].type==1) and (df.global.world.populations[k].race==430) then
print(v)
race = df.global.world.populations[k].race
print(df.global.world.raws.creatures.all[race].creature_id)
print(df.global.world.populations[k].quantity)
print(" ")

end
end
I have been able to track the decreasing population of fish in a surface stream. In particular, I had a test embark where only mussels were extracted from the stream. You get results like this:
Code: [Select]
<local_population: 0x040f1748>
MUSSEL
298

<local_population: 0x040f37e0>
MUSSEL
311

<local_population: 0x040fdd40>
MUSSEL
306  --------- this one decreases by 3 if someone removed mussel[3] from the stream

<local_population: 0x04100468>
MUSSEL
366

<local_population: 0x04110eb0>
MUSSEL
349

<local_population: 0x041135d8>
MUSSEL
436

Now I found that I could accelerate the arrival of "There is nothing to catch in the river" by reducing the quantity, or forestall it by increasing the quantity. However once there were no mussels left, the area became unfishable even if I set the population high again. Unfishable= you see zero fishing tiles when painting the fishing zone. The unfishable thing only applies to the one embark tile that everyone was fishing in, but not other parts of the map.

When looking at cave fish (race=510 in vanilla 0.34.11), there is a population of 1-2 cave fish, which can be seen teleporting around the underground lake. Fishing in the underground lake gets the "nothing to catch" message, without catching that one fish and without making the area unfishable. Increasing the cave fish populations using dfhack doesn't allow fisherdwarves to actually catch anything, but greatly increases the number of fish that can be seen teleporting around the underground lake.


Therefore each embark tile (those 48*48*Z areas of the map) or perhaps the river features have some kind of flag that informs the game that it has been fished out.
Unrelatedly, cave fishing doesn't behave the same way as river fishing, and something is causing cave fish populations to be very low despite what the raw files indicate.

If I multiply the cave fish pops in the raw files by 100, and generate a new world, some of the quantities in the list outputted by my lua code are between 90-110, while others are still 1. However I still got the "nothing to catch" message when fishing in several cavern locations, despite the visible teleporting cave fish.
Title: Re: DFHack 0.34.11 r2
Post by: MoloMowChow on December 08, 2012, 02:18:08 am
so I'm using advtools metal-detector, but what do I type to specify a specific type?
Title: Re: DFHack 0.34.11 r2
Post by: Flare on December 08, 2012, 02:27:15 am
Is there a hack that shows which columns of tiles goes right down to a magma source that is uninterrupted by empty space?
Title: Re: DFHack 0.34.11 r2
Post by: MasterShizzle on December 08, 2012, 03:01:47 am
Is there a hack that shows which columns of tiles goes right down to a magma source that is uninterrupted by empty space?
You can always pause the game and use "reveal all", scroll down to the caverns and find a solid column, designate it to be dug, and then use "unreveal" to go back to what it was. It won't affect feature discovery, so you won't have cave moss in your fort if you haven't yet breached caverns and you won't be able to build magma workshops until your dwarves actually see magma.
Title: Re: DFHack 0.34.11 r2
Post by: Flare on December 08, 2012, 03:48:15 am
Actually, I just meant finding the solid column. When I play with the default 3 cavern layers, finding a sufficiently sized column for whatever I'm doing tends to be quite hard since said column of tiles have to climb through 3 caverns unobstructed by empty space.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 08, 2012, 04:12:06 am
How would I resurrect a dead adventure mode companion?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on December 08, 2012, 04:28:47 am
Actually, I just meant finding the solid column. When I play with the default 3 cavern layers, finding a sufficiently sized column for whatever I'm doing tends to be quite hard since said column of tiles have to climb through 3 caverns unobstructed by empty space.

Actually, there's nearly always a solid column at the corners of every embark tile. That is, every 48 fort tiles.
Title: Re: DFHack 0.34.11 r2
Post by: Flare on December 08, 2012, 05:52:13 am
Yup, but sometimes I need it somewhere not in the corner, and in a sufficient size and shape. In any case, I think I'll repeat my question as it's been buried under a page.

Is there a utility that shows which column of tiles goes straight down to the magma sea or a magma tube?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on December 08, 2012, 06:44:03 am
No.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on December 08, 2012, 11:42:03 am
Actually, I just meant finding the solid column. When I play with the default 3 cavern layers, finding a sufficiently sized column for whatever I'm doing tends to be quite hard since said column of tiles have to climb through 3 caverns unobstructed by empty space.

Unless it's magma you're looking for, everything else can be immediately obtained in any non-soil layer via 'changelayer' and 'changevein'.  Native platinum, magnetite, marble, coal, candy, anything.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 08, 2012, 02:23:33 pm
Is there a resurrect script that works on dead bodies in adventure mode floating around here somewhere?
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 08, 2012, 04:24:49 pm
NVM, did some mode swapping to select the unit, then more to get back to adv mode.

Can dfhack add syndromes? Turning off the dead flag brings them back with all BP's missing.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 08, 2012, 06:15:03 pm
NVM, did some mode swapping to select the unit, then more to get back to adv mode.

Can dfhack add syndromes? Turning off the dead flag brings them back with all BP's missing.
yes it can https://gist.github.com/4061959 (not sure which version of dfhack though...)
Title: Re: DFHack 0.34.11 r2
Post by: Greiger on December 08, 2012, 06:53:20 pm
I have played DF again after a few months downtime.  See an update for DF hack and decide to download it while generating a world, and apply it without much of a thought and start playing.

After I find an embark, I load up the unit menu to check for dangerous wildlife and... a new hotkey? DFHack? But this is the DFwindow... Mother of god, is that Dwarf Therapist?  Ingame?  *Jaw drops*

Superb work guys, I almost thought this was a new version of DF or something.  Anybody show this to Toady yet to see if it can be made official?

P.S. After looking through the notes: A workshop that replaces water reactors?  Aim-able siege engines? And that magma source can finally make it possible for me to embark on an erupting volcano!  I love you people!
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 08, 2012, 09:08:17 pm
NVM, did some mode swapping to select the unit, then more to get back to adv mode.

Can dfhack add syndromes? Turning off the dead flag brings them back with all BP's missing.
yes it can https://gist.github.com/4061959 (not sure which version of dfhack though...)
Would the id be used be [CURSE_WHATEVER_#] or some hex string?
Title: Re: DFHack 0.34.11 r2
Post by: Andux on December 08, 2012, 10:25:11 pm
Can dfhack add syndromes? Turning off the dead flag brings them back with all BP's missing.
Actually, an easier way might be to just change the unit's caste--the game keeps track of each unit's original/normal caste separately from its current caste, and should (with no transformation syndrome active) immediately transform the unit back to its original form, with all its parts intact.

I use a script based on this principle to heal units my regular HealUnit (http://dwarffortresswiki.org/index.php/User:Andux/Scripts#HealUnit) script can't:
Code: [Select]
-- Does temporary body transformation on selected unit.
local unit=dfhack.gui.getSelectedUnit()
if unit then
if (unit.sex ~= 0) then
unit.caste=0
unit.sex=0
else
unit.caste=1
unit.sex=1
end
end
Note that I have experienced some bugs with this method--in one case, a teenage dwarf somehow got transformed into a 53-year-old.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 08, 2012, 10:57:43 pm
Well, I'll have to remember that then for next time, already used circuitous route with raw editing. Thanks though.

What's the one for changing hair color, etc?
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on December 08, 2012, 11:54:09 pm
is that Dwarf Therapist?  Ingame?
It's actually Dwarf Manipulator, a tool I originally wrote for Dwarf Fortress v0.23.130.23a (because there were no decent Therapist-style tools for that old version); once it became possible to override virtual methods within DF's own classes, I rewrote it as a DFHack plugin (as a custom viewscreen) and added a few improvements.
Title: Re: DFHack 0.34.11 r2
Post by: castellan on December 08, 2012, 11:59:14 pm
I'm trying dfhack on Mac OS X 10.8.2 and I'm running into two issues:

1. If I fire up dfhack-run, I get the following:

$ ./dfhack-run
dyld: Library not loaded: @executable_path/hack/libdfhack-client.dylib
  Referenced from: /Users/<username>/Desktop/DF/Dwarf Fortress 34.11.app/Contents/MacOS/hack/dfhack-run
  Reason: image not found
Trace/BPT trap: 5

2. If I fire up dfhack instead, it launches Dwarf Fortress, but the dfhack terminal window gets stuck in a repeating loop and I can never execute any commands:

[DFHack]# [DFHack]# [DFHack]# Do 'help' or '?' for the list of available commands.
[DFHack]# [DFHack]# [DFHack]# Do 'help' or '?' for the list of available commands.
[DFHack]# [DFHack]# [DFHack]# Do 'help' or '?' for the list of available commands.
[DFHack]# [DFHack]# [DFHack]# Do 'help' or '?' for the list of available commands.


Any ideas?
Title: Re: DFHack 0.34.11 r2
Post by: Xheia on December 09, 2012, 12:11:34 am
I'm not sure how I missed  the Mac version coming out 6 months ago...

I just want to report that I was able to get DFHack to work with Mac OSX 10.7.3, after much searching this thread.
I wasn't sure how to actually get it installed and working, as most guides don't include install info for Mac.
(Unzip to DF folder (or copy all contents to DF folder), and then click the DFHack icon.)
I plan to use DFHack for bugfixes (esp. patrol duty tweak) and FPS increasing (not sure how). I would appreciate advice - or a link to a new users guide or a FAQ perhaps.

Just saw your post castellan, good luck to you, fellow mac user.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on December 09, 2012, 10:33:45 am
I'm trying dfhack on Mac OS X 10.8.2 and I'm running into two issues:

1. If I fire up dfhack-run, I get the following:

$ ./dfhack-run
dyld: Library not loaded: @executable_path/hack/libdfhack-client.dylib
  Referenced from: /Users/<username>/Desktop/DF/Dwarf Fortress 34.11.app/Contents/MacOS/hack/dfhack-run
  Reason: image not found
Trace/BPT trap: 5

2. If I fire up dfhack instead, it launches Dwarf Fortress, but the dfhack terminal window gets stuck in a repeating loop and I can never execute any commands:

[DFHack]# [DFHack]# [DFHack]# Do 'help' or '?' for the list of available commands.
[DFHack]# [DFHack]# [DFHack]# Do 'help' or '?' for the list of available commands.
[DFHack]# [DFHack]# [DFHack]# Do 'help' or '?' for the list of available commands.
[DFHack]# [DFHack]# [DFHack]# Do 'help' or '?' for the list of available commands.


Any ideas?

Hm. It looks like you have installed DFHack inside a DF app bundle. At present, that is not supported—mostly because I haven't been able to come up with a good way to put together a DFHack app bundle.

Please try downloading a fresh copy of DF for Mac from the links at the top of the main DF page, put the DFHack resources into its folder, and then run the dfhack script.

Also, could you please show me where you got the app bundle? If I can figure out how the bundle itself works, I may be able to integrate DFHack into it, and possibly even create a script that can make a bundle out of a standard DF or DFHack installation...
Title: Re: DFHack 0.34.11 r2
Post by: danaris on December 09, 2012, 10:36:19 am
I'm not sure how I missed  the Mac version coming out 6 months ago...

I just want to report that I was able to get DFHack to work with Mac OSX 10.7.3, after much searching this thread.
I wasn't sure how to actually get it installed and working, as most guides don't include install info for Mac.
(Unzip to DF folder (or copy all contents to DF folder), and then click the DFHack icon.)
I plan to use DFHack for bugfixes (esp. patrol duty tweak) and FPS increasing (not sure how). I would appreciate advice - or a link to a new users guide or a FAQ perhaps.

Just saw your post castellan, good luck to you, fellow mac user.

Once you have it installed and running, using DFHack on the Mac is the same as using it on any other platform. You simply type the appropriate commands in the Terminal window it launches from.

As for a new users' guide...I dunno, I think the closest DFHack has right now is the README. You can also ask any question you want here, and usually get a pretty quick response, or if you like IRC, you can come to the #dfhack channel on Freenode and get real-time feedback.
Title: Re: DFHack 0.34.11 r2
Post by: thistleknot on December 09, 2012, 04:21:55 pm
I finally got dfhack to build thanks to help on the freenode irc #dfhack channel, instructions are as such

following original instructions here
https://github.com/peterix/dfhack/blob/master/Compile.html
 for dependencies, I was able to build dfhack on windows diong the following

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r2
Post by: thistleknot on December 09, 2012, 05:58:29 pm
what happened with dfusion embark modifier?  So I can change the # of dwarfs I start off with

it was called simple_embark
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 09, 2012, 06:04:53 pm
How would I hack an adventurer or companion to be a resident of some fort I wandered to? So that they'd be hanging around there (friendly or hostile) when I got there?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 10, 2012, 12:22:11 am
what happened with dfusion embark modifier?  So I can change the # of dwarfs I start off with

it was called simple_embark
https://github.com/warmist/dfhack/blob/master/Readme.rst#id115
Code: [Select]
:lua require('plugins.dfusion.embark').Embark:install{{"RACE",CASTE_NUM},{"RACE2",CASTE_NUM2},....,{}}
this is done because there should not be any races.txt files that you need to manipulate in dfhack file tree. Some day i'll make a gui for it.

Edit: misread, simple_embark got misplaced, will readd. In the mean time you can use Embark instead.
Title: Re: DFHack 0.34.11 r2
Post by: Eric Blank on December 10, 2012, 03:23:13 am
Anyone know if the friendship plugin still works, and/or how to use it? I could really use some extra hands right now, and as it turns out many of my pets have them, but refuse to use them for anything remotely helpful.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 10, 2012, 03:27:13 am
Anyone know if the friendship plugin still works, and/or how to use it? I could really use some extra hands right now, and as it turns out many of my pets have them, but refuse to use them for anything remotely helpful.
Which version and Os are you using? If it's r2 then you can edit dfusion/friendship/races.txt and then run dfusion and choose friendship
Title: Re: DFHack 0.34.11 r2
Post by: castellan on December 10, 2012, 03:30:46 am
Yep, that was it. I had a previous copy of DF running insite an app bundle created with appify (https://gist.github.com/674099).

Once I moved the files outside of the app bundle, everything was golden.

Thank you!
Title: Re: DFHack 0.34.11 r2
Post by: Eric Blank on December 10, 2012, 03:40:43 am
Anyone know if the friendship plugin still works, and/or how to use it? I could really use some extra hands right now, and as it turns out many of my pets have them, but refuse to use them for anything remotely helpful.
Which version and Os are you using? If it's r2 then you can edit dfusion/friendship/races.txt and then run dfusion and choose friendship

Windows, R2.

I entered "dfusion" and found friendship in the options menu. It works after adding the race to the list. Thanks.
The dingo men now have actual jobs listed in the units screen, but unfortunately I still can't assign labors to them, which I guess is because they still count as pets, or something. They're all running around picking up a bunch of "small" clothing which I guess came form cobald caravans I've been stealign from.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 10, 2012, 03:47:02 am
Anyone know if the friendship plugin still works, and/or how to use it? I could really use some extra hands right now, and as it turns out many of my pets have them, but refuse to use them for anything remotely helpful.
Which version and Os are you using? If it's r2 then you can edit dfusion/friendship/races.txt and then run dfusion and choose friendship

Windows, R2.

I entered "dfusion" and found friendship in the options menu. It works after adding the race to the list. Thanks.
The dingo men now have actual jobs listed in the units screen, but unfortunately I still can't assign labors to them, which I guess is because they still count as pets, or something. They're all running around picking up a bunch of "small" clothing which I guess came form cobald caravans I've been stealign from.
There should be something like "make sentient", it sets the dingo men "CAN_LEARN" flag so they show the labor menu.
Title: Re: DFHack 0.34.11 r2
Post by: Eric Blank on December 10, 2012, 04:16:03 am
When I run dfusion, select option 2 ("tools") and press 2 again ("Give Sentience") it prompts me to "Type race's token name in full caps to give sentience to:"

If I enter "DINGO_MAN" it gives me an error message:

Code: [Select]
[DFHack]# dfusion
No.     Name           Desc
  1   simple_embark A simple embark dwarf count editor
  2           tools some misc tools
  3          embark Multi race embark
  4      friendship Multi race fort enabler
  5           saves run current worlds's init.lua
  6       adv_tools some tools for (mainly) adventurer hacking
Select plugin to run (q to quit):2
Select choice (q exits):
  1).Set current race
  2).Give Sentience
  3).Embark anywhere
  4).Change Adventurer
  5).Make creature follow
  6).Empregnate
2
Type race's  token name in full caps to give sentience to:
DINGO_MAN
dfusion/tools/init.lua:46: Cannot read field vector<caste_raw*>.size: not found.
stack traceback:
        dfusion/init.lua:3: in function <dfusion/init.lua:1>
        [C]: in function '__index'
        dfusion/tools/init.lua:46: in function '?'
        dfusion/common.lua:268: in function 'display'
        dfusion/tools/plugin.lua:7: in main chunk
        [C]: in function 'xpcall'
        dfusion/init.lua:8: in function 'dofile'
        dfusion/init.lua:41: in function 'mainmenu'
        dfusion/init.lua:95: in main chunk
No.     Name           Desc
  1   simple_embark A simple embark dwarf count editor
  2           tools some misc tools
  3          embark Multi race embark
  4      friendship Multi race fort enabler
  5           saves run current worlds's init.lua
  6       adv_tools some tools for (mainly) adventurer hacking
Select plugin to run (q to quit):

If I do the same thing, but enter "DINGO_MAN FEMALE" (or anything else with some other string of letters after "DINGO_MAN") it doesn't display an error. It just doesn't do anything, and it doesn't appear to have any effect in-game either.

Code: [Select]
No.     Name           Desc
  1   simple_embark A simple embark dwarf count editor
  2           tools some misc tools
  3          embark Multi race embark
  4      friendship Multi race fort enabler
  5           saves run current worlds's init.lua
  6       adv_tools some tools for (mainly) adventurer hacking
Select plugin to run (q to quit):2
Select choice (q exits):
  1).Set current race
  2).Give Sentience
  3).Embark anywhere
  4).Change Adventurer
  5).Make creature follow
  6).Empregnate
2
Type race's  token name in full caps to give sentience to:
DINGO_MAN FEMALE


So what's going on here?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 10, 2012, 04:22:05 am
When I run dfusion, select option 2 ("tools") and press 2 again ("Give Sentience") it prompts me to "Type race's token name in full caps to give sentience to:"

If I enter "DINGO_MAN" it gives me an error message:
<...>
So what's going on here?
Haha... looks like i forgot to update it. Quickfix: goto dfusion/tools/init.lua (with text editor) and delete line 46. Should fix it.

EDIT: and the alternative as I said is to add "CAN_LEARN" to dingo_man raws.
Title: Re: DFHack 0.34.11 r2
Post by: Eric Blank on December 10, 2012, 04:26:34 am
Wait wait! this just in!

I had a looksy in my raws at the C_variation_default.txt and creature_temperate_new.txt, and although I removed the line adding PET_EXOTIC to animal men in the creature variations, there was still a PET_EXOTIC tag in the creature definition for DINGO_MAN. After removing that, the "s: Ready for slaughter: (N)" line disappeared. Apparently, they are already sentient, but I didn't realize there was still a pet tag in their creature definition.

Sorry for the trouble, I should have been more thorough with checking their definitions. :-[
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 10, 2012, 10:21:56 pm
Can I use DFusion to make an adventurer and/or companions be a resident in an area, so they'll be hanging around the map if the spot is embarked upon?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on December 10, 2012, 10:34:02 pm
They will do that automatically
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 10, 2012, 11:38:21 pm
But which tool marks as resident, and will it stop companions from disappearing upon retiring? The idea is, the companions, and maybe the adventurer will just be standing around, listed as "Friendly" upon embark.
Title: Re: DFHack 0.34.11 r2
Post by: Slackratchet on December 13, 2012, 01:54:20 am
I've been searching without much success so I figure I'll just ask. Is there a source for C++ coding for DFHack somewhere?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on December 13, 2012, 01:59:12 am
I've been searching without much success so I figure I'll just ask. Is there a source for C++ coding for DFHack somewhere?
The source code is available from github (https://github.com/peterix/dfhack), please read the Compile (https://github.com/peterix/dfhack/blob/master/COMPILE.rst) document before building.
Next time look harder.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 13, 2012, 02:10:57 am
So, through hacking, I have created an adventurer with 100+ children. Now, how to age them so they can actually do something?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on December 13, 2012, 03:09:19 am
So, through hacking, I have created an adventurer with 100+ children. Now, how to age them so they can actually do something?
by removing the baby profession.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on December 13, 2012, 10:02:45 am
You could also change their birthdate to just under 12 years ago, or whenever kids grow up in your version.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on December 13, 2012, 02:50:22 pm
You could also change their birthdate to just under 12 years ago, or whenever kids grow up in your version.
though they don't change profession unless their in fort mode by doing that, also having giving birth through dfhack you could also just remove the child tag and avoid the extra step.
you end up giving birth to normal peasants doing this... though depending on what raws you left in/out they would run away from danger and leave you to die. So you might as well set their profession to an army type
Title: Re: DFHack 0.34.11 r2
Post by: Slackratchet on December 13, 2012, 04:00:29 pm
I've been searching without much success so I figure I'll just ask. Is there a source for C++ coding for DFHack somewhere?
The source code is available from github (https://github.com/peterix/dfhack), please read the Compile (https://github.com/peterix/dfhack/blob/master/COMPILE.rst) document before building.
Next time look harder.

Yes. I found that but the source code is not what I need. I am looking for a guide to using the API, assuming one exists. I know I could take apart the source code and figure it out but that does seem like doing it that hard way if someone else has already document it. I don't really appreciate your snarky response either.
Title: Re: DFHack 0.34.11 r2
Post by: Rose on December 13, 2012, 04:25:42 pm
What's there is what there is. Any documentation we have is there, in that repo, really. The best thing you can do is to look through the existing plugins to see how they work, or to ask in the #DFhack channel on freenode.
Title: Re: DFHack 0.34.11 r2
Post by: Slackratchet on December 13, 2012, 04:47:46 pm
That was certainly more helpful. Thank you.
Title: Re: DFHack 0.34.11 r2
Post by: asibin on December 16, 2012, 10:35:02 pm
Have been looking for information regarding item-occupancy fix.  Without using DFHACK on vanilla and on Masterwork, I sometimes get this bug where items just vanish especially later in bigger games.

I've looked over the script and it looks good but when I try to run it:  script fix/item-occupancy or placing it in the main script location script item-occupancy.. the lua doesn't run.

I may be missing a utility it needs (lua says something that it requires 'util' - unsure what that is).

I'm trying to run it using dfhack 34.11r2 on vanilla DF and masterwork.

Any help would be greatly appreciated.

Title: Re: DFHack 0.34.11 r2
Post by: vjek on December 16, 2012, 11:33:20 pm
Trying adding:

utils = require 'utils'

to your script, before you call a function that's included as part of 'utils'.

That should stop that error, at least.  There may be more to it, but.. that may help.
Title: Re: DFHack 0.34.11 r2
Post by: asibin on December 17, 2012, 12:54:01 am
I found the UTILS in LUA folder, going to try to mess with it, can't get it to run some reason

EDIT: figured it out the LUA ran fine now, was user error :)

I broke down UTILS.LUA anyway just to see who it works etc, but it ended up being something I did to mess it up ha!
Title: Re: DFHack 0.34.11 r2
Post by: Askot Bokbondeler on December 17, 2012, 05:29:08 pm
i'd like to request a plugin or script that made armours and weapons wear down with use. i don't know how hard it would be or how reasonable it is to ask.
would anyone be interested?
Title: Re: DFHack 0.34.11 r2
Post by: asibin on December 17, 2012, 08:07:32 pm
i'd like to request a plugin or script that made armours and weapons wear down with use. i don't know how hard it would be or how reasonable it is to ask.
would anyone be interested?

It is possible but by use do you mean just time or actually when in a fight?

the latter is harder
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on December 18, 2012, 02:30:09 am
More ghost data for DFHack devs:
(see https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L867 )

ghost_goal  4 is "misplace item", and this is typically done by type 2 ghosts (secretive poltergeists)
After the ghost picks up an item, it generates coordinates in unk_pos  and then takes the item there, using a semi-random path. unk_pos  otherwise appears unused.

ghost_goal  7 is "topple building", and this is typically done by type 3 ghosts (energetic poltergeists)

unk_8  (target_unit), which I previously identified as the target unit, is actually also the spot where the ID of the item being misplaced or the ID of the building being toppled is stored. You need to know the ghost type or goal in order to interpret this value correctly.

unk_14  appears to be a count-up timer, as it is reset to 0 after a ghost has done something, and then increases by 1/tick. Setting it to 403200 initially might be to force the ghost to act soon after spawning. It doesn't necessarily have to go that high again to trigger an action.

unk_1c  is 0 when a ghost hasn't been announced yet, and is 1 after a ghost has been announced (and you can play with this to cause the announcements to happen again). It also appears to take the value 3 if a ghost was previously "put to rest" and then brought back by deconstructing its slab/coffin. This is probably flag data.

Previous post in this thread:
http://www.bay12forums.com/smf/index.php?topic=91166.msg3846263#msg3846263
Title: Re: DFHack 0.34.11 r2
Post by: Askot Bokbondeler on December 18, 2012, 09:57:41 am
i'd like to request a plugin or script that made armours and weapons wear down with use. i don't know how hard it would be or how reasonable it is to ask.
would anyone be interested?

It is possible but by use do you mean just time or actually when in a fight?

the latter is harder
the latter would be ideal, but i'd be happy with the first
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 20, 2012, 03:31:25 am
More ghost data for DFHack devs:

Added:

https://github.com/angavrilov/df-structures/commit/8de810f00eeb2252e0e726190f9b7ad466d246a6 (https://github.com/angavrilov/df-structures/commit/8de810f00eeb2252e0e726190f9b7ad466d246a6)
Title: Re: DFHack 0.34.11 r2
Post by: Arano-kai on December 20, 2012, 05:03:17 am
Need some help with keybinding @context statement:
What context I need to use for work only in loo[k] mode?
And what contexts are possible to use at all/Where look for them?
Didn't find any information, except only certain in dfhack.init-example file...
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 20, 2012, 11:10:56 am
The keybinding command without any arguments prints the current context somewhere near the end of the usage message.
Title: Re: DFHack 0.34.11 r2
Post by: moisesjns on December 20, 2012, 03:30:52 pm
Exactly how do i use the magma source here command? I have saved 
Spoiler (click to show/hide)
and i put it into the script folder in dfhack but it stills says command not recognized.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 20, 2012, 03:53:10 pm
Could I make a request ?

I do love the hack/raw things introduced, the steamengine and add_spatter. It allows more room for modders, even without the knowledge for C++,ruby or lua.

It would be great if more scripts could be linked by reactions. For example this brilliant new SIREN. Any reaction with "SOUND_SIREN_" in the name would automatically run this script, it would really help the immersion for the player.

Similar things can be done with all sorts of things, I did have a couple of tests in that regard, helped by expwnent, but it was difficult without actually seeing the C++ script behind it. Having some sort of control through keywords in the RAWs is amazing on the other hand.

Another one that I personally would love to see is "ANNOUNCEMENT_reaction-name-here" that will refocus the camera on the workshop, pause the game, and make an announcement in a pop-up box. It would greatly help players running reactions with a low percentage of success. I for example do have plenty of reactions with super-rare items, 2-3% success chance, and it is difficult to notice when you actually succeded in producing the wanted item. 
Title: Re: DFHack 0.34.11 r2
Post by: moisesjns on December 20, 2012, 04:20:53 pm
ok it wont work even after i make it workable. i get the line unxpected symbol near $ look a like symbol. is it a problem that i am using masterwork mod? or that my folder is called  masterwork DF on my desktop?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 20, 2012, 04:25:27 pm
The current version of MasterworkDF is bundled with an old dfhack version, not the new r2. I assume you did not download and installed the new dfhack ?

Other then that, I can assure you, it has nothing to do with the mod.
Title: Re: DFHack 0.34.11 r2
Post by: moisesjns on December 20, 2012, 04:40:00 pm
oh i see thank you. its working now
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 20, 2012, 05:17:24 pm
No problem.

I do have a question myself. I quote from the readme about steam engines:
Quote
After constructing the building itself, machines can be connected to the edge tiles that look like gear boxes. Their exact position is extracted from the workshop raws.

Does this mean that all tiles using gear-box tile-number will be able for connection, and will this mean that I cant change the design of the building much?

To clarify, this is from the building raws:
Code: [Select]
Tile 15 marks places where machines can connect.
Tile 19 marks the hearth (color changed to reflect power).
[TILE:3:1:15:246:15]
[TILE:3:2:'\':19:'/']
[TILE:3:3:7:' ':7]
Color 1:?:1 water indicator, 4:?:1 magma indicator:
[COLOR:3:1:7:0:0:MAT:7:0:0]
[COLOR:3:2:6:0:0:0:0:1:6:0:0]
[COLOR:3:3:1:7:1:0:0:0:4:7:1]

Can I change tile 15 with anything else, and it will still work?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 20, 2012, 05:39:39 pm
Could I make a request ?

I do love the hack/raw things introduced, the steamengine and add_spatter. It allows more room for modders, even without the knowledge for C++,ruby or lua.

It would be great if more scripts could be linked by reactions. For example this brilliant new SIREN. Any reaction with "SOUND_SIREN_" in the name would automatically run this script, it would really help the immersion for the player.

Similar things can be done with all sorts of things, I did have a couple of tests in that regard, helped by expwnent, but it was difficult without actually seeing the C++ script behind it. Having some sort of control through keywords in the RAWs is amazing on the other hand.

Another one that I personally would love to see is "ANNOUNCEMENT_reaction-name-here" that will refocus the camera on the workshop, pause the game, and make an announcement in a pop-up box. It would greatly help players running reactions with a low percentage of success. I for example do have plenty of reactions with super-rare items, 2-3% success chance, and it is difficult to notice when you actually succeded in producing the wanted item.
Sort of is in the new (unreleased) version already. You can run scripts on:
The "sort of" of my first sentence means that it's not way easy to use for raws modders (i still call myself a modder...). I could make a script that connects the "on one of those events" to "lua script" but that's the limitation (of existing system), you can't connect to other type of commands (dfhack has 3 types: native (like deramp, etc), lua script and ruby script). Also i'm working on a mod that tries to push dfhack boundaries to see what's possible and i was thinking about something like integrating raw commands (e.g. ">explode 1 4<") but for me it's way easier (and tidier) to do everything out of raws. So i'm not sure what is the best way to do it.

Title: Re: DFHack 0.34.11 r2
Post by: Caldfir on December 20, 2012, 05:42:06 pm
yay - got a forum-formatted textscreen exporter script

behold the results:

Spoiler: dwarf (click to show/hide)
Spoiler: item (click to show/hide)

and yes, the colors are added by the script, which is convenient - working on getting a version that cycles through the unit list, possibly some options to only export certain dwarves (by embark wave or something), although the current version would be equally useful for exporting artifacts or whatever

edit: and of course as I get this working I find out I'm doing it the dumb way
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 20, 2012, 06:00:04 pm
Could I make a request ? -snip-
Sort of is in the new (unreleased) version already. You can run scripts on:
  • user selecting workshop with "q"
  • reaction being completed (not sure about low percent thing, i'll test that) - this also allows complex completion requirements (e.g. only if you have statues around, etc...) else it fails the reaction
  • item/unit projectile move/hit
  • item contaminate wound - when item tries to contaminate a wound, great for magical weapons ammo...
The "sort of" of my first sentence means that it's not way easy to use for raws modders (i still call myself a modder...). I could make a script that connects the "on one of those events" to "lua script" but that's the limitation (of existing system), you can't connect to other type of commands (dfhack has 3 types: native (like deramp, etc), lua script and ruby script). Also i'm working on a mod that tries to push dfhack boundaries to see what's possible and i was thinking about something like integrating raw commands (e.g. ">explode 1 4<") but for me it's way easier (and tidier) to do everything out of raws. So i'm not sure what is the best way to do it.

Well, adding new commands is different from what I meant. I dont want to give the player more dfhack options, I want to give the dwarves more dfhack options ;) I dont want to overburden a player with more commands and hotkeys, I would just mod in workshops and reactions. The player would still play the game as usual.

It is the same with the ammo GUI in shooters. If it is on the gun, it is part of the game, if it is in a GUI, it is outside the actual game. I'd rather have a dwarf running to a workshop called "great horn of war/alarm siren/giant bell" and sound the alarm, then have a player type ctrl+alt+s to run "siren".

But reading what you wrote... you think something like: "item equiped" would work in a script?
Dwarf equips "gauntlets of ogre strength", script raises strength of this dwarf.
Dwarf equips "flamethrower of flamy doom", script adds firebreath to this dwarf.

That would be... one of the most innovative modding capabilities I have ever seen ^^
Title: Re: DFHack 0.34.11 r2
Post by: vjek on December 20, 2012, 10:08:45 pm
Well spank me rosy...

whoever added this:

https://raw.github.com/peterix/dfhack/master/scripts/magmasource.rb

Is my new hero for the day.  Well done!

/cheer
/cheer
/cheer
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 21, 2012, 12:23:25 am
- snipped -

Well, adding new commands is different from what I meant. I dont want to give the player more dfhack options, I want to give the dwarves more dfhack options ;) I dont want to overburden a player with more commands and hotkeys, I would just mod in workshops and reactions. The player would still play the game as usual.

It is the same with the ammo GUI in shooters. If it is on the gun, it is part of the game, if it is in a GUI, it is outside the actual game. I'd rather have a dwarf running to a workshop called "great horn of war/alarm siren/giant bell" and sound the alarm, then have a player type ctrl+alt+s to run "siren".

But reading what you wrote... you think something like: "item equiped" would work in a script?
Dwarf equips "gauntlets of ogre strength", script raises strength of this dwarf.
Dwarf equips "flamethrower of flamy doom", script adds firebreath to this dwarf.

That would be... one of the most innovative modding capabilities I have ever seen ^^
[/quote]
About gui in shooters- thats why i started this plugin (btw called "eventful"). So that all dfhack (or most of it) could be controled from inside df (aka non-cheating).  Also expwnent (i think) was working of triggers on death, job start, job end, siege etc...
Unfortunetly I still haven't found a good way to script equiped/unequiped thing, i'll try a few more ideas...
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 21, 2012, 04:53:01 am
Understood :)

To come back to my questions. Could anyone be so kind and do a plugin that:
1. Runs siren command by a reaction, similar to add_spatter ?
2. Create a script that makes announcements based on item created ?
3. Create a magma-aquifer. (not place magma source, but make a specific inorganic mat be a magma source be default)

Just a simple: this is easy, that part is hard, this one impossible, might take a day, might take a week, something like that. :)

I did figure out the steam engine myself by now, wrote a custom design for it that works.
Title: Re: DFHack 0.34.11 r2
Post by: Caldfir on December 21, 2012, 05:02:29 am
ok, fixed up the colors and followed some advice to change the way the screen is getting read, which is giving better control over the line endings: 
Spoiler: dwarf (click to show/hide)
Spoiler: history (click to show/hide)

still no ability to dump bunches of dwarves or items at a time, but it doesn't overwrite your earlier changes in the file it saves this stuff in, so you can just go down the list, running the script a bunch of times until you get all the ones you want

edit: put it on DFFD: http://dffd.wimbli.com/file.php?id=7245
Title: Re: DFHack 0.34.11 r2
Post by: Rose on December 21, 2012, 05:31:21 am
ok, fixed up the colors and followed some advice to change the way the screen is getting read, which is giving better control over the line endings: 
Spoiler: dwarf (click to show/hide)
Spoiler: history (click to show/hide)

still no ability to dump bunches of dwarves or items at a time, but it doesn't overwrite your earlier changes in the file it saves this stuff in, so you can just go down the list, running the script a bunch of times until you get all the ones you want
Notepad++ converts the characters in there easy enough. you just have to manually set it to OEM-US, then convert it to UTF-8
Title: Re: DFHack 0.34.11 r2
Post by: Cobbler89 on December 21, 2012, 08:44:48 pm
Is there a way to set the direction of a ramp -- as viewed by probe? Tiletypes doesn't seem to support it. I can't find the lua stuff to read/write that data for a tile, though I'm sure it must be in there and I've been using this technique (http://stackoverflow.com/questions/2620377/lua-reflection-get-list-of-functions-fields-on-an-object) to explore (pro tip to anyone new to the lua options exposed through dfhack).

I somehow messed up a river ramp -- or at least, I think I did -- and am trying to use dfhack to fix it. So far I've got it to be just like the other river ramps again except for the direction. First time using dfhack extensively -- not so much that I think "hacking" a game with no competitors and no high scores is inherently wrong, but I tend to prefer the vanilla experience and don't really want to use hacks to get stuff done unless it's something I A) kinda need and B) don't have another way to accomplish (for example, I've used drybuckets or whatever it was back when the bucket water bug plagued my fortresses, and I might apply clean judiciously if I felt it mattered -- is there a way to clean the map, but only the tile under the cursor?)... not that I mind if anyone else likes to, obviously... Anyway, this just happens to be one such thing, correcting a mistake that affects something that game doesn't give you much way to revert (unlike, well, a lot of the stuff in DF that can be reverted or at least rerandomized). But it's the first time I've really wanted to do that, so I'm a little flummoxed how to get all the details.

It would be nice, by the way, to have a version of tiletypes/probe that set tiletypes to match the results of a probe. I'd code it myself if I knew how...
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on December 21, 2012, 09:18:05 pm
A great feature for OCD overseers like me would be to add a script where, if activated, would assign laors to migrants in the order they come on the map. Like, give the first two guys mining, the next five masonry, the next two farming, and so on. Also, could you nickname them based on that? Because I name all of my planters "Planter", and it would be cool if the script could do that. 
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on December 22, 2012, 12:34:36 am
Is there a way to set the direction of a ramp -- as viewed by probe?
Ramps do not have a direction - the "direction" you're seeing with river ramps is a property of the river, not the ramp, and all it seems to do is control the direction in which contaminants are pushed when they end up in the water (i.e. so the blood runs downstream).
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on December 22, 2012, 12:36:15 am
Meph: I might have something similar to what you're talking about. I'm working on (and mostly done with) a plugin to make boiling rock syndromes apply instantaneously rather than relying on the game to sometimes make them breathe them in and sometimes not. I just tweaked it so that you can call dfhack commands using syndrome classes.

Here's the short version: you make a reaction that produces some rock. The rock has a syndrome. The syndrome has syndrome classes. When the reaction is triggered, the plugin scans for a reaction class called "command". If it finds one, it considers all remaining syndrome classes to be part of a dfhack command. The first subsequent one is a command, and each one after, if any, is an argument.

Early testing is promising. It should work both with scripts and by directly calling plugins.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 22, 2012, 12:39:51 am
That would instantly fix one of the biggest problem deon, narhiril and I have... balancing the boiling rocks syndromes that might hit 100%, might hit 10% of the time.

Sounds awesome :) dfhack is really getting ahead :)
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on December 22, 2012, 11:37:34 am
1. When during a tick does DFHack execute code? I assume that if the game is paused, code is executed "between" ticks, but if you try to run commands while the game isn't paused? Mostly I am trying to figure out if all creatures and mechanisms have had a chance to act on the time that a script is run.

2. Is it possible, and how would I run arbitrary code on a once-per-tick or once-every-X-ticks basis? My purpose here is to output data-over-time on fort mode things, and perhaps to autopause the game when an event of interest happens. Another utility would be to collect statistics over a period of time, and tell the player if their fort has some kind of inefficiency. I've always wanted utilities like Dwarf Therapist to tell me if a particular dwarf is under-used or useless in my fort, based on how much of the time they are working instead of idling/eating/drinking/sleeping/partying.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on December 22, 2012, 11:59:44 am
1. DFHack runs once per frame (as opposed to once per tick).

2. Actually, that's something else I was working on. My eventManager branch, once it works, will be able to do that sort of thing efficiently for C++. Right now though, you'd just have to check if something interesting has happened on every frame, either in lua or C++, or ruby maybe.
Title: Re: DFHack 0.34.11 r2
Post by: Cobbler89 on December 22, 2012, 03:42:52 pm
Is there a way to set the direction of a ramp -- as viewed by probe?
Ramps do not have a direction - the "direction" you're seeing with river ramps is a property of the river, not the ramp, and all it seems to do is control the direction in which contaminants are pushed when they end up in the water (i.e. so the blood runs downstream).

Aaaah, good to know.

...Still curious if it can be set -- clearly this tile should match all the other river tiles here...

ETA: I posted and got a gateway timeout, so I hit refresh and told the browser yes, try resending the info (because I'd rather clean up a double-post than having to rewrite it)... and got the usual "a reply has been posted while you were working on yours" message -- about my own reply that posted. I just ninja'd myself!!
Title: Re: DFHack 0.34.11 r2
Post by: Urist Da Vinci on December 22, 2012, 04:47:16 pm
1. DFHack runs once per frame (as opposed to once per tick).

2. Actually, that's something else I was working on. My eventManager branch, once it works, will be able to do that sort of thing efficiently for C++. Right now though, you'd just have to check if something interesting has happened on every frame, either in lua or C++, or ruby maybe.

What's our terminology here? When I said "tick", I meant that, for example, it takes 10 ticks for a dwarf to walk 1 tile, and 100 ticks for a bridge to raise. It's also called "steps".

I guess you are trying to say that DFHack depends on the "graphical frame refresh rate", which would make sense considering that DFHack is a wrapper for sdl.dll.

How would you check for events on every frame then? The lua scripts that I have written in the past all take place within a single frame, and I guess the script has to end before DF can resume.
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 22, 2012, 04:56:17 pm
No, it is simulation frames. Even when the game is paused, it does 100 (or whatever your fps setting is) frames, but in pause mode they don't actually advance anything. You can see that on a laggy fort your fps indicator goes up to exactly 100 or whatever your setting is when paused.

With the new interface screens and virtual method hooks there can also be callbacks directly from the game code at various points.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 22, 2012, 05:01:18 pm
Excuse me, I came up with another questions.

in the add_spatter raws it says:
COVERED = liquid, GLAZED = solid, BANDS = paste, SPIKES = powder

The reaction itself uses a liquid and covered. Can I assume that I could rewrite the reaction, use glazed and a solid inorganic mat (metals with syndromes) to coat things, and it would still work? Lets say I have uranium, a metal with a syndrome, and I take an ironsword, glaze it with uranium, will the uranium syndrome affect creatures hit by this sword ?

Or do I have to use a liquid and have it enter the enemies blood ?
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on December 22, 2012, 05:17:41 pm
I'm not sure I understand the question, but I don't think it's set up for that yet.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 22, 2012, 06:09:12 pm
Code: [Select]
[REACTION:SPATTER_ADD_OBJECT_LIQUID]
[NAME:coat object with liquid]
[ADVENTURE_MODE_ENABLED]
[SKILL:WAX_WORKING]
[REAGENT:extract:150:LIQUID_MISC:NONE:NONE:NONE]
[MIN_DIMENSION:150]
[DOES_NOT_DETERMINE_PRODUCT_AMOUNT]
[REAGENT:extract container:1:NONE:NONE:NONE:NONE]
[CONTAINS:extract]
[PRESERVE_REAGENT]
[DOES_NOT_DETERMINE_PRODUCT_AMOUNT]
The object to improve must be after the input mat, so that it is known:
[REAGENT:object:1:NONE:NONE:NONE:NONE]
[PRESERVE_REAGENT]
[DOES_NOT_DETERMINE_PRODUCT_AMOUNT]
Need some excuse why the spatter is water-resistant:
[REAGENT:grease:1:GLOB:NONE:NONE:NONE][REACTION_CLASS:FAT][UNROTTEN]
[DOES_NOT_DETERMINE_PRODUCT_AMOUNT]
The probability is used as spatter size; Legendary gives +90%:
COVERED = liquid, GLAZED = solid, BANDS = paste, SPIKES = powder
[IMPROVEMENT:800:object:COVERED:GET_MATERIAL_FROM_REAGENT:extract:NONE]

This is the reaction. It uses a liquid to cover a weapon. If the weapon hits an enemy, the liquids syndromes affect the enemy.

My question is: Can I use solids, pastes or powders instead of liquids?

I already tested if it gets covered (the answer is yes. I covered swords with an inorganic material called dragonfire) What I need to know is if the syndrome will still work.

Usually a syndrome works by injecting something liquid into the blood of an enemy. OR hitting with an arrow that gets stuck in the wound and melts on body temp. Testing is difficult, but I will try to make something that I can immediatly see in fortress mode, and hunt some animals.

EDIT: I noticed while testing that already covered weapons get accepted in the reaction again, to be covered over and over... this is a problem in fortress mode, when people set it on repeat, or want to cover 10 weapons. It would just take the same weapon 10 times. I dont know if NOT_IMPROVED fixes this, but I will test.
Title: Re: DFHack 0.34.11 r2
Post by: Cobbler89 on December 22, 2012, 10:18:15 pm
Unrelated questions because I'm fiddling with Soundsense (though I am well aware that that utility is meant to run independent of dfhack and I wouldn't want it to require dfhack, there are things I think users of both may be able to improve for themselves...):

Is it possible to have a dfhack script check the current season? What about the status of whether any given race's caravan is present/trading/etc? The status of beseigedness? Of revealed ambushers present on the map? Of weather in a general way (whether there's rain, snow or evil weather on the map, not necessarily a detailed weathermap like the one dfhack utility)? Of whether Hell is revealed? (I'm pretty sure the answers to a lot of these are yes, based on other dfhack tools already in existence, but if anyone would be so kind as to point me in the general direction to look in lua for any of these I'd sure appreciate being spared from digging through dfhack tools' source code.)

Is it possible to have a dfhack script output to gamelog.txt?
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on December 23, 2012, 12:12:40 am
Meph: I understand the question now, but I don't know. Hopefully someone else will.
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 23, 2012, 03:31:26 am
EDIT: I noticed while testing that already covered weapons get accepted in the reaction again, to be covered over and over... this is a problem in fortress mode, when people set it on repeat, or want to cover 10 weapons. It would just take the same weapon 10 times. I dont know if NOT_IMPROVED fixes this, but I will test.

Adventure mode reactions work completely separately from fortress mode. In fortress mode it should not allow double coating with the same material automatically.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 23, 2012, 03:43:10 am
Any way to hack my adventure mode party so adventurer and companions are just standing around, listed as either "Friendly" or "Hostile" when I embark in the area?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 23, 2012, 08:15:27 am
@ag: But it does. I had a sword coated, and in the next reaction the already coated sword was being used again, simply because it was the nearest weapon.
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 23, 2012, 09:05:16 am
Coated with what? If it is a different liquid, it will happily use it again. I know it does work in my fort with my raws: I have a whole stockpile of poisoned ammo, and if I resume the reaction it says there is no improvable ammo, except if some new ammo has been produced. The workshop is linked to stockpiles with ammo and specific poison.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 23, 2012, 09:19:38 am
I actually dont know if it was the same kind of liquid, or another one. I will do more testing on coating and syndromes in fortress mode later.
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 23, 2012, 09:23:26 am
One interesting thing to test is how much poison needs to be applied as a spatter for it to work effectively. I notice that giant cave spider poison on ammo doesn't seem to do much in my fort: in the combat logs it says that enemies overcome the paralysis basically immediately. Maybe I need to change the spatter size so that there is more poison.
Title: Re: DFHack 0.34.11 r2
Post by: thistleknot on December 24, 2012, 10:45:08 am
is there a plugin to automatically dig out all designated areas?
Title: Re: DFHack 0.34.11 r2
Post by: vjek on December 24, 2012, 11:00:44 am
is there a plugin to automatically dig out all designated areas?
You can use tiletypes to adjust tiles to be floors, but you don't get stones as a result of the change.
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on December 24, 2012, 12:19:18 pm
How do I use the dfusion Embark plugin to choose specific castes of whichever race I want? Example: I play the Fallout:Equestria mod, wherein the author used hundreds of castes to get the right cutie marks. How would I pick which ponies I want?
Title: Re: DFHack 0.34.11 r2
Post by: ArKFallen on December 24, 2012, 02:38:47 pm
How do I use the dfusion Embark plugin to choose specific castes of whichever race I want? Example: I play the Fallout:Equestria mod, wherein the author used hundreds of castes to get the right cutie marks. How would I pick which ponies I want?
Two ways from what I can see. You can do "raceID:CasteId" or "raceID:Caste#" in the embark.txt to get a specific caste. The numbers are the first 'CASTE:ID' entry order with the very first being number '0' and then going up.
Title: Re: DFHack 0.34.11 r2
Post by: rampaging-poet on December 24, 2012, 02:56:50 pm
I added a pair of commands to dftraffic: restrictliquids and restrictice.  The former sets traffic to restricted on all visible liquid, while the later restricts traffic on all tiles above ice.  There's a few minor improvements that could be made (checking LOW_PASSABLE in restrictice, descriptions when "help" is used as a parameter), but the code is on my github fork and I've sent peterix a pull request.
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on December 24, 2012, 05:09:44 pm
How do I use the dfusion Embark plugin to choose specific castes of whichever race I want? Example: I play the Fallout:Equestria mod, wherein the author used hundreds of castes to get the right cutie marks. How would I pick which ponies I want?
Two ways from what I can see. You can do "raceID:CasteId" or "raceID:Caste#" in the embark.txt to get a specific caste. The numbers are the first 'CASTE:ID' entry order with the very first being number '0' and then going up.
Neither of those work. Does Dfusion only recognize the first number of the Caste#? If so, how would I go about changing the program to make it recognize up to the three digits?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 24, 2012, 05:24:59 pm
How do I use the dfusion Embark plugin to choose specific castes of whichever race I want? Example: I play the Fallout:Equestria mod, wherein the author used hundreds of castes to get the right cutie marks. How would I pick which ponies I want?
Two ways from what I can see. You can do "raceID:CasteId" or "raceID:Caste#" in the embark.txt to get a specific caste. The numbers are the first 'CASTE:ID' entry order with the very first being number '0' and then going up.
Neither of those work. Does Dfusion only recognize the first number of the Caste#? If so, how would I go about changing the program to make it recognize up to the three digits?

It should be e.g. "DWARF:0" for first dwarf caste. And i'm sure it does recognize up more than 1 digit (although i wonder what are you doing that would require 3 digits for castes)
Title: Re: DFHack 0.34.11 r2
Post by: ArKFallen on December 24, 2012, 05:52:39 pm
Alright, when I tried earlier with the CasteID thing I foolishly chose the first caste entry and it defaulted to itself :(


What's the ''saves run current world's init.lua" in DFusion do/mean exactly? Where would I find this init.lua to edit it or does the script create one to use? It sounds really useful for in-game init customization.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on December 24, 2012, 05:59:37 pm
Alright, when I tried earlier with the CasteID thing I foolishly chose the first caste entry and it defaulted to itself :(


What's the ''saves run current world's init.lua" in DFusion do/mean exactly? Where would I find this init.lua to edit it or does the script create one to use? It sounds really useful for in-game init customization.
Unfortunately it can only access dfusion stuff (so not much can be done). It reads "data/save/<region>/dfusion/init.lua" file if it exists. Useful for setting up friendship for multiple runs (although that's what i remember, that was ages ago and i have changed everything at least two times  :-\ )
Next release will have dfusion integrated better into dfhack (although that required a lot of changes)
Title: Re: DFHack 0.34.11 r2
Post by: Kyphis on December 24, 2012, 07:00:52 pm
I'm trying to rename a Civilisation, but can't figure out what I need to do to get its reference in the lua. Could anyone help me out?
Title: Re: DFHack 0.34.11 r2
Post by: arclance on December 24, 2012, 10:12:11 pm
I have been trying to get stonesense to work on my 64bit main computer again and have had some success getting stonesense to start by building with allegro 5.0.8. (http://www.bay12forums.com/smf/index.php?topic=106497.msg3899812#msg3899812)
I am unable to run debuggers on it in my 32bit build VM though because they fail with this error.
Code: [Select]
setarch: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
Anyone know why that would be?
Title: Re: DFHack 0.34.11 r2
Post by: ag on December 25, 2012, 12:58:07 am
It needs to link to libgraphics.so from DF itself for some ui stuff, and cannot find it or whatever. Also, the "setarch:" bit suggests that itis coming from the wrong program anyway, so you can probably ignore it if other stuff works.
Title: Re: DFHack 0.34.11 r2
Post by: CarloTheCurious on December 25, 2012, 02:25:22 am
In the workflow and job commands, is there any way to specify NON_PRESSED as part of the constraint spec or job material?

(for rock nut paste/cake, which are both GLOB//BUSH_QUARRY:SEED as far as I can tell)

cheers.
Title: Re: DFHack 0.34.11 r2
Post by: arclance on December 25, 2012, 09:58:17 am
It needs to link to libgraphics.so from DF itself for some ui stuff, and cannot find it or whatever. Also, the "setarch:" bit suggests that itis coming from the wrong program anyway, so you can probably ignore it if other stuff works.
gdb stops because of it with
Code: [Select]
/bin/bash: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
During startup program exited with code 127.
vagrind also stops with or without the setarch part of the line.
Code: [Select]
/bin/sh: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
Title: Re: DFHack 0.34.11 r2
Post by: Andux on December 25, 2012, 10:50:47 am
I'm trying to rename a Civilisation, but can't figure out what I need to do to get its reference in the lua. Could anyone help me out?
If you can select a unit belonging to that civ, you could get at the civ name like so:
Code: [Select]
local u=dfhack.gui.getSelectedUnit()
if u then
print("Selected unit has civ_id of "..u.civ_id.."...")
if u.civ_id == -1 then
print('How uncivilized!')
else
local civ = df.global.world.entities.all[u.civ_id]
print('Entity #'..u.civ_id..' is '..dfhack.TranslateName(civ.name)..', "'..dfhack.TranslateName(civ.name,1)..'", '..civ.type)
end
end
Otherwise, you'll need to use pairs to go through df.global.world.entities.all until you find the one you want.
Title: Re: DFHack 0.34.11 r2
Post by: Cobbler89 on December 25, 2012, 01:32:55 pm
I am unable to run debuggers on it in my 32bit build VM though because they fail with this error.
Code: [Select]
setarch: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
Anyone know why that would be?
Obviously you need to upgrade your Zed Television to the 8th Edition. The 7th Edition isn't good enough for the ASCII this game uses!!

...In all seriousness, it sounds (at a glance, to an amateur debuggist who has not yet tried to program on Linux, though it's on the todolist for some of his projects) as though dfhack referenced another library that is there for it to use normally, but isn't available to the debugger? If you could get that other library into the debugger's hands, so to speak, might that solve the issue? Could that be done by giving the debugger whatever program contains the other library? Maybe you should only pay attention to my jokes and not my actual advice; I don't seem to know as much as most others here. ;^)
Title: Re: DFHack 0.34.11 r2
Post by: Kyphis on December 25, 2012, 05:20:40 pm
I'm trying to rename a Civilisation, but can't figure out what I need to do to get its reference in the lua. Could anyone help me out?
If you can select a unit belonging to that civ, you could get at the civ name like so:
Code: [Select]
local u=dfhack.gui.getSelectedUnit()
if u then
print("Selected unit has civ_id of "..u.civ_id.."...")
if u.civ_id == -1 then
print('How uncivilized!')
else
local civ = df.global.world.entities.all[u.civ_id]
print('Entity #'..u.civ_id..' is '..dfhack.TranslateName(civ.name)..', "'..dfhack.TranslateName(civ.name,1)..'", '..civ.type)
end
end
Otherwise, you'll need to use pairs to go through df.global.world.entities.all until you find the one you want.
Managed to find it, thanks! The first ID (civ_id=) was not the same as its reference in global.world.entities, but the global.world.entities where all listed numerically so it was just a case of finding the linear offset.

After that, the actual words used are taken from the Dwarven Language file, with each incriment of 1 being by line. A lot of non-culled words didn't turn up due to word case, so I just had to switch between the different language modes to get the one I wanted (very easy, it ranges between like 0 and 3) and the word turned up. When the word wasn't turning up, it was only in the translation, the name would still have change even though the translation didnt, allowing me to make sure I had the right word. Language settings of 0 and 1 are the most likely to show the word.
Title: Re: DFHack 0.34.11 r2
Post by: arclance on December 25, 2012, 07:51:26 pm
I am unable to run debuggers on it in my 32bit build VM though because they fail with this error.
Code: [Select]
setarch: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
Anyone know why that would be?
Obviously you need to upgrade your Zed Television to the 8th Edition. The 7th Edition isn't good enough for the ASCII this game uses!!

...In all seriousness, it sounds (at a glance, to an amateur debuggist who has not yet tried to program on Linux, though it's on the todolist for some of his projects) as though dfhack referenced another library that is there for it to use normally, but isn't available to the debugger? If you could get that other library into the debugger's hands, so to speak, might that solve the issue? Could that be done by giving the debugger whatever program contains the other library? Maybe you should only pay attention to my jokes and not my actual advice; I don't seem to know as much as most others here. ;^)
I found the solution here, it lead me to the documentation on "set exec-wrapper" in gdb. (http://sourceware-org.1504.n7.nabble.com/How-to-run-gdb-with-LD-PRELOAD-td104844.html)
Code: [Select]
When `exec-wrapper' is set, the specified wrapper is used to launch programs for debugging. GDB starts your program with a shell command of the form exec wrapper program. Quoting is added to program and its arguments, but not to wrapper, so you should add quotes if appropriate for your shell. The wrapper runs until it executes your program, and then GDB takes control.

You can use any program that eventually calls execve with its arguments as a wrapper. Several standard Unix utilities do this, e.g. env and nohup. Any Unix shell script ending with exec "$@" will also work.

For example, you can use env to pass an environment variable to the debugged program, without setting the variable in your shell's environment:
I turned out that the "dfhack" launcher script was incorrectly setting up gdb to for use with the "LD_PRELOAD" environment variable in this line.
Code: [Select]
echo "set environment LD_PRELOAD=./hack/libdfhack.so" > gdbcmd.tmp
The problem is that this applies the LD_PRELOAD to both bash and DwarfFortress.

This line will only apply the LD_PRELOAD to DwarfFortress and gdb will work.
Code: [Select]
echo "set exec-wrapper env 'LD_PRELOAD=./hack/libdfhack.so'" > gdbcmd.tmp

Now I can get a more data about this wonderful crash.
Code: [Select]
                                            *** glibc detected *** /home/arclance/build/Dwarf_Fortress/0_Utils/dfhack/Petrix_Branch/dfhack_2012-12-24/build/0_Output/df_34_11_linux-copy2/df_linux/libs/Dwarf_Fortress: corrupted double-linked list: 0x872fbb18 ***

I assume that this is the same problem with valgrind but I have not checked if there is a equivalent solution there.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 26, 2012, 02:06:09 am
Sorry to be repetetive, but...
Any way to hack my adventure mode party so adventurer and companions are just standing around in the area upon embark, listed as either "Friendly" or "Hostile"?
Title: Re: DFHack 0.34.11 r2
Post by: CarloTheCurious on December 26, 2012, 03:31:45 am
In the workflow and job commands, is there any way to specify NON_PRESSED as part of the constraint spec or job material?

(for rock nut paste/cake, which are both GLOB//BUSH_QUARRY:SEED as far as I can tell)
Also, is it possible to get workflow to include the 'in use' items as meeting the constraint? Mainly for armour and weapons - I may want 20 masterful steel sets, but that includes what my militia is already wearing.
Title: Re: DFHack 0.34.11 r2
Post by: thistleknot on December 26, 2012, 11:26:37 am
Quote from: Meph link=topic=91166.msg3892202#msg3892202

I did figure out the steam engine myself by now, wrote a custom design for it that works.

please tell
Title: Re: DFHack 0.34.11 r2
Post by: arclance on December 26, 2012, 11:31:56 am
Quote from: Meph link=topic=91166.msg3892202#msg3892202

I did figure out the steam engine myself by now, wrote a custom design for it that works.

please tell
It is in his Masterwork mod. (http://www.bay12forums.com/smf/index.php?topic=98196.msg3903083#msg3903083)
Title: Re: DFHack 0.34.11 r2
Post by: proxn_punkd on December 27, 2012, 05:48:16 pm
Okay, I give up, how the heck do I install/use it?

I don't think I've used DFHack since the new format, and I am going crazy trying to play DF without the ability to clean things and get rid of vermin corpses.

ETA: Windows 7, DF 0.31.25 SDL version.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on December 27, 2012, 05:49:36 pm
you put it into your DF folder and open DF.
Title: Re: DFHack 0.34.11 r2
Post by: proxn_punkd on December 27, 2012, 05:50:27 pm
Which (part of which) folder do I put where? There are so many folders. D:
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on December 27, 2012, 05:53:34 pm
The DF folder. The one where the exe is.
Title: Re: DFHack 0.34.11 r2
Post by: proxn_punkd on December 27, 2012, 05:56:44 pm
Okay, I found the problem. Extracting DF Hack components from the zip put them into a folder inside the DF folder.

SWEET MERCIFUL ARMOK I'M HACKING AGAIN. :D

Thanks for the help, Putnam!
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on December 27, 2012, 06:00:42 pm
No, you just extract the files and folders in the zip directly to the same folder as the df exe.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 27, 2012, 08:05:41 pm
Is there a way to set the death year? Looking at legends xml exports, it seems that creatures that never died have it set to -1

On another note, how do I to add syndromes/symptoms to a unit using the lua prompt?
Title: Re: DFHack 0.34.11 r2
Post by: §¢ǿŗÞﵧ on December 29, 2012, 03:20:39 pm
I'm having a huge problem with DF hack. You guys might have solved this problem already but, when i installed df hack, i couldn't place magma forges (There was no magma forge in the workshop screen). Is this only on my computer?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 29, 2012, 03:21:28 pm
Magma Forges only show up after you discovered a volcano or magma lake... always. Has nothing to do with dfhack.
Title: Re: DFHack 0.34.11 r2
Post by: §¢ǿŗÞﵧ on December 29, 2012, 03:22:29 pm
Magma Forges only show up after you discovered a volcano or magma lake... always. Has nothing to do with dfhack.

i have discovered it..

i have a volcano on my map
Title: Re: DFHack 0.34.11 r2
Post by: tilly on December 29, 2012, 07:13:15 pm
Couldn't find an answer to this anywhere but was very curious cuz I read on a different website that people were using DFhack to create walls and floor tiles. Is this possible if so how?
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on December 29, 2012, 07:17:11 pm
Couldn't find an answer to this anywhere but was very curious cuz I read on a different website that people were using DFhack to create walls and floor tiles. Is this possible if so how?

liquids, 'o' (obsidian) and 'of' (obsidian floors)
Title: Re: DFHack 0.34.11 r2
Post by: Cobbler89 on December 30, 2012, 12:58:07 am
You may also try fiddling with Tiletypes. I'm not sure if it can create wall or floor tiles out of thin air, but it should be able to modify obsidian ones made with Liquids, if nothing else.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on December 30, 2012, 01:51:01 am
I have not tried it, but you ought be able to use tiletypes to make tiles out of midair, as long as you're doing it in tile blocks that are allocated. If there was something there (ever), then it'll be fine, otherwise maybe. Unless I'm totally crazy. Save first.
Title: Re: DFHack 0.34.11 r2
Post by: Sutremaine on December 30, 2012, 12:11:30 pm
Question about makeown:

I used it on a dwarven caravan guard, but he's not listed as a citizen or member of anything (no blue text in his description). I can force him into a squad using DT and he'll follow station orders, but he won't go and train or put on a uniform, or in fact any clothes at all. He was wearing them at one point, but then dropped everything when I forced him into a squad. Removing him from the squad via DT doesn't make him wear anything either.

Is there any way of making him a full member of the fortress, or does makeown only work for making civilians?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on December 31, 2012, 11:39:37 pm
I just wanted to report my findings about the coating system.

Already coated weapons cant be coated again. Inorganics can be used for coating, even solid materials. You could theoratically give adamantine a syndrome, coat a weapon with adamantine, and whenever it hits, the syndrome comes into effect. So far as I can tell every hit does trigger. No need to "lodge weapon/ammo in wound".

It is great. I now have weapons that slow the enemy down, ammo that transformes them into sheep, and traps that turn them crazed, so they rip each other apart. I like it. Thanks so much at the dfhack team, for making such possibilities a reality. :)
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 01, 2013, 01:45:23 am
What kind of syndromes does it trigger? Any? Or Injected / Contact only? Also, how?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 01, 2013, 10:31:19 am
SYN_CONTACT is enough. All syndromes work, and with can_do_interaction there is really no limit in what you want to achieve. How ? dfhack magic I guess, someone wrote the SPATTER_ADD_ plugin, check the readme and the hack/raw folder.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 01, 2013, 01:08:25 pm
So stabbing someone with a [SYN_INJECTED] material will work?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 01, 2013, 01:24:31 pm
No. Stabbing someone with a weapon, ammo or trapcomp coated in a syn_contact material will work. You take any weapon, run the SPATTER_ADD reaction, and coat it with your material. Like I said, have a look at the df readme.
Title: Re: DFHack 0.34.11 r2
Post by: Tharwen on January 01, 2013, 07:46:58 pm
I'm trying to make a plugin but having a bit of trouble... When I call DFHACK_PLUGIN at the start of the file, it gives me this compile error:

error C2065: 'DFHACK_VERSION' : undeclared identifier

I can't see anything different to other plugins in the source so I assume the problem must be somewhere in my project settings, but I can't see where... Can anyone help?


Never mind. It turns out DFHACK_VERSION needs to be defined under Preprocessor Definitions.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on January 02, 2013, 12:26:21 am
I've been adding things to autoSyndrome. It can intelligently pass "smart arguments" to a DFHack command (including an lua or ruby script). So if you have a boiling rock syndrome with

Code: [Select]
[SYN_CLASS:\COMMAND]
[SYN_CLASS:someFunction]
[SYN_CLASS:location]
[SYN_CLASS:\LOCATION]
[SYN_CLASS:worker_id]
[SYN_CLASS:\WORKER_ID]
[SYN_CLASS:\REACTION_INDEX]
[SYN_CLASS:\reaction_index]

then whenever a reaction creates such a rock, it would be equivalent to typing the following into the DFHack console:

Code: [Select]
someFunction location {x} {y} {z} worker_id {worker id} {reaction index} \reaction_index

(curly braces are non-literal: it would put the actual x location of the job instead of {x})

Is there anything else that might be useful to modders, argument-wise? It's fairly easy to add other stuff like that.
Title: Re: DFHack 0.34.11 r2
Post by: smokebubble on January 02, 2013, 01:48:15 am
Is it supposed to enable a tweak more than once?

Every time I start up DF, dfhack enables 2 stable-temp's, 3 fast-heat's, 3 fixed-dimension's with an extra one that couldn't activate, and 2 fast-trade's. The remaining tweaks are only enabled once.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 02, 2013, 08:46:13 am
So stabbing someone with a [SYN_INJECTED] material will work?

No. Stabbing someone with a weapon, ammo or trapcomp coated in a syn_contact material will work.
Actually, [SYN_INJECTED] will work, because that's what subterranean animal peoples use (they coat their blowdarts with venom, and most types of venom are only dangerous when injected).
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on January 02, 2013, 11:55:28 am
A note on using tyletypes to generate walls, etc. in mid-air.  It works.  BUT, make sure that if you make something that would have a floor above it (like a wall) you then follow up by ACTUALLY PLACING that floor on the Z-level above.  Else, weird stuff happens.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 02, 2013, 12:33:13 pm
Is it possible by dfhack to limit a reaction and/or workshop to a certain skill level ?

Example: Reaction: Masterful ultra epic dwarven weapons made of material supersteel. Can only be run by a legendary weaponsmith.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 02, 2013, 01:30:12 pm
Well, you can already arbitrarily limit a workshop with the manager profile, but that's not what you're after.

Is this AutoSyndrome available yet?
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on January 02, 2013, 03:38:04 pm
AutoSyndrome basically can't be released as an individual plugin, because it depends on other recent stuff. It'll have to wait until the next release.
Title: Re: DFHack 0.34.11 r2
Post by: Tierre on January 03, 2013, 04:24:34 pm
Then is binpatch going to come out?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 03, 2013, 04:44:54 pm
I want to make a report on the add_spatter:

It seems to check the item for covered materials, and does not cover it again with the same one. So far so good. All other materials are ok for coating, so a weapon coated with "poison1" can still be coated with "poison2". That leads to immense gameplay/balance issues, as soon as several poisons are introduced. I tried to fix it with adding the not_improved tag to the reaction, and then improving the weapon in the same reaction that coats it with poison. This way every weapon that is coated would be impossible to be used in another coating reaction. The problem is that dfhack automatically adds the improvement to the weapon  as a coating, instead of an improvement. This way the weapon will not be improved, and is still a valid item for another poison.

It would be great if a coated item would either be illegal to be used in any coating reaction, OR if the new coating replaces the old one. I personally would prefer the first, because the second would make micromanagement in fortress mode obviously very difficult.

Another solution would be to check the weapon coating for reaction_class, but from what I have been seeing in testing, it does use the material. One could give all poison coating materials an additional reaction_class, to avoid multiple coatings then.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 03, 2013, 04:50:01 pm
You can coat things with more than one poison IRL, which might either cancel each other or have unexpected synergistic effects. As such, most poisons in DF are sufficiently deadly on their own, so I don't think it's a huge balance issue.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 03, 2013, 04:57:36 pm
It is for modders. ^^ And the player, mostly the micromanagement. You have to manually sort items from coated and not coated. You would end up coating the same item mutiple times, especially with ammo. I also want to write an extended rune coating system, and that would be a problem. Narhiril plans something similar if I am not entirely mistaken, so she will have the same problem.

This is a suggestion for a possible improvement of the feature, not a "everything is broken, fix it" thing. Everything works, but it will be a lot of work for the player. On the other hand, I will continue the Runesmith idea, and report once I have a couple of people test it ingame.

EDIT: The working system is finished, and I am quite pleased with it. This is how it looks ingame:
(https://lh6.googleusercontent.com/-l1UjOrLXLOA/UOZCKA-fpeI/AAAAAAAALk0/Rl4VSuCujDM/s940/steel%2520sword.png)

Thanks for the great plugin again. :)
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 04, 2013, 04:45:18 am
Erm... how do I make it work on Mac? I use 10.6.8... I launch the dfhack and dwarfort.exe launches... but nothing appears and dwarfort.exe is not responding, so I force quit it. What do I do?
Guys, please, what do I do? I don't want to use WINE. :/
Launch it from terminal? Post what it prints
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on January 04, 2013, 05:43:47 am
-snip- Fun content

Oh my that sounds great, combine that with retire forts always having hostile wild life spawning and you might have something.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on January 04, 2013, 09:25:04 am
Erm... how do I make it work on Mac? I use 10.6.8... I launch the dfhack and dwarfort.exe launches... but nothing appears and dwarfort.exe is not responding, so I force quit it. What do I do?
Guys, please, what do I do? I don't want to use WINE. :/

(Quasi-official Mac port guy here.)

At present, I cannot officially support 10.6.8. I no longer have a 10.6.8 machine to build or test on, and all the tests I ran previously were unsuccessful at getting it to run.

However, another poster reported that he was able to get it to run by editing the dfhack script and changing this line:

Code: [Select]
DYLD_FORCE_FLAT_NAMESPACE=1

...by adding a # in front of it (commenting it out).

Once that is done, simply run dfhack from the Terminal, and if your setup is like his, it should work for you.

If it does not, then the only thing I can recommend is upgrading to Lion. Sorry.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 04, 2013, 02:43:39 pm
So, if I use the lua function, can I give people syndromes that aren't defined in the raws by setting unit.curse.add_tags1.whatever=true ?

BTW, found that setting unit.body.blood_count=0 kills most things without the "disappearing body" glitch that unit.flags1.dead=true causes.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on January 04, 2013, 03:15:36 pm
Erm, I can NOT update to Lion just yet (No access to online payment and too lazy to ask my local apple store guy). But, it worked. The problem now, is, this : Can't load plugin /Users/fryselectronics/Downloads/df_osx/hack/plugins/stonesense.plug.so

You can just remove the Stonesense plugin; it's got further issues with 10.6.8 support, IIRC. (Or ignore the message; it shouldn't interfere with normal operation, I don't think.)
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on January 04, 2013, 03:28:52 pm
It is for modders. ^^ And the player, mostly the micromanagement. You have to manually sort items from coated and not coated. You would end up coating the same item mutiple times, especially with ammo. I also want to write an extended rune coating system, and that would be a problem. Narhiril plans something similar if I am not entirely mistaken, so she will have the same problem.

This is a suggestion for a possible improvement of the feature, not a "everything is broken, fix it" thing. Everything works, but it will be a lot of work for the player. On the other hand, I will continue the Runesmith idea, and report once I have a couple of people test it ingame.

EDIT: The working system is finished, and I am quite pleased with it. This is how it looks ingame:
(https://lh6.googleusercontent.com/-l1UjOrLXLOA/UOZCKA-fpeI/AAAAAAAALk0/Rl4VSuCujDM/s940/steel%2520sword.png)

Thanks for the great plugin again. :)
Meph, if you are going whole hog on the DFhack intergration thing, then how about a slaving function using "tweak makeown"?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 04, 2013, 03:58:47 pm
Well, tahujdt, if you write the C++/lua/ruby plugin, I will happily do the mod content. But I cant program dfhack, simply a matter of lacking skill on my part. I dont know these languages.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 04, 2013, 04:21:19 pm
I know C++ and lua, kind of. Also, tweak makeown is in vanilla DFHack.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 04, 2013, 04:31:24 pm
The thing that is missing (in current release) is bridge between a dfhack command/script (e.g. tweak makeown (although custom script would be better)) and reaction, or hit or any other in df event.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 04, 2013, 04:31:45 pm
Ok, I rephrase: If anyone writes the C++/lua/ruby plugin, I will happily do the mod content.

Edit: Or join the dfhack team as a modding-related consultant, and give suggestions on what modders could make best use of. :P
Title: Re: DFHack 0.34.11 r2
Post by: danaris on January 04, 2013, 06:28:51 pm
You can just remove the Stonesense plugin; it's got further issues with 10.6.8 support, IIRC. (Or ignore the message; it shouldn't interfere with normal operation, I don't think.)
Er, is there any way to fix this? I kinda DLed dfhack only for it... :P. also, speaking of updates, I heard you can ask the storekeeper to give a flash drive with the OS upgrade. Is that true?

As I said, I do not currently have access to a 10.6.8 build machine. Thus, even when I get stonesense fully working for 10.7+, there is no guarantee that it will work on 10.6.

If you are willing to do a little extra work, you could build it yourself. I'd even be willing to help you through the process (preferably on IRC, in the #dfhack channel on Freenode, but I'm flexible).

For the update, I don't think they're selling the flash drives anymore: they're not selling Lion at all.
Title: Re: DFHack 0.34.11 r2
Post by: CaptainArchmage on January 04, 2013, 09:31:11 pm
You can just remove the Stonesense plugin; it's got further issues with 10.6.8 support, IIRC. (Or ignore the message; it shouldn't interfere with normal operation, I don't think.)
Er, is there any way to fix this? I kinda DLed dfhack only for it... :P. also, speaking of updates, I heard you can ask the storekeeper to give a flash drive with the OS upgrade. Is that true?

As I said, I do not currently have access to a 10.6.8 build machine. Thus, even when I get stonesense fully working for 10.7+, there is no guarantee that it will work on 10.6.

If you are willing to do a little extra work, you could build it yourself. I'd even be willing to help you through the process (preferably on IRC, in the #dfhack channel on Freenode, but I'm flexible).

For the update, I don't think they're selling the flash drives anymore: they're not selling Lion at all.

I have such a machine (10.6.8) and so I could *try* to build one myself. How exactly does this work?

You can use a PM if the process is extremely complicated.
Title: Re: DFHack 0.34.11 r2
Post by: narhiril on January 05, 2013, 10:13:58 am

A small request for AutoSyndrome:

As I understand it...

Spoiler: Priorities (click to show/hide)

Is there any chance that priorities 3 and 4 could be switched, thereby giving immunities priority over affected creature/classes?  Maybe a silly request, but I can envision this getting muddled up somewhere down the line.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on January 05, 2013, 10:28:26 am
The reasoning was that you can have an immune class, but have a creature be affected as an exception, despite having that class. If a creature is named specifically as affected, then it really ought to be affected.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 05, 2013, 02:11:51 pm
The reasoning was that you can have an immune class, but have a creature be affected as an exception, despite having that class. If a creature is named specifically as affected, then it really ought to be affected.
But that means if you have a syndrome that's supposed to affect normal humans alone, and not vampires, werewolves, or zombies/husks, then it will affect them regardless.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on January 05, 2013, 03:31:08 pm
Hm. Is that the way syndromes normally work?
Title: Re: DFHack 0.34.11 r2
Post by: danaris on January 05, 2013, 05:05:39 pm
You can just remove the Stonesense plugin; it's got further issues with 10.6.8 support, IIRC. (Or ignore the message; it shouldn't interfere with normal operation, I don't think.)
Er, is there any way to fix this? I kinda DLed dfhack only for it... :P. also, speaking of updates, I heard you can ask the storekeeper to give a flash drive with the OS upgrade. Is that true?

As I said, I do not currently have access to a 10.6.8 build machine. Thus, even when I get stonesense fully working for 10.7+, there is no guarantee that it will work on 10.6.

If you are willing to do a little extra work, you could build it yourself. I'd even be willing to help you through the process (preferably on IRC, in the #dfhack channel on Freenode, but I'm flexible).

For the update, I don't think they're selling the flash drives anymore: they're not selling Lion at all.

I have such a machine (10.6.8) and so I could *try* to build one myself. How exactly does this work?

You can use a PM if the process is extremely complicated.

The process is described in the Compile document (https://github.com/peterix/dfhack/blob/master/Compile.rst#mac-os-x).

If you need help, then during the week, you're likely to be able to find me as Delvin_Anaris or Delvin_at_Work in the DFHack channel (http://webchat.freenode.net/?channels=dfhack) on Freenode's IRC server. (Help of this sort is vastly easier in a real-time format than over forum PM. But if you can't do IRC, I can do my best to help over PM.  :D )
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on January 05, 2013, 05:17:46 pm
Can anyone tell me how to change the Dfusion plugin to use caste names?
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 05, 2013, 05:18:04 pm
Hm. Is that the way syndromes normally work?
Yes, as those get [SYN_CLASS:WEREBEAST/VAMPIRE/ANIMATED_CORPSE] in order to prevent someone repeatedly getting the same curse or getting both lycanthropy and vampirism. If you want a syndrome to target all members of one species regardless of curse status or undeath, just give it [SYN_AFFECTED_CREATURE] and nothing else. Those curses won't disqualify if the syndrome doesn't have any disqualifications specified.
Title: Re: DFHack 0.34.11 r2
Post by: CaptainArchmage on January 05, 2013, 06:25:24 pm
Thanks, I'm starting by downloading the stuff needed to make cmake work. I didn't find any "downloads" section in the XCode preferences, but I've used the command prompt to compile programs before (and I have used "make install" for a few things).

If things go well I might be able to finish this tomorrow, but I cannot give any guarantees. Delay beyond tomorrow may result in this taking a few days

How many other people here use Mac OS X 10.6 (Snow Leopard)? Also is this the earliest version of Mac that will run DF or is the earliest version 10.5 (which also runs with Intel macs)?
Title: Re: DFHack 0.34.11 r2
Post by: Deep on January 06, 2013, 07:17:11 am
Hi.  I started trying to use DFHack recently.  if i type "prospect" into the command window it seems to work and gives me mineral info

if i type "tweak patrol-duty" nothing seems to happen and there is no impact in game as far as i can see, could anyone tell me what i need to type in to activate the fix on training counting towards bad thoughts.  I have spent a long time reading the DF-Hack readme but i must be doing something wrong or not understanding it .. in fact there are lots of things that it talks about that i cant access. i typed "ls" and it doesn't list or give commands for a lot of stuff in the readme or probably im just not understanding it

Title: Re: DFHack 0.34.11 r2
Post by: splinterz on January 06, 2013, 10:06:40 am
is there any way to determine which skills are rusty vs very rusty? i'm assuming it's using the values in the unit's skill list (unused_counter, rusty, rust_counter and demotion_counter) but i haven't been able to figure out where it draws the line between rusty and very rusty.
Title: Re: DFHack 0.34.11 r2
Post by: CaptainArchmage on January 06, 2013, 03:14:30 pm
Progress update: I'm currently installing the mac ports dependencies. It is mentioned this may take a long time; yesterday it appeared stuck so I terminated the process and instead went on to install the pearl dependencies. Do I need to have the mac ports dependencies installed or can I use the binary install for cmake and then compile?

Edit: Crisis averted, the mac port dependencies install is done. I'm now going to look into the actual compilation of dfhack. Typing stuff into the terminal during compilation may screw things up.

Update: I've downloaded a fresh, completely unmodded version of the latest Dwarf Fortress and used it. The program is at the "make" stage which means hopefully stuff will be finished without errors.

Update2: The process failed in the make stage with the following errors

dfhack/library/LuaTypes.cpp:467:55: error: 'strnlen' was not declared in this scope
make[2]: *** [library/CMakeFiles/dfhack.dir/LuaTypes.cpp.o] Error 1
make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
make: *** [all] Error 2

I've tried to restart the process, but I get the same error. Problem seems to lie in the code.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on January 06, 2013, 09:43:06 pm
Progress update: I'm currently installing the mac ports dependencies. It is mentioned this may take a long time; yesterday it appeared stuck so I terminated the process and instead went on to install the pearl dependencies. Do I need to have the mac ports dependencies installed or can I use the binary install for cmake and then compile?

Edit: Crisis averted, the mac port dependencies install is done. I'm now going to look into the actual compilation of dfhack. Typing stuff into the terminal during compilation may screw things up.

Update: I've downloaded a fresh, completely unmodded version of the latest Dwarf Fortress and used it. The program is at the "make" stage which means hopefully stuff will be finished without errors.

Update2: The process failed in the make stage with the following errors

dfhack/library/LuaTypes.cpp:467:55: error: 'strnlen' was not declared in this scope
make[2]: *** [library/CMakeFiles/dfhack.dir/LuaTypes.cpp.o] Error 1
make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
make: *** [all] Error 2

I've tried to restart the process, but I get the same error. Problem seems to lie in the code.

CaptainArchmage, I should be able to help you bash at this tomorrow during the day (US Eastern time). I'll be available in the aforementioned IRC channel, or you can shoot me a forum PM when you'll be around if web-IRC isn't a viable option for you.
Title: Re: DFHack 0.34.11 r2
Post by: CaptainArchmage on January 06, 2013, 09:53:31 pm
Thanks. I've written down the single error message I get as it appears starting with the file address. I'll have to check up on my schedule as it goes.

Update: OK I think I've got why the compile was failing, but I now have further problems with a missing Docutils, which wasn't happening before. I will need to look this over tomorrow. may have been happening but I didn't get any fatal errors so I disregarded it, is it serious?

I'm going to try to make with the edited file.

Still has the "out of scope" error.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 07, 2013, 12:01:51 am
A quick question: Can a building be given the OUTSIDE tag, like furniture or windmills already have? For something thats needs to be build aboveground.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 07, 2013, 12:58:23 am
I'm not entirely sure if they have tags at all.

Unless of course you're just talking in raw terms because those are the ones you're familiar with, in which case I guess the term you'd be looking for is flag as opposed to tag.
Title: Re: DFHack 0.34.11 r2
Post by: assaultdoor on January 07, 2013, 12:59:08 am
Thanks, I'm starting by downloading the stuff needed to make cmake work. I didn't find any "downloads" section in the XCode preferences, but I've used the command prompt to compile programs before (and I have used "make install" for a few things).

If things go well I might be able to finish this tomorrow, but I cannot give any guarantees. Delay beyond tomorrow may result in this taking a few days

How many other people here use Mac OS X 10.6 (Snow Leopard)? Also is this the earliest version of Mac that will run DF or is the earliest version 10.5 (which also runs with Intel macs)?

I'm still using Snow Leopard, and I'd love to be able to use DFHack. For some reason, I can't get it to work under Wine.



Oh, you were talking about Stonesense, wheren't you? I knew I should have read back another page in the thread before replying.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 07, 2013, 01:12:17 am
A quick question: Can a building be given the OUTSIDE tag, like furniture or windmills already have? For something thats needs to be build aboveground.
Is possible (for anyone wanting to implement my idea: isPowered vmethod to check if it's outside). Although not with tags (might be e.g. building name token) because there no "OUTSIDE" tag and df discards all the unknown tags afaik.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 07, 2013, 01:27:22 am
Yes, I did mean flag in this case. I know no such tag exist, but at least I was understood. :) And good news that it is possible.

In that case I would like to request a plugin that makes all buildings with building_id "OUTSIDE_" to get this flag. If that is not too much work of course. I can never tell ^^
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 07, 2013, 06:13:04 am
Yes, I did mean flag in this case. I know no such tag exist, but at least I was understood. :) And good news that it is possible.

In that case I would like to request a plugin that makes all buildings with building_id "OUTSIDE_" to get this flag. If that is not too much work of course. I can never tell ^^
Nope thats not too much. I'm thinking maybe we should implement additional "raws" e.g. "something.raw" file(s) with similar to raw syntax (e.g. [BUILDING:MASON][OUTSIDE][NEEDS_POWER][ADD_REACTION:MAGIC_BLOCKS][REMOVE_NATIVE_JOBS])
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on January 07, 2013, 11:03:25 am
Hm. Is that the way syndromes normally work?
Yes, as those get [SYN_CLASS:WEREBEAST/VAMPIRE/ANIMATED_CORPSE] in order to prevent someone repeatedly getting the same curse or getting both lycanthropy and vampirism. If you want a syndrome to target all members of one species regardless of curse status or undeath, just give it [SYN_AFFECTED_CREATURE] and nothing else. Those curses won't disqualify if the syndrome doesn't have any disqualifications specified.

Then I'll fix it. Thanks for letting me know.
Title: Re: DFHack 0.34.11 r2
Post by: Deon on January 07, 2013, 11:28:43 am
Expwnent, when can we get a working release with the "definitely will affect" boiling stones you have a beta of? I can't wait to use it :D.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on January 07, 2013, 12:37:52 pm
I think there's going to be a new release within the next few weeks. It should be included then.
Title: Re: DFHack 0.34.11 r2
Post by: koter on January 07, 2013, 12:51:04 pm
Does anyone know of a script to trigger a siege or megabeast attack? I have a 15-year-old fort that's never seen an encounter larger than cave crocodiles. I am getting bored with just human and elven caravans (for some reason they don't care that none of their merchants ever come back).
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 07, 2013, 02:08:40 pm
Megabeast attack:
Code: [Select]
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.Megabeast, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
Night creature attack:
Code: [Select]
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.NightCreature, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
Siege:
Code: [Select]
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.CivAttack, season = df.global.cur_season, season_ticks = df.global.cur_season_tick, entity = df.historical_entity.find(<entityID>) } )
For each of the above commands, you need to type "lua" first.

The "megabeast" and "night creature" events probably won't take effect unless your fortress is large enough.
Also, for a siege you'll need to know the entity ID of your nearby Goblin civilization. If you've killed at least one in the past, you can put "dfhack.gui.getSelectedUnit().civ_id" in the above command and then run it while you have said goblin selected in the Units list; if you've never seen one before, then you're out of luck.
Title: Re: DFHack 0.34.11 r2
Post by: koter on January 07, 2013, 02:36:57 pm
Megabeast attack:
Code: [Select]
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.Megabeast, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
Night creature attack:
Code: [Select]
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.NightCreature, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
Siege:
Code: [Select]
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.CivAttack, season = df.global.cur_season, season_ticks = df.global.cur_season_tick, entity = df.historical_entity.find(<entityID>) } )
For each of the above commands, you need to type "lua" first.

The "megabeast" and "night creature" events probably won't take effect unless your fortress is large enough.
Also, for a siege you'll need to know the entity ID of your nearby Goblin civilization. If you've killed at least one in the past, you can put "dfhack.gui.getSelectedUnit().civ_id" in the above command and then run it while you have said goblin selected in the Units list; if you've never seen one before, then you're out of luck.

Great! Thank you.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 07, 2013, 05:11:35 pm
How would I set the civ I'm currently playing as? DFusion doesn't seem to have an option for it.
Title: Re: DFHack 0.34.11 r2
Post by: koter on January 07, 2013, 05:33:00 pm
It seems that the megabeast and night creature commands do nothing. Lua seems to accept the command, but nothing happens. Is it because there are currently no beasts or night creatures in the world I generated? Though it would be weird since I set evil and savagery to higher than average.
Oh and my fort is way past the requirements for those events. It's currently 270-strong with 5.5kk wealth.

Update: looked it up in Legends. Wow. There was a colossus, a roc and a couple of titans who all died. That's it.
There are some necromancers, though... can I trigger a necromancer siege?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 07, 2013, 05:56:24 pm
Evil and savagery don't affect special beasties; you may just have none.
Title: Re: DFHack 0.34.11 r2
Post by: koter on January 07, 2013, 06:05:37 pm
Evil and savagery don't affect special beasties; you may just have none.
Sorry, edited my last post without refreshing, didn't see yours; you're right, no thrills for this fort. And it was by far the biggest and most successful... such a shame. Well, at least next time I'll remember to check the world I generated before putting in the effort.
Thanks anyway.
Title: Re: DFHack 0.34.11 r2
Post by: CaptainArchmage on January 07, 2013, 06:36:02 pm
Thanks, I'm starting by downloading the stuff needed to make cmake work. I didn't find any "downloads" section in the XCode preferences, but I've used the command prompt to compile programs before (and I have used "make install" for a few things).

If things go well I might be able to finish this tomorrow, but I cannot give any guarantees. Delay beyond tomorrow may result in this taking a few days

How many other people here use Mac OS X 10.6 (Snow Leopard)? Also is this the earliest version of Mac that will run DF or is the earliest version 10.5 (which also runs with Intel macs)?

I'm still using Snow Leopard, and I'd love to be able to use DFHack. For some reason, I can't get it to work under Wine.



Oh, you were talking about Stonesense, wheren't you? I knew I should have read back another page in the thread before replying.

No, the port is the entire DFhack thing over to OSX 10.6.8. I might be able to get an install working for an earlier version of 10.6 though, but the first thing is to get around the "make" stage. Something there just isn't working, and I've been trying to figure out what it is I need to do (Ok, the deal is there's a line in the LuaTypes.cpp which uses a function called "strnlen", and that said function isn't working properly. Problems with said function are noted on the internets, and when I get around other things I may try to rewrite it; that's something I might be able to do myself.)
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 07, 2013, 07:42:25 pm
Nope thats not too much. I'm thinking maybe we should implement additional "raws" e.g. "something.raw" file(s) with similar to raw syntax (e.g. [BUILDING:MASON][OUTSIDE][NEEDS_POWER][ADD_REACTION:MAGIC_BLOCKS][REMOVE_NATIVE_JOBS])

The needs_power one is amazing as well... atm people barely use power/machines at all. And what are the last two, magic_blocks and native_jobs ? And the other post below, about triggering megabeast/nightbeasts, maybe sieges, titans, fbs... man... think of all that ingame...  "Run reaction sound-the-horn-of-war" and a megabeast accepts the challenge your fort sends out. "Send raiding party to goblins" and if it fails, trigger goblin invasion. DAMN.

Oh, and Portals. 2 Buildings, (blue, orange, because you know) needs some magic stuff to be build, has a reaction "use portal" and the dwarf that runs the reaction instantly pops out at the other building. Of course it would have to be limited to 1 building each, or it would select a random portal of the other color, dont know how you could code this...

I have tons of ideas. ^^
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 07, 2013, 09:15:04 pm
The problem is that the errorlog would complain about the new tokens. Maybe have the building designation tell what its DFHack properties are like with the existing ones?

EDIT: Could anything like add-spatter be done for, say, applying syndromes from worn armor or wielded weapons?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 08, 2013, 01:19:37 am
Nope thats not too much. I'm thinking maybe we should implement additional "raws" e.g. "something.raw" file(s) with similar to raw syntax (e.g. [BUILDING:MASON][OUTSIDE][NEEDS_POWER][ADD_REACTION:MAGIC_BLOCKS][REMOVE_NATIVE_JOBS])

The needs_power one is amazing as well... atm people barely use power/machines at all. And what are the last two, magic_blocks and native_jobs ? And the other post below, about triggering megabeast/nightbeasts, maybe sieges, titans, fbs... man... think of all that ingame...  "Run reaction sound-the-horn-of-war" and a megabeast accepts the challenge your fort sends out. "Send raiding party to goblins" and if it fails, trigger goblin invasion. DAMN.

Oh, and Portals. 2 Buildings, (blue, orange, because you know) needs some magic stuff to be build, has a reaction "use portal" and the dwarf that runs the reaction instantly pops out at the other building. Of course it would have to be limited to 1 building each, or it would select a random portal of the other color, dont know how you could code this...

I have tons of ideas. ^^
Code: [Select]
[ADD_REACTION:MAGIC_BLOCKS] -- add reaction (could be extended to support jobs, not just reactions) to the list of possible in the 'a'dd job menu of the building
[REMOVE_NATIVE_JOBS] -- remove all the buttons from add job menu (all the native at least...)
I would like to hear what do you (and others) think about this raws idea. This would have limited functionality compared to e.g. lua script because it would need adding support for each of the tokens, instead of just adinng e.g. lua function or c++ plugin.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 08, 2013, 01:52:04 am
Code: [Select]
[ADD_REACTION:MAGIC_BLOCKS] -- add reaction (could be extended to support jobs, not just reactions) to the list of possible in the 'a'dd job menu of the building
[REMOVE_NATIVE_JOBS] -- remove all the buttons from add job menu (all the native at least...)
I would like to hear what do you (and others) think about this raws idea. This would have limited functionality compared to e.g. lua script because it would need adding support for each of the tokens, instead of just adinng e.g. lua function or c++ plugin.

To be honest, I dont even know what thats supposed to mean. First one adds reactions to buildings, thats done by raw modding, except if you mean the hardcoded buildings that cant be accessed, like ashery, woodburner and so forth. If that is the case, to add reactions to existing vanilla buildings, then it is helpful, but not incredibly so. All custom reactions can be added to custom buildings already. It would make a cleaner mod and open the possibility to distribute reactions among workshops more evenly, but it would not add a game mechanic.

Second one would delete the vanilla reactions from the buildings? For example the still not having "brew drink" ? That would mostly benefit total conversions, and in a small extent open possibilities for making the game harder. Removing wooden shields, or drinks directly from plants, crossbows from 1 bone...

Putnams question about syndrome-bearing armors that affect the wearer would be a lot more interesting to modders. Making cursed items that transform the wearer into a werebeast, adding firebreath of a person equips a flamethrower, adding material_force_multiplier:1:3 to someone with magic armor.

Just my two cents of course. Some changes are nice, but wouldnt drastically change anything, while others would open tons of possibilities. Big things have small beginnings ;)

How about we make an extra thread and all the modders come together and brainstorm a bit, and any dfhack guy can come by and say: No, that does not work, but this, yeah, I can do that in 1h. You know what, I just open one, and we'll see if it will work out.

EDIT: Here we go: http://www.bay12forums.com/smf/index.php?topic=121451.msg3935855#msg3935855 (http://www.bay12forums.com/smf/index.php?topic=121451.msg3935855#msg3935855)
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 08, 2013, 02:21:39 am
To be honest, I dont even know what thats supposed to mean. First one adds reactions to buildings, thats done by raw modding, except if you mean the hardcoded buildings that cant be accessed, like ashery, woodburner and so forth. If that is the case, to add reactions to existing vanilla buildings, then it is helpful, but not incredibly so. All custom reactions can be added to custom buildings already. It would make a cleaner mod and open the possibility to distribute reactions among workshops more evenly, but it would not add a game mechanic.

Second one would delete the vanilla reactions from the buildings? For example the still not having "brew drink" ? That would mostly benefit total conversions, and in a small extent open possibilities for making the game harder. Removing wooden shields, or drinks directly from plants, crossbows from 1 bone...

Putnams question about syndrome-bearing armors that affect the wearer would be a lot more interesting to modders. Making cursed items that transform the wearer into a werebeast, adding firebreath of a person equips a flamethrower, adding material_force_multiplier:1:3 to someone with magic armor.

Just my two cents of course. Some changes are nice, but wouldnt drastically change anything, while others would open tons of possibilities. Big things have small beginnings ;)

How about we make an extra thread and all the modders come together and brainstorm a bit, and any dfhack guy can come by and say: No, that does not work, but this, yeah, I can do that in 1h. You know what, I just open one, and we'll see if it will work out.
Yeah it adds/removes reactions from "unmoddable" buildings (but unfortunately not all are supported, i think e.g. butcher can't be modified). As for syndrome-bearing armors, can't see how it could be implemented (have an idea or two, that need checking). I'll write it down not to forget. You could start new one, but IMHO this thread is not very crowded and can happen here. One thing that i noticed that sometimes very complicated ideas are easy to implement (e.g. custom viewscreens for workshops) and sometimes simple ideas are very hard to do (especially correctly) (e.g. unit related functionality, like detecting when it's hurt, when it is got a new thought etc...) this related to virtual methods that df uses (and units don't have those, but e.g. buildings, items, viewscreens, reactions (including reaction products), projectiles, etc... have)
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 08, 2013, 02:23:10 am
I already made another thread about it, to collect everything in one post at the beginning. I just wanted people to see what is already suggested, what is possible and what is not possible in one place.
Title: Re: DFHack 0.34.11 r2
Post by: A Dwarf on January 08, 2013, 04:32:10 am
Used the 'reveal' command, which worked fine and everything. But 'unreveal' isn't doing anything when I use it.. I get Map hidden! but the map is stays revealed.
Title: Re: DFHack 0.34.11 r2
Post by: Askot Bokbondeler on January 08, 2013, 04:48:19 am
that's probabbly due to misuse reather than a bug. use revflood
Title: Re: DFHack 0.34.11 r2
Post by: toasteur on January 08, 2013, 11:49:02 am
Used the 'reveal' command, which worked fine and everything. But 'unreveal' isn't doing anything when I use it.. I get Map hidden! but the map is stays revealed.

did you save while the map was revealed and then wanted to unreveal after quitting the game? unreveal keeps a list of the cells it just revealed to revert back later if you unreveal. however, it keeps it for the current session, so if you quit and reload later, its list of tile to unreveal is now empty. also, you should not unpause while unrevealed, as you get the risk that new terrain being mined will revert back to unreveal later and stay that way.
Title: Re: DFHack 0.34.11 r2
Post by: Deon on January 08, 2013, 12:00:34 pm
Megabeast attack:
Code: [Select]
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.Megabeast, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
Night creature attack:
Code: [Select]
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.NightCreature, season = df.global.cur_season, season_ticks = df.global.cur_season_tick } )
Siege:
Code: [Select]
df.global.timed_events:insert('#', { new = df.timed_event, type = df.timed_event_type.CivAttack, season = df.global.cur_season, season_ticks = df.global.cur_season_tick, entity = df.historical_entity.find(<entityID>) } )
For each of the above commands, you need to type "lua" first.

The "megabeast" and "night creature" events probably won't take effect unless your fortress is large enough.
Also, for a siege you'll need to know the entity ID of your nearby Goblin civilization. If you've killed at least one in the past, you can put "dfhack.gui.getSelectedUnit().civ_id" in the above command and then run it while you have said goblin selected in the Units list; if you've never seen one before, then you're out of luck.
Can a forgotten beast attack be triggered the same way?
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 08, 2013, 01:08:19 pm
A forgotten beast attack should be the same as a megabeast attack, though possibly with some of the additional fields filled in (fields whose meanings are not fully known).
Title: Re: DFHack 0.34.11 r2
Post by: TheKaspa on January 09, 2013, 09:20:29 am
Is it possible to edit the requirements for a mood? My Exp Leader wants iron bars, but I have not any...
Title: Re: DFHack 0.34.11 r2
Post by: Rose on January 09, 2013, 09:22:47 am
Melt something.
Title: Re: DFHack 0.34.11 r2
Post by: TheKaspa on January 09, 2013, 10:43:09 am
Melt something.

I don't have a forge yet, nor a smelter or coal.
Title: Re: DFHack 0.34.11 r2
Post by: Rose on January 09, 2013, 10:59:23 am
mod the soap reaction to produce iron bars from nothing.
Title: Re: DFHack 0.34.11 r2
Post by: TheKaspa on January 09, 2013, 11:30:42 am
So it is not possible with dfhack?
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 09, 2013, 12:25:17 pm
None of the official DFHack plugins do that, though if you know what you're doing you can certainly use the Lua interface to manually modify the appropriate structures:

Code: [Select]
unit = dfhack.gui.getSelectedUnit()
job = unit.job.current_job
item = job.job_items[n] (where "n" is the index of the item being requested, i.e. 0 if it's the very first item)
~item (should include "item_type = 0, item_subtype = -1, mat_type = 0, mat_index = 0, quantity = 150")
mat = dfhack.matinfo.find("INORGANIC:STEEL")  (or whatever material you want him to use)
item.mat_type = mat.type
item.mat_index = mat.index
Title: Re: DFHack 0.34.11 r2
Post by: ag on January 10, 2013, 01:20:33 am
Actually, job item-type and job item-material should work probably; the new gui/workshop-job script definitely does (obviously only once a workshop is claimed). Note however that changing item type is not that simple because the item vector id field may need changing too.
Title: Re: DFHack 0.34.11 r2
Post by: TheKaspa on January 10, 2013, 09:22:29 am
It solved by himself.
As soon as I managed to smelt a couple of hematite ores (I found them while digging for the moat), the former expeditionary leader got struck by melancholy. At least he got assigned two hunting bitches, that should instakill him when he will go mad.

And Caravan keep not providing male dogs. I wanted a small hunting pack...
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 10, 2013, 09:27:26 am
As soon as I managed to smelt a couple of hematite ores (I found them while digging for the moat), the former expeditionary leader got struck by melancholy. At least he got assigned two hunting bitches, that should instakill him when he will go mad.
If you're expecting him to go berserk, then you're expecting the impossible to happen - he's already insane, so he's never going to succumb to another type of insanity...
Title: Re: DFHack 0.34.11 r2
Post by: TheKaspa on January 10, 2013, 09:41:27 am
I assigned the dogs at the beginning, because I wanted the exp leader to be safe. Didn't expect him to get caught by mood, and I thought that there was a way to unassign the animals (I discovered later that it is not possible).
I wonder if assigning him another pet would help to recover. Or if I should burrow him into the pond (wondering if it is possible - let me do some !!SCIENCE!!).
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 10, 2013, 10:09:21 am
Melancholy is insanity. He will be stricken by melancholy until he dies.
Title: Re: DFHack 0.34.11 r2
Post by: Fyzxs on January 10, 2013, 01:27:41 pm
I hope this is the correct place to ask about coding things with DFHack. :)

I'm trying to create a windows console app (VS2012) that uses DFHack to get information. Crazy idea, right? :P
I'm pretty much hitting a wall at square one. I tried the approach in the non-plugin version of stonesense (DFHack::ContextManager), but the memory locations in that Memory.xml are; I assume, no longer valid.
Outside of that single example; I have no idea how to use DFHack in my little console app. I've dinked around some more, and looked through some source code... but am lacking new things to try. ... Pretty much totally lost right now. :(

Can anyone point me to working non-plugin DFHack utilizing code/projects; I suspect that should get me going, at least show me some options. I've been reviewing some projects but apparently they either are obsolete (stonesense), not using DFHack (Dwarf Therapist), or plugins (stonesense).
I don't really know what I should ask right now; I think the function I was going to call was 'getNumberOfCreatures'... So I'm trying to create a console app that displays the number of creatures... or something. Any value; just something outta DFHack. :)

Any suggestions/pointers/projects will be very appreciated. Thanks.

Title: Re: DFHack 0.34.11 r2
Post by: Rose on January 10, 2013, 01:30:59 pm
There is no non-plugin DFhack anymore.

Everything in Dfhack is plugins. the best you can hope for is a plugin that communicates with an external app. I think the only example of that right now is DFhack-run.
Title: Re: DFHack 0.34.11 r2
Post by: Fyzxs on January 10, 2013, 01:50:48 pm
There is no non-plugin DFhack anymore.
Well.... That explains it pretty well.
Then plugin-ing it is! Well... is attempted anyway. :)

Thanks.

Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 10, 2013, 04:08:51 pm
Note that if you're going to write a plugin, you must compile it with VS2010 - VS2012 will not work because it'll use the wrong C runtime (msvcr110 instead of msvcr100) and thus use the wrong heap (for malloc/free and operator new/delete).

It might appear to work for simple tasks such as "reveal", but if the plugin tried to allocate memory and DF then tried to free it (e.g. with the "trigger siege" sample I just posted earlier), it would cause the game to crash.
Title: Re: DFHack 0.34.11 r2
Post by: Intrinsic on January 11, 2013, 05:07:15 pm
Hi just a quick query as the documentation doesn't exactly specify, and been away a while so appologies if this has been asked already but search didn't reveal anything.

From the new-ish tweaks it says:
"Subcommands that persist until disabled or DF quit:"

Does that mean each time i load up DF i'll need to re-enter these commands?
ie stable-temp

Many thanks.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 11, 2013, 05:09:58 pm
Hi just a quick query as the documentation doesn't exactly specify, and been away a while so appologies if this has been asked already but search didn't reveal anything.

From the new-ish tweaks it says:
"Subcommands that persist until disabled or DF quit:"

Does that mean each time i load up DF i'll need to re-enter these commands?
ie stable-temp

Many thanks.
yes. Could be automated by adding the same thing that you want to type into dfhack.init as documented here: relevant help entry (https://github.com/peterix/dfhack/blob/master/Readme.rst#id10)
Also note that most tweak entries are already in dfhack.init-example.
Title: Re: DFHack 0.34.11 r2
Post by: Intrinsic on January 11, 2013, 05:53:15 pm
...
yes. Could be automated by adding the same thing that you want to type into dfhack.init as documented here: relevant help entry (https://github.com/peterix/dfhack/blob/master/Readme.rst#id10)
Also note that most tweak entries are already in dfhack.init-example.

Ty i'll look into that.
Title: Re: DFHack 0.34.11 r2
Post by: Sutremaine on January 11, 2013, 06:43:31 pm
Would it be possible to have a 'break' command for injured dwarves that hang around getting hungry and thirsty with No Job instead of being fed and watered and treated? The command would break various bones, causing any dwarf to pass out from the pain and triggering a 'Recover Wounded' job.
Title: Re: DFHack 0.34.11 r2
Post by: bezment78 on January 12, 2013, 12:03:40 am
how to increase the number of starting dwarves or migrants
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 12, 2013, 12:05:07 am
Starting dwarves is a dfusion plugin called "simple embark", accessible by running dfusion. Migrants I'm not sure about, but you could always increase fortress wealth.
Title: Re: DFHack 0.34.11 r2
Post by: bezment78 on January 12, 2013, 12:29:27 am
what command should i put in
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 12, 2013, 12:46:41 am
dfusion
Title: Re: DFHack 0.34.11 r2
Post by: bezment78 on January 12, 2013, 12:55:05 am
thanks, really thanks
Title: Re: DFHack 0.34.11 r2
Post by: Bates on January 13, 2013, 03:08:35 pm
As outlined here http://www.bay12forums.com/smf/index.php?topic=119761.msg3945920#msg3945920
I have a dwarf that will die of old age when the day changes.

I was told in the masterwork thread, that adding a new tag [CE_ADD_TAG:NO_AGING:START:0] would help, but how do I use it with a script like rejuvenation?
Title: Re: DFHack 0.34.11 r2
Post by: CaptainArchmage on January 13, 2013, 08:03:00 pm
Got an update on the conversion process. Remember the problem with the "make" of DFhack that I was having? I've gotten around that now by editing the code (actually, I found a replacement for the dodgy function). Compilation continues. Hopefully I can make the install properly

Edit: Another error at 67% of the building:
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 13, 2013, 08:35:24 pm
Is there anything that can be hacked during the world generation process?
Title: Re: DFHack 0.34.11 r2
Post by: thepodger on January 14, 2013, 12:10:26 pm
Hrmph.  This is a particularly noobish question, but I can't for the life of me figure this program out.  There was time I used it frequently even but its been forever since I fired up DF seriously.

How do I disable an aquifer?  The old "drainaquifer" command isn't recognized.
Better yet, how would I paint a 1x1 untouched generic stone square for plugging holes?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 14, 2013, 05:43:26 pm
You can spawn magma and water on one tile, making obsidian to seal everything.
Title: Re: DFHack 0.34.11 r2
Post by: zwei on January 16, 2013, 07:45:29 am
Is there a way to get siege flag?

Simple true/false is enough for me.
Title: Re: DFHack 0.34.11 r2
Post by: Urist McUristson on January 16, 2013, 08:39:23 am
You can spawn magma and water on one tile, making obsidian to seal everything.
Or just spawn obsidian wall.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 16, 2013, 09:54:20 am
You can spawn magma and water on one tile, making obsidian to seal everything.
Or just spawn obsidian wall.
Has the unfortunate glitch of not having a floor tile above it, though, so be careful.
Title: Re: DFHack 0.34.11 r2
Post by: thepodger on January 16, 2013, 12:59:11 pm
I mean, you can't play DF without knowing that stone plugs holes.  I was asking what commands will actually accomplish that.  Or why drainaquifer doesn't work anymore.
Title: Re: DFHack 0.34.11 r2
Post by: Urist McUristson on January 16, 2013, 02:39:02 pm
It would be in the "liquids" command.   Can type "ls" to get a list of all commands.
Title: Re: DFHack 0.34.11 r2
Post by: Frenchchef on January 16, 2013, 06:47:44 pm
So I need help. When I enter into arena mode while in dwarf fortress, I want to spawn some animals/monsters y'know? But when I go to try, it has a blank list and before I have hit enter only to ahve a nameless, invisible creature kill all my orcs. Anyone know how to get the animal spawner on it working?
Title: Re: DFHack 0.34.11 r2
Post by: thepodger on January 16, 2013, 06:54:22 pm
Ah, of course spawning a stone block would be under liquids!
*facepalm*
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 16, 2013, 07:55:39 pm
So I need help. When I enter into arena mode while in dwarf fortress, I want to spawn some animals/monsters y'know? But when I go to try, it has a blank list and before I have hit enter only to ahve a nameless, invisible creature kill all my orcs. Anyone know how to get the animal spawner on it working?

Well, I think that this is caused due to the game not loading the raws for arena mode (as you have it do when you start arena mode) and I have no idea how that would be fixed.
Title: Re: DFHack 0.34.11 r2
Post by: Qwo on January 16, 2013, 09:30:56 pm
Is there a tiletypes command that turns a wall back into rock? I smoothed some stone and would like it unsmoothed, but getting my head around tiletypes is a bit of a wrangle.
Title: Re: DFHack 0.34.11 r2
Post by: ArKFallen on January 17, 2013, 09:14:00 am
Is there a tiletypes command that turns a wall back into rock? I smoothed some stone and would like it unsmoothed, but getting my head around tiletypes is a bit of a wrangle.
'P'aint using the 'SPECIAL' 'NORMAL' command and 'F'iltering out any 'SHAPE' 'WALL' with the 'SPECIAL' 'SMOOTH'.
Code: (one line at a time) [Select]
f sh wall
f special smooth
p special normal
You can also use the 'R'ange or 'B'lock commands to increase the selection beyond the cursor (custom peramiters starting at the current z-level and going up however many is directed or a whole block of the current z-level).
So I could do
Code: [Select]
r 50 50 100
To select a 50x50 square starting at the cursor and going up a 100 z-levels. If I put in the first commands too and hit the Enter key it would un-smooth any wall within that range. For more command information go into tiletypes and type 'help' and then/or 'help [insert command]' (ie 'help shape' 'help mat' etc).
Title: Re: DFHack 0.34.11 r2
Post by: Squeegy on January 17, 2013, 11:53:02 pm
The resurrection script isn't working for me-- it tells me body_part_status is a complex object?
Title: Re: DFHack 0.34.11 r2
Post by: Wolfwood on January 18, 2013, 07:40:17 am
I need some help, I can not see the target of a quest (i think that is a bug, i ve looked everywhere), can i find him using DFhack? appears in historical figures.

Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on January 18, 2013, 07:56:33 am
I need some help, I can not see the target of a quest (i think that is a bug, i ve looked everywhere), can i find him using DFhack? appears in historical figures.
chances are they are stuck in a site that doesn't spawn them.
so you need to change the site to one that kinda does.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on January 18, 2013, 03:45:00 pm
Some context,

From the output of

print(unit.status.current_soul.skills)
printall(unit.status.current_soul.skills)
printall(unit.status.current_soul.skills)

is something like:

<vector<unit_skill*>: 0x0d94162c>

0                        = <unit_skill: 0x05263668>
1                        = <unit_skill: 0x05263690>
2                        = <unit_skill: 0x052636b8>
3                        = <unit_skill: 0x052636e0>
4                        = <unit_skill: 0x05263708>
5                        = <unit_skill: 0x05263730>
6                        = <unit_skill: 0x05263758>
7                        = <unit_skill: 0x05263780>
8                        = <unit_skill: 0x052637a8>
9                        = <unit_skill: 0x052637d0>
10                       = <unit_skill: 0x052637f8>
11                       = <unit_skill: 0x05263820>
12                       = <unit_skill: 0x05263848>
13                       = <unit_skill: 0x05263870>
14                       = <unit_skill: 0x05263320>
15                       = <unit_skill: 0x052632f8>

id                       = 1
rating                   = 1
experience               = 0
unk_c                    = 0
rusty                    = 0
unk_14                   = 7
unk_18                   = 0
unk_1c                   = 0


I'm trying to figure out the lua code necessary to recursively remove all entries, including every id, rating, experience, etc field.

The goal is to remove all skills, all experience gained in all skills, without leaving behind any trace of the removal.  I have written the code necessary to remove the skills from view, but they show up as "UNKNOWN" in Therapist, and new skills are added (as #16 in the above example) after the end, rather than at the beginning (zero).  So they're not being removed, they're just being hidden, and badly.  ;D

Something that would work wiith

local i
utils = require 'utils'
   for i=0, #unit.status.current_soul.skills-1 do
      ...
   end


Is what I'm looking for.
Any ideas would be very welcome.  I've tried a variety of table.remove and vector:remove but nothing seems to want to touch this, or if it does, it crashes DF entirely.  thanks in advance!
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 18, 2013, 03:48:36 pm
Hey,
Is there any info on a possible release date for r3? All these comments by expwnent and warmist make me giddy to get my modders hands on it. ;) It doesnt matter if it comes out in 1 week or 4, but it would be nice to get a rough idea about how long it will be.
Title: Re: DFHack 0.34.11 r2
Post by: Wolfwood on January 18, 2013, 05:36:26 pm
I need some help, I can not see the target of a quest (i think that is a bug, i ve looked everywhere), can i find him using DFhack? appears in historical figures.
chances are they are stuck in a site that doesn't spawn them.
so you need to change the site to one that kinda does.
How can I do that? I dont find the commands. Sorry, im a newbie with DFHack :-[
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 18, 2013, 06:37:21 pm
Is what I'm looking for.
Any ideas would be very welcome.  I've tried a variety of table.remove and vector:remove but nothing seems to want to touch this, or if it does, it crashes DF entirely.  thanks in advance!
Code: [Select]
local skills=unit.status.current_soul.skills
for index,skill in ipairs(skills) do
   skill:delete() --not to leak memory
end
--trying to access any skill here would crash (they are deleted but not removed)
skills:resize(0) --this removes all entries
this is untested, but should work in theory. The delete part is optional, but recommended (if it will not work- e.g. if those are not pointers, just omit use the resize(0) part)
Title: Re: DFHack 0.34.11 r2
Post by: vjek on January 18, 2013, 06:53:23 pm
Exactly what I needed, Warmist, thank you very much.
Title: Re: DFHack 0.34.11 r2
Post by: Mohreb el Yasim on January 18, 2013, 07:46:47 pm
hy
first of all, thanks for this utility it seems amasing, i see much possibilities in it to run a fortress smoothly. but i would like to ask some questions:
wich commands will stand after restart of a DF? (some are listed as persistant as autobutcher, autoseed, but others ar workflow / job and so on have nothing writen explicitly)?
how can you make work those commands?
for example i tried to turn this job:
[DFHack]# job query
Job 1974: MakeBarrel
    material: any (wood)
  Input Item 1: wood

to accept only ash wood, then i would like to make a workflow from it so it keeps at least 5 ash barrels.
(only for the sake of testing how does it works, what is the sintax)
could someone put it in an example stating wich part means what in the command and where it is come from (raws, built in values etc.)?
so long i tried a few syntaxes but they did not changed it :S
i tried as well job-material and job item-material commands, but i run out of the imaginable combinasions for me ...
I know, there are usage examples on read-me but i get no idee (tried to figur out, really) which one states for input, output, where are can tokens to be found, and which is the use of ':' and '/' in querys ...

Title: Re: DFHack 0.34.11 r2
Post by: Squeegy on January 18, 2013, 10:55:01 pm
Seriously, anybody know why it's saying vector <body_part_status>.0 is a complex object?

   for k,v in pairs(unit.body.components) do
      for kk,vv in pairs(v) do
         v[kk]=0
      end
   end

This doesn't work.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 19, 2013, 05:31:30 am
Seriously, anybody know why it's saying vector <body_part_status>.0 is a complex object?

   for k,v in pairs(unit.body.components) do
      for kk,vv in pairs(v) do
         v[kk]=0
      end
   end

This doesn't work.
Because it's a complex object
Code: [Select]
for k,v in pairs(unit.body.components.body_part_status) do   
for kk,vv in pairs(v) do
v[kk]=0
end
        --also could probably do "v.whole=0" instead ...
end
It also has: "numbered_masks" and bunch of "body_layer_<number>" have no idea what are those for...
Title: Re: DFHack 0.34.11 r2
Post by: zwei on January 19, 2013, 07:58:53 am
Seriously, anybody know why it's saying vector <body_part_status>.0 is a complex object?

   for k,v in pairs(unit.body.components) do
      for kk,vv in pairs(v) do
         v[kk]=0
      end
   end

This doesn't work.

Or if there is exhaustive documentation of data structures?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on January 19, 2013, 08:08:14 am
There's a bunch of xml files here: https://github.com/angavrilov/df-structures

don't know what else is there.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 19, 2013, 08:18:16 am
There's a bunch of xml files here: https://github.com/angavrilov/df-structures

don't know what else is there.
I use generated header files: "hack\include\df" in r3 or if you are building yourself it's somewhere in project tree.

Or printall(thing), printall(thing.thing2), etc... Start is df.global (.world almost always, sometimes .ui). I think new version supports printall(<type>) e.g. printall(df.unit) to check what fields a struct can have.
Title: Re: DFHack 0.34.11 r2
Post by: Bates on January 19, 2013, 08:27:41 am
Seriously, anybody know why it's saying vector <body_part_status>.0 is a complex object?

   for k,v in pairs(unit.body.components) do
      for kk,vv in pairs(v) do
         v[kk]=0
      end
   end

This doesn't work.

Wasn't there a bug in that, I seem to recall Rumrusher fixing that...

Oh yeah, try this:

Code: [Select]
for k,v in pairs(unit.body.components) do
for kk,vv in pairs(v) do
if k == 'body_part_status' then v[kk].whole = 0  else v[kk] = 0 end
end
end
Title: Re: DFHack 0.34.11 r2
Post by: Frenchchef on January 19, 2013, 10:39:14 am
So I need help. When I enter into arena mode while in dwarf fortress, I want to spawn some animals/monsters y'know? But when I go to try, it has a blank list and before I have hit enter only to ahve a nameless, invisible creature kill all my orcs. Anyone know how to get the animal spawner on it working?

I still need this answered, if anyone else has answers.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 19, 2013, 01:41:10 pm
So I need help. When I enter into arena mode while in dwarf fortress, I want to spawn some animals/monsters y'know? But when I go to try, it has a blank list and before I have hit enter only to ahve a nameless, invisible creature kill all my orcs. Anyone know how to get the animal spawner on it working?

I still need this answered, if anyone else has answers.
this-> https://gist.github.com/4514230
Title: Re: DFHack 0.34.11 r2
Post by: Frenchchef on January 19, 2013, 06:14:45 pm
So I need help. When I enter into arena mode while in dwarf fortress, I want to spawn some animals/monsters y'know? But when I go to try, it has a blank list and before I have hit enter only to ahve a nameless, invisible creature kill all my orcs. Anyone know how to get the animal spawner on it working?

I still need this answered, if anyone else has answers.
this-> https://gist.github.com/4514230

I put it in the DFHACK lua folder and it still isn't working.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 19, 2013, 06:38:29 pm
So I need help. When I enter into arena mode while in dwarf fortress, I want to spawn some animals/monsters y'know? But when I go to try, it has a blank list and before I have hit enter only to ahve a nameless, invisible creature kill all my orcs. Anyone know how to get the animal spawner on it working?

I still need this answered, if anyone else has answers.
this-> https://gist.github.com/4514230

I put it in the DFHACK lua folder and it still isn't working.
Did you run it? Did you name it "*.lua"? what is the dfhack window reporting? I have no ESP skills can't tell you anything if you don't tell me anything :D
Title: Re: DFHack 0.34.11 r2
Post by: CaptainArchmage on January 19, 2013, 06:59:59 pm
Got a question and a request.

I've noticed that in the latest version of Dwarf Fortress, violence doesn't result in disorderly conduct convictions, and neither does vandalism or building destruction. Do you think there's a way to update DFhack to deal with this?

I believe that in addition, murder resulting from tantrums doesn't result in the crime being registered either. In the masterwork succession fortress, one dwarf killed another with a thrown barrel in a public area filled with other dwarves, but that was never taken down as a crime in the justice screen; in fact, the only crimes recorded were deaths caused by vampires.

Mandate-related crimes still result in justice.

I'm also wondering whether it may be possible to deal with the justice exemptions issue as well, for legendary and [PUNISHMENT_EXEMPTION] dwarves.
Title: Re: DFHack 0.34.11 r2
Post by: Frenchchef on January 19, 2013, 07:07:04 pm
So I need help. When I enter into arena mode while in dwarf fortress, I want to spawn some animals/monsters y'know? But when I go to try, it has a blank list and before I have hit enter only to ahve a nameless, invisible creature kill all my orcs. Anyone know how to get the animal spawner on it working?

I still need this answered, if anyone else has answers.
this-> https://gist.github.com/4514230

I put it in the DFHACK lua folder and it still isn't working.
Did you run it? Did you name it "*.lua"? what is the dfhack window reporting? I have no ESP skills can't tell you anything if you don't tell me anything :D

It does not let me run it or name it *.lua because * is a forbidden numerical thing. I have no experience with using LUA of the sort so uh yeah.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on January 19, 2013, 07:32:21 pm
So I need help. When I enter into arena mode while in dwarf fortress, I want to spawn some animals/monsters y'know? But when I go to try, it has a blank list and before I have hit enter only to ahve a nameless, invisible creature kill all my orcs. Anyone know how to get the animal spawner on it working?

I still need this answered, if anyone else has answers.
this-> https://gist.github.com/4514230

I put it in the DFHACK lua folder and it still isn't working.
Did you run it? Did you name it "*.lua"? what is the dfhack window reporting? I have no ESP skills can't tell you anything if you don't tell me anything :D

It does not let me run it or name it *.lua because * is a forbidden numerical thing. I have no experience with using LUA of the sort so uh yeah.
also I think Warmist meant * as in * = [what you need to do]any name you want[/what you need to do] and not *= [WYNTD]name the file *.lua [/WYNTD].
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 19, 2013, 08:23:28 pm
Speaking of which, can DFhack save a .lua from within the console?
Title: Re: DFHack 0.34.11 r2
Post by: Squeegy on January 19, 2013, 09:22:15 pm
Seriously, anybody know why it's saying vector <body_part_status>.0 is a complex object?

   for k,v in pairs(unit.body.components) do
      for kk,vv in pairs(v) do
         v[kk]=0
      end
   end

This doesn't work.

Wasn't there a bug in that, I seem to recall Rumrusher fixing that...

Oh yeah, try this:

Code: [Select]
for k,v in pairs(unit.body.components) do
for kk,vv in pairs(v) do
if k == 'body_part_status' then v[kk].whole = 0  else v[kk] = 0 end
end
end

This works... but on resurrecting dead people, it won't seem to fix all their red and missing parts.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 19, 2013, 09:25:57 pm
Set their unit.race to something else, they will instantly change back with all wounds healed. However, might mess up their stats.
Title: Re: DFHack 0.34.11 r2
Post by: Squeegy on January 19, 2013, 10:13:58 pm
Set their unit.race to something else, they will instantly change back with all wounds healed. However, might mess up their stats.

That doesn't seem to work, but perhaps I am doing it wrong:

Code: [Select]
function tools.heal2(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
unit.body.wounds:resize(0) -- memory leak here :/
unit.body.blood_count=unit.body.blood_max
--set flags for standing and grasping...
unit.status2.able_stand=4
unit.status2.able_stand_impair=4
unit.status2.able_grasp=4
unit.status2.able_grasp_impair=4
--should also set temperatures, and flags for breath etc...
unit.flags1.dead=false
unit.flags2.calculated_bodyparts=false
unit.flags2.calculated_nerves=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.counters.winded=0
unit.counters.unconscious=0
for k,v in pairs(unit.body.components) do
for kk,vv in pairs(v) do
if k == 'body_part_status' then v[kk].whole = 0  else v[kk] = 0 end
end
end
unit.race=0
unit.race=df.global.ui.race_id
end
tools.menu:add("Heal unit",tools.heal2)
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 19, 2013, 10:23:18 pm
You don't have to set it back, the game will notice it's not the right race and instantly switch it. Also, 0 is an invalid race id, the lowest is 1 (which would be toad in an unmodified game).
Title: Re: DFHack 0.34.11 r2
Post by: Squeegy on January 19, 2013, 10:27:29 pm
You don't have to set it back, the game will notice it's not the right race and instantly switch it. Also, 0 is an invalid race id, the lowest is 1 (which would be toad in an unmodified game).
That works! Thank you!

e: And 3rd question... would it be possible to write a script to change a dwarf's relationships?
Title: Re: DFHack 0.34.11 r2
Post by: Frenchchef on January 19, 2013, 11:04:12 pm
So I need help. When I enter into arena mode while in dwarf fortress, I want to spawn some animals/monsters y'know? But when I go to try, it has a blank list and before I have hit enter only to ahve a nameless, invisible creature kill all my orcs. Anyone know how to get the animal spawner on it working?

I still need this answered, if anyone else has answers.
this-> https://gist.github.com/4514230

I put it in the DFHACK lua folder and it still isn't working.
Did you run it? Did you name it "*.lua"? what is the dfhack window reporting? I have no ESP skills can't tell you anything if you don't tell me anything :D

Didn't know how to run it but I just realized I could run it from the dfhack window, and it works. Thanks so much!
Title: Re: DFHack 0.34.11 r2
Post by: maxg on January 20, 2013, 01:23:13 am
Hello all,

I'm trying to use tiletypes to make an area naturally grow plants, but seem to be having trouble with it. Certain areas, despite matching tile probes, refuse to grow plants. For instance, if I fill a lake in with soil using tiletypes and the patch it over with grass, nothing ever grows there but all the tiles around what used to be the lake will grow trees and shrubs. I saw a variable in some of the ruby scripts called "no_grow", is that what needs to be set? How can I set this?

Additionally, is there any way to manually plant specific trees or shrubs? Using paint material plant/shape tree just shows a capital T and I can't seem to figure out how to make an actual tree.

Any input would be appreciated!
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 20, 2013, 01:53:42 am
The area still counts as a lake biome, and since no plants are specified to grow in lake biomes (or any water biome), nothing sprouts. The only plants that will grow there are those your farmers plant themselves.
Title: Re: DFHack 0.34.11 r2
Post by: TheKaspa on January 20, 2013, 08:39:56 am
I have problems in understanding "prospect". How can I understand how much z-level to dig for the magma?
Title: Re: DFHack 0.34.11 r2
Post by: Raul on January 20, 2013, 11:34:45 am
I have problems in understanding "prospect". How can I understand how much z-level to dig for the magma?
From my limited understanding (and my own experience with it from my play session yesterday), it tells you the range of z levels that contain magma and other stuff, you just have to look for it.
Title: Re: DFHack 0.34.11 r2
Post by: CheatingChicken on January 20, 2013, 01:11:02 pm
I have a request for the autolabor plugin: Add a command to mark individual dwarves to be excluded, so you can still manually set their labors. If this is already possible, please tell me how
Title: Re: DFHack 0.34.11 r2
Post by: vjek on January 20, 2013, 04:37:30 pm
I have problems in understanding "prospect". How can I understand how much z-level to dig for the magma?
Do you have a sample prospect you can show us to see what is unclear?
Title: Re: DFHack 0.34.11 r2
Post by: maxg on January 20, 2013, 09:38:15 pm
The area still counts as a lake biome, and since no plants are specified to grow in lake biomes (or any water biome), nothing sprouts. The only plants that will grow there are those your farmers plant themselves.

So is it possible to plant trees? I have a map where I tiletype'd an area with grass_light to get rid of sand and boulders, but now nothing grows there anymore. So it seems like you can set stuff to not grow somehow.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on January 20, 2013, 10:23:05 pm
Only thing that might be relevant I can think of regarding trees:  They need a soil layer beneath them to grow.  Trees won't grow with dug out cavern/soil or stone in the Z layer below.  Might not be what is giving you trouble, but thought I'd mention it.
Title: Re: DFHack 0.34.11 r2
Post by: maxg on January 20, 2013, 11:47:14 pm
Only thing that might be relevant I can think of regarding trees:  They need a soil layer beneath them to grow.  Trees won't grow with dug out cavern/soil or stone in the Z layer below.  Might not be what is giving you trouble, but thought I'd mention it.

Was completely unaware of that; I guess that was what I was doing, and tiletypes wasn't changing it.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on January 21, 2013, 12:03:37 am
The area still counts as a lake biome, and since no plants are specified to grow in lake biomes (or any water biome), nothing sprouts. The only plants that will grow there are those your farmers plant themselves.

So is it possible to plant trees? I have a map where I tiletype'd an area with grass_light to get rid of sand and boulders, but now nothing grows there anymore. So it seems like you can set stuff to not grow somehow.

Again, no trees are assigned to grow in lake biomes, so even when you fill in the lake with soil, no trees will grow. The only thing that will grow are planted crops, and in this version, there is no way to plant trees.

Even if you did the completely un-hacking method of partially draining the lake, still nothing would grow there of its own accord.
Title: Re: DFHack 0.34.11 r2
Post by: TheKaspa on January 21, 2013, 08:15:40 am
I have problems in understanding "prospect". How can I understand how much z-level to dig for the magma?
Do you have a sample prospect you can show us to see what is unclear?

I get MAGMA:0 Z -30000

I assume this means that I have to reach the magma sea, right?
Title: Re: DFHack 0.34.11 r2
Post by: Greiger on January 21, 2013, 10:31:55 am
That looks bizarre.  If I had to guess I would say that indicates you have no magma at all.  Even the magma sea still counts into the amount, but yer showing 0. -30000 seems like DFhack not knowing what to say when you don't have any of something that is assumed to always be present.

Is it possible that the magma sea and circus was turned off in that worlds generation parameters?
Title: Re: DFHack 0.34.11 r2
Post by: danaris on January 21, 2013, 10:37:13 am
That looks bizarre.  If I had to guess I would say that indicates you have no magma at all.  Even the magma sea still counts into the amount, but yer showing 0. -30000 seems like DFhack not knowing what to say when you don't have any of something that is assumed to always be present.

Is it possible that the magma sea and circus was turned off in that worlds generation parameters?

No, I believe he just needs to use "prospect all" rather than "prospect".

DFHack will show no magma and -30k when it can't see your magma, because you've not told it to look outside the visible/revealed area.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on January 21, 2013, 11:08:31 am
... I get MAGMA:0 Z -30000

I assume this means that I have to reach the magma sea, right?
try 'prospect all'
and/or
'prospect hell'

and see if it shows you magma.

Keep in mind, it is entirely possible to generate a world without magma, so if those don't show any, that's possibly what you've done.
Title: Re: DFHack 0.34.11 r2
Post by: TheKaspa on January 21, 2013, 11:42:21 am
Thanks guys, "prospect all" says -11 to -16, so I have to dig deeper to reach the magma sea. Thank God I have plenty of trees to cut (plus the caverns, unluckly I have no soil so no tree-farm).
Title: Re: DFHack 0.34.11 r2
Post by: Frenchchef on January 21, 2013, 08:19:46 pm
I heard it is possible to re-enable economy with dwarf hack. If so, how? I'm trying to make an economical caste system of a feudal type system and I definitely need economy.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 22, 2013, 07:24:27 am
I heard it is possible to re-enable economy with dwarf hack. If so, how? I'm trying to make an economical caste system of a feudal type system and I definitely need economy.
It won't work - if you set the "economy enabled" flag and you have a Broker or Bookkeeper (I forget which) appointed, the game will crash shortly after you unpause.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 22, 2013, 06:24:05 pm
The code was probably commented out in the DF2010 devcycle or something.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 22, 2013, 10:40:55 pm
The code was probably commented out in the DF2010 devcycle or something.
The only code that was commented out was the bit that turns the economy on in the first place - best I can tell, the rest of it is still there, though the reason it crashes is because of some uninitialized variables in the material definitions (specifically, "material.food_mat_index" - it looks in there when nobles adjust the prices of goods, and it expects uninitialized values to be -1), though properly initializing them doesn't seem to fix the problem either. I think I reported it to Toady back in 2011, but unsurprisingly it's not a high priority bug to fix (since it only manifests itself in code that's never actually executed).
Title: Re: DFHack 0.34.11 r2
Post by: zwei on January 23, 2013, 08:47:17 am
Is there a way to get siege flag?

Simple true/false is enough for me.

Answering myself:

If there is any unit with unit.flags1.active_invader = true then siege is considered active, if no unit has this flag, siege is not active.
Title: Re: DFHack 0.34.11 r2
Post by: zwei on January 23, 2013, 09:04:54 am
Another question:

How does skill rust work?

I have unit with grower skill that df displays as not rusty, but has rusty attribute=6
Then i have unit with rusty=6 and game displaying skill as very rusty
Then there is unit that has wrestler skill wirth rusty=1 and displayed as not rusty and various social skill with rusty=1 and not displaying any rust.

So what is rusty attribute of skill for exactly and how does rust work internally?
Title: Re: DFHack 0.34.11 r2
Post by: vjek on January 23, 2013, 05:08:23 pm
Recently upgraded to DFHack 34.11r2 and found that trying to prospect from the embark screen doesn't work quite the way it did in DFHack 34.11.

In particular, if you generate a world that does not have a magma sea, DFHack 34.11r2 prospect will not prospect it from the embark selection screen.  However, DFHack 34.11 prospect will prospect it just fine. 

For now, unless there is a workaround (I can't find one), I'll have to go back to DFHack 34.11. :(  I need this feature to scope out my next challenge embark.

Screenshots:
(http://dl.dropbox.com/u/1339319/broken-prospect.gif)
Same world, vanilla df 34.11 in both cases, just the two different dfhack versions.

To create a world to see the issue for yourself, simply set "Bottom Layer (Forces Magma)" to No and set "Magma Layer" to No, in advanced worldgen, generate your world, and then try to prospect from the embark selection/finder screen.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on January 23, 2013, 05:09:25 pm
Hey,
Is there any info on a possible release date for r3? All these comments by expwnent and warmist make me giddy to get my modders hands on it. ;) It doesnt matter if it comes out in 1 week or 4, but it would be nice to get a rough idea about how long it will be.
Title: Re: DFHack 0.34.11 r2
Post by: zwei on January 24, 2013, 04:53:30 am
So what is rusty attribute of skill for exactly and how does rust work internally?

It is really weird, i made dump of data and it does not corelate with anything:

Spoiler (click to show/hide)

Game not displaying rust for Rusty = 6 for skills that were demoted to 0xp/dabbling i can understand, but there are other cases (big group of skills with rusty=1 and demotion=1 that are not displayed rusty, but other skills with similar numbers like leadership or wrestling which are displayed rusty and no way to distinguish between two groups)


Title: Re: DFHack 0.34.11 r2
Post by: ag on January 24, 2013, 11:58:14 am
In particular, if you generate a world that does not have a magma sea, DFHack 34.11r2 prospect will not prospect it from the embark selection screen.  However, DFHack 34.11 prospect will prospect it just fine. 

The r1 prospect does not account for magma sea, which means that it can and does misrepresent the amounts of minerals found around the magma sea level by an order of magnitude in some cases, and even report minerals that aren't actually present because they are way below the sea level if it is close to the surface.

How does skill rust work?

I have unit with grower skill that df displays as not rusty, but has rusty attribute=6
Then i have unit with rusty=6 and game displaying skill as very rusty
Then there is unit that has wrestler skill wirth rusty=1 and displayed as not rusty and various social skill with rusty=1 and not displaying any rust.

So what is rusty attribute of skill for exactly and how does rust work internally?

The rusty field of a skill is the same as soft_demotion of attributes, i.e. it is subtracted from the rating to determine the actual skill value:

https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L903 (https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L903)

The reason for a separate field is that it takes a lot less xp to recover rust demotion compared to gaining new levels. The rest of the fields are presumably counters used in updating the main values, but the exact logic was not verified. Neither was the logic used for displaying "rusty" on-screen.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 24, 2013, 01:03:33 pm
Neither was the logic used for displaying "rusty" on-screen.
A brief bit of disassembly diving (and a quick in-game test using DFHack) reveals that skills show as "Rusty" once 'rusty' reaches 50% of the rating and show as "V Rusty" once it reaches 75% of the rating.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on January 24, 2013, 03:20:34 pm
Context: vanilla df 34.11, dfhack 34.11r2

In the past, I've started out with the normal 7 dwarves, removed ACTIVE_SEASON, let the two migrant waves happen, get to my 20+ dwarves, and everything works great, as expected.  Invasions happen starting in late autumn/early winter.

My current goal is to embark with 21 dwarves, and have the game proceed from that point as though the two hardcoded migrant waves have already happened, right in early Spring. (1st Granite)

So, I've used dfusion to embark with 21 dwarves, set my population cap in d_init and then used fix/population-cap to prevent any more migrations.  I've also turned off liaison visits by removing ACTIVE_SEASON from dwarves in entity_default.txt

Unfortunately, if I do this, there are no invasions.  I've let the game play through for 5 years, and no invasions.  With all other parameters identical, if I let the intial two summer/autumn hardcoded migrant waves happen, invasions work.  If I don't, and use fix/population-cap, they don't work.

Does anyone know: Is there an additional flag that is set after the second migrant wave arrives that I can/should toggle to start the normal invasion schedule?  Or something else I'm missing?
Title: Re: DFHack 0.34.11 r2
Post by: Uggh on January 24, 2013, 05:03:16 pm
I deactivated autobutcher, most probably due to this bug: http://www.bay12forums.com/smf/index.php?topic=91166.msg3758349#msg3758349 (http://www.bay12forums.com/smf/index.php?topic=91166.msg3758349#msg3758349).
Is there anything else that I can do besides compiling dfhack?
Title: Re: DFHack 0.34.11 r2
Post by: falconne on January 24, 2013, 05:46:35 pm
I deactivated autobutcher, most probably due to this bug: http://www.bay12forums.com/smf/index.php?topic=91166.msg3758349#msg3758349 (http://www.bay12forums.com/smf/index.php?topic=91166.msg3758349#msg3758349).
Is there anything else that I can do besides compiling dfhack?

If you use the zone plugin from my custom plugins set: http://dffd.wimbli.com/file.php?id=7248 it has the autobutcher problem fixed.
Title: Re: DFHack 0.34.11 r2
Post by: Uggh on January 24, 2013, 06:13:37 pm
That's great. I always collect hoards of animals and woulc be lost without it. thanks
Title: Re: DFHack 0.34.11 r2
Post by: zwei on January 25, 2013, 03:27:37 am
Neither was the logic used for displaying "rusty" on-screen.
A brief bit of disassembly diving (and a quick in-game test using DFHack) reveals that skills show as "Rusty" once 'rusty' reaches 50% of the rating and show as "V Rusty" once it reaches 75% of the rating.

Thank you! This works perfectly for "rusty" (skills with rating=0 being ignored), but gives strange results for very rusty - Concentration, Student and Crossbowman in my example picture show ingame as only rusty, but rusty is more than rating*0.75
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on January 25, 2013, 07:16:09 am
That's because there's an additional special case (which I forgot to mention) that makes it so "V Rusty" can only appear if the rating is greater than or equal to 4.
Title: Re: DFHack 0.34.11 r2
Post by: splinterz on January 25, 2013, 11:54:35 am
when i tried to figure out the rusting, i never saw the rust count exceed 6, was this consistent with your testing?

also, any rust counter attempting to exceed 6 resulted in the other counters (demotion, last used) being reset to 0, the 'rusty' or 'v. rusty' descriptor being removed from the display, and the counters would never increase after that.
Title: Re: DFHack 0.34.11 r2
Post by: Evgenijm86 on January 26, 2013, 03:41:22 pm
Hi, I am new to this game and wanted to have some visualization. So, how do I use stonesense? I tried running latest dfhack-0.34.11-r2-Linux and...

[DFHack]# stonesense
stonesense is not a recognized command.

How do I fix this?

Edit: I missed checking stderr.log file. If anyone have the same problem as I did - you should check it. It turns out I didn't have a 32bit version of libjpeg62 library. Now it works, but you should add better error message in dfhack console.
Title: Re: DFHack 0.34.11 r2
Post by: Triskelli on January 30, 2013, 05:24:27 am
-off topic, moved to suggestions thread-
Title: Re: DFHack 0.34.11 r2
Post by: Trev_lite on January 30, 2013, 04:34:25 pm
hello
i'm using the version of dfhack included in http://dffd.wimbli.com/file.php?id=7207 (http://dffd.wimbli.com/file.php?id=7207)
i says its dfhack 0.34.11 r2 but has many differences from the version included in official dfhack r2 release

i first thought that it was meant dfhack r2 since this was relesed before the official dfhack r2 relese and it calls itself dfhack r2

so is this an old custom version of dfhack r2 or a beta version of dfhack r2.5?

the internal documention for both versions only say that its version r2

some clarification is wanted?

thanks

EDIT: who made this version. was it QUIETUST or thistleknot. the fixes and patches are credited but the version of dfhack isn't?
Title: Re: DFHack 0.34.11 r2
Post by: vjek on January 30, 2013, 05:01:36 pm
Hacked this together today, someone may find it useful.

I had the need to see how many Titans & Forgotten beasts had been killed in my fort, since embarkation.
Here is the result:

Spoiler: dead_list.lua (click to show/hide)
Spoiler: sample output (click to show/hide)
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on January 30, 2013, 05:13:46 pm
hello
i'm using the version of dfhack included in http://dffd.wimbli.com/file.php?id=7207 (http://dffd.wimbli.com/file.php?id=7207)
i says its dfhack 0.34.11 r2 but has many differences from the version included in official dfhack r2 release

i first thought that it was meant dfhack r2 since this was relesed before the official dfhack r2 relese and it calls itself dfhack r2

so is this an old custom version of dfhack r2 or a beta version of dfhack r2.5?

the internal documention for both versions only say that its version r2

some clarification is wanted?

thanks
Yes it's a custom build from repository at github. Probably some intermediate version from someones repo. Custom builds are okay, but please refrain from distributing them as they will make everyone confused and be a little patient, r3 is coming soon.

P.s. It's not official stance- i'm just guessing.
Edit: Also that is quite a strange version...
Title: Re: DFHack 0.34.11 r2
Post by: Trev_lite on January 30, 2013, 07:53:53 pm
OK. i will switch to the official r2 version once i find out how to modifiy it so that it has the bug fixes that i want. i think i just need to copy the "Dwarf fortress.exe" and some of the scripts.
Title: Re: DFHack 0.34.11 r2
Post by: thburns on January 31, 2013, 12:35:58 am
Okay I have accelerated df merged with modest mod. If that matters, but it may.
I now have a legendary hammerdwarf in a mood. I don't normally use a cheat but I have too right now (not losing this fort to a previous dumb mistake I made). Long story short,I need silk. From what I understand changeitem will do it. I put my (k)ursor over a rope reed fiber cloth and went through the Data-Raw file a bit, and tried many combinations,  to change it to silk, to no avail. Me Frustrated >:(
Can someone here please tell me how to changeitem to silk? Preferably the exact thing I need to type.
Thank you in advance.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on January 31, 2013, 12:39:24 am
If you need silk, (save first!) you can pause, reveal, mark all the webs in the caverns for dumping, use autodump to bring it into the fort (next to your loom/wherever) and unreveal.  Voila.  Instant silk, very quick & easy.
Title: Re: DFHack 0.34.11 r2
Post by: thburns on January 31, 2013, 12:48:57 am
Wish I could attempt that right now. I have a damn metal FB down there. And if I open them caverns up I'm toast. But I have pondered the idea already. I want to use a cave-in on it, but the world gened with tight maze-like caverns. Too many supporting walls. Eventually I will flood the darn thing with magma though :D
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on January 31, 2013, 12:49:40 am
Wish I could attempt that right now. I have a damn metal FB down there. And if I open them caverns up I'm toast.

That method doesn't require any dwarves or cavern opening at all...
Title: Re: DFHack 0.34.11 r2
Post by: thburns on January 31, 2013, 12:52:37 am
Ohh. Duh! Your right. I didnt read the autodump part. Too funny. Time to set up a new workshop. thanks!
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 01, 2013, 12:26:31 am
So, are the structures for historical figure links inside the historical figure struct documented anywhere?  I don't see them in df-structures anywhere, but I can access them in DFHack itself through the Lua interface.  I'm pretty sure the only data inside the struct is just a historical figure id (or maybe a unit id, I don't remember which), but I can't access the property to fiddle with it since I don't know what the name of the property is.  I've only ever modified those values through a memory editor.

DFHack seems to understand what the type is though, it tells me that the first entry is a histfig_hf_link_deityst, which is correct.  Does it actually have the internal structure though?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 01, 2013, 12:33:30 am
Any way to detect a creature's body size?
Title: Re: DFHack 0.34.11 r2
Post by: TheKaspa on February 01, 2013, 02:40:14 am
I have problem with autodump.
I designed a single tile as garbage dump, then designed the items to be dumped, then wrote 'autodump' in dfhack (I marked the position with the k interface). It says that 0 items were dumped, and now they are all marked as forbidden. How is it?
Title: Re: DFHack 0.34.11 r2
Post by: snooptodd on February 01, 2013, 10:12:17 am
I have problem with autodump.
I designed a single tile as garbage dump, then designed the items to be dumped, then wrote 'autodump' in dfhack (I marked the position with the k interface). It says that 0 items were dumped, and now they are all marked as forbidden. How is it?
This is how I use autodump.

In the game d-b-d
Mark the items to be dumped.
Move the cursor to location where I want the items dumped.
Type autodump in dfhack.
in DF type c to change mode and press enter twice.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 02, 2013, 12:03:11 am
Well, figured my own problem out.  The structure isn't documented anywhere that I can find, although I was able to finally figure out how to use Lua to get the property names.  Apparently it's called anon_1, presumably because it's not documented.

Well, no matter, I finished my first try at a Lua script.  Here's the Lua script for marrying any two dwarves (or whatevers).  I threw this together while teaching myself DFHack's API and Lua at the same time, so there is no error checking, and it doesn't use the fancy core suspension thing to make sure that the memory is consistent.  It hasn't crashed the game for me yet, but certainly has the potential to.  You've been warned.

Code: [Select]
-- Marries two specified creatures

local args = {...}

local victim1, historic_victim1
local victim2, historic_victim2

for key, value in pairs(df.global.world.units.all) do
-- The arguments are strings, but the structs contain numbers
if value.id == tonumber(args[1]) then
victim1 = value
end
if value.id == tonumber(args[2]) then
victim2 = value
end
end

print("Marrying " .. victim1.name.nickname .. " and " .. victim2.name.nickname)

historic_victim1 = df.global.world.history.figures[victim1.hist_figure_id]
historic_victim2 = df.global.world.history.figures[victim2.hist_figure_id]

local new_link1 = df.histfig_hf_link_spousest:new()
local new_link2 = df.histfig_hf_link_spousest:new()

-- Not documented, but this is the historical figure id
new_link1.anon_1 = victim2.hist_figure_id
new_link1.link_strength = 100

new_link2.anon_1 = victim1.hist_figure_id
new_link2.link_strength = 100

local link_count1 = #historic_victim1.histfig_links
local link_count2 = #historic_victim2.histfig_links

historic_victim1.histfig_links:resize(link_count1 + 1)
historic_victim1.histfig_links[link_count1] = new_link1
historic_victim2.histfig_links:resize(link_count2 + 1)
historic_victim2.histfig_links[link_count2] = new_link2

victim1.relations.spouse_id = victim2.id
victim2.relations.spouse_id = victim1.id

Just toss that in a file called marry.lua in your DFHack scripts folder.  To use it, you'll need to run this command:

marry unit_id1 unit_id2

So you need to get those unit ids.  The fastest way I know of to do that is to use the 'k' look around command and put it over each dwarf, then run this command inside the interactive Lua interpreter:

Code: [Select]
print(dfhack.gui.getSelectedUnit().id)
Do that for each dwarf, then run the marry command above and let the wedding bells ring.  There's a lot that could be done to tweak the script, especially error checking and sanity checking.  It will most certainly let you try to marry someone to multiple people (of either gender!), which will work for the relationships screen, but in the invisible relations section they're only really married to the last one you run through this command.

Next up is probably a divorce script, which should be pretty simple too.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 02, 2013, 12:04:26 am
Cool beans. I'm guessing this means you can marry yourself and your companion in adventurer, too.

EDIT: Getting an error from this line:

local strength = dfhack.units.getPhysicalAttrValue(selectedUnit, STRENGTH)/3550

attempt to call field 'getPhysicalAttrValue' (a nil value)
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 02, 2013, 12:23:36 am
Cool beans. I'm guessing this means you can marry yourself and your companion in adventurer, too.

Probably.  I tested it out and yes, you can marry someone to themselves.  I haven't tried it adventure mode though, no idea what will happen.  I haven't tested to see what happens if you marry two women together either, but it's possible they'll get pregnant.  You can also marry someone to a deity this way I think, but they don't have units as far as I know, so pregnancy won't happen among other strange things.

As to the other problem, don't you need to specify which unit you're getting the attribute of?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 02, 2013, 02:13:22 am
So, apparently there's no getPhysicalAttrValue function?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on February 02, 2013, 06:57:44 am
Cool beans. I'm guessing this means you can marry yourself and your companion in adventurer, too.

Probably.  I tested it out and yes, you can marry someone to themselves.  I haven't tried it adventure mode though, no idea what will happen.  I haven't tested to see what happens if you marry two women together either, but it's possible they'll get pregnant.  You can also marry someone to a deity this way I think, but they don't have units as far as I know, so pregnancy won't happen among other strange things.

As to the other problem, don't you need to specify which unit you're getting the attribute of?
You can but nothing happen... you might end up with children due to the filter for pregnancy is marriage in DF. beware of having cross breeded children who you can't look at the detail or fear crashing.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on February 02, 2013, 12:40:54 pm
you might end up with children due to the filter for pregnancy is marriage in DF.
You won't - the marriage is only a restriction on top of the existing logic, so you still need both a male and female.
Title: Re: DFHack 0.34.11 r2
Post by: Lord_Phoenix on February 02, 2013, 02:25:29 pm
Here's a little script I just cooked up to give proper spouse/parent last names to dwarves in the fort (only works if spouse/parent is actually at the fort), for those who like having family names.  Valid arguments are nothing or 0 for a patriarchal lineage (wives and children get father/husband last name), or 1 for a matriarchal lineage (husbands and children get mother/wife last name).  I just cobbled this together, so it's nothing perfect, might be builtin dfhack functions to do some stuff that I did, but I don't know cause there's very little documentation I could find on the properties and methods associated with each class, so I just had to go by key,value pairs to find properties and worked from there.  If anyone wants to do any improvements to it, that's fine by me.  Not even sure this would actually change their names in legends or what since there seems to be a separate historical id.

Oh, and does anyone know how to update the names when viewing unit status without giving them a nick and then removing it in game?

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 02, 2013, 06:34:45 pm
Any way to detect a creature's body size?

Found an answer myself--unit.body.blood_max returns a value that appears to be 1/10th the body size of the given creature.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 02, 2013, 07:11:26 pm
So, if you use the marriage script, then the force pregnancy script, will it properly show who the father was in legends and get the gene info, instead of "identity of father was lost to history?"

Would make some epic legend mode stuff after adventure XD
Title: Re: DFHack 0.34.11 r2
Post by: Caldfir on February 02, 2013, 09:29:04 pm
Here's a little script I just cooked up to give proper spouse/parent last names to dwarves in the fort (only works if spouse/parent is actually at the fort), for those who like having family names.  Valid arguments are nothing or 0 for a patriarchal lineage (wives and children get father/husband last name), or 1 for a matriarchal lineage (husbands and children get mother/wife last name).  I just cobbled this together, so it's nothing perfect, might be builtin dfhack functions to do some stuff that I did, but I don't know cause there's very little documentation I could find on the properties and methods associated with each class, so I just had to go by key,value pairs to find properties and worked from there.  If anyone wants to do any improvements to it, that's fine by me.  Not even sure this would actually change their names in legends or what since there seems to be a separate historical id.

Oh, and does anyone know how to update the names when viewing unit status without giving them a nick and then removing it in game?

Spoiler (click to show/hide)

Neat.  Been meaning to do something like this myself for a while now but haven't gotten around to it.  Should make figuring out what the family trees are in the fort a more tractable problem (one challenge I like to play with is giving each family/clan appropriately connected living quarters). 
Title: Re: DFHack 0.34.11 r2
Post by: Lord_Phoenix on February 02, 2013, 09:36:39 pm
Neat.  Been meaning to do something like this myself for a while now but haven't gotten around to it.  Should make figuring out what the family trees are in the fort a more tractable problem (one challenge I like to play with is giving each family/clan appropriately connected living quarters).

Just have to run it whenever migrants come or someone has a baby.  Though, if someone with a family has their father show up, it will change the entire last name of everyone in that family.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 02, 2013, 11:50:39 pm
Hmm. Apparently, blood values don't change with body size perc changes. Odd.

There has to be somewhere the body size is stored, even if it's just the sum of all body parts...
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 03, 2013, 12:10:14 am
So, if you use the marriage script, then the force pregnancy script, will it properly show who the father was in legends and get the gene info, instead of "identity of father was lost to history?"

Would make some epic legend mode stuff after adventure XD

Would be interesting to test, and I suspect it would work.  The parent ids and all should be set up, so DF should be able to piece it all together as needed.  If there are legends mode entries for marriages that's almost certainly not going to show up, but parentage should work.

Hmm. Apparently, blood values don't change with body size perc changes. Odd.

There has to be somewhere the body size is stored, even if it's just the sum of all body parts...

I'm curious about this too.  Seems like it has to be stored somewhere.  I really doubt DF is summing the size of all of the body parts every time it's needed, since that's very inefficient.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 03, 2013, 01:30:27 am
Marriage doesn't seem to be working in adventure mode, gives me

Code: [Select]
Cannot read field vector(historical_figure*).6965: index out of bounds.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 03, 2013, 01:45:38 am
Hmm, it's possible that I'm making some bad assumptions in the way it looks up the historical figure.  It currently uses the historical figure id as the index into the array, which worked perfectly fine in my testing.  It's possible adventure mode doesn't load all of the historical figures at once?  Or it's possible that the id doesn't always equal the index.

If that's the case, the part where it sets the historical figure should be replaced with a loop through the historical figures and comparing to the ids until it finds the one that matches.  I'll be working on it and related stuff in the next couple of days, so if you can't figure it out by then I'll post a version that should be more correct.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 03, 2013, 01:46:58 am
Have you tested it on more than 1 world?
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 03, 2013, 01:54:13 am
Nope, just one embark on one world.  I wouldn't be surprised at all if it just happened to conveniently work on that one embark.  In fact, later embarks may well break it.  Fixing the code should be fairly straightforward.  I may get to it tonight.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 03, 2013, 01:58:02 am
It's just, that 6965 seems oddly specific, possibly derived from some data unique to that world.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 03, 2013, 02:03:56 am
Oh, no, it's not.  That's the historical figure id of whoever you told it to marry.  That's specific to each world and whoever it is for.  In this case, that just means that one of the two you were trying to marry had a historical figure id of 6965, but the number of historical figures currently in DF's memory is less than 6965.  That could be either because DF doesn't load them all in adventure mode, or because they lose the 1-to-1 relationship of index associated to historical figure id I was relying on.  That worked in my world, but worlds that have actually had gameplay happen in them may invalidate that.

Edit: Here's the updated script.  It has a lot more error checking, does a proper look up for the historical figures, and uses the core suspension call to reduce the risk of the game crashing.  Still seems to work fine in my world, testing in others would be great though.

Code: [Select]
-- Marries two specified creatures

local args = {...}

function marry (unit_id1, unit_id2)

local victim1, historic_victim1
local victim2, historic_victim2

for key, value in pairs(df.global.world.units.all) do
-- The arguments are strings, but the structs contain numbers
if value.id == unit_id1 then
victim1 = value
end
if value.id == unit_id2 then
victim2 = value
end
end

if df.isnull(victim1) then
print('The first unit was not found.')
return
end
if df.isnull(victim2) then
print('The second unit was not found.')
return
end

print("Marrying " .. victim1.name.nickname .. " and " .. victim2.name.nickname)

for key, value in pairs(df.global.world.history.figures) do
if value.id == victim1.hist_figure_id then
historic_victim1 = value
end
if value.id == victim2.hist_figure_id then
historic_victim2 = value
end
end

if df.isnull(historic_victim1) then
print('The historical figure for the first unit was not found.')
return
end
if df.isnull(historic_victim2) then
print('The historical figure for the second unit was not found.')
return
end

local new_link1 = df.histfig_hf_link_spousest:new()
local new_link2 = df.histfig_hf_link_spousest:new()

-- Not documented, but this is the historical figure id
new_link1.anon_1 = victim2.hist_figure_id
new_link1.link_strength = 100

new_link2.anon_1 = victim1.hist_figure_id
new_link2.link_strength = 100

local link_count1 = #historic_victim1.histfig_links
local link_count2 = #historic_victim2.histfig_links

historic_victim1.histfig_links:resize(link_count1 + 1)
historic_victim1.histfig_links[link_count1] = new_link1
historic_victim2.histfig_links:resize(link_count2 + 1)
historic_victim2.histfig_links[link_count2] = new_link2

victim1.relations.spouse_id = victim2.id
victim2.relations.spouse_id = victim1.id
end

if df.isnull(args[1]) or df.isnull(args[2]) then
print('You must pass in two unit ids.')
return
end

dfhack.with_suspend(marry, tonumber(args[1]), tonumber(args[2]))

Edit2: Here's a script for divorcing units:

Code: [Select]
-- Divorces a creature from its spouse and / or lover.  Run this per creature in a relationship.

local args = {...}

function divorce (unit_id)

local victim, historic_victim

for key, value in pairs(df.global.world.units.all) do
-- The arguments are strings, but the structs contain numbers
if value.id == unit_id then
victim = value
end
end

if df.isnull(victim) then
print('The unit was not found.')
return
end

if victim.relations.spouse_id == -1 and victim.relations.lover_id == -1 then
print('Warning: the unit has no lover or spouse, nothing to do.')
return
end

print("Divorcing " .. victim.name.nickname)

for key, value in pairs(df.global.world.history.figures) do
if value.id == victim.hist_figure_id then
historic_victim = value
end
end

if df.isnull(historic_victim) then
print('The historical figure for the unit was not found.')
return
end

local link_count = #historic_victim.histfig_links

-- Remove the spouse hf link, if it exists
for key, value in pairs(historic_victim.histfig_links) do
if df.histfig_hf_link_spousest:is_instance(value) then
if key ~= link_count -1 then
-- Moves the spouse entry to the end of the list, then resizes the list to size - 1, erasing it
historic_victim.histfig_links[key] = historic_victim.histfig_links[link_count - 1]
end

historic_victim.histfig_links:resize(link_count - 1)
link_count = link_count - 1
value:delete()

break
end
end

-- Remove the lover hf link, if it exists
for key, value in pairs(historic_victim.histfig_links) do
if df.histfig_hf_link_loverst:is_instance(value) then
if key ~= link_count -1 then
-- Moves the lover entry to the end of the list, then resizes the list to size - 1, erasing it
historic_victim.histfig_links[key] = historic_victim.histfig_links[link_count - 1]
end

historic_victim.histfig_links:resize(link_count - 1)
link_count = link_count - 1
value:delete()

break
end
end

victim.relations.spouse_id = -1
victim.relations.lover_id = -1
end

if df.isnull(args[1]) then
print('You must pass in a unit id.')
return
end

dfhack.with_suspend(divorce, tonumber(args[1]))

The format is similar, except you run:

Code: [Select]
divorce unit_id
It just takes one unit id at a time.  Yes, you can have one directional relationships this way.  It also removes lover links, so you can remove these from dwarves who have a lover die, and they should be able to pick up another later.  Or, if their spouse dies they can pick up another.

Tested and working on my world, but again, testing in others would be nice.
Title: Re: DFHack 0.34.11 r2
Post by: ag on February 03, 2013, 03:38:10 am
Edit: Here's the updated script.  It has a lot more error checking, does a proper look up for the historical figures, and uses the core suspension call to reduce the risk of the game crashing.  Still seems to work fine in my world, testing in others would be great though.

There is nothing proper in linear loops :P. Use df.historical_figure.find(id) and df.unit.find(id). Also, if run from hack/script/ and not via legacy dfusion, core is always already suspended.
Title: Re: DFHack 0.34.11 r2
Post by: Lord_Phoenix on February 03, 2013, 06:28:41 am
Oh, no, it's not.  That's the historical figure id of whoever you told it to marry.  That's specific to each world and whoever it is for.  In this case, that just means that one of the two you were trying to marry had a historical figure id of 6965, but the number of historical figures currently in DF's memory is less than 6965.  That could be either because DF doesn't load them all in adventure mode, or because they lose the 1-to-1 relationship of index associated to historical figure id I was relying on.  That worked in my world, but worlds that have actually had gameplay happen in them may invalidate that.

I noticed in my fort when messing about with the renaming script I made that the keys on the list of hist fig ids stopped around 96000, but all the dwarves in the fort had hist fig ids in the 120000-140000 range.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on February 03, 2013, 09:12:20 am
Looking at the "marry" and "divorce" scripts, you're missing one important thing: historical events; the 'marry' script should add a pair of history_event_add_hf_hf_linkst entries so Legends will report them having been married, and the 'divorce' script should similarly add a pair of history_event_remove_hf_hf_linkst entries (which, if I recall correctly, will actually show up as "X divorced Y" in Legends mode).
Title: Re: DFHack 0.34.11 r2
Post by: Naryar on February 03, 2013, 09:44:09 am
I heard there was a tool that permitted creature respawn, because my current fort is out of cavern creatures and i'm pretty damn sure I didn't hunted them all to extinction, considering how like only 2 GCS ever spawned on my map, and the population number is far higher.
Title: Re: DFHack 0.34.11 r2
Post by: Mikesullivan on February 03, 2013, 12:20:06 pm
ANy ideas why im allways getting the error message "could not move xxx", it usually happens to stones and i dont understand why.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 03, 2013, 01:02:27 pm
There is nothing proper in linear loops :P. Use df.historical_figure.find(id) and df.unit.find(id). Also, if run from hack/script/ and not via legacy dfusion, core is always already suspended.

That find method is certainly simpler than what I was doing.  As I mentioned before, my experience with Lua is completely confined to those scripts, which also represent the entire breadth of my DFHack knowledge.  It's good to know that the core is always suspended for Lua scripts, that would also explain why this didn't crash DF like I expected it to before I added the suspend call.

Looking at the "marry" and "divorce" scripts, you're missing one important thing: historical events; the 'marry' script should add a pair of history_event_add_hf_hf_linkst entries so Legends will report them having been married, and the 'divorce' script should similarly add a pair of history_event_remove_hf_hf_linkst entries (which, if I recall correctly, will actually show up as "X divorced Y" in Legends mode).

I saw something about those in df-structures, but since I pretty much never read Legends mode and really only cared if it worked in Fort mode it was good enough for me.  Still, it pays to do it right I suppose.  There are a few more tweaks that could be added to the scripts (such as upgrading lovers to marriages instead of just letting a dwarf have both...), so when I get to fixing that I'll see about adding the Legends mode data.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 03, 2013, 01:04:58 pm
So, uh, can anyone have a looksie at this here script I wrote and see if there's anything odd? I'm not going to be that confident in this business until I write ~5 or 6 of them...

Code: [Select]
[c-- Gives power level of selected unit. Type "popup" for popup announcement.

local selectedUnit = dfhack.gui.getSelectedUnit(silent)

local arg = ...

function isWinded(unit)
if unit.counters.winded > 0 then return true end
return false
end
function isStunned(unit)
if unit.counters.stunned > 0 then return true end
return false
end
function isUnconscious(unit)
if unit.counters.unconscious > 0 then return true end
return false
end
function isParalyzed(unit)
if unit.counters2.paralysis > 0 then return true end
return false
end
function getExhaustion(unit)
local exhaustion = 1
if unit.counters2.exhaustion~=0 then
exhaustion = 1000/unit.counters2.exhaustion
if exhaustion>1 then exhaustion = 1 end
else unit.counters2.exhaustion=1
return exhaustion
end
return 1
end
function getBoost(unit)
return unit.counters.soldier_mood
end

--power levels should account for disabilities and such

--I have to declare the individual skill's numbers, including these here makes the program easier to read
local MELEE_COMBAT = 99
local WRESTLING = 102
local GRASP_STRIKE = 104
local STANCE_STRIKE = 105
local BITE = 103
local THROW = 55
local RANGED_COMBAT = 101

if df.isnull(selectedUnit) then
qerror('Need to select a unit.')
end

--blood_max appears to be the creature's body size divided by 10; the power level calculation relies on body size divided by 1000, so divided by 100 it is. blood_count refers to current blood amount, and it, when full, is equal to blood_max.
local strength = selectedUnit.body.physical_attrs.STRENGTH.value/3550
local agility = selectedUnit.body.physical_attrs.AGILITY.value/3550
local endurance = selectedUnit.body.physical_attrs.ENDURANCE.value/1000
local toughness = selectedUnit.body.physical_attrs.TOUGHNESS.value/2250
local spatialsense = selectedUnit.status.current_soul.mental_attrs.SPATIAL_SENSE.value/1500
local kinestheticsense = selectedUnit.status.current_soul.mental_attrs.KINESTHETIC_SENSE.value/1000
local willpower = selectedUnit.status.current_soul.mental_attrs.WILLPOWER.value/1000
local exhaustion = getExhaustion(selectedUnit)
local bodysize = selectedUnit.body.blood_count/100
local fighting = dfhack.units.getEffectiveSkill(selectedUnit, MELEE_COMBAT)*1000
local wrestling = dfhack.units.getEffectiveSkill(selectedUnit, WRESTLING)*1000
local grasp_strike = dfhack.units.getEffectiveSkill(selectedUnit, GRASP_STRIKE)*1000
local stance_strike = dfhack.units.getEffectiveSkill(selectedUnit, STANCE_STRIKE)*1000
local biting = dfhack.units.getEffectiveSkill(selectedUnit, BITE)*1000
local ki = dfhack.units.getEffectiveSkill(selectedUnit, THROW)*1000 + dfhack.units.getEffectiveSkill(selectedUnit, RANGED_COMBAT)*1000
local powerlevel = bodysize*bodysize*strength*agility*endurance*toughness*spatialsense*kinestheticsense*willpower*exhaustion+fighting+wrestling+grasp_strike+stance_strike+biting+ki
if getBoost(selectedUnit)==0 then powerlevel=powerlevel*1.5 end
if getBoost(selectedUnit)==1 then powerlevel=powerlevel*2 end
if getBoost(selectedUnit)==2 then powerlevel=powerlevel*1.3 end
if isWinded(selectedUnit) then powerlevel=powerlevel/1.2 end
if isStunned(selectedUnit) then powerlevel=powerlevel/1.5 end
if isParalyzed(selectedUnit) then powerlevel=powerlevel/5 end
if isUnconscious(selectedUnit) then powerlevel=powerlevel/10 end

if arg == "popup" or arg == "Popup" then
dfhack.gui.showPopupAnnouncement("The scouter says " .. math.floor(powerlevel) .. "!",11)
else dfhack.gui.showAnnouncement("The scouter says " .. math.floor(powerlevel) .. "!",11)
end
Title: Re: DFHack 0.34.11 r2
Post by: Lord_Phoenix on February 03, 2013, 01:06:01 pm
ANy ideas why im allways getting the error message "could not move xxx", it usually happens to stones and i dont understand why.

With autodump?  Helps to say what you're doing.

With autodump, if the item is forbidden or already has a task generated for it (like someone coming to move it to a stockpile, or someone coming to grab it for some job), then it will stay there and give that error.  In the case of it being a task, then the item will forbid itself and the task will fail, and then you have to reclaim the thing.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 03, 2013, 01:24:29 pm
Oh, no, it's not.  That's the historical figure id of whoever you told it to marry.  That's specific to each world and whoever it is for.  In this case, that just means that one of the two you were trying to marry had a historical figure id of 6965, but the number of historical figures currently in DF's memory is less than 6965.  That could be either because DF doesn't load them all in adventure mode, or because they lose the 1-to-1 relationship of index associated to historical figure id I was relying on.  That worked in my world, but worlds that have actually had gameplay happen in them may invalidate that.
Actually, the id's I tried to use were 2465 and 2414, which was why I was perplexed at 6965. Maybe I mistyped the first one?

I'll test the updated script right now.

EDIT: seems to work in adventure mode so far, only glitch I've seen is the "Marrying and " doesn't show names (but it calls for nicknames right?)
Title: Re: DFHack 0.34.11 r2
Post by: Mikesullivan on February 03, 2013, 01:27:16 pm
Thank you, it looks like that was the problem (dwarfs was trying to use that rock and i cant autodump because they are going to get it already).

Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 03, 2013, 01:48:20 pm
Oh, no, it's not.  That's the historical figure id of whoever you told it to marry.  That's specific to each world and whoever it is for.  In this case, that just means that one of the two you were trying to marry had a historical figure id of 6965, but the number of historical figures currently in DF's memory is less than 6965.  That could be either because DF doesn't load them all in adventure mode, or because they lose the 1-to-1 relationship of index associated to historical figure id I was relying on.  That worked in my world, but worlds that have actually had gameplay happen in them may invalidate that.
Actually, the id's I tried to use were 2465 and 2414, which was why I was perplexed at 6965. Maybe I mistyped the first one?

I'll test the updated script right now.

EDIT: seems to work in adventure mode so far, only glitch I've seen is the "Marrying and " doesn't show names (but it calls for nicknames right?)

That's correct.  It's just a diagnostic message though, and I didn't want to fool around with translating the compound names if DFHack doesn't do it for you.  The 6965 sounds like it's right.  What's happening is that you enter the unit ids 2465 and 2414, which are then associated with historical figures which use different ids.  So 6965 was the historical figure id of one of the two units you provided.

Quote
So, uh, can anyone have a looksie at this here script I wrote and see if there's anything odd? I'm not going to be that confident in this business until I write ~5 or 6 of them...

I don't see anything obviously amiss, but my Lua is very green.  The only thing that looks suspicious is the way you're treating the arg variable.  Is it not always an array?  You might want to use

Code: [Select]
local args = ...
if args[1] == "popup"

instead of

Code: [Select]
local arg = ...
if arg == "popup"

Does it work as is?  I may be completely mistaken in the way Lua treats this variable.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 03, 2013, 01:49:41 pm
It works as-is. I figure that it doesn't need to be an array if I only have one argument.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 03, 2013, 02:46:13 pm
Hmm, interesting.  I guess accessing the array in that manner silently accesses the first element?

Anyway, is there any way to use the Lua API to set up a repeating event?  Something like the workflow plugin?  It looks like the workflow plugin is registering a callback of some sort that is called every frame, but I didn't see anything like that in the Lua interface documentation.

If that's not possible, then I guess I'll have to write the "family planning" plugin I want as a C++ module.  I recall Quietust writing earlier in the thread VS2012 won't work because of the runtime.  Is that because DFHack's precompiled binary uses an older runtime, or because Dwarf Fortress does?  I'm guessing it's the latter, which would mean rebuilding all of DFHack in VS2012 won't fix the problem.  Guess I need to find a computer to install an older version of VS on.

Or I could just write a buggy plugin that leaks memory, I guess.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on February 03, 2013, 05:27:30 pm
I recall Quietust writing earlier in the thread VS2012 won't work because of the runtime.  Is that because DFHack's precompiled binary uses an older runtime, or because Dwarf Fortress does?  I'm guessing it's the latter, which would mean rebuilding all of DFHack in VS2012 won't fix the problem.
Dwarf Fortress uses the MSVC 2010 runtime, therefore DFHack (and all of its plugins) must also use it.

It would be theoretically possible for DFHack to use a different runtime, but you'd need to jump through a bunch of extra hoops to get it to work. DFHack-23a and DFHack-40d did this, and I had to write special versions of malloc() and free() (as well as operator new/delete) which used DF's own heap handle instead of the one in the C runtime.

The problem is that that technique wouldn't work very well with 0.31 and later since the heap handle is located inside msvcr100.dll, meaning you'd have to find its load address without actually allocating any memory on the heap (which would require a whole bunch of special logic); it worked in 23a and 40d (with difficulty) because they linked against the static version of libc and were non-relocateable (so I could just hardcode the address of the heap handle).
Title: Re: DFHack 0.34.11 r2
Post by: TigerHunter on February 03, 2013, 07:20:15 pm
I am having difficulty getting DFHack to run on OSX.

I extracted the files into my DF folder. When I double-click on "dfhack", it opens terminal and dwarffort.exe but does not start the game.

Double-clicking "dfhack-run" opens another terminal window that displays "Segmentation fault", then logs out and declares the process completed.

The readme has not been updated to include the new OSX version, can anyone help me? I have no idea what I'm doing.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on February 04, 2013, 12:51:56 am
Here's a little script I just cooked up to give proper spouse/parent last names to dwarves in the fort (only works if spouse/parent is actually at the fort), for those who like having family names.  Valid arguments are nothing or 0 for a patriarchal lineage (wives and children get father/husband last name), or 1 for a matriarchal lineage (husbands and children get mother/wife last name).  I just cobbled this together, so it's nothing perfect, might be builtin dfhack functions to do some stuff that I did, but I don't know cause there's very little documentation I could find on the properties and methods associated with each class, so I just had to go by key,value pairs to find properties and worked from there.  If anyone wants to do any improvements to it, that's fine by me.  Not even sure this would actually change their names in legends or what since there seems to be a separate historical id.

Oh, and does anyone know how to update the names when viewing unit status without giving them a nick and then removing it in game?

Does all of that and more: http://www.bay12forums.com/smf/index.php?topic=112381.0
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 04, 2013, 01:09:36 am
Alright Telgin, new script successfully results in marriages, but when the woman is impregnated using Dfusion, the child still does not belong to the father ("father is lost to history"). My guess is that the script needs to set the lover_id as well as spouse_id. Needs more testing, though.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 04, 2013, 01:26:27 am
Alright Telgin, new script successfully results in marriages, but when the woman is impregnated using Dfusion, the child still does not belong to the father ("father is lost to history"). My guess is that the script needs to set the lover_id as well as spouse_id. Needs more testing, though.
The dfusion impregnation might be at fault here.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 04, 2013, 01:29:36 am
Perhaps true. I don't think I've ever seen it use genetic data, always just "creating pregnancy ptr"
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 04, 2013, 02:12:50 am
Interesting.  I would have expected DF to only care if the mother had a spouse id set at the time of birth, and would set up the history entries as needed.  If that's the case, then DFusion shouldn't be at fault.

I don't think it's the lover id though.  I'm pretty sure DF clears that once two dwarves marry.  It could be the links Quietust mentioned though.  I'd find it pretty strange if DF needed that to set up the future history entries.

It may be that my script isn't setting the spouse ids correctly.  What you see in the relationships screen doesn't depend on that at all, it actually uses the historical figure links.  The spouse id is what's needed for DF to generate 'talked with the spouse lately' thoughts, to start pregnancies, and to prevent a dwarf from getting another lover or spouse.

I'll take another look at it when I get a chance.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 04, 2013, 02:27:50 am
Interesting.  I would have expected DF to only care if the mother had a spouse id set at the time of birth, and would set up the history entries as needed.  If that's the case, then DFusion shouldn't be at fault.

I don't think it's the lover id though.  I'm pretty sure DF clears that once two dwarves marry.  It could be the links Quietust mentioned though.  I'd find it pretty strange if DF needed that to set up the future history entries.

It may be that my script isn't setting the spouse ids correctly.  What you see in the relationships screen doesn't depend on that at all, it actually uses the historical figure links.  The spouse id is what's needed for DF to generate 'talked with the spouse lately' thoughts, to start pregnancies, and to prevent a dwarf from getting another lover or spouse.

I'll take another look at it when I get a chance.
Having hist. events for marriage would make sense as it might check for them when creating new unit.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 04, 2013, 03:07:47 am
Have yet to check whether the pregnancy can occur naturally in fort mode. Though, in legends, it does not list "in year X, A married B." Could be part of it, or could be an adv-mode specific problem.
Title: Re: DFHack 0.34.11 r2
Post by: Lord_Phoenix on February 04, 2013, 07:56:50 am
Does all of that and more: http://www.bay12forums.com/smf/index.php?topic=112381.0

Nifty.  Weird naming schema though.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on February 04, 2013, 09:23:25 am
I am having difficulty getting DFHack to run on OSX.

I extracted the files into my DF folder. When I double-click on "dfhack", it opens terminal and dwarffort.exe but does not start the game.

Double-clicking "dfhack-run" opens another terminal window that displays "Segmentation fault", then logs out and declares the process completed.

The readme has not been updated to include the new OSX version, can anyone help me? I have no idea what I'm doing.

First: what version of OS X are you running? Some changes need to be made to the dfhack script before it is possible to run it on versions prior to 10.7 (and even then I don't guarantee that they'll work).

Second: If you're running 10.7 or newer, please open up the Terminal, type "cd " (that's a space after cd), then drag the folder containing the dfhack script into the Terminal window and press Enter. Then type "./dfhack" and press Enter. What, exactly, does it say?
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 04, 2013, 01:31:35 pm
Have yet to check whether the pregnancy can occur naturally in fort mode. Though, in legends, it does not list "in year X, A married B." Could be part of it, or could be an adv-mode specific problem.

I haven't tested it with this tool yet, but it should work.  When I did this the hard way with a memory editor it worked.

The lack of the Legends mode mentions of them marrying is becuase of the problem Quietust pointed out.  The script doesn't add the legends mode entries, which might be responsible for it not understanding who the father is in Legends mode.  I'll try fixing it eventually, but it's going to probably be a little while before I do.
Title: Re: DFHack 0.34.11 r2
Post by: TigerHunter on February 04, 2013, 03:20:28 pm
I am having difficulty getting DFHack to run on OSX.

I extracted the files into my DF folder. When I double-click on "dfhack", it opens terminal and dwarffort.exe but does not start the game.

Double-clicking "dfhack-run" opens another terminal window that displays "Segmentation fault", then logs out and declares the process completed.

The readme has not been updated to include the new OSX version, can anyone help me? I have no idea what I'm doing.

First: what version of OS X are you running? Some changes need to be made to the dfhack script before it is possible to run it on versions prior to 10.7 (and even then I don't guarantee that they'll work).

Second: If you're running 10.7 or newer, please open up the Terminal, type "cd " (that's a space after cd), then drag the folder containing the dfhack script into the Terminal window and press Enter. Then type "./dfhack" and press Enter. What, exactly, does it say?
I am running 10.6.8. What changes do I need to make?

Thank you for your help!
Title: Re: DFHack 0.34.11 r2
Post by: danaris on February 04, 2013, 05:51:34 pm
I am running 10.6.8. What changes do I need to make?

Thank you for your help!

You need to comment out the line
Quote
export DYLD_FORCE_FLAT_NAMESPACE=1
(in other words, put a # in front of it).

(Or you can just delete the line.)
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 04, 2013, 07:31:36 pm
Comment out the line in which file?
Title: Re: DFHack 0.34.11 r2
Post by: danaris on February 04, 2013, 09:21:53 pm
Comment out the line in which file?

In the dfhack script you run to launch DF with DFHack attached.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 04, 2013, 09:35:03 pm
I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 04, 2013, 09:48:34 pm
hack/scripts is for lua scripts; that shouldn't be it.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 04, 2013, 10:29:59 pm
Is it in the hack, though?
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 05, 2013, 01:13:33 am
And one more script for those who are interested.  It's kind of a niche thing I threw together for an upcoming community fort, but I think it might be useful to anyone inundated with too many babies being born, as a supplement or instead of the init child cap.  I call it Family Planning, but that's probably not the best name for it since it's also simulating infertility due to age.  Just drop this into a file called familyplanning.lua in your scripts folder:

Code: [Select]
-- Simulates menopause and gives a limit on the number of living kids per mother

local args = {...}

function count_children(unit_id)
local children = 0

for key, value in pairs(df.global.world.units.all) do
if value.relations.mother_id == unit_id then
children = children + 1
end
end

return children
end

function terminate_pregnancy(unit)
if unit.relations.pregnancy_timer > 0 then
unit.relations.pregnancy_ptr:delete()
unit.relations.pregnancy_ptr = nil
unit.relations.pregnancy_timer = 0
unit.relations.pregnancy_mystery = -1
return 1 -- Terminated a pregnancy
end

-- Wasn't pregnant
return 0
end

function family_planning(menopause_min, menopause_max, children_min, children_max)
local terminated_pregnancies = 0

for key, value in pairs(df.global.world.units.all) do
local children = 0

-- Only married females matter
if (value.sex == 0 and value.relations.spouse_id ~= -1) then
children = count_children(value.id)
end

math.randomseed(value.id)
local maximum_children = math.random(children_min, children_max)
local menopause_age = math.random(menopause_min, menopause_max)
local age = df.global.cur_year - value.relations.birth_year

if age > menopause_age or children > maximum_children then
-- This is awkward syntax, but I have no idea how to pass local values by reference in Lua
terminated_pregnancies = terminated_pregnancies + terminate_pregnancy(value)
end
end

print("Terminated " .. terminated_pregnancies .. " pregnancies.")
end

if df.isnull(args[4]) then
print('You did not specify four parameters, so the following are assumed: menopause at 40-60, maximum children from 2-4.')
args[1] = 40
args[2] = 60
args[3] = 2
args[4] = 4
end

dfhack.with_suspend(family_planning, tonumber(args[1]), tonumber(args[2]), tonumber(args[3]), tonumber(args[4]))

The syntax is either

Code: [Select]
familyplanning or
Code: [Select]
familyplanning menopause_min menopause_max children_min children_max
If you don't provide all four of those arguments, it uses these defaults:  Menopause sets in at some age between 40 and 60.  A mother will be limited to somewhere between 2 and 4 children.

The actual menopause age and child cap are randomly decided per mother, with the RNG seeded based on her unit id.  This has the effect of being consistent between runs of the tool, but giving different values per mother.  If a mother is found who is too old or has more kids than she's supposed, and she's pregnant, it will remove her pregnancy.  I think this currently counts deceased children too, if they have migrated.  I'm not positive what it will do for those who haven't migrated: it only checks the global units list, so if things that haven't migrated aren't populated in that list they won't get counted.

These are roughly human values.  Ideally this would check the max age of the creature in question, but I don't know how to do that yet if it's possible.  Instead, if you really care about more dwarfy values you can just enter something like 100 for the menopause ages.  If you don't want that to be simulated, just enter like 1000.

This script will need to be run manually periodically.  It should arrive at the same random age and child caps even between runs of DF.  I don't know if it's possible to configure DFHack to run Lua scripts automatically, but I don't think so.  I can't code it in C++ right now either due to a lack of a compatible compiler being available right now.

I tested this one on a 20 year old fort, but it is unfortunately modded and running a species of egg layers.  It found and terminated 8 pregnancies as a result, and while they're egg layers, I assume it will work properly for dwarves and other creatures.
Title: Re: DFHack 0.34.11 r2
Post by: Andux on February 05, 2013, 03:41:06 am
These are roughly human values.  Ideally this would check the max age of the creature in question, but I don't know how to do that yet if it's possible.
Code: [Select]
local unitcaste = df.creature_raw.find(value.race).caste[value.caste]
local menopause_age = math.random((unitcaste.misc.maxage_min / 2), (unitcaste.misc.maxage_max / 2))
Or something like that.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on February 05, 2013, 08:17:04 am
I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?

No. There should also be a Unix executable file called simply dfhack.

If you are missing that, you need to redownload a new copy.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 05, 2013, 08:24:20 am
These are roughly human values.  Ideally this would check the max age of the creature in question, but I don't know how to do that yet if it's possible.
Code: [Select]
local unitcaste = df.creature_raw.find(value.race).caste[value.caste]
local menopause_age = math.random((unitcaste.misc.maxage_min / 2), (unitcaste.misc.maxage_max / 2))
Or something like that.

Ah hah, thanks, that is a much better solution.  I'll work that into my script and test it later today.
Title: Re: DFHack 0.34.11 r2
Post by: ag on February 05, 2013, 10:22:42 am
The actual menopause age and child cap are randomly decided per mother, with the RNG seeded based on her unit id.

Messing with the global random generator state is not a good idea...
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 05, 2013, 10:27:25 am
The actual menopause age and child cap are randomly decided per mother, with the RNG seeded based on her unit id.

Messing with the global random generator state is not a good idea...

Oh?  Why is that?  I'm only calling math.randomseed inside the Lua script.  Does this have repercussions outside of the Lua interface?  I assumed that it had an isolated RNG, but if it's affecting the state of DF's RNG then I can see the potential issue.  If so I can just find a way to calculate a pseudo random number based on the unit id I suppose.
Title: Re: DFHack 0.34.11 r2
Post by: ag on February 05, 2013, 10:41:06 am
I assumed that it had an isolated RNG, but if it's affecting the state of DF's RNG then I can see the potential issue.

It so happens that Toady uses his own RNG; however that lua api works on top of the global RNG in the standard C library, so it will affect anything that uses that, including any other lua scripts.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 05, 2013, 10:45:25 am
I have a few rng written in lua (correctness not guaranteed)  if anyone needs.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 05, 2013, 10:48:30 am
Right then, time to find a very simple RNG generator to embed in the script.  Or some other simple way to generate random looking values that are consistent for a unit.

I have a few rng written in lua (correctness not guaranteed)  if anyone needs.

If it's fairly simple and generates anything approaching random looking numbers I'm interested.
Title: Re: DFHack 0.34.11 r2
Post by: ag on February 05, 2013, 10:51:31 am
Note also that since afaik the math behind the standard C rng is not standardized in any way, implementing a custom one is the only way to get guaranteed consistent behavior between different operating systems and compilers. This is probably one of the reasons Toady did that - consistent random numbers are critical for worldgen.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 05, 2013, 11:01:45 am
Right then, time to find a very simple RNG generator to embed in the script.  Or some other simple way to generate random looking values that are consistent for a unit.

I have a few rng written in lua (correctness not guaranteed)  if anyone needs.

If it's fairly simple and generates anything approaching random looking numbers I'm interested.
https://github.com/warmist/OpusArcania/blob/master/random.lua
Enjoy.
Edit: Usage
Code: [Select]
local rand=Mersenne(myseed) -- or xorShift(seed)
local value=rand:get(min,max)
--and
local deck={0,1,2,3,4,5,6}
value=rand:pick(deck)
Title: Re: DFHack 0.34.11 r2
Post by: Deon on February 05, 2013, 03:09:20 pm
Ever since I started using DFHack, people report appearance of "granite" with a sand icon and a weight of 1 urist in food stockpile. Some time later it's gone.

I guess some plugin from DFHack causes it for some workaround, do you know what coud it be?

Here: http://dffd.wimbli.com/file.php?id=7374

On F2 hotkey there's a food stockpile full of "granite", when you unpause it disappears.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 05, 2013, 03:15:39 pm
I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?

No. There should also be a Unix executable file called simply dfhack.

If you are missing that, you need to redownload a new copy.

Got that too. But how to open up its code? I feel as if I'm missing something obvious.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 05, 2013, 03:28:39 pm
I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?

No. There should also be a Unix executable file called simply dfhack.

If you are missing that, you need to redownload a new copy.

Got that too. But how to open up its code? I feel as if I'm missing something obvious.
Try opening with text editor. It should be a script. Not sure how it works on Mac but in ubuntu it asked you if you want to edit or run it. Also you could just open text editor and file->open, navigate to it and open.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on February 05, 2013, 03:45:25 pm
I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?

No. There should also be a Unix executable file called simply dfhack.

If you are missing that, you need to redownload a new copy.

Got that too. But how to open up its code? I feel as if I'm missing something obvious.

You can open it up with TextEdit, in any of the various ways one opens Mac documents with non-default applications. (The simplest I can describe being to open up TextEdit, then drag the file onto its Dock icon.)
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 05, 2013, 03:51:04 pm
Huh, TextEdit wasn't working before, but it is now. Thanks!

EDIT: And now I know for sure that Dfhack does not work on my ancient 10.5.8 system. Just wanted to test it.
Title: Re: DFHack 0.34.11 r2
Post by: Andux on February 05, 2013, 08:08:32 pm
Right then, time to find a very simple RNG generator to embed in the script.

Also, if you want a more realistic age distribution, you can do something like this:
Code: [Select]
-- Approximate a normal (Gaussian) distribution
local menopause_age = 0
local unitcaste = df.creature_raw.find(value.race).caste[value.caste]
local mmin = (unitcaste.misc.maxage_min / 2)
local mmax = (unitcaste.misc.maxage_max / 2)
for i=1,4 do
menopause_age = menopause_age + math.random(mmin, mmax)
end
menopause_age = menopause_age / 4
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 06, 2013, 01:26:50 am
Right then, time to find a very simple RNG generator to embed in the script.

Also, if you want a more realistic age distribution, you can do something like this:
Code: [Select]
-- Approximate a normal (Gaussian) distribution
local menopause_age = 0
local unitcaste = df.creature_raw.find(value.race).caste[value.caste]
local mmin = (unitcaste.misc.maxage_min / 2)
local mmax = (unitcaste.misc.maxage_max / 2)
for i=1,4 do
menopause_age = menopause_age + math.random(mmin, mmax)
end
menopause_age = menopause_age / 4
Better normal distribution:
Code: [Select]
function norm()
return math.sqrt((-2)*math.log(math.random()))*math.cos(2*math.pi*math.random())
end
function normalDistributed(mean,sigma)
return mean+sigma*norm()
end
Title: Re: DFHack 0.34.11 r2
Post by: ag on February 06, 2013, 04:13:30 am
Ever since I started using DFHack, people report appearance of "granite" with a sand icon and a weight of 1 urist in food stockpile. Some time later it's gone.

From reports:

The spinning granite strikes The Vulture in the lower body, bruising the muscle and bruising the guts!

In the raws:

Code: [Select]
[CDI:MATERIAL:INORGANIC:GRANITE:SOLID_GLOB]
Apparently SOLID_GLOB creates a glob item, and those generally end up in the food stockpile. They are also erased once per season if on ground.
Title: Re: DFHack 0.34.11 r2
Post by: Thundercraft on February 07, 2013, 01:05:10 am
I want to ask if a certain application is possible. And please forgive my ignorance. (My programming is rusty and I'm not familiar yet with Lua.):

In the Units module is the dfhack.units.getPosition function to return the true x,y,z of a unit. And in the Items module is dfhack.items.getPosition(item) to return the true x,y,z of an item.

Those return values. But is it possible to change these values - to force a unit and/or an item to be instantly relocated from one position to another (such as swapping positions with an item or creature)? If so, how would one go about doing that?

Also, if the above is true, is it possible to relocate a creature and/or item instantly to a different global position? To explain, I have an example:

Say I have a utility that - in fortress mode - reads the position of one or more creatures/items and stored the values. Then I use Rumrusher's technique of "properly retiring a fort". (DFusion hack to adjust the items so they do not scatter, civ ownership of pets, etc, etc. See this thread (http://www.bay12forums.com/smf/index.php?topic=81738.0) and DFusion's thread for more.) Then I start a new embark.

Now, with the saved position(s) of the creature(s)/item(s) from the now "retired" old fort - assuming they have not moved or scattered - would it be possible to relocate them to the new embark map?

I realize that the game differentiates between global and local maps. But, after the old fort is retired, what used to be local becomes global and a new embark map becomes the new local map... right? Would that pose a problem?

I thought I'd ask before further banging my head on this problem... (I really, REALLY want to see a "Successive Embark" or let my old fort continue on while starting a new one with resources on hand. And I don't have the patience to wait for Toady to get to it one of these days. With the tools and techniques available now, I figure a hack might be within reach.)
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 07, 2013, 01:49:53 am
At this point, the answer is not known and requires testing of the principle. However, perhaps the x,y,z only applies within a local map? There might be region tile coordinates stored on the unit which might also have to be changed to get them into your map.

However, on a local map level, afaik this is somewhat how autodump works.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on February 07, 2013, 03:33:09 am
I wonder to know what's your problem?.. oh wait you want migrants from a retired fort, they should move over to the new site easily in the upcoming migrant waves.
though the units are stuck in a pool of natural citizens of the civ and might take a couple sessions.

though my guess is the game keeps the global map to be the terrain and the local maps being the site, each time you get near a site the game loads up the local map data of the area.

retired forts just becomes a site with a bunch of changes DF needs to remember next time it needs to load it up.
though if you want people from another site to visit you could jump into adventure mode and walk them to the next site.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on February 07, 2013, 09:33:13 am
If those embarks are in different locations, it cannot be done - items are offloaded to the site in which they are located, so you can't actually get at them without loading the site itself. Units are offloaded to special global files (unit-*.dat), but you still can't get at them without convincing DF to load them for you.

If it's within the current site, then that's easy - DFHack is already capable of moving items and units (using autodump and fastdwarf, for example).
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 07, 2013, 10:44:59 am
If flags can be set on an off-site unit, it's possible that one could be forced to load in the map.
Title: Re: DFHack 0.34.11 r2
Post by: Deon on February 07, 2013, 10:54:15 am
Ever since I started using DFHack, people report appearance of "granite" with a sand icon and a weight of 1 urist in food stockpile. Some time later it's gone.

From reports:

The spinning granite strikes The Vulture in the lower body, bruising the muscle and bruising the guts!

In the raws:

Code: [Select]
[CDI:MATERIAL:INORGANIC:GRANITE:SOLID_GLOB]
Apparently SOLID_GLOB creates a glob item, and those generally end up in the food stockpile. They are also erased once per season if on ground.

Oh, thanks for the explanation!
Title: Re: DFHack 0.34.11 r2
Post by: Thundercraft on February 07, 2013, 12:09:25 pm
I wonder to know what's your problem?.. oh wait you want migrants from a retired fort, they should move over to the new site easily in the upcoming migrant waves.
That's not exactly what I was talking about. I want dwarves from my old fort as the founders (not migrants) of a new embark. In addition, I want to take along a selection of pets and creatures and a sizable amount of supplies and items.

...if you want people from another site to visit you could jump into adventure mode and walk them to the next site.
I've thought of that, but can be problematic (such as surviving the trip and carrying all the stuff).

Thanks for the replies, guys. It is appreciated. My idea sounds unlikely now, but it has sparked some new ideas.

But to avoid getting too far off topic, I started a new thread on this subject:
Successive Embark (from retired, not abandoned fortresses) (http://www.bay12forums.com/smf/index.php?topic=122643.0)
Title: Re: DFHack 0.34.11 r2
Post by: Shininglight on February 07, 2013, 03:54:29 pm
I was wondering if i could get a bit of help here, i've been trying to get the dfhack for osx to work on my computer but so far nothing has worked, for whatever reason it doesn't seem to run any help would be wonderful. I can start normal df but the dfhack attachment doesn't start up when it does and specifically starting dfhack just opens a terminal that does nothing.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on February 07, 2013, 04:04:01 pm
I was wondering if i could get a bit of help here, i've been trying to get the dfhack for osx to work on my computer but so far nothing has worked, for whatever reason it doesn't seem to run any help would be wonderful. I can start normal df but the dfhack attachment doesn't start up when it does and specifically starting dfhack just opens a terminal that does nothing.

If you are running 10.6, you will need to edit the dfhack script to remove the line referencing DYLD_FORCE_FLAT_NAMESPACE.

...We should really mention somewhere prominent that 10.6 a) is not fully supported, and b) requires this change to even have a chance at working. This is at least the third person who's asked about it.
Title: Re: DFHack 0.34.11 r2
Post by: Shininglight on February 07, 2013, 04:22:54 pm
Thanks for the help danaris, it works now.
Title: Re: DFHack 0.34.11 r2
Post by: Mugtorg on February 08, 2013, 03:58:10 pm
Here are some small scripts in case someone needs them.
Spoiler (click to show/hide)
This one clears the combat reports or announcements list.
Spoiler (click to show/hide)
Run this one right after the migrant wave shows up and it erases their skills, sets their profession to peasant and sets the flag on their animals so they leave the map.(Usually you won't even see them, but very rarely they show up and leave on the edge of the map immediately.)
Spoiler (click to show/hide)
Same as above but for the selected unit only.

Code may be kind of bad as i started coding in LUA only recently
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 10, 2013, 05:12:00 am
So a unit can have more than one soul.

What effect, exactly, does that have?

I made a real quickie script to test if I could do it and, sure enough, it shows the creature as having two souls after using it:

Code: [Select]
-- It's a test!

function getMaxId()
local maxid = 0
  local units = df.global.world.units.all
  for _uid,unit in ipairs(df.global.world.units.all) do
    maxid = maxid + 1
end
return maxid
end

local selectedUnit = dfhack.gui.getSelectedUnit()

local maxid = getMaxId()+1

selectedUnit.status.souls:insert('#',
{
new = df.unit_soul,
unit_id = maxid,
race = 894, --this is Lord English in Fortbent, shouldn't cause any problems in vanilla etc. AFAIK. If it does, just change it to 1  or something.
sex = 1,
caste = 0,
unk1 = -1,
unk2 = -1,
unk3 = -1,
unk4 = -1,
anon_1 = 0,
anon_2 = 0,
anon_3 = -1,
anon_4 = -1,

}
)
Title: Re: DFHack 0.34.11 r2
Post by: FogAnimal on February 10, 2013, 11:13:41 am
My apologies if this is incredibly noobish, but can and if so how would DFHack be used to remove the insanity tag from a single dwarf?
  Any help is much appreciated.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 10, 2013, 01:03:27 pm
So a unit can have more than one soul.

What effect, exactly, does that have?

I made a real quickie script to test if I could do it and, sure enough, it shows the creature as having two souls after using it:

I'm not sure there is any point yet, actually.  It's part of a frame work for future things I think.  Do reanimated zombies reuse the same unit but with a different soul?  That could be a potential future use if not.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on February 10, 2013, 01:43:39 pm
So a unit can have more than one soul.

What effect, exactly, does that have?

I made a real quickie script to test if I could do it and, sure enough, it shows the creature as having two souls after using it:

I'm not sure there is any point yet, actually.  It's part of a frame work for future things I think.  Do reanimated zombies reuse the same unit but with a different soul?  That could be a potential future use if not.
uhh no it's really a new but that copies the identity of a corpse over an undead unit.
you can revive both the original unit and the corpse at the same time if you want.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 10, 2013, 03:20:09 pm
So, a zombie counts as a completely different entity, as in fort mode someone shows up as 'deceased' but their reanimated body shows up as 'Urist's corpse - undead.' If someone is resurrected, though, does it still make a new unit using their body or does it actually bring them back?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 10, 2013, 03:55:51 pm
So a unit can have more than one soul.

What effect, exactly, does that have?

I made a real quickie script to test if I could do it and, sure enough, it shows the creature as having two souls after using it:

Code: [Select]
-- It's a test!

function getMaxId()
local maxid = 0
  local units = df.global.world.units.all
  for _uid,unit in ipairs(df.global.world.units.all) do
    maxid = maxid + 1
end
return maxid
end

local selectedUnit = dfhack.gui.getSelectedUnit()

local maxid = getMaxId()+1

selectedUnit.status.souls:insert('#',
{
new = df.unit_soul,
unit_id = maxid,
race = 894, --this is Lord English in Fortbent, shouldn't cause any problems in vanilla etc. AFAIK. If it does, just change it to 1  or something.
sex = 1,
caste = 0,
unk1 = -1,
unk2 = -1,
unk3 = -1,
unk4 = -1,
anon_1 = 0,
anon_2 = 0,
anon_3 = -1,
anon_4 = -1,

}
)
There are two wrong (afaik) assumption here: 1st getting the max id of unit. 2nd that soul needs a new unit id.
I think it should be like this:
Code: [Select]
unit_id=selectedUnit.id
Also if you need next unit id its:
Code: [Select]
df.global.unit_next_id
but usually you don't need to mess with that.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on February 10, 2013, 04:09:37 pm
My apologies if this is incredibly noobish, but can and if so how would DFHack be used to remove the insanity tag from a single dwarf?
  Any help is much appreciated.

This (http://www.bay12forums.com/smf/index.php?topic=91166.msg3790375#msg3790375) may be of help.
In particular:
Code: [Select]
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit
I have not tested this myself, I have no idea if it will work or not.
Title: Re: DFHack 0.34.11 r2
Post by: FogAnimal on February 10, 2013, 06:29:14 pm
My apologies if this is incredibly noobish, but can and if so how would DFHack be used to remove the insanity tag from a single dwarf?
  Any help is much appreciated.

This (http://www.bay12forums.com/smf/index.php?topic=91166.msg3790375#msg3790375) may be of help.
In particular:
Code: [Select]
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit
I have not tested this myself, I have no idea if it will work or not.

Worked! You are a life saver, my thanks.
Title: Re: DFHack 0.34.11 r2
Post by: chairo on February 10, 2013, 08:34:55 pm
Hello! I cannot run DFhack. I have installed it as the directions say, but every time I run DF, I get the message "Main index file missing/corrupted. The file "index" must be in the data folder. Make sure DF compressed into its folders properly". The problem is, it only does this when DFhack is installed. Index is in the data folder, and it is not corrupted.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 11, 2013, 12:02:06 am
how could I get the caste name of a unit?
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 11, 2013, 12:28:03 am
Looks like something like this should work, if you have a handle to the unit already.

Code: [Select]
local caste = df.creature_raw.find(unit.race).caste[unit.caste]
I don't know what the property is for the name of the caste, but you can do this in the Lua interpreter to print out all keys in a table:

Code: [Select]
for key, value in pairs(some_object) do print(key, value) end
You can substitute anything into some_object there, so you could do that with a caste variable or anything to dump out all of the properties.  That can be useful if you don't feel like looking it up in df-structures.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 11, 2013, 12:29:49 am
I knew the latter one, but the former one I didn't, thanks!

Also, I usually just go into the lua interpreter and use the included (very handy) printall(table) function they have.

Okay, so what I was looking for is this:

df.creature_raw.find(unit.race).caste[unit.caste].caste_name[0]

Thanks again!

EDIT: Ah--how could I get the current adventurer unit?
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 11, 2013, 12:56:25 am
Also, I usually just go into the lua interpreter and use the included (very handy) printall(table) function they have.

I knew there had to be an easier way to do that.  How did I miss this in the documentation?   :-\

Quote
EDIT: Ah--how could I get the current adventurer unit?

No idea about that, unfortunately, since I never use adventure mode.  Is there a look command in adventure mode you can center over yourself?  You could probably get it through dfhack.gui.getSelectedUnit() in that case, but that's hardly suitable for automated scripts.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 11, 2013, 01:07:46 am
Hmm. It appears that only adventurers (and perhaps former adventurers) have values in their adventurer_knows table, but I'll have to check that further.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 11, 2013, 01:08:12 am
Hit z to go to your stats window, then use dfhack.gui.getselectedunit(print.id)

What is the adventurer_knows table?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 11, 2013, 01:15:07 am
No idea, but it has a bunch of numbers (hist fig ids for units the player has talked to?) if the unit is an adventurer and nothing at all if unit is not an adventurer.

This function successfully found my adventurer:

Code: [Select]
function find_adventurer()
for _uid,unit in ipairs(df.global.world.units.all) do
if #unit.adventurer_knows~=0 then return unit end
end
end

player = find_adventurer()
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 11, 2013, 01:27:05 am
No idea, but it has a bunch of numbers (hist fig ids for units the player has talked to?) if the unit is an adventurer and nothing at all if unit is not an adventurer.

This function successfully found my adventurer:

Code: [Select]
function find_adventurer()
for _uid,unit in ipairs(df.global.world.units.all) do
if #unit.adventurer_knows~=0 then return unit end
end
end

player = find_adventurer()
better way to find adventurer:
Code: [Select]
-- some code to check if advmode here --
return df.global.world.units.active[0]
:)
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 11, 2013, 01:30:27 am
Haha, much simpler!

EDIT: Is there a way to check if a tile is a wall or similarly non-walkable terrain?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 11, 2013, 02:20:06 am
Haha, much simpler!

EDIT: Is there a way to check if a tile is a wall or similarly non-walkable terrain?
There is no sure way to tell without in depth analysis of surounding area (due to ramps) but there was:
Code: [Select]
local ttype=dfhack.maps.getTileType(coords)
local tileshape=df.tiletype.attrs[ttype].shape
return  df.tiletype_shape.attrs[tileshape]
you can see more info about this here:
https://github.com/angavrilov/df-structures/blob/master/df.tile-types.xml#L11
PS i'm not sure if that code snippet works, can't test it here.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 11, 2013, 07:00:53 pm
getTileType() apparently doesn't exist.
Title: Re: DFHack 0.34.11 r2
Post by: snooptodd on February 12, 2013, 07:38:54 am
Hello! I cannot run DFhack. I have installed it as the directions say, but every time I run DF, I get the message "Main index file missing/corrupted. The file "index" must be in the data folder. Make sure DF compressed into its folders properly". The problem is, it only does this when DFhack is installed. Index is in the data folder, and it is not corrupted.
I don't know anybody who can read minds. There is not enough info in this post to help you.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 12, 2013, 09:00:33 am
getTileType() apparently doesn't exist.
hmm it will soon exist :)
you could use "dfhack.maps.getTileBlock(coords)" and then a tile type lookup from it with modulo 16.
Title: Re: DFHack 0.34.11 r2
Post by: Dragoon209 on February 12, 2013, 09:28:18 am
To whoever is adding the additional notes and pictures to the Readme: THANK YOU!

My only gripe with DF Hack has been the documentation, which looks like its getting a nice update.  Thanks to all involved for making such an amazing tool!
Title: Re: DFHack 0.34.11 r2
Post by: peterix on February 13, 2013, 12:42:50 pm
I've moved the downloads to a different server because github is nuking its downloads section: http://dethware.org/dfhack/download/

If you link to the old download place somewhere, please fix your links.
Title: Re: DFHack 0.34.11 r2
Post by: IRIS_EYE_AZURE on February 13, 2013, 03:19:47 pm
Can someone help explain autoSyndrome to me?

I've been playing around with it, and it appears to be very limited in functionality. When the job complete event is called, the unit reference has already been removed from the job.

The lua eventful interface adds in the unit and building references, in addition to the job itself. I'm not sure why the cpp event isn't implemented in the same way.

Edit: I'm referring to a a built copy of the latest git files at https://github.com/peterix/dfhack
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on February 13, 2013, 09:39:22 pm
Give the syndrome the "\LOCATION" or "\UNIT_ID" synclass and it should give you more or less what you want.

https://github.com/peterix/dfhack/blob/master/plugins/autoSyndrome.cpp#L357
Title: Re: DFHack 0.34.11 r2
Post by: kragnoth on February 14, 2013, 11:33:19 am
Is there an adventure mode command to change current units stats and skills?  (built in command that I can't find, or am misusing, not a lua script I could create)

If not, I'll look into the scripting.  Thanks
Title: Re: DFHack 0.34.11 r2
Post by: vjek on February 14, 2013, 12:04:17 pm
Is there an adventure mode command to change current units stats and skills?  (built in command that I can't find, or am misusing, not a lua script I could create)

If not, I'll look into the scripting.  Thanks
my 'armoks_blessing' script works in adventure mode.  Just tested it with DF34.11 & DFHack34.11r2
You could likely adjust that to your needs.
Title: Re: DFHack 0.34.11 r2
Post by: Thundercraft on February 15, 2013, 09:56:33 am
Recently, I looked through the readme and GitHub for a way to cancel a dwarf party. About all I found was siren.lua. But that's not exactly what I was looking for:
Quote
Wakes up sleeping units, cancels breaks and stops parties either everywhere, or in the burrows given as arguments. In return, adds bad thoughts about noise, tiredness and lack of protection. Also, the units with interrupted breaks will go on break again a lot sooner...

Looking at the code, this is the part used to stop parties:
Code: [Select]
-- Stop parties
for _,v in ipairs(df.global.ui.parties) do
    local pos = utils.getBuildingCenter(v.location)
    if is_in_burrows(pos) then
        v.timer = 0
        for _, u in ipairs(v.units) do
            add_thought(unit, df.unit_thought_type.Tired)
        end
    end
end

If all I wanted to do was to stop a party without causing a negative thought and without the option to specify a burrow, could I simplify it down to this?
Code: [Select]
-- Stop parties
for _,v in ipairs(df.global.ui.parties) do
    v.timer = 0
end
The above would work as long as I included the "local utils = require 'utils'" line above it, correct? That's all I would need?
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on February 15, 2013, 11:34:39 am
Code: [Select]
-- Stop parties
for _,v in ipairs(df.global.ui.parties) do
    v.timer = 0
end
The above would work as long as I included the "local utils = require 'utils'" line above it, correct? That's all I would need?
That is right, and you don't need the "local utils = require 'utils'" line.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 15, 2013, 06:37:40 pm
I think you do, since the utils functions don't work when I try them.
Title: Re: DFHack 0.34.11 r2
Post by: KVC627 on February 15, 2013, 08:33:07 pm
Help, please:  ???
How do I get the magmasource script to work?

I've tried downloading the .rb script and dfhack doesn't see it.  Renaming it magmasource.lua and I get errors.

[DFHack]# magmasource here
...l Games\Dwarf\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:297: ...warf\Dwarf F
ortress 0.34.11\hack\scripts/magmasource.lua:3: unexpected symbol near '$'
stack traceback:
        [C]: in function 'error'
        ...l Games\Dwarf\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:297: in func
tion <...l Games\Dwarf\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:287>

Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 15, 2013, 08:35:04 pm
it's a ruby script, not a lua script. Renaming it to .lua just made it not work entirely.
Title: Re: DFHack 0.34.11 r2
Post by: Talanic on February 15, 2013, 11:46:40 pm
Hrm.  I'm trying to play around with RevFlood but it doesn't work the way I'd hoped.  It doesn't just reveal everywhere that has a path - if there are constructed walls, it treats them as open ground and reveals right through them.

I've already found a work-around for what I want to do - it doesn't look through the obsidian walls I place with Liquids.
Title: Re: DFHack 0.34.11 r2
Post by: KVC627 on February 16, 2013, 09:14:41 am
I got it, I had to update dfhack
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on February 16, 2013, 10:53:12 am
if there are constructed walls, it treats them as open ground and reveals right through them.
That is entirely by design - DF doesn't reveal tiles behind constructions when you remove them, so if you ever tried to remove them and designate something in the unrevealed area, the game would start rapidly spamming "could not find path" job cancellations.

Why exactly did you need to re-hide part of the map, anyways?
Title: Re: DFHack 0.34.11 r2
Post by: Sutremaine on February 16, 2013, 06:33:56 pm
Why exactly did you need to re-hide part of the map, anyways?
I've placed obsidian via liquids to get revflood to hide dug-out areas I'm finished with.
Title: Re: DFHack 0.34.11 r2
Post by: kragnoth on February 18, 2013, 07:12:28 am
Do bogeymen scale with the player in adventure mode?  I used the stat/skills dfhack script posted in response to my question, and I get 50 bogeymen at night and about 5 pages of text.

Its amazing what instantaneous combat between 8 bogeymen at once can do to even someone with legendary in everything.  It almost seems like it gives the bogeymen speed 0 when I use the make_legendary and boost stats scripts.   Or have I just successfully avoided bogeymen since the latest patch, and they've always been this overpowered even when by themselves?
Title: Re: DFHack 0.34.11 r2
Post by: vjek on February 18, 2013, 10:03:45 am
Personally, I remove Bogeymen from worldgen, given their level of annoyance.  But YMMV!
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on February 18, 2013, 02:37:47 pm
Do bogeymen scale with the player in adventure mode?  I used the stat/skills dfhack script posted in response to my question, and I get 50 bogeymen at night and about 5 pages of text.

Its amazing what instantaneous combat between 8 bogeymen at once can do to even someone with legendary in everything.  It almost seems like it gives the bogeymen speed 0 when I use the make_legendary and boost stats scripts.   Or have I just successfully avoided bogeymen since the latest patch, and they've always been this overpowered even when by themselves?
no their always professional stats. Also not to bad as a race of professional warriors if you assign a civ on to them. though in the current patches bogeymen are some what immune to vanilla resurrection or any general-class poison effects(don't quote me on that info on syndromes) but still have means of learning skills.
if you're out in the cackling you could set all wild civ units to civ 1. then wait out the next morning, or recruit one of the civ bogeys then offload them before the cackling ends.
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 18, 2013, 05:54:33 pm
What if the civ id of 1 matches a human civ you've pissed off though? Or do subterranean animal tribes get the first several civ numbers?
Title: Re: DFHack 0.34.11 r2
Post by: Thundercraft on February 21, 2013, 09:35:33 pm
Is it theoretically possible to write a script for DFHack that can change a Dwarf's likes or preferences? You know, to change things like "admires cats for their aloofness" or hatred of snails?

I searched this thread as well as the DFHack and DFusion readme's, but I could not find a mention of this. But I thought it could be possible since we can use it to change skills, stats, and practically anything else about a dwarf.

Also, is it possible to write a .lua or .cpp to detect if a given dwarf has a lover or spouse? I did notice something interesting in "Buildings.cpp": The setOwner function has this line:
Code: [Select]
if (auto spouse = df::unit::find(bld->owner->relations.spouse_id))
So that implies it is possible to determine a spouse. What about lover status?
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 21, 2013, 10:04:51 pm
Ah, well, there is also a lover_id. Don't know what significance it has, though.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 21, 2013, 10:59:14 pm
Yep.  If lover_id isn't set to -1, then the creature has a lover.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on February 21, 2013, 11:03:13 pm
Is it theoretically possible to write a script for DFHack that can change a Dwarf's likes or preferences? You know, to change things like "admires cats for their aloofness" or hatred of snails?
Absolutely - in fact, I've used it to add new preferences to units back in version 0.31.25 (in a fortress with a king who had no preferences in the first place, in a successful experiment to see if I could get him to make mandates).
Title: Re: DFHack 0.34.11 r2
Post by: WillowLuman on February 21, 2013, 11:04:41 pm
Can we set it so someone simultaneously likes and detests a vermin creature? If so, do they come out with a net happiness or net unhappiness from being locked in a room with several?
Title: Re: DFHack 0.34.11 r2
Post by: MaximumZero on February 22, 2013, 12:53:57 am
Is it theoretically possible to write a script for DFHack that can change a Dwarf's likes or preferences? You know, to change things like "admires cats for their aloofness" or hatred of snails?
If someone makes a dummy-proof version of this, please let me know.
Title: Re: DFHack 0.34.11 r2
Post by: expwnent on February 22, 2013, 09:43:08 am
Proof of concept: http://www.bay12forums.com/smf/index.php?topic=112276.0

I forget how I did it. I'll try to look into it later today.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on February 22, 2013, 10:38:56 am
Regarding preferences...

The link to pref_adjust has been in my sig and on the wiki for several months, now.  The older version for many months before that.  But not to be 'that guy'...

Spoiler: pref_adjust.lua (click to show/hide)
I used the 'rtbl' array to have a sorted list for another script that made them hate all domestic animals (in a range).  As such, it's superfluous and you could reference something like df.global.world.raws.creatures.all.[n].creature_id to do the same thing without that 'rtbl' array.

Oh and... standard disclaimer, the pref_adjust script changes ALL DWARVES IN PLAY.  If you want it to just affect a single dwarf, you'll have to modify it.
Title: Re: DFHack 0.34.11 r2
Post by: Thundercraft on February 22, 2013, 12:33:09 pm
Thanks, vjek.

I thought I vaguely recalled this having been done already. But, as I said, I could not find a mention of it in this thread, in DFHack's documents, or even on GitHub. Somehow, it escaped me to look in your awesome scripts. :-[
Title: Re: DFHack 0.34.11 r2
Post by: MaximumZero on February 22, 2013, 03:03:53 pm
How in the world are you supposed to get that to work on one dorf?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on February 22, 2013, 03:35:30 pm
What if the civ id of 1 matches a human civ you've pissed off though? Or do subterranean animal tribes get the first several civ numbers?
yeah animal tribes get civ numbers as well, though just for the safe side you best either don't piss off to many civs or assign it to your own.
Title: Re: DFHack 0.34.11 r2
Post by: IRIS_EYE_AZURE on February 22, 2013, 04:39:39 pm
Can someone help explain autoSyndrome to me?

I've been playing around with it, and it appears to be very limited in functionality. When the job complete event is called, the unit reference has already been removed from the job.

The lua eventful interface adds in the unit and building references, in addition to the job itself. I'm not sure why the cpp event isn't implemented in the same way.

Edit: I'm referring to a a built copy of the latest git files at https://github.com/peterix/dfhack
Give the syndrome the "\LOCATION" or "\UNIT_ID" synclass and it should give you more or less what you want.

https://github.com/peterix/dfhack/blob/master/plugins/autoSyndrome.cpp#L357

Follow up:
I modified autoSyndrome to print the current reaction being processed to the dfhack console. I'm not sure why, but the "couldn't find unit -1" message only appears on reaction products without syndromes. So in other words, autoSyndrome works, but puts out unnecessary spam messages to the console.

perhaps a check for syndromes on the reaction products could be done before the worker check?
Title: Re: DFHack 0.34.11 r2
Post by: Intrinsic on February 23, 2013, 07:49:36 am
Is there a way to display a currently selected dwarfs attributes? interested in speed only atm. ty.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 23, 2013, 12:00:25 pm
Is there a way to display a currently selected dwarfs attributes? interested in speed only atm. ty.

Go into the lua interface with "lua", highlight the dwarf you want with k, v, l or what have you, then type this:

dfhack.units.computeMovementSpeed(dfhack.gui.getSelectedUnit())

Lower is better.
Title: Re: DFHack 0.34.11 r2
Post by: Andux on February 23, 2013, 02:06:01 pm
How in the world are you supposed to get that to work on one dorf?

Change the last bit to something like:
Code: [Select]
-- ---------------------------------------------------------------------------
-- main script operation starts here
-- ---------------------------------------------------------------------------
local args = {...}
if not args[1] then
local unit=dfhack.gui.getSelectedUnit()
if unit then
clear_preferences(unit)
brainwash_unit(unit)
else
print("Select a unit, or use pref_adjust all to brainwash ALL dwarves.")
end
elseif string.upper(args[1])=="ALL" then
clearpref_all_dwarves()
adjust_all_dwarves()
else
print("Unknown argument: "..args[1])
end
Title: Re: DFHack 0.34.11 r2
Post by: Intrinsic on February 23, 2013, 02:26:33 pm
Is there a way to display a currently selected dwarfs attributes? interested in speed only atm. ty.

Go into the lua interface with "lua", highlight the dwarf you want with k, v, l or what have you, then type this:

dfhack.units.computeMovementSpeed(dfhack.gui.getSelectedUnit())

Lower is better.

Cheers that worked, i just have to remember to use v etc as i accidentally pressed q and then used the command and DF crashed :D
Title: Re: DFHack 0.34.11 r2
Post by: Meph on February 23, 2013, 07:54:03 pm
Coul dfhack supress the games inbuild auto-pause?

Example:
You use mining designations to designate an area to be dug. The game pauses.
You are in the military screen, assigning uniforms. The game pauses.
You are in the manager screen. The game pauses.

Could dfhack force the game to still run while using these menus? I am just asking for a potential hard-mode RTS option. ;)
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 23, 2013, 07:55:05 pm
Coul dfhack supress the games inbuild auto-pause?

Example:
You use mining designations to designate an area to be dug. The game pauses.
You are in the military screen, assigning uniforms. The game pauses.
You are in the manager screen. The game pauses.

Could dfhack force the game to still run while using these menus? I am just asking for a potential hard-mode RTS option. ;)

The menu pause? No, almost certainly not. There is a nopause plugin already included for other stuff, however.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on February 23, 2013, 07:58:04 pm
All the "normal" autopause can be disabled in the init.txt and the anouncements.txt. I do indeed mean the menu pause.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 23, 2013, 08:02:08 pm
All the "normal" autopause can be disabled in the init.txt and the anouncements.txt. I do indeed mean the menu pause.

Well, nopause disables pause entirely, even by the player, so it could be useful for a kind of hardcore RTS mode.
Title: Re: DFHack 0.34.11 r2
Post by: Thundercraft on February 23, 2013, 08:52:14 pm
The DF wiki is your friend. Try reading: DF2012:Announcement (http://dwarffortresswiki.org/index.php/DF2012:Announcement)
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 23, 2013, 08:53:25 pm
(He was asking about menu autopause, not announcement autopause)
Title: Re: DFHack 0.34.11 r2
Post by: Spy227X on February 23, 2013, 09:17:58 pm
Does not load
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 23, 2013, 09:41:04 pm
Does not load

This does not help in the slightest. Can you give any more specific info? How are you attempting to load it? When doesn't it load? Etc.
Title: Re: DFHack 0.34.11 r2
Post by: Di on February 24, 2013, 12:12:50 pm
Hi, everyone.
Could anyone tell me which buttons correspond to '*' and '/' in dwarf manipulator?
I try to get dwarves sorted by arrival in it but neither shift+8, nor Fn+button (laptop substitute for numpad) do anything.
Title: Re: DFHack 0.34.11 r2
Post by: Rose on February 24, 2013, 12:34:38 pm
Does your laptop have an Fn numpad? most do.
Title: Re: DFHack 0.34.11 r2
Post by: Di on February 24, 2013, 01:15:10 pm
Yes it has. But  its "+", "*" and "/" don't do anything.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on February 24, 2013, 06:46:17 pm
It should be the same keys you use for scrolling through lists one page at a time (e.g. dwarf inventory/skills/labors) - in keybinding config, "General" -> "Page secondary selector up/down".
Title: Re: DFHack 0.34.11 r2
Post by: zlurker on February 24, 2013, 09:39:06 pm
Just recently started a new game after not playing for about a year. Decided to modify the raws for the semi-/megabeasts so they're all pet_exotic and trainable. So, I ended up catching a minotaur in in one of my cage traps and proceeded to tame it up to domestic before noticing it has the EQUIPS tag. It hasn't tried to pick up any weapons on its own and someone mentioned using DFHack to somehow achieve this by switching to adventure mode as the minotaur, picking up the weapons I want it to use, then switching back. However I've never used DFHack prior and was hoping someone here could list the directions to achieve this, please.
Title: Re: DFHack 0.34.11 r2
Post by: Rose on February 24, 2013, 10:01:19 pm
if you type 'ls' you'll get a list of commands, but I think the one you're looking for is 'mode set' which has the instructions for its use built in.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 25, 2013, 12:37:07 am
This is probably pretty simple, but how does DF differentiate between babies / children / adults, other than age?  Just changing the age doesn't trigger the transition between the three.  Is there a flag somewhere that sets this?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 25, 2013, 12:39:05 am
This is probably pretty simple, but how does DF differentiate between babies / children / adults, other than age?  Just changing the age doesn't trigger the transition between the three.  Is there a flag somewhere that sets this?

I would just look in the raws for the CHILD and BABY tags, hehe.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 25, 2013, 12:54:23 am
Yeah, that works in general, but not quite what I'm looking for.  I probably should have been more specific.  :)

I was trying to find a way to immediately make a baby into an adult.  Just a single baby.  I set the age to the age I wanted, but that of course didn't trigger the baby to grow up into a peasant.  I ended up just changing the birth_time value to the next day in game, which triggered the transition to a child.  Changing it to the next day again triggered the change to an adult.

So that works anyway.
Title: Re: DFHack 0.34.11 r2
Post by: Di on February 25, 2013, 03:12:16 am
It should be the same keys you use for scrolling through lists one page at a time (e.g. dwarf inventory/skills/labors) - in keybinding config, "General" -> "Page secondary selector up/down".
Yep, that's it. Thanks.
Title: Re: DFHack 0.34.11 r2
Post by: zlurker on February 25, 2013, 04:08:49 am
Whoops, wrong thread.
Title: Re: DFHack 0.34.11 r2
Post by: mr_nomad on February 25, 2013, 07:12:16 am
So I had an error in DF of some kind that caused a massive tantrum spiral. I had legendary dining rooms, lots of food and booze, and individual great quality bedrooms for every dwarf. It didn't matter though because the negative thoughts were just outweighing all the positive I had (had two popular dwarves die at the same time due to burrows/forbidding doors refusing to work). Worst part is I'd unfortunately saved right after they died so I couldn't savescum. So I started looking for a DF utility to reset bad moods so I could fix this because I felt cheated by a bug (as opposed to legitimate !!FUN!!) and I'd already put a ton of effort into this fortress.

I finally came across this thread and realized the utility I was using (stonesense) was actually just a small part of this big awesome suite of tools and one of the listed tools in the documentation was called removebadthoughts. Only problem is apparently removebadthoughts is a ruby script and it requires the ruby plugin which doesn't come default with the standard dfhack install. Fortunately I discovered the github instructions on how to build your own version from the source files and after a ton of swearing and experimentation managed to pull it off.

In memory of the pain of the past 6 hours of searching, sweating, and tinkering, I decided to save as many people as I can the trouble I went through (as awesome as dfhack is it's still very much developer focused and not very layman friendly). So I've thrown up a vanilla build of dwarf fortress with nothing but the fully built version of dfhack for anyone who would like access to some of the more obscure scripts. I offer a word of warning though that there's probably a good reason that Peterix didn't include all of these in the standard build (instability issues most likely). I've tested and confirmed that all the default scripts plus removebadthoughts are fine to use but I can't speak for anything else so use them at your own peril (just backup your saves and you should be safe). Also this is windows only, sorry to anyone else but I only have my windows 7 machine working right now and I can't really build a linux version at the moment (maybe later on). Anyhow here you are:

Dwarf Fortress 0.31.11 + DFHack (All Scripts) (http://www.filedropper.com/dwarffortress_1)

TL;DR
- Download the above link if you want access to every single DFHack script including all the ones not packaged in the normal version (like removebadthoughts).
Title: Re: DFHack 0.34.11 r2
Post by: Rose on February 25, 2013, 07:56:09 am
Actually a more likely reason that those scripts are not included in the standard build is that they, quite simple, are made after the last release. The next one most likely will have them.
Title: Re: DFHack 0.34.11 r2
Post by: Thundercraft on February 25, 2013, 08:07:16 am
I think there's something to be said for relying on Peterix and GitHub as the source of DFHack. I can trust that source. Question: Are there still some Anti-virus software which give a false warning about DFHack? Or was that just with the old 2010 versions?

Anyway, after downloading this and trying to open the archive, I find I can't because it says it is corrupted or incomplete. I deleted and downloaded again, but got the same problem.  ???

Also, personally, I'd much prefer to download just the DFHack portion by itself, without Dwarf Fortress.
Title: Re: DFHack 0.34.11 r2
Post by: mr_nomad on February 25, 2013, 08:07:33 am
Actually a more likely reason that those scripts are not included in the standard build is that they, quite simple, are made after the last release. The next one most likely will have them.

Possibly but in looking/asking around I did come across some discussion about crashes and other issues with some of the scripts not included in the normal build (likely because they're still being worked on). I'm just making people aware that there may or may not be potential issues. I don't know enough about all these scripts to say "hey go for it it's fine" so I'd rather throw in that disclaimer then not.

I think there's something to be said for relying on Peterix and GitHub as the source of DFHack. I can trust that source. Question: Are there still some Anti-virus software which give a false warning about DFHack? Or was that just with the old 2010 versions?

Anyway, after downloading this and trying to open the archive, I find I can't because it says it is corrupted or incomplete. I deleted and downloaded again, but got the same problem.  ???

Also, personally, I'd much prefer to download just the DFHack portion by itself, without Dwarf Fortress.

What program are you using to open the archive? Also I can look into throwing up just the dfhack files if you'd like that.

EDIT: ok I tried hosting it again, this version is only the dfhack files. Hope it works for you. And yea I agree that the most trustworthy way to do this is to just build it from github yourself, this is for those people who can't/don't know how. I guess if you don't trust me, don't download it. All I can give is my word that there's no viruses or other malicious things on this. If you don't trust me you can of course follow the instructions at https://github.com/peterix/dfhack/blob/0.34.11-r2/Compile.rst which will guide you through how to build your own version. Otherwise my file is here for anyone who wants it.

DFHack (All Scripts) (http://www.filedropper.com/dfhack-03411-r2-windows)
Title: Re: DFHack 0.34.11 r2
Post by: MightyDorf on February 25, 2013, 10:55:50 am
Hello guys, I have an issue about dfhack's installation on vista : when I launch the game, dfhack's window doesn't automatically show up. When I try to run it manually, it doesn't work either. SDL.ll was replaced during the process and dfhack.init-example rewritten into dfhack.init. I play with the "accelerated df + modest mod".
Title: Re: DFHack 0.34.11 r2
Post by: Thundercraft on February 25, 2013, 06:36:43 pm
That download works fine. Though, while I expected it to be larger, I didn't expect it to be quite this large.

I noticed several files and folders that did not exist in the old version. Some are obvious. But the one that really has me scratching my head is "binpatch.exe". It's not large, but... isn't that a Windows\system32 file? What does DFHack need that for?

I also noticed that DFusion is completely absent. Was that an oversight? Or was it merged into the "hack" folder?

Speaking of, the "hack" folder ballooned from 5.28 MB in r2 to 12.92 MB! :o The main reason is SDL.lib, which is 4.95 MB. That file was not in the old version. And the "include" (1.47 MB), "patches" (28 KB), and "images" (0.12 MB) folders are new, as well.

The "images" folder contains .png screenshots of some new scripts/tools and they are appreciated and very compact - less than 8 KB each. (Nicely done!  :D) The "include" is obvious .h code and "patches" has .dif files for some of the scripts.

I guess my question is: Couldn't I just delete "include", "patches", "SDL.lib", and "binpatch.exe" and it would still work as intended? Also, what about DFusion? Could I just migrate the "dfusion" folder from the official r2 release?
Title: Re: DFHack 0.34.11 r2
Post by: mr_nomad on February 25, 2013, 07:17:21 pm
That download works fine. Though, while I expected it to be larger, I didn't expect it to be quite this large.

I noticed several files and folders that did not exist in the old version. Some are obvious. But the one that really has me scratching my head is "binpatch.exe". It's not large, but... isn't that a Windows\system32 file? What does DFHack need that for?

I also noticed that DFusion is completely absent. Was that an oversight? Or was it merged into the "hack" folder?

Speaking of, the "hack" folder ballooned from 5.28 MB in r2 to 12.92 MB! :o The main reason is SDL.lib, which is 4.95 MB. That file was not in the old version. And the "include" (1.47 MB), "patches" (28 KB), and "images" (0.12 MB) folders are new, as well.

The "images" folder contains .png screenshots of some new scripts/tools and they are appreciated and very compact - less than 8 KB each. (Nicely done!  :D) The "include" is obvious .h code and "patches" has .dif files for some of the scripts.

I guess my question is: Couldn't I just delete "include", "patches", "SDL.lib", and "binpatch.exe" and it would still work as intended? Also, what about DFusion? Could I just migrate the "dfusion" folder from the official r2 release?

Looking it up apparently binpatch is for automated patching of binary files. I assume it has to do with the process of compiling the source into the finalized DFHack build though you'd probably have to ask someone more familiar with DFHack than me (this is only like my second day of using it haha). Looking it up it seems to be a legit program (http://binpatch.sourceforge.net/doc.html) but beyond that I can't say fully what it's doing in DFHack.

And yes, DFusion is now in the hack folder as a lua script (if you use 'ls' inside DFHack you should see it listed in there still). As to SDL.lib it's just a library that gives access to input and graphics options (http://www.libsdl.org/) and is likely there for use by some of the additional scripts that the "all" version includes. I believe that's likewise true for the include, patches, and images folders which probably contain the resources for the additional scripts. I suppose you could try to remove them but I imagine most if not all of these files are used by all the extended DFHack scripts so it may stop running properly.
Title: Re: DFHack 0.34.11 r2
Post by: zlurker on February 25, 2013, 07:19:43 pm
If you use the the feature show on an adamantine deposit will the monarch show up? I remember that being a pretty infallible trigger or so it seemed and was curious.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 25, 2013, 07:23:21 pm
If you use the the feature show on an adamantine deposit will the monarch show up? I remember that being a pretty infallible trigger or so it seemed and was curious.

I don't think that works anymore since .31.x?  Doesn't the monarch depend on the complex architecture and population requirements now instead of the discovery of adamantine?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 25, 2013, 07:24:46 pm
If you use the the feature show on an adamantine deposit will the monarch show up? I remember that being a pretty infallible trigger or so it seemed and was curious.

I don't think that works anymore since .31.x?  Doesn't the monarch depend on the complex architecture and population requirements now instead of the discovery of adamantine?

I've had the monarch show up when I gave Adamantine [SEDIMENTARY] etc. and just mined a lot of it.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on February 25, 2013, 07:41:28 pm
Looking it up apparently binpatch is for automated patching of binary files. I assume it has to do with the process of compiling the source into the finalized DFHack build though you'd probably have to ask someone more familiar with DFHack than me (this is only like my second day of using it haha). Looking it up it seems to be a legit program (http://binpatch.sourceforge.net/doc.html) but beyond that I can't say fully what it's doing in DFHack.
Actually, the "binpatch.exe" that comes with DFHack has nothing to do with that SourceForge project - it's actually part of DFHack (https://github.com/peterix/dfhack/blob/master/library/binpatch.cpp) and it's used to [un]apply binary patches to the Dwarf Fortress executable to fix bugs Toady hasn't gotten around to fixing yet.
Title: Re: DFHack 0.34.11 r2
Post by: mr_nomad on February 25, 2013, 08:16:57 pm
Looking it up apparently binpatch is for automated patching of binary files. I assume it has to do with the process of compiling the source into the finalized DFHack build though you'd probably have to ask someone more familiar with DFHack than me (this is only like my second day of using it haha). Looking it up it seems to be a legit program (http://binpatch.sourceforge.net/doc.html) but beyond that I can't say fully what it's doing in DFHack.
Actually, the "binpatch.exe" that comes with DFHack has nothing to do with that SourceForge project - it's actually part of DFHack (https://github.com/peterix/dfhack/blob/master/library/binpatch.cpp) and it's used to [un]apply binary patches to the Dwarf Fortress executable to fix bugs Toady hasn't gotten around to fixing yet.

Ah ok, good to know.
Title: Re: DFHack 0.34.11 r2
Post by: Thundercraft on February 25, 2013, 08:45:45 pm
I was going to say. Reading the News (https://github.com/peterix/dfhack/blob/master/NEWS) for DFHack:
Spoiler: "binpatch in 'News'" (click to show/hide)

And it seems GitHub has three different versions of binpatch:
Spoiler (click to show/hide)

But, I'm still curious to know how "SDL.lib" is used.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on February 25, 2013, 10:10:42 pm
And it seems GitHub has three different versions of binpatch:
Spoiler (click to show/hide)
They're not different versions, but different parts of it - the first one is a standalone program for permanently applying patches to DF (while it's not running), the second one is a Lua script for temporarily applying patches to DF while it's running, and the 3rd one is a library used by the 2nd one (which can potentially also be used by other Lua scripts).

But, I'm still curious to know how "SDL.lib" is used.
That's only needed if you want to compile new plugins without having to compile DFHack itself - if all you're going to do is distribute the binaries, that file is completely unneeded, as are the headers in the "include" directory.
Title: Re: DFHack 0.34.11 r2
Post by: sideflare on February 26, 2013, 07:03:44 pm
Technical problem here  :-[. I can't get the "search" plugin of DFHack to work (the one that lets you search the Stocks list). I am running the latest version of Lazy Newb Pack.

The DFHack readme implies that "search" is built into DFHack as-is, but it doesn't work and when I go to \hack\plugins, it's .dll was missing. So I downloaded search.plug.dll, but wasn't sure how to install it. I simply pasted it into my \hack\plugins directory. But now when I start the game, Windows 7 gives me the error: "Dwarf Fortress.exe - Entry Point Not Found" and DFHack gives the the error: "Can't load plugin ...\hack\plugins\search.plug.dll"

Clearly I don't know how to install plugins into DFHack. I searched the readme / install instructions, but what am I missing!!! Thank you <3
Title: Re: DFHack 0.34.11 r2
Post by: danaris on February 26, 2013, 08:24:04 pm
Technical problem here  :-[. I can't get the "search" plugin of DFHack to work (the one that lets you search the Stocks list). I am running the latest version of Lazy Newb Pack.

The DFHack readme implies that "search" is built into DFHack as-is, but it doesn't work and when I go to \hack\plugins, it's .dll was missing. So I downloaded search.plug.dll, but wasn't sure how to install it. I simply pasted it into my \hack\plugins directory. But now when I start the game, Windows 7 gives me the error: "Dwarf Fortress.exe - Entry Point Not Found" and DFHack gives the the error: "Can't load plugin ...\hack\plugins\search.plug.dll"

Clearly I don't know how to install plugins into DFHack. I searched the readme / install instructions, but what am I missing!!! Thank you <3

If your copy of DFHack didn't come with the search plugin, there's a good chance it's a slightly older version that doesn't yet support it.

You should be able to download the latest DFHack in its entirety from the beginning of this thread, and install it over the copy you have.

...I think.
Title: Re: DFHack 0.34.11 r2
Post by: sideflare on February 26, 2013, 08:45:10 pm
Wow, Danaris, you're right! I figured since I had LNP direct from the official thread (http://www.bay12forums.com/smf/index.php?topic=59026.0), that it would be all up to date. But it only had DFHack 0.34.11 r1, which you were exactly right, did not include the Search plugin.

I simply overwrote my existing DFHack install with the new 0.34.11 r2, and Search now functions out of the box.

Thanks!
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on February 26, 2013, 08:49:01 pm
LNP is the specific thing mentioned by most sources as the common cause of not-up-to-date DFHack :P
Title: Re: DFHack 0.34.11 r2
Post by: Meph on February 26, 2013, 09:28:03 pm
Just wanted to drop a little tid-bit of information here: Add_spatter also works on ballista ammo.

I tested dynamite coated ballista ammo successfully. It has a syndrome that adds an interaction to the target. The interaction causes them to spawn a cloud of a very hot material, simulating an explosion.
Title: Re: DFHack 0.34.11 r2
Post by: Dragoon209 on February 27, 2013, 03:47:35 pm
Hello!

   I was hoping I could get a hand on making workflow work a bit better with my mod.  (Upgradable Leather Tiers, Link in Sig)

   My problem stems from the production of the new leather types.  When I try to set workflow up to work with it, It doesn't seem to detect the different leather materials.  I will post my reactions from the workshop, and the materials of the new leather.

Spoiler: Reactions (click to show/hide)

Spoiler: Materials (click to show/hide)

   The reactions are pretty basic, and the materials are actually copied from the Metals they emulate, and only have name changes, and reaction classes, and Material Reaction Products added.  I am able to use workflow to manage the amount of armor studs, but not the leather upgrades.  I am able to make the upgraded leather pieces when I queue them up at the workshops via standard DF commands.  I have tried automating it with workflow in DFHack 0.34.11 r2, and with a new build  of the gui/workflow pulled from git.   Neither seems to give any indication that the reactions make different products.

Am I doing something wrong (Likely), or is this a limitation of Workflow/Dwarf Fortress?  If its a limitation, is there anything I can to to make it more compatible? 

Thanks!
Title: Re: DFHack 0.34.11 r2
Post by: RickRollYou2 on February 28, 2013, 05:45:43 am
Sorry if this sounds really noob, but I need a script to set a unit with the stunned EDIT: Unconscious flag so I can cage it...
I know this could only be two lines of code, but I have 0 experience with anything other than html so... any help would be much appreciated!
Title: Re: DFHack 0.34.11 r2
Post by: Andux on February 28, 2013, 03:02:57 pm
Code: (ko_unit.lua) [Select]
-- Knocks a unit unconscious.
local sleepytime = 100
local args = {...}
if args[1] then
sleepytime = tonumber(args[1])
end
local unit = dfhack.gui.getSelectedUnit()
if unit then
unit.counters.unconscious = sleepytime
end

By default, the unconscious lasts for 100 simulation "frames" (= ~1 second of real time, assuming default init settings), but you can specify a different number if desired; ko_unit 0 will instantly wake the selected unit.
Title: Re: DFHack 0.34.11 r2
Post by: RickRollYou2 on February 28, 2013, 05:09:36 pm
Thank you so much!  :)
Title: Re: DFHack 0.34.11 r2
Post by: Tabithda on February 28, 2013, 09:58:38 pm
Using the empregnate tool on a creature that lacks a caste with the [MALE] token seems to result in the game crashing as soon as the birthing of the child is supposed to take place.  Does anyone have any idea as to what might be causing this?
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on February 28, 2013, 11:59:13 pm
I've used it on unmarried females before, so I have no idea why it would depend on there being a male anything to work properly.  Did you use it on a female, or was the thing you impregnated genderless too?
Title: Re: DFHack 0.34.11 r2
Post by: Tabithda on March 01, 2013, 01:02:47 am
The creature was female; impregnating a genderless or male creature simply results in nothing happening, not a game crash.  The problem here is not that the creature is not married, but rather that the creature does not have a caste with the [MALE] token in its creature file.

This crash can be easily replicated by placing a harpy in arena mode and using the empregnate tool on it.  What I am having trouble figuring out is why the lack of a caste with the [MALE] token is causing the game to crash.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on March 01, 2013, 02:21:42 am
I don't know, that's a tough one and possibly a bug.  I'd suggest maybe it's related to having to look up the father or something, but since the creature isn't married (and I know that works), that seems unlikely.  Also seems unlikely that it's a result of the baby being born and the game deciding it should be male and not finding a suitable caste.  I don't think that's how it selects castes.

Have you tested this on more than one creature that has no male castes?
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on March 01, 2013, 06:44:56 am
I don't know, that's a tough one and possibly a bug.  I'd suggest maybe it's related to having to look up the father or something, but since the creature isn't married (and I know that works), that seems unlikely.  Also seems unlikely that it's a result of the baby being born and the game deciding it should be male and not finding a suitable caste.  I don't think that's how it selects castes.

Have you tested this on more than one creature that has no male castes?
you can recreate the crash by slapping a female gender on a genderless creature then impregnate it(did this with bogeymen one day). so it's might have to do with looking for another Male or unit with the opposite sex but not finding one in the raws and crashing.
Title: Re: DFHack 0.34.11 r2
Post by: Fungus on March 01, 2013, 09:38:25 am
Meph sent me here as I've been messing with steam engines in the Mastework mod but I can't get them to work. My problem as copied from the Masterwork thread:

Spoiler (click to show/hide)

Can anybody help me out here? I've done extensive googling and readme reading but nothing helps. You guys are my last resort. Shoot!
Title: Re: DFHack 0.34.11 r2
Post by: Meph on March 01, 2013, 10:15:49 am
Which brings me here too. I did a testrun of all plugins and additions, but I have a problem with the siege engine.

My init:
# siege engine control
keybinding add Ctrl-A@dwarfmode/QueryBuilding/Some/SiegeEngine gui/siege-engine

But when I hover with 'q' over a loaded ballista/catapult ingame and press Ctrl+A nothing happens. Tried different hotkeys as well... anything I have to enable first, and if yes, how to enable it by default?
Title: Re: DFHack 0.34.11 r2
Post by: Tabithda on March 01, 2013, 11:33:16 pm
I don't know, that's a tough one and possibly a bug.  I'd suggest maybe it's related to having to look up the father or something, but since the creature isn't married (and I know that works), that seems unlikely.  Also seems unlikely that it's a result of the baby being born and the game deciding it should be male and not finding a suitable caste.  I don't think that's how it selects castes.

Have you tested this on more than one creature that has no male castes?
you can recreate the crash by slapping a female gender on a genderless creature then impregnate it(did this with bogeymen one day). so it's might have to do with looking for another Male or unit with the opposite sex but not finding one in the raws and crashing.
Well, after messing around with the lua code for the empregnate tool I found that changing this line:
Code: [Select]
unit.relations.pregnancy_mystery=1to this:
Code: [Select]
unit.relations.pregnancy_mystery=0seems to fix the problem.  I am not quite sure why, but it works now.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on March 01, 2013, 11:41:08 pm
That's very interesting... and may shed some light on what the mystery field is for.  I can't quite figure it out just from those two data points though.
Title: Re: DFHack 0.34.11 r2
Post by: Splint on March 02, 2013, 12:38:32 am
This seems like a good place to ask. Is there anything I can use to remove the drowsy flag from a dwarf? Something other than siren that will let the dwarf sleep normally but clear the status (At present two important soldiers are in a coma simply because despite sleeping, they're still flagged as drowsy and was hoping someone had something to alleviate that.)

Would the above knockout script be applicable to wake them?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 02, 2013, 12:42:38 am
unit.counters2.sleepiness_timer=0 ? Or is the number counting down and not up?
Title: Re: DFHack 0.34.11 r2
Post by: Splint on March 02, 2013, 12:44:10 am
I have no idea. But they've been out for well over a season and still listed as drowsy. The other dwarves are keeping them alive though thankfully but I'd like my champion back on her feet.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 02, 2013, 12:49:48 am
I have no idea. But they've been out for well over a season and still listed as drowsy. The other dwarves are keeping them alive though thankfully but I'd like my champion back on her feet.

No, try that. Go into the lua interface and type "dfhack.gui.getSelectedUnit().counters2.sleepiness_timer = 0" as a single line while having your soldier highlighted and see what that does.
Title: Re: DFHack 0.34.11 r2
Post by: Splint on March 02, 2013, 12:56:23 am
Oh. Sorry, not exactly my realm of understanding. I'll give it a shot and see if it works. If it does, then thank you very much.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 02, 2013, 01:05:20 am
Oh. Sorry, not exactly my realm of understanding.

Oh, it's simple enough, kinda like Bethesda's console. In fact, the interactive lua console basically acts as a console for this game anyway; the issue is that there is a DAMN lot that can be edited with it, to the level that it's almost overwhelming and overwhelmingly likely to crash your game if you do something really wrong.
Title: Re: DFHack 0.34.11 r2
Post by: ag on March 02, 2013, 01:17:22 am
Spoiler (click to show/hide)

Can anybody help me out here? I've done extensive googling and readme reading but nothing helps. You guys are my last resort. Shoot!

This sounds exactly like the kind of effects you would get if the plugin isn't actually loaded and running properly.

Edit: Steam engine MUST be a workshop, not a furnace. There is no freedom of choice in this point.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on March 02, 2013, 01:52:42 am
Oh. Sorry, not exactly my realm of understanding.

Oh, it's simple enough, kinda like Bethesda's console. In fact, the interactive lua console basically acts as a console for this game anyway; the issue is that there is a DAMN lot that can be edited with it, to the level that it's almost overwhelming and overwhelmingly likely to crash your game if you do something really wrong.
which is why you should always save before doing these changes.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 02, 2013, 01:53:30 am
And also why DFHack includes a quicksave feature :P
Title: Re: DFHack 0.34.11 r2
Post by: Splint on March 02, 2013, 03:41:56 am
Ok so i finally got around to fiddling around with that line you gave me and it simply said it wasn't a valid command.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on March 02, 2013, 04:22:47 am
And also why DFHack includes a quicksave feature :P
for fort mode, adventure mode doesn't have that luxury.
Title: Re: DFHack 0.34.11 r2
Post by: Angel Of Death on March 02, 2013, 07:22:56 am
Is there a way I can select people on the map to become a part of my fort? I'm in the middle of a bit of a nasty invasion, and I want to cause a bit of chaos before I pull the doomsday lever.

Well, that was mighty stupid of me. I forgot to read the readme. Oops.
Title: Re: DFHack 0.34.11 r2
Post by: Intrinsic on March 02, 2013, 08:06:47 am
Quick little script to return the speed of the currently selected unit. Lower is better.
Ended up making this as i kept crashing my game by forgetting to select a unit ;p

Code: [Select]
-- Returns the speed of the currently selected unit, lower is better.

function get_speed()
unit=dfhack.gui.getSelectedUnit()

if unit==nil then
print ("No unit under the cursor, please select one using v etc.")
return
end

print(dfhack.units.computeMovementSpeed(dfhack.gui.getSelectedUnit()))
end

get_speed()
Title: Re: DFHack 0.34.11 r2
Post by: Fungus on March 02, 2013, 09:48:09 am
Spoiler (click to show/hide)

Can anybody help me out here? I've done extensive googling and readme reading but nothing helps. You guys are my last resort. Shoot!

This sounds exactly like the kind of effects you would get if the plugin isn't actually loaded and running properly.

Edit: Steam engine MUST be a workshop, not a furnace. There is no freedom of choice in this point.
Ok well they are under the furnace category. How do I run the plugin? How do I make sure it's working? And why am I having this problem in the first place?
Title: Re: DFHack 0.34.11 r2
Post by: ag on March 02, 2013, 10:53:57 am
Ok well they are under the furnace category. How do I run the plugin? How do I make sure it's working? And why am I having this problem in the first place?

The raws are wrong, so it won't work in that world.
Title: Re: DFHack 0.34.11 r2
Post by: Splint on March 02, 2013, 11:40:51 am
Alright after rereading what was said (and making myself feel stupid for missing the letters l, u, and a,) I have gotten my soldiers out of their otherwise seemingly irreversible comas. Thanks Putnam.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on March 02, 2013, 01:06:15 pm
Quote
Edit: Steam engine MUST be a workshop, not a furnace. There is no freedom of choice in this point.

Well... crap. Its under Furnaces in the MasterworkDF mod. I could put it back into workshops (didnt knew that would affect anything) but I would really prefer that it would be added as a furnace. Simply for realisms sake. A steam boiler is per definition a furnace.
Title: Re: DFHack 0.34.11 r2
Post by: ag on March 02, 2013, 01:12:27 pm
Furnaces simply don't have a certain data structure necessary for connecting to machines.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on March 02, 2013, 01:16:31 pm
Understood. I will convert it back to a workshop for the next version. Thanks, at least I now know why it had problems.

Is there a workshop that needs power in work for dfhack r3? Like the millstone... that would be a nice addition for mods. :)
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 03, 2013, 02:08:25 am
Any way to get if a unit is within another unit's line of sight?

EDIT: Eh, I'll probably just go with 25 x 25...
Title: Re: DFHack 0.34.11 r2
Post by: Deon on March 03, 2013, 03:20:26 am
So any info on how the autosyndome is coming along? I've been waiting for the new release for a while :).
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 03, 2013, 03:21:56 am
Looks like it's doing pretty well, since it's on the github now. (https://github.com/peterix/dfhack/blob/master/plugins/autoSyndrome.cpp)
Title: Re: DFHack 0.34.11 r2
Post by: Meph on March 03, 2013, 03:48:53 am
The version I send you was finished as far as I know. Its just that it relies on parts of the next update, r3, and cant be released on its own. At least thats how I understood it. I'm waiting as well ;)

Edit: Well, maybe I should just copy the code from githhub and see if it works with r2. ^^
Title: Re: DFHack 0.34.11 r2
Post by: Splint on March 03, 2013, 09:21:34 am
Ok, so i seem to be having some issues with my soldiers again. Or one anyway. He gets drowsey but sleeping just puts him ina coma. Anything df hack can do to alleviate this? I'd rather not have to run the lua thing every time one or both soldiers finishes an action.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 03, 2013, 01:27:28 pm
Edit: Well, maybe I should just copy the code from githhub and see if it works with r2. ^^

I think you'll have to compile the entire thing...
Title: Re: DFHack 0.34.11 r2
Post by: Meph on March 03, 2013, 01:31:15 pm
Nonsense. I simply copy the code into a .txt, rename it to .dll and I'm done. It will totally work, trust me. - he said, oblivious to all facts.

I have no idea how this works
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 03, 2013, 01:35:03 pm
https://github.com/peterix/dfhack/blob/master/Compile.rst
Title: Re: DFHack 0.34.11 r2
Post by: Fungus on March 03, 2013, 05:30:25 pm
Ok well they are under the furnace category. How do I run the plugin? How do I make sure it's working? And why am I having this problem in the first place?

The raws are wrong, so it won't work in that world.
Thanks for the help, hopefully when they're registered as a workshop in Masterwork this'll be the end of the problems. Tried to do it myself but... Well, the process swelled my already bloated respect for modders.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 03, 2013, 05:33:25 pm
The process is literally changing a single instance of BUILDING_FURNACE to BUILDING_WORKSHOP >_>
Title: Re: DFHack 0.34.11 r2
Post by: Fungus on March 03, 2013, 05:40:48 pm
Well... I kept moving it to a different file. The mistakes I made there were !!fun!! as I'm sure you can imagine.

EDIT: This is why I don't listen to music while working. Curse you Joni Mitchell, even my dwarves aren't safe.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 03, 2013, 05:49:03 pm
Well... I kept moving it to a different file. The mistakes I made there were !!fun!! as I'm sure you can imagine.

Can't imagine how moving something to a different file would cause that >_>
Title: Re: DFHack 0.34.11 r2
Post by: Fungus on March 03, 2013, 05:54:31 pm
Well. Not deleting the old entry, not changing FURNACE, copying it into the wrong part of the file (i.e. into another workshop), deleting the colon, misspelling WORKSHOP, different combinations of the above and more. I guess I just can't copy and sing effectively.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on March 04, 2013, 05:29:31 pm
Is there any way to fling units into the air with DFHack's Lua interface?  I've tried just setting the z coordinate of the unit to be a few z-levels above the ground, but they just stand there in the air.  I thought perhaps it was a flag that had to be set, but the projectile flag only makes it impossible to select them with the 'v' or 'k' keys.

Any other ideas?

For what it's worth, I'm just trying to find a simple way to injure something.  If there's an easier way I'm all ears.  There is the wounds vector under the body structure, but it seems to be almost completely unknown and probably not remotely simple to manipulate.

Edit: Alright, this worked the next time I tried it (on a different unit).  That's strange...
Edit2: Ok, apparently it works if you set their z coordinate up by 2, but more than that causes them to just stand around in the air.  Most strange.
Title: Re: DFHack 0.34.11 r2
Post by: Meph on March 04, 2013, 05:40:38 pm
Why is my first instict to think of dwarves on catapults ? ^^
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on March 04, 2013, 08:05:18 pm
Edit2: Ok, apparently it works if you set their z coordinate up by 2, but more than that causes them to just stand around in the air.  Most strange.
You probably moved the unit into an unallocated map block.

By the way, manually changing a unit's coordinates is a dangerous thing to do because it will result in the map's "unit occupancy" flags getting out of sync, leading to this (http://www.bay12games.com/dwarves/mantisbt/view.php?id=3499) bug.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 04, 2013, 08:09:19 pm
Any way around that, Quietust?
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on March 04, 2013, 08:17:17 pm
Any way around that, Quietust?
Yes - manually clear the occupancy flag at the source tile depending on whether the unit is prone, then set the appropriate flag in the destination tile. Take a look at the sources for the "fastdwarf" plugin for an example.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on March 04, 2013, 09:48:22 pm
Edit2: Ok, apparently it works if you set their z coordinate up by 2, but more than that causes them to just stand around in the air.  Most strange.
You probably moved the unit into an unallocated map block.

By the way, manually changing a unit's coordinates is a dangerous thing to do because it will result in the map's "unit occupancy" flags getting out of sync, leading to this (http://www.bay12games.com/dwarves/mantisbt/view.php?id=3499) bug.

That definitely sounds like it had something to do with it.  The problem seemed to manifest at specific z-levels above 0, not just above the ground.  I tried it again over a hole and it worked fine at 3 z-levels.

Hopefully I didn't break anything in my map data.  If it's just a matter of the occupancy flags I can probably fix those manually if it ever comes up as a problem.  I'll have to note to be more careful about moving things around this way in the future though.
Title: Re: DFHack 0.34.11 r2
Post by: Rumrusher on March 04, 2013, 09:52:13 pm
also you're better off shoving your men into minecarts and pumping the carts with enough G to send them flying.
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on March 04, 2013, 10:01:00 pm
Yeah, if I wanted to go through the trouble of engineering a way to injure dwarves that would be fantastic.  I was just looking for a quick way to injure them from the interactive interface since I have no such thing set up.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 04, 2013, 10:01:23 pm
Hopefully I didn't break anything in my map data.  If it's just a matter of the occupancy flags I can probably fix those manually if it ever comes up as a problem.  I'll have to note to be more careful about moving things around this way in the future though.

Always test your scripts in the arena.

You could always include a check to see if the z-level you want them to teleport to is invalid:

Code: [Select]
function tileIsValid(pos)
local tileSize = {dfhack.maps.getTileSize()}
for k,v in ipairs(tileSize) do
if pos[k]>=v then return false
end
return true
end

(Note: wrote this up as a quickie, not sure if it's right)
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on March 04, 2013, 10:49:42 pm
I know there is a script for make legendary, but how would I make a script to make a skill set to 0? I don't want my military to have civvie skills, because then they don't look as neat all lined up in a row. Also, would setting that skill to zero make them a peasant? Or would you have to make a separate script to change their profession type?
Title: Re: DFHack 0.34.11 r2
Post by: Dragoon209 on March 04, 2013, 10:55:01 pm
Evening gentlemen,

   I was doing some more testing, and realized that the new leather types I have been experimenting with are showing up in the workflow GUI, but sadly nested under each creature. Is there a way to use workflow to pick materials with reaction classes?

My original info and questions are here for reference: http://www.bay12forums.com/smf/index.php?topic=91166.msg4064736#msg4064736

Thanks!
Title: Re: DFHack 0.34.11 r2
Post by: vjek on March 05, 2013, 12:31:34 am
I know there is a script for make legendary, but how would I make a script to make a skill set to 0? I don't want my military to have civvie skills, because then they don't look as neat all lined up in a row. Also, would setting that skill to zero make them a peasant? Or would you have to make a separate script to change their profession type?
Removing all their skills does make them a peasant, yes.

Here's a snippet that should work to remove all skills from all dwarves in play.  As usual, it can be easily modified to work with a single dwarf.

Spoiler: remove_all_skills.lua (click to show/hide)

Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 05, 2013, 12:33:18 am
Haha, I like the way you give the user info on what the program's doing.
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on March 05, 2013, 11:24:46 am
I know there is a script for make legendary, but how would I make a script to make a skill set to 0? I don't want my military to have civvie skills, because then they don't look as neat all lined up in a row. Also, would setting that skill to zero make them a peasant? Or would you have to make a separate script to change their profession type?
Removing all their skills does make them a peasant, yes.

Here's a snippet that should work to remove all skills from all dwarves in play.  As usual, it can be easily modified to work with a single dwarf.

Spoiler: remove_all_skills.lua (click to show/hide)
Will this change their profession to peasant automatically, or will that require another skill update. To show you what I mean: if you used make-legendary to change a peasant into a miner, would it call him a miner from the second you ran the script, or would it take another skill check to change his profession?
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on March 05, 2013, 11:30:46 am
Just looking at the code, I strongly suspect he'd have to gain experience or do a job of some fashion for the game to recognize the change.
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on March 05, 2013, 11:45:02 am
Just looking at the code, I strongly suspect he'd have to gain experience or do a job of some fashion for the game to recognize the change.
Do you know a way to change that?
Title: Re: DFHack 0.34.11 r2
Post by: Telgin on March 05, 2013, 11:52:22 am
Offhand, no, but it's probably an enum field in the unit struct that can be set.  I'm at work right now so I can't really fiddle with it, but in theory it's doable without much modification to the script.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on March 05, 2013, 01:16:43 pm
Just looking at the code, I strongly suspect he'd have to gain experience or do a job of some fashion for the game to recognize the change.
Yep, in the form I posted, this is accurate.  If the unit has a profession, and you remove all their skills, they will become a peasant (as an announcement) only after an additional update.  I've seen this happen (almost immediately) after a change of personality, preferences and attributes, but I don't know what the real/proper trigger is.
The profession update also seems to happen about one in-game month after a change in skill, typically.  To see this, you can embark with a starting seven that have skills allocated from the embark preparation screen, run remove_all_skills.lua, and then wait a month.  You'll see a/some/all dwarves be reduced to Peasants, as an announcement, after that in-game month has passed.
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on March 05, 2013, 01:28:39 pm
I tried this script and it removed all skills from all adult dwarves. WTF?
Title: Re: DFHack 0.34.11 r2
Post by: vjek on March 05, 2013, 01:40:24 pm
I tried this script and it removed all skills from all adult dwarves. WTF?

Almost like... it was meant to do that, eh?  And is the first line in the code acting as a description, which is displayed when you see the tool listed in 'ls' ...  :D

Ok, to have a single dwarf changed to a Peasant immediately (without an announcement), you can use:
--
EDIT:  I removed the code.  I'll put in a new post when I have time to test it properly.
--
Again, this doesn't address the problem of triggering the announcement and background check that would trigger it normally, but it does what you wanted, tahujdt.
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on March 05, 2013, 01:42:17 pm
How can I make it target an individual dwarf?
Title: Re: DFHack 0.34.11 r2
Post by: vjek on March 05, 2013, 01:46:55 pm
How can I make it target an individual dwarf?
I don't have time to separate that out today, but I strongly encourage you to look at the script and try cutting it out yourself.  LUA is a well documented and syntactically pleasant language, compared to some.  You can look at my individual-dwarf-affecting scripts on the wiki as a guide.
If you or someone else hasn't done that sometime between now and later in the week, I should have time in a few days and will post it then.
Title: Re: DFHack 0.34.11 r2
Post by: Sutremaine on March 05, 2013, 10:24:14 pm
How would you do this for individual skills? It bugs me that any XP at all in a skill means that it stays on the dwarf's skill list forever.
Title: Re: DFHack 0.34.11 r2
Post by: Intrinsic on March 06, 2013, 04:44:24 am
How can I make it target an individual dwarf?
I don't have time to separate that out today, but I strongly encourage you to look at the script and try cutting it out yourself.  LUA is a well documented and syntactically pleasant language, compared to some.  You can look at my individual-dwarf-affecting scripts on the wiki as a guide.
If you or someone else hasn't done that sometime between now and later in the week, I should have time in a few days and will post it then.

Code: [Select]
-- Remove all skills for the currently selected dwarf. Use v etc to select a unit in game
-- ---------------------------------------------------------------------------
function BreathOfArmok(v)
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit available!  Aborting with extreme prejudice.")
return
end

local skills=unit.status.current_soul.skills
for index,skill in ipairs(skills) do
   skill:delete()
end
skills:resize(0)
unit.profession = df.profession["STANDARD"]
print ("The foul breath of Armok has engulfed "..unit.name.first_name)
end
-- ---------------------------------------------------------------------------

BreathOfArmok()

This should do it i guess? completely untested, and it'll try and wipe the skills for anything selected, even a dog so may blow up(crash your game) :D will prolly be cheesy if used on an FB...
Title: Re: DFHack 0.34.11 r2
Post by: Mr S on March 06, 2013, 09:07:02 am
Fido McPetDog
Dabbling Barker
Dabbling Scent Marker
Dabbling Tracker
Novice Shoe Chewer
Dabbling Judge of Scent
Competent Carpet Stainer
Not Biter
Not Dodger
Not Kicker
Title: Re: DFHack 0.34.11 r2
Post by: tahujdt on March 06, 2013, 10:08:24 am
This script will remove all skills, but also the ability to assign tasks to the dwarf in question.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on March 06, 2013, 03:06:44 pm
This script will remove all skills, but also the ability to assign tasks to the dwarf in question.
Ok, did a bit more testing, this script now removes all skills, sets the profession to Peasant ("STANDARD") and allows you to assign new labors/skills to all the dwarves.
Let me know if you run into any trouble.

Intrinsic: for your single dwarf version, you should just have to add
unit.profession = df.profession["STANDARD"]
after the skill:resize line

As always, not-tested-a-long-time, might blow up your computer, end the world, etc, etc.
Title: Re: DFHack 0.34.11 r2
Post by: Intrinsic on March 06, 2013, 05:25:03 pm
This script will remove all skills, but also the ability to assign tasks to the dwarf in question.
Ok, did a bit more testing, this script now removes all skills, sets the profession to Peasant ("STANDARD") and allows you to assign new labors/skills to all the dwarves.
Let me know if you run into any trouble.

Intrinsic: for your single dwarf version, you should just have to add
unit.profession = df.profession["STANDARD"]
after the skill:resize line

As always, not-tested-a-long-time, might blow up your computer, end the world, etc, etc.

Oki cool have updated it.
Title: Re: DFHack 0.34.11 r2
Post by: Girlinhat on March 07, 2013, 06:55:59 pm
Hallo.

Wasn't there before, a tool to set jobs up as 'continual upkeep' like "always keep 500 booze in stock" and similar?  Where did that one go, or have I just forgotten the name?
Title: Re: DFHack 0.34.11 r2
Post by: Dragoon209 on March 07, 2013, 07:03:41 pm
Hallo.

Wasn't there before, a tool to set jobs up as 'continual upkeep' like "always keep 500 booze in stock" and similar?  Where did that one go, or have I just forgotten the name?

I think 'workflow' is the one you are looking for.
Title: Re: DFHack 0.34.11 r2
Post by: Girlinhat on March 07, 2013, 07:05:23 pm
So it is.  I was trying to make it Autolabor.  Thanky kindly.
Title: Re: DFHack 0.34.11 r2
Post by: Beardmourned on March 07, 2013, 09:02:18 pm
Long time reader, first time poster here.

I was wondering if there existed (or if there were any plans for) some feature for adventure mode necromancers that would allow them to designate corpses to be revived over an arbitrary rectangle, instead of just a single tile at a time.

Designating 100+ corpses to be revived in the current way is kind of a pain when they're strewn everywhere, and doing it every few turns during a large battle is pretty time consuming.

Thanks for your time!
Title: Re: DFHack 0.34.11 r2
Post by: Intrinsic on March 08, 2013, 03:43:03 am
So it is.  I was trying to make it Autolabor.  Thanky kindly.

Checkout this amazing plugin: http://www.bay12forums.com/smf/index.php?topic=118872.0

It's basically an ingame UI for Workflow, and it's god-like.
Title: Re: DFHack 0.34.11 r2
Post by: Dustman on March 08, 2013, 08:42:33 am
Downloaded OSX version and installed it on my OSX 10.7.5
DFHack itself works properly but I caught error with stonesense loading.

stderr.log says:
Code: [Select]
dlopen(/Users/user/Applications/DwarfFortress.app/Contents/Resources/hack/plugins/stonesense.plug.so, 2): Library not loaded: @executable_path/stonesense/deplibs/liballegro.5.0.dylib
  Referenced from: /Users/user/Applications/DwarfFortress.app/Contents/Resources/hack/plugins/stonesense.plug.so
  Reason: image not found
Can't load plugin /Users/user/Applications/DwarfFortress.app/Contents/Resources/hack/plugins/stonesense.plug.so
and liballegro.5.0.dylib exists on mentioned path in stonesense directory.

What should I try to do to make it work?
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on March 08, 2013, 08:49:16 am
Stonesense doesn't work in the current OSX build, but I've been told that it should work in the next release.
Title: Re: DFHack 0.34.11 r2
Post by: danaris on March 08, 2013, 09:09:58 am
Stonesense doesn't work in the current OSX build, but I've been told that it should work in the next release.

Yes; I can get it to work on my build machine, so the problem is with distribution.

I should have some time to work on getting it to run properly in the next week or two (the students are all going away, so I should have some breathing space...).
Title: Re: DFHack 0.34.11 r2
Post by: Dustman on March 08, 2013, 01:25:16 pm
Yes; I can get it to work on my build machine, so the problem is with distribution.

I should have some time to work on getting it to run properly in the next week or two (the students are all going away, so I should have some breathing space...).

That's great. I'm really looking forward to it.
Title: Re: DFHack 0.34.11 r2
Post by: Rinin_Rus on March 09, 2013, 02:27:59 pm
How biome temperature could be changed in fortress mode using lua?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 10, 2013, 03:01:21 am
Oy. Could I get some commented code on how to run a function every X frames/ticks/whatever?
Title: Re: DFHack 0.34.11 r2
Post by: Rose on March 10, 2013, 03:28:53 am
There's an onupdate function for code that needs to run every frame.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 10, 2013, 04:18:23 am
one other thing: how about running a lua script from a C++ plugin?
Title: Re: DFHack 0.34.11 r2
Post by: yovannyX on March 10, 2013, 09:49:11 am
hello
i really like df hack, it kinda makes the game playable for me
im playing with the masterworks mod, and i notice it doesnt have many scripts.
is there a way to find all scripts in one place?
also, i wanna know if theres a script for:
-making pets have babies
-making said babies grow up fast
hope someone can help me
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 10, 2013, 01:28:38 pm
Define "doesn't have many scripts".

EDIT: agh, the lua API doesn't have any of the maps functions I need to not have fucked up teleporting!

It has:

ensureTileBlock
getGlobalInitFeature
isValidTilePos
getTileBiomeRgn
getSize
spawnFlow
getTileSize
getRegionBiome
canWalkBetween
getTileBlock
getLocalInitFeature
enableBlockUpdates
getBlock
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on March 10, 2013, 03:36:45 pm
If you want to teleport units without leaving glitches in the occupancy flags, the only function you really need is getBlock - from there, you can index into the 'occupancy' array and set/clear the appropriate flags.
Title: Re: DFHack 0.34.11 r2
Post by: sayke on March 10, 2013, 03:46:44 pm
Hey all -

I was wondering about the current status of the effort on DFHack r3! It sounded like various folks were working on a whole range of fantastically powerful features, but I haven't heard anything for a while!

I just wanted to thank everybody for their hard work, and wish all concerned all the best of luck as they keep clanking away on this - I know it's tricky stuff and I wish I was a really good programmer so I could help out =D Cheers!
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 10, 2013, 04:15:27 pm
If you want to teleport units without leaving glitches in the occupancy flags, the only function you really need is getBlock - from there, you can index into the 'occupancy' array and set/clear the appropriate flags.

Okay, good!
Title: Re: DFHack 0.34.11 r2
Post by: yovannyX on March 10, 2013, 05:52:15 pm
oh, nevermind my original comment, i figured it out how to acceses de scripts, and added a few, hoppefully i did it correctly

i have one little question,

when i use dfusion's embark and friendship for my world,to the migrants will appear randomized already or i have to enable something in dfusion?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 10, 2013, 06:55:55 pm
Bah. I'm trying to implement a version of this code that I wrote that will work automatically (as opposed to requiring the user to activate the script in the console):

Code: [Select]
-- Checks if creature has an item equipped with a special syndrome and applies item's syndrome if it is.

local function getMaterial(item)
if item.item.mat_type~=0 then return nil end --Can't find out how to get leather and such out, which is annoying but definitely not crippling, unless you want magic dragon scale'
return df.global.world.raws.inorganics[item.item.mat_index]
end

local function getSyndrome(material)
if #material.material.syndrome>0 then return material.material.syndrome[0] end
return nil
end

local function syndromeIsDfHackSyndrome(syndrome)
for k,v in ipairs(syndrome.syn_class) do
if v.value=="DFHACK_ITEM_SYNDROME" then
return true
end
end
return false
end

local function assignSyndrome(target,syn_id) --taken straight from here, but edited so I can understand it better: https://gist.github.com/warmist/4061959/
    if target==nil then
        qerror("Not a valid target") --this probably won't happen :V
    end
    local newSyndrome=df.unit_syndrome:new()
    local target_syndrome=df.syndrome.find(syn_id)
    newSyndrome.type=target_syndrome.id
    --newSyndrome.year=
    --newSyndrome.year_time=
    newSyndrome.ticks=1
    newSyndrome.unk1=1
    for k,v in ipairs(target_syndrome.ce) do
        local sympt=df.unit_syndrome.T_symptoms:new()
        sympt.ticks=1
        sympt.flags=2
        newSyndrome.symptoms:insert("#",sympt)
    end
    target.syndromes.active:insert("#",newSyndrome)
end

local function findItems()
for _uid,unit in ipairs(df.global.world.units.all) do
for _,item in ipairs(unit.inventory) do
if getMaterial(item)~=nil then
local syndrome = getSyndrome(getMaterial(item))
if syndromeIsDfHackSyndrome(syndrome) then assignSyndrome(unit,syndrome.id) end
end
end
end
end

findItems()

I'm mainly having build issues with my C++ code, but I'm 90% sure my cobbled-together C++ code won't build anyway, especially since the code relies entirely on 1. Functions I don't know how to use and 2. functions I'm not sure exist:

Code: [Select]
#include "PluginManager.h"
#include "Export.h"
#include "DataDefs.h"
#include "Core.h"

#include "modules/EventManager.h"

#include "df/creature_raw.h"
#include "df/global_objects.h"
#include "df/item.h"
#include "df/syndrome.h"
#include "df/unit_syndrome.h"
#include "df/ui.h"
#include "df/unit.h"
#include "df/general_ref.h"
#include "df/general_ref_type.h"

#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>

using namespace std;
using namespace DFHack;

/*Using this plugin:

Armor with a material that has [SYN_CLASS:DFHACK_ITEM_SYNDROME] will affect the person who wears it.
For example:
//////////////////////////////////////////////
//Simple example syndrome that will cause the equipper to take half damage
    [SYNDROME]
        [SYN_CLASS:DFHACK_ITEM_SYNDROME]
        [CE_MATERIAL_FORCE_MULTIPLIER:MAT_MULT:NONE:NONE:1:2]
//////////////////////////////////////////////
*/

//Code is mostly taken from autoSyndrome.

bool enabled = true;

command_result itemSyndrome(color_ostream& out, vector<string>& parameters);

DFhackCExport command_result plugin_init(color_ostream& out, vector<PluginCommand> &commands) {
    commands.push_back(PluginCommand("itemSyndrome", "Automatically give units syndromes when they wear certain materials on armors specified in the raws\n", &itemSyndrome, false,
        "itemSyndrome:\n"
        "  itemSyndrome 0 //disable\n"
        "  itemSyndrome 1 //enable\n"
        "  itemSyndrome disable //disable\n"
        "  itemSyndrome enable //enable\n"
        "\n"
        "itemSyndrome looks for units wearing armor or holding weapons that are made of a material with a syndrome that has a certain SYN_CLASS, causing the creature who equips that item to gain the syndrome.\n"
        "\n"
        "Requirement:\n"
        "  1) The armor worn must have a material that has a syndrome with the class \"DFHACK_ARMOR_SYNDROME\"\n"
        "\n"
        "When this conditions are met, the unit wearing the armor will become afflicted with all applicable syndromes associated with the material of the armor, or stones. It should correctly check for whether the creature or caste is affected or immune, and it should also correctly account for affected and immune creature classes.\n"
        ));
    return CR_OK;
}

DFHACK_PLUGIN("itemSyndrome");

DFhackCExport command_result plugin_shutdown ( color_ostream &out )
{
    enabled = false;
    return CR_OK;
}

DFhackCExport command_result plugin_onupdate(color_ostream &out) //Copy+pasted from some of Falconne's code because I'm not that good at this :V
{
    if (!enabled)
        return CR_OK;

    // Every 150 frames check for syndromes
    static unsigned cnt = 0;
    if ((++cnt % 150) != 0 && first_update_done)
        return CR_OK;
    if (!first_update_done)
    {
        last_frame_count = world->frame_counter;
        run_script(utility/itemsyndrome)
        first_update_done = true;
    }

    return CR_OK;
}

The lua code works for a fact; the C++ code--again, 20% build problems, 80% "I have no idea what I'm doing".
Title: Re: DFHack 0.34.11 r2
Post by: falconne on March 11, 2013, 12:16:23 am
I'm mainly having build issues with my C++ code, but I'm 90% sure my cobbled-together C++ code won't build anyway, especially since the code relies entirely on 1. Functions I don't know how to use and 2. functions I'm not sure exist:

I can't speak for the build errors yet as I'm at work and can't compile that to see, but I can suggest a change to the onupdate function you got from my code, to make it work better for what what you need:

Code: [Select]
DFhackCExport command_result plugin_onupdate (color_ostream &out)
{
    if(!Maps::IsValid())
        return CR_OK;

    static decltype(world->frame_counter) last_frame_count = 0;
   
    bool is_paused = Core::getInstance().getWorld()->ReadPauseState();
    if (is_paused)
        return CR_OK;

    if (world->frame_counter - last_frame_count < 150)
        return CR_OK;

    last_frame_count = world->frame_counter;

    ... DO STUFF ...

    return CR_OK;
}
Title: Re: DFHack 0.34.11 r2
Post by: Laggy on March 11, 2013, 01:27:55 am
Is there some kind of reference somewhere for the data structures available to lua from the game?  Looking through a few example scripts, I saw things like df.global.world.units.all for a table with all the units in it.  But where did it come from?!  I can't seem to find any reference lists anywhere :(
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 11, 2013, 02:30:30 am
library/xml in the github.

I mostly use printall(table), though...
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on March 11, 2013, 05:24:57 am
@Putnam: i just remembered that there is onupdate in lua (or similar thing anyway...):
https://github.com/warmist/dfhack/blob/master/Lua%20API.rst#id30
Namely: dfhack.timeout(time,mode,callback). Setting it up like: dfhack.timeout(150,'ticks',callback) would work. Also if combined with:
Code: [Select]
dfhack.onStateChange.foo = function(code)
if code==SC_MAP_LOADED then --not sure if SC_MAP_LOADED or SC_WORLD_LOADED
dfhack.timeout(150,'ticks',callback) --disables if map/world is unloaded automatically
end
--and then in callback

function callback()
-- real stuff that does whatever
--
--
dfhack.timeout(150,'ticks',callback)
end
Title: Re: DFHack 0.34.11 r2
Post by: Laggy on March 11, 2013, 11:59:50 am
library/xml in the github.

I mostly use printall(table), though...
Thanks!  I had already checked out the git repository (yea yea, I'm used to SVN, its called checkout there :P) but the library/xml folder wasn't populated.  I didn't realized I had to run a sub-module Update as well.

Also, after a bit of searching, i found the built in lua-interpreter.  That definitely makes things easier for playing around!  (fun fact:  for _,item in ipairs(df.global.world.items.all) do printall(item) end ---- in a fort with 50k items takes a while!)
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 11, 2013, 12:02:25 pm
Back before I removed all my god tiers, I did a printall for the raws for every creature in the game. It took two minutes :P
Title: Re: DFHack 0.34.11 r2
Post by: Laggy on March 11, 2013, 12:14:19 pm
Only 2?  Weak!  That printall up there took at least 5.  Maybe more, I didn't actually time it.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 11, 2013, 12:46:15 pm
Is there any way to check if a syndrome that a unit is affected by is the same as one on a material? They're stored really damn differently. If not, it'd be pretty easy to just make modders have their syndrome end at 150.
Title: Re: DFHack 0.34.11 r2
Post by: Laggy on March 11, 2013, 01:36:43 pm
So playing around with this a bit as a learning exercise, I made a script to remove all the wear from all the items in your fort.  If anyone is interested:

Spoiler: removewear.lua (click to show/hide)


In an unrelated question, is there like...a list of material IDs somewhere or something?  Like, i just picked a random item, and printall shows that mat_type = 30, and mat_index = 536.  I know that one of those has to refer to Silk, but for the life of me I can't find the struct that has that info in it.  Attempting to cross-reference all this stuff at this point has just been an exercise in futility, basically just printall'ing one table after another hoping I find something.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 11, 2013, 01:48:38 pm
Yeah, I kinda need to know about mat_types too--where to find a struct for the ones that aren't 0 (inorganic).
Title: Re: DFHack 0.34.11 r2
Post by: Rose on March 11, 2013, 02:18:41 pm
The first 18 mat types are listed here: https://github.com/angavrilov/df-structures/blob/master/df.materials.xml

These ones are fixed. After that, they're split into plant mats and creature mats, but which are which is raw-dependent.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 11, 2013, 04:20:50 pm
Related to the earlier issue with lua:

Code: [Select]
local function teleport(unit)
local playerblockoccupancy = dfhack.maps.getTileBlock(player.pos).occupancy
player.pos.x = unitToTeleportTo.pos.x-1
player.pos.y = unitToTeleportTo.pos.y
player.pos.z = unitToTeleportTo.pos.z
for k,v in ipairs(playerblockoccupancy) do
for k,v in ipairs(v) do
v.unit = false
v.unit_grounded = false
end
end
end

This seems a bit stupid, but a bit of testing reveals that it works. Should I expect anything weird out of this?
Title: Re: DFHack 0.34.11 r2
Post by: Laggy on March 11, 2013, 06:53:34 pm
Here's another little utility mod I made for myself (*****WARNING******* Back up your save before using, just in case.  I tested this for my game, but it could potentially cause problems.  I hope not, but just be safe.) to delete all my excess useless stone.  I had something like 20,000 stone in my fort, and it took up a lot of space (or walking time to dump into a Quantum Stockpile, or time marking a ton of stuff to dump and then using autodump).

Spoiler: destroy_stone.lua (click to show/hide)

Change the destroyThese table entries for the stones you want to destroy.  I'm using Masterwork mod, and I only wanted to keep Obsidian, and metal-bearing ore/stones that were ~steel quality or better.  Adjust per your needs/wants. 
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on March 11, 2013, 08:59:35 pm
This seems a bit stupid, but a bit of testing reveals that it works. Should I expect anything weird out of this?
Yes - that'll clear the unit occupany bits on all tiles in that map block, not just the one formerly occupied by your player.
Additionally:
1. It isn't bothering to set the proper occupancy bits in the destination tile.
2. It isn't checking occupancy in the destination tile to see if the player needs to be set Prone.
3. It isn't even checking if the destination tile is valid - for all you know, your target could be standing next to a wall, and your player will end up inside the wall. Even better, your target could be standing next to the edge of the map, resulting in you being teleported off of the map.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 11, 2013, 09:15:06 pm
Well, that last part I knew about :P It's damn difficult to check all that when there is no easy method to check the info for an individual position.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on March 11, 2013, 09:35:00 pm
But it's plenty easy: local playeroccupancy = dfhack.maps.getTileBlock(player.pos).occupancy[player.pos.x%16][player.pos.y%16]
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 11, 2013, 09:37:15 pm
Ah, 16? That's all I needed to know. Not sure how I didn't figure that out, but oh well.
Title: Re: DFHack 0.34.11 r2
Post by: Andux on March 11, 2013, 09:52:45 pm
In an unrelated question, is there like...a list of material IDs somewhere or something?  Like, i just picked a random item, and printall shows that mat_type = 30, and mat_index = 536.  I know that one of those has to refer to Silk, but for the life of me I can't find the struct that has that info in it.

Here's some example code that may help you get the hang of the various material-info-finder functions:
Code: [Select]
local mi = dfhack.matinfo.decode(mat_type,mat_index)
if mi then
print('Decoded MatInfo:')
printall(mi)
print('Full material token: '.. dfhack.matinfo.getToken(mat_type,mat_index) )
print('Specific material ID: '..mi.material.id)

printall( dfhack.matinfo.find('CREATURE:DWARF:BLOOD') )
end


Additionally:
...
4. It isn't checking whether the player is the only unit in the starting tile. :P
Title: Re: DFHack 0.34.11 r2
Post by: Rose on March 11, 2013, 10:59:08 pm
I had something like 20,000 stone in my fort
Spoiler: You're doing it wrong. (click to show/hide)
Title: Re: DFHack 0.34.11 r2
Post by: Laggy on March 12, 2013, 01:11:03 am
I had something like 20,000 stone in my fort
Spoiler: You're doing it wrong. (click to show/hide)
Haha, I saw that when you pasted it in irc.

--------------------

Unrelated:  Are keybindings broken for anyone else?  I added 'keybinding add Ctrl-Z' liquids-here to my init, but when I get in game and hit Ctrl-Z, nothing happens.  I checked 'keybinding list Ctrl-Z' and it says its bound to 'liquids-here'.  Any ideas?
Title: Re: DFHack 0.34.11 r2
Post by: Meph on March 12, 2013, 02:06:28 am
Press Alt once. That will fix it. If you Alt+Tab out of DF, DF thinks that ALT is still pressed, till you press it again.

So after you Alt+Tabbed out of the game once, and went back to DF, and pressed your Ctrl+Z, you are actually pressing Ctrl+Alt+Z.
Title: Re: DFHack 0.34.11 r2
Post by: Laggy on March 12, 2013, 02:14:01 am
Press Alt once. That will fix it. If you Alt+Tab out of DF, DF thinks that ALT is still pressed, till you press it again.

So after you Alt+Tabbed out of the game once, and went back to DF, and pressed your Ctrl+Z, you are actually pressing Ctrl+Alt+Z.
That didn't fix it :(

Edit:  What's weird is that some of them work.  Like Ctrl+Q does quicksave.  But Ctrl+Z still doesn't do anything.

Edit2:  Well, using Alt-Z for the keybinding works fine.  Weird.  Maybe its because Ctrl-Z has a windows function and is getting intercepted before it gets to DF?
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 12, 2013, 04:16:51 pm
Where's the data for a tile being a wall? I can't find it and it's kinda bumming me out.
Title: Re: DFHack 0.34.11 r2
Post by: Warmist on March 12, 2013, 04:45:24 pm
it's a tiletype (or some tile types are "walls") a bit complex thing to wrap a head around.
Code: [Select]
--basic idea there is a LOT of tile types. For any sane way of dealing with them there are some enums with magic stuff...
--e.g.
local tiletype=somefunction_that_returns_tiletype(a,b,c)
local attrs=df.tiletype.attrs[tiletype]
--now with attrs we can do a lot of stuff...
--like:
if attrs.shape==df.tiletype_shape.WALL then print("this is a wall") end -- this is what you need...
--or:
if attrs.material==df.tiletype_material.SOIL then print("it has soil") end --this matches both soil floor and soil ramps and soil walls and...
to get tile type at location:
Code: [Select]
local function getTileType(cursor)
    local block = dfhack.maps.getTileBlock(cursor)
    if block then
        return block.tiletype[cursor.x%16][cursor.y%16]
    else
        return 0
    end
end
this is taken straigth from here (https://github.com/angavrilov/dfhack/blob/master/scripts/gui/guide-path.lua#L46)

Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 13, 2013, 07:56:13 pm
At what point in time does the game decide if there will be a megabeast attack or siege in a particular week/month/year/whatever?

In related news, I've determined that unit.curse.anon_6[0] is the amount of time until the syndrome wears off, apparently. Also, I don't think unit.curse.maybe_body_appearance is body appearance, which is pretty damn confounding, since I have no idea what is.
Title: Re: DFHack 0.34.11 r2
Post by: Quietust on March 13, 2013, 10:07:28 pm
At what point in time does the game decide if there will be a megabeast attack or siege in a particular week/month/year/whatever?
I believe it gets decided at the very beginning of the season, at which point it schedules a "megabeast atttack" event for a random time during that season (but not too close to the beginning or the end) - in 23a, it was a 10% chance per season once all of your "progress" counters had reached 2, and it was anywhere from 1000 to 9000 ticks from the end of the season (e.g. 8th day of the first month to the 19th day of the last month), so it's probably still like that (though it probably skips the progress checks upfront and defers them to when it selects which megabeast is going to show up, since the trigger points are in the creature raws).

In fact, I'm pretty sure it schedules all events at the beginning of the season - looking at my disassembly of 23a, that's when it decided when to trigger all types of events (caravans, migrants, diplomats, invasions, feature attacks (i.e. cave river, chasm, or magma flow), megabeasts, "curious beast" swarms, and the "Too Deep" ending), so it's highly likely that it's still done this way.
Title: Re: DFHack 0.34.11 r2
Post by: Putnam on March 13, 2013, 10:11:19 pm
Haha, that's very convenient!

EDIT: I notice you have a lot of unknowns in your syndrome.ce raw entries (E.G df.global.world.raws.syndromes.all[0].ce[0]). I can tell you a few right now:

unk_e4 is the second person VERB for CE_CAN_DO_INTERACTION; unk_100 is the third; unk_11c is the mutual.

unk_1a8 is the CDI:INTERACTION for CE_CAN_DO_INTERACTION.

unk_25c is the ADV_NAME for CE_CAN_DO_INTERACTION.

EDIT 2: Any way to tell what creature a megabeast encounter will be?
Title: Re: DFHack 0.34.11 r2
Post by: Laggy on March 14, 2013, 02:40:36 am
Quick little script if anyone is interested:

Spoiler: military_training.lua (click to show/hide)

Threw this together tonight because I basically wanted parts of make_legendary, and parts of the armoks_blessing, with the ability to customize the weapon skills it at run-time.  (*Note, this doesn't have rejuvenate, elevate_physical, elevate_mental, or brainwash).

Can be used on a single dwarf, or all of your dwarves.  Includes a list of default skills that are always trained (Shield, Armor, Biter, Kicker, Fighter, Archer, Wrestler, Dodging, Misc. Object Using, and Striking).  Because every military dwarf wants those!  But I wanted to be able to specialize in a certain weapon type.

Usage examples with a single unit selected via the 'k' or units list:

Input                                         -> military_training hammer
Output:                                      -> [DwarfName] is now a Legendary Hammerdwarf!
Output:                                      -> [DwarfName] is now a Legendary Armor User!
............etc etc etc

Input                                         -> military_training dagger axe crossbow
Output:                                      -> [DwarfName] is now a Legendary Knife User!
Output:                                      -> [DwarfName] is now a Legendary Axedwarf!
Output:                                      -> [DwarfName] is now a Legendary Marksdwarf!
Output:                                      -> [DwarfName] is now a Legendary Armor User!
............etc etc etc


If you don't have a unit selected, it goes through all your dwarves and gives them the selected skills.



P.S.  Most of the credit goes to vjek.  I 'borrowed' a lot of his code to get what I wanted.  Maybe someone else will find it useful!
Title: Re: DFHack 0.34.11 r3
Post by: peterix on March 14, 2013, 03:28:25 am
Hello!

A new release is out, with many improvements.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on March 14, 2013, 04:16:30 am
Finally!

Good luck all.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 14, 2013, 04:35:19 am
Let the madness begin!
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 14, 2013, 04:40:48 am
Nice. :)

Its like christmas, with both autosyndrome and itemsyndrome being out.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 14, 2013, 04:58:01 am
also this for adv mode :)  (https://gist.github.com/warmist/5081626)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 14, 2013, 05:00:08 am
Excuse me asking, but what does it do? Anvil figurine claim a site? ^^
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 14, 2013, 05:05:09 am
A way to make anvil in smelter (because there is no way to make on in vanilla minecraft without having one and in adventure mode there is no place to get one) and a reaction that makes you create a site around 3x3 yourself by using a figurine
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 14, 2013, 05:27:11 am
I understood the avnil one, I have a similar reaction in my mod. I was mostly wondering what a site does, since I never played adv. mode. I mean, I know what a site IS, but not what pros/cons it would have to create an empty 3x3 site as an adventurer.
Title: Re: DFHack 0.34.11 r3
Post by: Askot Bokbondeler on March 14, 2013, 05:35:26 am
A way to make anvil in smelter (because there is no way to make on in vanilla minecraft without having one and in adventure mode there is no place to get one) and a reaction that makes you create a site around 3x3 yourself by using a figurine
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 14, 2013, 05:48:53 am
I understood the avnil one, I have a similar reaction in my mod. I was mostly wondering what a site does, since I never played adv. mode. I mean, I know what a site IS, but not what pros/cons it would have to create an empty 3x3 site as an adventurer.
All* changes to df world are not kept unless they are done in some site (sites are: player forts, caves, camps (but not towns), maybe forts...) so without a site you are in the digging that you done will be gone the moment you move from that place.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 14, 2013, 06:22:25 am
 You can dig in adv mode? I should just stop asking I guess, its not really important to me. Just ignore me. ;)  But yeah, makes sense. I know about the old trick of making your fortress a lair, so that all items will stay when you reclaim, but adv mode is beyond me.

Anyway, fortress mode got a lot, lot, lot nicer thanks to autosyndrome, and that is what counts for me. Thanks for that release. :)
Title: Re: DFHack 0.34.11 r3
Post by: Maklak on March 14, 2013, 08:19:04 am
Strange, but under 64 bit Linux Mint 13 I didn't get the "[DFHack]#" to show up with r3 and that means no commands. r2 worked just fine.
Title: Re: DFHack 0.34.11 r2
Post by: vjek on March 14, 2013, 09:06:09 am
Quick little script if anyone is interested:
...
P.S.  Most of the credit goes to vjek.  I 'borrowed' a lot of his code to get what I wanted.  Maybe someone else will find it useful!
That's good stuff, Laggy.  I particularly like the single/all interactive option.  Well done, and that's why those scripts are there!  :D  Hopefully more people take up the DFhack scripting challenge.
Title: Re: DFHack 0.34.11 r3
Post by: RickRollYou2 on March 14, 2013, 09:10:37 am
Vjek, would your scripts work with r3? If not, when do you think you could get the new ones up? :P
Title: Re: DFHack 0.34.11 r3
Post by: vjek on March 14, 2013, 09:16:31 am
Vjek, would your scripts work with r3? If not, when do you think you could get the new ones up? :P
Hell if I know.  :)  Haven't tried them yet.  If they do (or do not), feel free to add comments to that effect on the discussion area of the wiki for the scripts page.
The only reason they might not is adjustments to the structures/names of fields.  They're nothing special, otherwise.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 14, 2013, 10:00:31 am
You can dig in adv mode? I should just stop asking I guess, its not really important to me. Just ignore me. ;)  But yeah, makes sense. I know about the old trick of making your fortress a lair, so that all items will stay when you reclaim, but adv mode is beyond me.

Anyway, fortress mode got a lot, lot, lot nicer thanks to autosyndrome, and that is what counts for me. Thanks for that release. :)
yes you can dig and do all kinds of jobs in adventure mode. though the real fun is Converting your enemies into Chairs and have your entire office be made of or is a skull.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 14, 2013, 12:19:18 pm
You can dig in adv mode? I should just stop asking I guess, its not really important to me. Just ignore me. ;)  But yeah, makes sense. I know about the old trick of making your fortress a lair, so that all items will stay when you reclaim, but adv mode is beyond me.

Anyway, fortress mode got a lot, lot, lot nicer thanks to autosyndrome, and that is what counts for me. Thanks for that release. :)

i don't think you understand just how really goddamn huge that site claim script is.

Anyway... mmm, eventful...
Title: Re: DFHack 0.34.11 r3
Post by: danaris on March 14, 2013, 12:43:03 pm
Currently working on getting an OS X build of r3 up and running. I'll be testing it on 10.6 and 10.7+, and if all goes well, maybe even getting Stonesense properly bundled.
Title: Re: DFHack 0.34.11 r3
Post by: Intrinsic on March 14, 2013, 01:01:14 pm
wow r3!

I don't think anyone can thank enough ALL the people who contribute to DFHack and it's plugins, and the mod makers for this very special experience that is Dwarf Fortress.

We are not worthy! *bows down*
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 14, 2013, 01:29:42 pm
You can dig in adv mode? I should just stop asking I guess, its not really important to me. Just ignore me. ;)  But yeah, makes sense. I know about the old trick of making your fortress a lair, so that all items will stay when you reclaim, but adv mode is beyond me.

Anyway, fortress mode got a lot, lot, lot nicer thanks to autosyndrome, and that is what counts for me. Thanks for that release. :)

i don't think you understand just how really goddamn huge that site claim script is.

Anyway... mmm, eventful...
also Warmist made a easier fort claim script that allows your adventurer to take control over any 'player fort' with little ease. combine that with advfort and you pretty much using the fort claim script to wait out migrants or diplomats. though this should be the part where I figure out how to open a github fork and dump my 'warmlor-anga' and spellbook spells scripts for people who want to explode corpses, and summon units...
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 14, 2013, 01:30:29 pm
Quote
and summon units...

Say what again?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 14, 2013, 01:48:03 pm
Indeed :V
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 14, 2013, 04:04:41 pm
Quote
and summon units...

Say what again?
summon units remember all those talks about ungbuga (http://www.truimagz.com/host/fortcrush2/folder16/ungbuga.png) she's a result of warmist's summon unit, let alone we have waypoints for fast travel and the ability to teleport in the fast travel menu, which means you may never need to jump in and out of fast travel to cross a 1 tile deep river... or mountains. or any travel mode blocking hazard.
best thing is waypoint, travelport work in the travel menu and sleeping/waiting so you can 'set up the coordinates and warp back to the base.' oh and advfort doesn't only work on adventurers but any unit you want... example was I had a version of companion order that gave companions a channel command(which is why I was displeased with Deon's changes from Letters to numbers due to Companion order script doesn't work well with non number/letter characters and a huge list will break it.) though be warned advfort gives you Fort mode jobs but also fort mode needs. if your adventurer is drowsy and hungry, and thirsty they will stop what they were about to do/or doing and hunt down some food or water... or drop out cold. which might make certain tasks in hazardous scenarios more hazardous if you don't Feed your character.

also in other news adventure mode + custom workshops + Meph lack of interest in adventure mode and cramming tons of content in fort mode alone = make up for lack of content for adventure mode. though I find if any one going to use advfort they best have a bunch of adventure reactions for hand crafting some tools...
I just got an idea to combine cage warping, waypoint, travelport and orc airships together.

edit: Oh you can with r3 play as a demon and break out of hell through a demonic fort by in tearing down the weapon stand through the glowing barrier. since you can't dig through slade, or dig due to lack of pickaxe.
Title: Re: DFHack 0.34.11 r3
Post by: BigD145 on March 14, 2013, 05:50:41 pm
What is this magical thing?!
Title: Re: DFHack 0.34.11 r3
Post by: Lycaeon on March 14, 2013, 11:21:31 pm
> Unit summoning
Can this behavior be used to create creatures in fortress mode? And if so, how?

Also, when will the readme for the new features in r3 be released?

Thank you Peterix for your amazing work! :)
Title: Re: DFHack 0.34.11 r3
Post by: sayke on March 14, 2013, 11:58:36 pm
holy crap this is fantastic - well done all!! i am salivating at the possibilities... meph, whatcha cookin? =D
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 15, 2013, 01:04:51 am
Wait, wait wait. Are you saying that we can summon off-site units to the currently loaded map!?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 15, 2013, 02:39:23 am
Its not the lack of interest, just the lack of knowledge. I cant mod for it, since I dont play it. I honestly didnt knew that you can dig in adv mode. My question is of course for fort mode, could a reaction summon a creature? If yes, I can clean up my old, unrelyable summoning system.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 15, 2013, 03:51:39 am
Learn it! At the very least, get someone else to do it for you!

...hmm
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 15, 2013, 04:36:32 am
Its not the lack of interest, just the lack of knowledge. I cant mod for it, since I dont play it. I honestly didnt knew that you can dig in adv mode. My question is of course for fort mode, could a reaction summon a creature? If yes, I can clean up my old, unrelyable summoning system.
There are some limitations: first i have no idea how complete the unit is. Second it has no nemesis record/hist fig  (for fort mode it does not matter much... except it cannot be a squad member, take any positions, etc...).

this is Wip creature spawning (https://gist.github.com/warmist/4296504) it has some todo (mostly important the death time from old age is one year from creation)

btw one important thing that might be missed while reading readme or lua api help: dfhack now automatically runs init.lua in raws folder. That means that each mod can have it's own lua scripts. see  here  (https://gist.github.com/warmist/5081626) for examples.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 15, 2013, 05:55:42 am
Creatures in fort mode become historical figures automatically after the created a masterwork item, or killed a creature. Hugo_the_dwarf did a lot of testing in that regard, with transformed pet offspring into slave caste civ members. Anyway, this is no big concern, I am mostly aiming at pets. Could this be used to create pets in a reaction?

@Putnam: Between the mod, kobolds, the gui, the manual, and the tileset/sprites... I dont even have enough time for all that, so adv. mode is far, far away.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 15, 2013, 11:00:29 am
Its not the lack of interest, just the lack of knowledge. I cant mod for it, since I dont play it. I honestly didnt knew that you can dig in adv mode. My question is of course for fort mode, could a reaction summon a creature? If yes, I can clean up my old, unrelyable summoning system.
Summoning units is possible in Fort mode as well adventure mode, though I also say  companion order is also a fort mode script in only if you designate a "hero" unit and assign Companions to said "Hero"
though currently no way to have historical units pop up unless you Sleep/fast travel.

also Meph don't worry about Adventure mode... with advfort a person could just custom build any work shop they want from either 3 fractions.
So if a blood crazed Adventurer was a skull throne made from his enemies or a Ork boss pole, or a kobold tinker shop, or a summoning shrine to transform their selves into a Fire breathing web shooting Daemon spider, they could do that... though changing into a Daemon Spider is restricted to Dwarves so best to bring a buddy.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 15, 2013, 11:08:12 am
If summoning units works in fort mode, how would I go about this?

Currently I transform dwarves into a creature that drops a bodyparts, which is resurrected and then transformed into the new creature. This creature is "friendly", its no member of the civ, and no pet. I cant give these creatures any commands.

It would be great if I could just run the reaction and the creature instantly spawns on location, with possible selections of being civ-members, pets, friendlies, or hostiles.

Edit: I also stumbled upon another question I have. I am using autosyndrome to balance reactions atm. Transforming the worker works without fail. Transforming a pet pastured on the workshop works as well. I only have one problem, which is not really big, but I wanted to ask anyway.

If I station 1 pet, autosyndrome will target it and add the syndrome. GOOD.
If I station 10 pets, autosyndrome will target one and add the syndrome. GOOD.
The other 9 pets are hit by the boiling cloud with a syndrome, and might get affected anyway. BAD.

The point is that people can exploit the reaction by pasturing more then one pet (or dwarf in case of the golem/turret/landmine reactions) and transform more then one creature. The question is: Can this be fixed somehow? It is not really important, if people want to cheat a little, they can/will do that. But it would be nicer if it would be limited to one single creature. Deleting the boiling rock before the cloud spreads would be an option for example.
Title: Re: DFHack 0.34.11 r3
Post by: addictgamer on March 15, 2013, 11:53:57 am
except it cannot be a squad member, take any positions, etc...

Ah, thank you very much. For the last week I couldn't figure out why the units I stole with a take-unit script I'm working on were able to do jobs but I could not assign them to the military.

I'll extend that with a general question: Has anybody else written a take-unit script/plugin? That is, a script that allows you to add, say, a merchant dwarf to your fort. If so, please direct me to it.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 15, 2013, 01:26:14 pm
Meph: check out the source (autosyndrome.cpp) in the github. It gives an example of a boiling stone that works on the unit that does the reaction only.
Title: Re: DFHack 0.34.11 r3
Post by: danaris on March 15, 2013, 01:28:12 pm
The latest DFHack build for OS X is now available. This build officially supports 10.6-10.8, and includes a working Stonesense.

It can be downloaded from http://topazgryphon.org/df/df_osx_hack.zip (http://topazgryphon.org/df/df_osx_hack.zip).

Once I tidy up a few loose ends, I will bug Peterix to pull my most recent changes into his Github repo so that those wishing to build an OS X build themselves can do so easily. (This will also include the minor tweaks necessary to get it to build on 10.6.)
Title: Re: DFHack 0.34.11 r3
Post by: Maklak on March 15, 2013, 02:48:26 pm
Edit: I also stumbled upon another question I have. I am using autosyndrome to balance reactions atm. Transforming the worker works without fail. Transforming a pet pastured on the workshop works as well. I only have one problem, which is not really big, but I wanted to ask anyway.

If I station 1 pet, autosyndrome will target it and add the syndrome. GOOD.
If I station 10 pets, autosyndrome will target one and add the syndrome. GOOD.
The other 9 pets are hit by the boiling cloud with a syndrome, and might get affected anyway. BAD.

FoE mod has a work-around for this. I think. It uses a chain of syndromes and interaction.

Basically the upgrade cloud / drink works for the Dwarf (Pony, but that's beside the point.) (It is restricted to just the pony race.), giving her an interaction that can be used exactly once before it times out. The interaction targets a creature of type chicken and transforms it into a robot indefinitely. It works, but is quite complex.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 15, 2013, 02:55:34 pm
@both Putnam and Maklak: I know how to affect the worker only, or how to use an interaction. That works without problem. Its just that I want to target one single creature inside the workshop that is not the worker by using autosyndrome. I just wanted to know if that is possible. :) More a... design improvement suggestion for the script.

But thanks for reminding me of the FAllout Equestria trick. I read about it a while ago, but I didnt think of it just now. Guess I have to rewrite a lot of reactions ;)

My question about fortress-mode creature summoning still stands though. ;) Sorry to pester everyone so much, but this release warrants so many raw changes for me, its overwhelming.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 15, 2013, 03:35:23 pm
If summoning units works in fort mode, how would I go about this?

Currently I transform dwarves into a creature that drops a bodyparts, which is resurrected and then transformed into the new creature. This creature is "friendly", its no member of the civ, and no pet. I cant give these creatures any commands. it's not friendly in Adventure mode and will strike you down

It would be great if I could just run the reaction and the creature instantly spawns on location, with possible selections of being civ-members, pets, friendlies, or hostiles.

Edit: I also stumbled upon another question I have. I am using autosyndrome to balance reactions atm. Transforming the worker works without fail. Transforming a pet pastured on the workshop works as well. I only have one problem, which is not really big, but I wanted to ask anyway.

If I station 1 pet, autosyndrome will target it and add the syndrome. GOOD.
If I station 10 pets, autosyndrome will target one and add the syndrome. GOOD.
The other 9 pets are hit by the boiling cloud with a syndrome, and might get affected anyway. BAD.

The point is that people can exploit the reaction by pasturing more then one pet (or dwarf in case of the golem/turret/landmine reactions) and transform more then one creature. The question is: Can this be fixed somehow? It is not really important, if people want to cheat a little, they can/will do that. But it would be nicer if it would be limited to one single creature. Deleting the boiling rock before the cloud spreads would be an option for example.
Eh with dfhack you could just run a reaction that will implant one animal. That way you can do away with Gas syndrome contamination. 

also my old files had an adventure reaction that called into a gui menu which then ran the spawn unit script.
you can make any reaction a lua hook trigger even workshop related ones, though you need to add more to the script like setting the pos, on the building pos, or the unit who using the building pos, or set up a spawn portal that will summon any type of unit.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 15, 2013, 03:54:22 pm
Rumrusher, you must be mistaken, because I clearly cannot do this. Otherwise I would have long done so. ;)

Why... I am so confused right now. How can you casually strutt in here, say "yep, you could just spawn an animal, no problem", while every modder ever, has been running around in circles trying to do just that? Its like the holy grail of modding, creating new creatures. An unachieved holy grail I might add, no one has been able to do this. Its just beyond the scope of modding, outside of our grasp.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 15, 2013, 04:18:45 pm
Rumrusher, you must be mistaken, because I clearly cannot do this. Otherwise I would have long done so. ;)

Why... I am so confused right now. How can you casually strutt in here, say "yep, you could just spawn an animal, no problem", while every modder ever, has been running around in circles trying to do just that? Its like the holy grail of modding, creating new creatures. An unachieved holy grail I might add, no one has been able to do this. Its just beyond the scope of modding, outside of our grasp.
I just notice what you said(and accidentally click post before reviewing)... sorry uhh well I thought you want a script to summon a unit, which was posted by warmist in the chat, which was modified to work in both fort and adventure mode.
and not how do I combine this script with reactions in general.  well then

Code: [Select]
function PlaceUnit()
trgunit=df.global.world.units.active[0] --could be any unit on site
local u=CreateUnit(trgunit.race,0)  -- the first part is unit race second is caste
u.relations.group_leader_id=trgunit.id --this makes the summon a companion
local u_nem=dfhack.units.getNemesis(u)
local t_nem=dfhack.units.getNemesis(trgunit)
if u_nem then
u_nem.group_leader_id=t_nem.id
end
if t_nem and u_nem then
t_nem.companions:insert(#t_nem.companions,u_nem.id)
end
u.civ_id=(df.global.world.units.active[0].civ_id)
u.pos:assign(df.global.world.units.active[0].pos) --this appoints them near the unit
u.name.first_name="CRUBUGA"
u.name.has_name=true
end

okay so here's a function in Spawnunit called 'place unit', which is used to create and place down a created unit
what you can do with this is like set the race, affiliation, and name of the unit you want to create then spawn them in. now this is fine on it's own and needs basic knowledge of Dfhack to say hook this up to a workshop then have said workshop track who uses it so you can run this with out needing DFhack(which as of now even I can't do.). though from use of this, the units you do make end up part of the fort but no real chance to order them around. oh well I just have to make up to you by learning how to make separate lua_hook reaction scripts for each summon reaction(which has the added bonus of not going fully going through the reaction which means you could set it up so that if the player picks the wrong they could screw up and get a face full of Syndromes.)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 15, 2013, 04:22:12 pm
Peerfect. Saibamen, here I come!
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 15, 2013, 04:28:32 pm
I assume it would be done like SPATTER_ADD_. The script checks the material from the reaction and applies it, and knows which reactions to check because of the SPATTER_ADD_ in the reaction id. For creatures it would look more like SPAWN_CREATURE_, and it takes creature id and creature caste from the reaction. That way its only one script, not a new one for each reaction. SPAWN_CREATURE_CIV, SPAWN_CREATURE_PET and SPAWN_CREATURE_HOSTILE would be useful of course.

Just to let you know what I would use it for: I currently have those systems in the mod:
Golem creation and Pet Armory, both use transformations
Turrets and Landmines that are build in a factory, these are spawned. Narhirhil and deon have similar things, with robotic spiders and steam centurions.
My spawn location, which does things from sowing treant seeds (spawns 3-5 magical living trees), setting up scarecrows, or a gargoyle statue that come to life when enemies come nearby.
Deon and me also have colosseums/arenas, to summon hostile creatures to fight.
And special rocks that spawn creatures, for "random encounters" while mining.

Because if creatures could be spawned from reactions (or interactions, which would be the same in the end, I guess?) one could simulate invaders that spawn inside a fortress. I was planning on a lich that summons a skeletal army, or wormfolk that digs into your fort, shades the open portals to their realm and pour out... obviously without real diggin and real portals, all simulated, but it would work in a way.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 15, 2013, 05:57:28 pm
@both Putnam and Maklak: I know how to affect the worker only, or how to use an interaction. That works without problem. Its just that I want to target one single creature inside the workshop that is not the worker by using autosyndrome. I just wanted to know if that is possible. :) More a... design improvement suggestion for the script.

Did you try it without allow multiple targets with a syndrome that only affects the pet? That should work. If you don't allow multiple targets, it stops once it found an acceptable target, starting with the worker.

Actually I just noticed a bug. If you don't allow multiple targets, it could potentially infect two units if one of them is the worker and both can be infected and you don't have worker_only. I'll fix that for the next version.

edit: also make sure you don't use PRESERVE_ROCK. If so, it might create mists which do troublesome things and affect things you don't want affected. If you insist on mists for visual effect, create another boiling rock which has no syndromes.
Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on March 15, 2013, 08:05:01 pm
I remember seeing a "raise dead" dfhack script somewhere. Does anyone know where it is? I couldn't find it on the github or in VJek's library.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 15, 2013, 08:11:29 pm
I repeat: does the previously mentioned summon plugin mean we can load off-site units on the current map?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 15, 2013, 08:14:13 pm
I repeat: does the previously mentioned summon plugin mean we can load off-site units on the current map?

No, it makes new ones entirely.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 15, 2013, 08:24:01 pm
Aw :(

Oh well, that has fun uses too!
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 15, 2013, 10:46:39 pm
sorry guys I about the details about spawn units, I rarely use it due to how warmist coded it making more than 1 unit will end up causing the game to crash from trying to remember 10 new units to mark down in nemesis. it's pretty rough and currently needs more work, though that one unit you spawn will make wonders as a meatshield.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 12:24:16 am
So Meph asked me about reactions doing DFHack console commands. Couldn't autosyndrome or somesuch have a kind of... [SYN_CLASS:DFHACK_CONSOLE_weather rain] something? I feel like that could work. Heck, I could maybe add it to itemsyndrome as well, but I'm not sure what utility that would have off the top of my head.

EDIT: Also:

soundsense-season.lua:23: attempt to concatenate field '?' (a nil value)
stack traceback:
...hack\scripts/soundsense-season.lua:23:in function (...hack\scripts/soundsense-season.lua:21)
Title: Re: DFHack 0.34.11 r3
Post by: ag on March 16, 2013, 12:45:54 am
soundsense-season.lua:23: attempt to concatenate field '?' (a nil value)
stack traceback:
...hack\scripts/soundsense-season.lua:23:in function (...hack\scripts/soundsense-season.lua:21)

How did you manage to produce that? It means that your 'current season' global contains some totally stupid value instead of normal 0/1/2/3.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 12:57:57 am
I just launch the game normally and start genning a world, and that's what happens during worldgen.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on March 16, 2013, 01:00:33 am
Huh. Probably is set to automatically run when a world is loaded, and mistakes worldgen for a loaded map
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 01:01:31 am
Yeah, I personally don't think it's much of a problem. Bothers me mostly because I think it's my code erroring it up until I look at it twice :P
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 16, 2013, 01:49:45 am
@expwnent: Thank you, deleting PRESERVE_ROCK did it. :) Exactly what I was asking for. :)

@ag: I also have the red error-lines about soundsense. I figured its because I dont have soundsense on, and ignored it.
Title: Re: DFHack 0.34.11 r3
Post by: ag on March 16, 2013, 01:59:24 am
Hm, yes, I think SC_WORLD_LOADED does fire in worldgen; after all, there is a world loaded in a fashion. That event actually works by detecting if df.global.world.world_data exists and contains something.

Edit: this should fix it: http://raw.github.com/angavrilov/dfhack/101ab2b301ddfe7bc5382157952599a32bae5d08/scripts/soundsense-season.lua (http://raw.github.com/angavrilov/dfhack/101ab2b301ddfe7bc5382157952599a32bae5d08/scripts/soundsense-season.lua)
Title: Re: DFHack 0.34.11 r3
Post by: Pkassad on March 16, 2013, 02:17:02 am
If you set all the items the traders bring to be dumped and use the autodump function you can 'teleport' all their goods into your mountainhome for free...

Might be a good way to increase fun with the other races.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2013, 04:58:04 am
Couldn't autosyndrome or somesuch have a kind of... [SYN_CLASS:DFHACK_CONSOLE_weather rain] something? I feel like that could work. Heck, I could maybe add it to itemsyndrome as well, but I'm not sure what utility that would have off the top of my head.

I don't understand what this means.

edit: If you want to create rain/whatever with a reaction you can already do that with autoSyndrome. Just make it trigger a script that does whatever you want. If you want to trigger something every time it rains, you'd need something else.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 16, 2013, 05:01:42 am
I guess it means that as soon as a Syndrome existst ingame with this ID, the ID is entered into dfhack. Same for reactions. Run reaction DFHACK_CONSOLE_SIREN, and dfhack runs siren. Dwarf has an interactions with Syn_class:DFHACK_CONSOLE_WEATHER_RAIN, dfhack runs "weather rain".

Just a way to enter the command ingame, through modding, instead of typing it into the console.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2013, 05:29:11 am
That should totally be possible, but isn't implemented at the moment.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 16, 2013, 09:07:50 am
Yep. Understood.

I also have this old, unresolved question: I cant get siege engine control to work. I use this in the init, and aim with 'q' on a ballista, press Ctrl-A, nothing happens...

# siege engine control
keybinding add Ctrl-A@dwarfmode/QueryBuilding/Some/SiegeEngine gui/siege-engine
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 12:38:09 pm
Couldn't autosyndrome or somesuch have a kind of... [SYN_CLASS:DFHACK_CONSOLE_weather rain] something? I feel like that could work. Heck, I could maybe add it to itemsyndrome as well, but I'm not sure what utility that would have off the top of my head.

I don't understand what this means.

edit: If you want to create rain/whatever with a reaction you can already do that with autoSyndrome. Just make it trigger a script that does whatever you want. If you want to trigger something every time it rains, you'd need something else.

Yes, that's already possible? Then it's far simpler to implement than what Meph wants, since it already exists. How does one have autosyndrome syndromes trigger scripta?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2013, 01:05:38 pm
[SYN_CLASS:\COMMAND]
[SYN_CLASS:weather]
[SYN_CLASS:rain]

Or whatever. Works for plugins, lua scripts, ruby scripts, anything. Anything the user can do from the console (in one command), you can do with this.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 01:11:58 pm
So there, Meph :V
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2013, 01:15:02 pm
I think Meph was asking about something slightly different, like triggering scripts when a unit gets a particular syndrome for any reason, including creature abilities, evil rains, etc. THAT is not yet implemented, but would be an easy enough augmentation to autoSyndrome.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 01:16:14 pm
He was asking about reactions triggering scripts, which is exactly what you just posted.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 16, 2013, 01:36:17 pm
Just to make myself abundantly clear.

[SYN_CLASS:\COMMAND]
[SYN_CLASS:fastdwarf 1]

I put this on a boiling rock, apply it to a creature by spawning it in a workshop, and dfhack runs fastdwarf 1? Its a rethorical question, because I will test it anyway, but yeah... wow.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 01:37:02 pm
I think it would be more like:

[SYN_CLASS:\COMMAND]
[SYN_CLASS:fastdwarf]
[SYN_CLASS:1]
Title: Re: DFHack 0.34.11 r3
Post by: Askot Bokbondeler on March 16, 2013, 01:38:50 pm
i'm sorry i'm asking this again but i'd really like this
i'd like to request a plugin or script that made armours and weapons wear down with use. i don't know how hard it would be or how reasonable it is to ask.
would anyone be interested?

It is possible but by use do you mean just time or actually when in a fight?

the latter is harder
the latter would be ideal, but i'd be happy with the first

E: and also, rotting food even when properly stockpiled
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2013, 01:46:29 pm
I'd recommend learning ruby or lua or C++ and doing it yourself. That's complicated enough that it's not trivial for someone to do it for you.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 16, 2013, 03:23:08 pm
TrueTransformation and InfiniteSky don't seem to work, just tells me there's no such command.

Is there a way to boost the region populations of all the cave creatures at once so they actually appear in adventure mode?

EDIT: Actually, are there ANY valid values for region-pops?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 16, 2013, 04:14:05 pm
I cant get it to work. I tried all these:

 [SYN_CLASS:/COMMAND] autosyndrome command begins here
   [SYN_CLASS:/WORKER_ONLY]
   [SYN_CLASS:/LOCATION]
   [SYN_CLASS:/WORKER_ID]
   [SYN_CLASS:/REACTION_INDEX]
[SYN_CLASS:weather]
[SYN_CLASS:rain]
[SYN_CLASS:REVEAL]
[SYN_CLASS:/REVEAL]
[SYN_CLASS:\REVEAL]

It does affect the worker with the syndrome correctly, but nothing happens with weather rain, or reveal...
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 16, 2013, 04:19:34 pm
There any guide to the new features? Does Spawnunit.lua even work? How to use advfort?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 16, 2013, 04:29:16 pm
There any guide to the new features? Does Spawnunit.lua even work? How to use advfort?
Spawn unit is a bit out of date (too drunk to update...) and adv fort tutorial is wip (but you can already use it) here:  ^^v (http://www.bay12forums.com/smf/index.php?topic=123944.0) (nobody loves advfort :< )

Edit: updated spawnunit...  here  (https://gist.github.com/warmist/4296504) ^3^
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2013, 04:30:34 pm
TrueTransformation and InfiniteSky don't seem to work, just tells me there's no such command.

It's case-sensitive.

I cant get it to work. I tried all these:

 [SYN_CLASS:/COMMAND] autosyndrome command begins here
   [SYN_CLASS:/WORKER_ONLY]
   [SYN_CLASS:/LOCATION]
   [SYN_CLASS:/WORKER_ID]
   [SYN_CLASS:/REACTION_INDEX]
[SYN_CLASS:weather]
[SYN_CLASS:rain]
[SYN_CLASS:REVEAL]
[SYN_CLASS:/REVEAL]
[SYN_CLASS:\REVEAL]

It does affect the worker with the syndrome correctly, but nothing happens with weather rain, or reveal...

It should be backslashes everywhere, not forward slashes.

Also, you can only execute one command per syndrome. You can, of course, have multiple syndromes per stone, or multiple stones per reaction.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 16, 2013, 04:36:15 pm
Slashes work as well. :) At least all the transformations ingame work with slash and/or backslash.

Isnt worker_only a command, and location a command, and worker_id a commend, and reaction_index another one? So only SYN_CLASS:\COMMAND followed by SYN_CLASS:any-dfhack-script-name-here ?

It is really hard to do everything on trail&error basis, since there are no raws for this to read. ^^

Your example with
[SYN_CLASS:\COMMAND]
[SYN_CLASS:weather]
[SYN_CLASS:rain]
didnt work, thats why I started experimenting.
Title: Re: DFHack 0.34.11 r3
Post by: smakemupagus on March 16, 2013, 04:45:45 pm
(nobody loves advfort :< )

i bet more fort-mode players will get into adv mode after some of Toady's upcoming updates, and this will become a big hit :D
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2013, 04:51:36 pm
https://github.com/peterix/dfhack/blob/master/plugins/autoSyndrome.cpp#L331

"\COMMAND" Every SYN_CLASS after this will be a dfhack command. Except for a few special arguments, each SYN_CLASS will be one argument.


Special \COMMAND arguments
"\LOCATION": The next three arguments passed to whatever command are the x, y, and z coordinate of the work tile of the building which triggered the reaction.

"\WORKER_ID": The next argument passed to whatever command is the id of the worker who did the reaction.

"\REACTION_INDEX": The next argument is the index of the custom reaction, as used internally by DF.


Special arguments that must be given BEFORE \COMMAND, (or without any \COMMAND at all)

"\WORKER_ONLY": When present, add the syndrome to (at most) the worker. Still check if the worker can be affected based on SYN_AFFECTED and SYN_IMMUNE stuff. When absent, try to add the syndrome to all units in the workshop.

"\PRESERVE_ROCK": When present, do NOT delete the rock that was created by the reaction. When absent, do delete it (prevents it from being inhaled conventionally).

"\ALLOW_MULTIPLE_TARGETS": When absent, any number of targets may be affected by any syndrome (as long as they are influenced according to the SYN_AFFECTED, SYN_IMMUNE, and WORKER_ONLY rules). When present, at most one unit can be affected by the syndrome.

Allow multiple targets bug: if you don't have WORKER_ONLY, it could plausibly affect both the worker and somebody else in the workshop.

Allow multiple targets design flaw / bug sort of: Leaving out allow multiple targets basically means that only one syndrome per the entire reaction can affect anybody. This is probably not what people would want in the case that they want to affect exactly two units , or make one thing happen to every unit, and one to just the worker, etc.

edit: It's only a problem if you have two or more syndromes that leave out allow multiple targets.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 16, 2013, 05:00:01 pm
btw people don't forget about "lua api.rst/html" e.g. that save/raws specific lua scripts i was talking about? here: https://github.com/warmist/dfhack/blob/master/Lua%20API.rst#save-init-script (https://github.com/warmist/dfhack/blob/master/Lua%20API.rst#save-init-script)
I think we need to necro that thread where stuff was suggested...
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 05:11:50 pm
Yeah, that init thing is really cool. Very useful for those who want to make scripts for their mod specifically.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2013, 05:30:33 pm
I forget: can it also do separate dfhack.init files per save?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 05:35:03 pm
I forget: can it also do separate dfhack.init files per save?

Looks like it should, yeah.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 16, 2013, 05:39:28 pm
The updated spawnunit is giving me the same error. Does it work in fort mode only?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 16, 2013, 06:02:51 pm
I forget: can it also do separate dfhack.init files per save?

Looks like it should, yeah.
Hmm not that i know of. Only init.lua in raws.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 06:04:52 pm
Since each save has its own raw folder...
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 16, 2013, 06:08:36 pm
How does the trueTransformation plugin work?
Title: Re: DFHack 0.34.11 r3
Post by: Lycaeon on March 16, 2013, 07:23:03 pm
Can you give a summary of how to use the spawnunit.lua script Warmist? Entering "spawnunit" in the DFhack command window yields only errors about race_id...I assume other information like creature ID and caste must be inputted, but I haven't the slightest clue on how to do this.

Advice on attaching the script to a custom reaction would also be appreciated.

Thanks Warmist! :)
Title: Re: DFHack 0.34.11 r3
Post by: falconne on March 16, 2013, 07:54:46 pm
u can already use it) here:  ^^v (http://www.bay12forums.com/smf/index.php?topic=123944.0) (nobody loves advfort :< )

I think in that post you should start off by describing what advfort does (ie perform fort mode jobs in adventure mode) and the implications of this for the game (being able to build and craft things in adv mode). I would think this is a big deal for adv mode players, but it won't be immediately clear to forum users in that section not familiar with DFHack. They'd see the thread title "advfort" and some technical details, but it doesn't mean anything to them so they move on before realising what they're missing.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2013, 08:01:29 pm
trueTransformation:

It works like this: you transform temporarily into some creature. Just after that takes effect, the plugin changes your "base" unit type to be something else. When the transformation wears off, you turn into the other thing.

Example usage:

[SYNDROME]
[CE_BODY_TRANSFORMATION:PROB:100:START:0:END:5]
[CE:CREATURE:BIRD_DUCK:MALE]
[SYN_CLASS:\PERMANENT]
[SYN_CLASS:HUMAN]
[SYN_CLASS:MALE]

Permanently transforms the target into a human male after 5 ticks (or 6, ask a better raw modder). Do NOT apply it to male ducks or it will crash the game.

edit: Will probably also crash the game without START:0. I could fix that if people want it, otherwise I won't bother.

edit2: This is useful because it allows you to transform again from the next form, either with a trueTransformation or a conventional one. Also, it might work better with special abilities. I've gotten weird things before with overlapped transformations and abilities. This should work better, unless the other way also works fine and I just messed it up or misremembered, in which case it'll work equally well.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 16, 2013, 10:15:24 pm
There any guide to the new features? Does Spawnunit.lua even work? How to use advfort?
^^v (http://www.bay12forums.com/smf/index.php?topic=123944.0) (nobody loves advfort :< )

I consider it one of the most important things that DFHack has ever ended up allowing. The problem is that... you're really devving it up :V It's too developer-looking. Looks too much like something a developer would use, the way you describe it.
Title: Re: DFHack 0.34.11 r3
Post by: Lycaeon on March 16, 2013, 10:22:41 pm
I agree. DFHack's tools are inestimably valuable for modders, but most of us are not coders and so it's difficult to implement plugins and scripts that are released without corresponding instructions on how to use them (Both in the command window and in the raws). A post for each plugin/script (Much like expwnent's ones for truetransformation and autosyndromes...much thanks for those!) would go a long way in improving ease-of-access so more modders will take advantage of them.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 16, 2013, 10:49:40 pm
And region-pops, wtf is with that? It asks for "populations tokens," something which does not seem to exist.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 17, 2013, 12:01:31 am
I meant to put a tutorial in the usage string for autoSyndrome. There's a brief description there, but it really isn't enough detail. I'll write something up for the Readme.html that comes with DFHack.
Title: Re: DFHack 0.34.11 r3
Post by: Dragoon209 on March 17, 2013, 12:59:31 am
plugin suggestion:

when placing buildings like a farm plot, or road, etc, have Shift + U max it out to the max length of 10.  same for Shift + H. 

I know this small tweak would really speed up my game.  I'm also really a fan of Falconne's construction plugin, the box select implementation could be used here too.

Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: ag on March 17, 2013, 02:07:03 am
And region-pops, wtf is with that? It asks for "populations tokens," something which does not seem to exist.

Population token is just a plant or creature token for which a population exists  :P
Title: Re: DFHack 0.34.11 r3
Post by: thrush_titan on March 17, 2013, 03:17:52 am
And region-pops, wtf is with that? It asks for "populations tokens," something which does not seem to exist.
It seems to just mean the creature's name in the raws i.e. BIRD_ROC or whatever.  I used it to raise my jabberer population and I'm currently training an army of war Jabberers :)
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 17, 2013, 09:10:57 am
Has anyone been getting error messages that give a file and a line number, especially if related to autoSyndrome? Those shouldn't happen, but I can't fix them if I don't know what's going on.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 17, 2013, 09:54:46 am
@all: Anyone has any idea why siege engine control would not work? I hover over a ballista with 'q', press the hotkey, doesnt trigger...

@expwnent: I have been running dozens of worlds testing different sorts of autosyndrome, no error messages. It either works, or it doesnt. When it does not work, its because I used wrong syntax or was trying something crazy.

And THANK YOU. I will add a new engraving into the mod, that way people end up with statues of expwnent the great, because it works. Running scripts from workshops.  Tests with reveal and die just finished, both work nicely. Will next try scripts with different commands, see what can be used for the mod. :)

EDIT: I wrote an example and posted it here (http://www.bay12forums.com/smf/index.php?topic=124014.0). That way it is not drowned in this thread so quickly. :)
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 17, 2013, 01:50:03 pm
And region-pops, wtf is with that? It asks for "populations tokens," something which does not seem to exist.
It seems to just mean the creature's name in the raws i.e. BIRD_ROC or whatever.  I used it to raise my jabberer population and I'm currently training an army of war Jabberers :)

That's the thing, I use those and it either says "invalid population token" or "invalid increment factor." And not just for cave creatures with populations of 0, but for any creature. Creature tokens don't work either.

What's the syntax?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 17, 2013, 01:50:47 pm
It says the syntax. Post your syntax.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 17, 2013, 02:20:27 pm
region-pops incr CRUNDLE 300

or

region-pops incr CREATURE:CRUNDLE 300

region-pops incr BIOME:SUBTERRANEAN_CHASM 300

Tried both with Parentheses and without
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 17, 2013, 02:27:13 pm
Works fine for me, the first one does. You have to make sure the creature exists already, note.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 17, 2013, 04:35:51 pm
Works fine for me, the first one does. You have to make sure the creature exists already, note.

You mean, the creature population must be greater than 0? The commands also don't work for DINGO, of which there are 3000+
Title: Re: DFHack 0.34.11 r3
Post by: ag on March 18, 2013, 01:27:56 am
You mean, the creature population must be greater than 0? The commands also don't work for DINGO, of which there are 3000+

The local creature population must exist, i.e. it must already be possible for it to appear on your map in your biome.
Title: Re: DFHack 0.34.11 r3
Post by: XXSockXX on March 18, 2013, 01:44:55 am
You mean, the creature population must be greater than 0? The commands also don't work for DINGO, of which there are 3000+

The local creature population must exist, i.e. it must already be possible for it to appear on your map in your biome.

This plugin looks very interesting.
So does this mean I can use it to say refill the GCS population on a map where I almost hunted them down to extinction (i.e. there is still at least one left in the local population pool that could appear in my biome) - OR - could I possibly repopulate a whole world that has lost all population due to a bug (http://www.bay12games.com/dwarves/mantisbt/view.php?id=6220) (i.e. a species is completely extinct in the whole world)?
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 18, 2013, 01:56:11 am
Yes, that's the bug I want to fix. Thing is, in a biome with dingoes, I still can't affect their population, which had led me to believe that there were some esoteric "population tokens."
Title: Re: DFHack 0.34.11 r3
Post by: Eldrick Tobin on March 18, 2013, 12:24:31 pm
Yes, that's the bug I want to fix. Thing is, in a biome with dingoes, I still can't affect their population, which had led me to believe that there were some esoteric "population tokens."

Are they listed on "region-pops list" or "region-pops list-all"? If all they're wandering in from 'outside' and aren't thus 'local'. "region-pops incr-all DINGO (number)" would be what you need.
Title: Re: DFHack 0.34.11 r3
Post by: ag on March 18, 2013, 12:37:38 pm
Are they listed on "region-pops list" or "region-pops list-all"? If all they're wandering in from 'outside' and aren't thus 'local'. "region-pops incr-all DINGO (number)" would be what you need.

The exact set that you should be able to modify is printed by list-all, i.e. in other words if it isn't there, it won't be recognized. List without all should be printing only animals that you've already actually had arrive on your map, or something like that.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 18, 2013, 01:20:54 pm
What is the true transformation plugin? It's not in the https://github.com/peterix/dfhack/blob/0.34.11-r3/Readme.rst
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 18, 2013, 03:33:17 pm
Are they listed on "region-pops list" or "region-pops list-all"? If all they're wandering in from 'outside' and aren't thus 'local'. "region-pops incr-all DINGO (number)" would be what you need.

The exact set that you should be able to modify is printed by list-all, i.e. in other words if it isn't there, it won't be recognized. List without all should be printing only animals that you've already actually had arrive on your map, or something like that.

They can't have wandered in, since their population is 0. 3 of the worlds I've tested have no cold regions, and thus no polar bears or others even with "list-all," but the cave creatures are still listed as population 0. I'm trying to solve the bug where cave creatures vanish after a while of playing adventure mode, because I want to encounter them in adventure mode. I just used Dingoes as an example because I had seen them. "region pops-list" in adventure mode returns nothing.

I did not know that you had to specify the creature after incr-all, I just thought that it incremented ALL populations, so that explains why my attempts weren't working. I'll try it later, see if it works.
Title: Re: DFHack 0.34.11 r3
Post by: Heimdall86 on March 18, 2013, 05:34:41 pm
Can someone help me out real quick. Say i wanted to create-items a steel breastplate or a steel axe. How would i go about entering that into the console? Or is this just materials blocks, logs?
Title: Re: DFHack 0.34.11 r3
Post by: munki on March 18, 2013, 06:07:29 pm
It appears the OS X download link in the OP is either broken, or the file in question was never uploaded:

Quote

Warning: fopen(dfhack-0.34.11-r3-Darwin.tar.gz) [function.fopen]: failed to open stream: No such file or directory in /home/content/40/8553340/html/dfhack/download/download.php on line 27

Warning: fclose() expects parameter 1 to be resource, boolean given in /home/content/40/8553340/html/dfhack/download/download.php on line 59
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 18, 2013, 06:40:04 pm
Is there any way to check if an item has a "subtype" struct in it? Because it's either don't check or get an error where I am.

EDIT: ref._type

welp
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 18, 2013, 07:08:53 pm
Can someone help me out real quick. Say i wanted to create-items a steel breastplate or a steel axe. How would i go about entering that into the console? Or is this just materials blocks, logs?
The "create-items" script can only create a few specific simple types of items - if you want to create something else, then you should use the "createitem" plugin (which I apparently forgot to add to the NEWS file) which creates a temporary custom reaction and 'performs' it using a specific unit (and leaks a tiny bit of memory each time you invoke it, but unless you're invoking it hundreds of thousands of times in a single gameplay session you're never going to notice it).
Title: Re: DFHack 0.34.11 r3
Post by: danaris on March 18, 2013, 07:20:06 pm
It appears the OS X download link in the OP is either broken, or the file in question was never uploaded:

Quote

Warning: fopen(dfhack-0.34.11-r3-Darwin.tar.gz) [function.fopen]: failed to open stream: No such file or directory in /home/content/40/8553340/html/dfhack/download/download.php on line 27

Warning: fclose() expects parameter 1 to be resource, boolean given in /home/content/40/8553340/html/dfhack/download/download.php on line 59

Huh. Not sure what's going on there; I'll bug peterix about it.

In the meantime, you're welcome to download the OS X version from http://topazgryphon.org/df/df_osx_hack.zip (http://topazgryphon.org/df/df_osx_hack.zip).
Title: Re: DFHack 0.34.11 r3
Post by: munki on March 18, 2013, 07:33:50 pm

Huh. Not sure what's going on there; I'll bug peterix about it.

In the meantime, you're welcome to download the OS X version from http://topazgryphon.org/df/df_osx_hack.zip (http://topazgryphon.org/df/df_osx_hack.zip).

Looks like it's just a typo: the file linked in the OP is .tar.gz, but it should just be .zip, which worked.
Title: Re: DFHack 0.34.11 r3
Post by: ag on March 19, 2013, 05:12:03 am
I'm trying to solve the bug where cave creatures vanish after a while of playing adventure mode, because I want to encounter them in adventure mode. I just used Dingoes as an example because I had seen them. "region pops-list" in adventure mode returns nothing.

Well that could explain it. The script was really intended for fort mode, more specifically for fixing forts plagued by hordes of silly animal men and not enough normal animals. For instance, the "-all" options are so that you can decimate anything with "MAN" or "GIANT" in it ;)
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 19, 2013, 05:40:31 am
What is the true transformation plugin? It's not in the https://github.com/peterix/dfhack/blob/0.34.11-r3/Readme.rst

http://www.bay12forums.com/smf/index.php?topic=91166.msg4109015#msg4109015
Title: Re: DFHack 0.34.11 r3
Post by: Vaftrudner on March 19, 2013, 05:48:59 am
Hi there, a request for help please!

My civ has a goblin queen and she just immigrated. She's treated like a noble in the noble interface, but I can not assign her rooms. I found a previous thread talking about it, suggesting that the engine treats her like a pet, and I can assign her to chains and such. Is there a way to use DFHack to assign rooms to her? I looked in the readme, but I couldn't find anything specific or it went over my head.

I would love to give her a bedroom and then tie her goblin consort up in a chain with spikes and stuff around. A femdom torture chamber as a married noble bedroom seems very appropriate for a goblin dwarf queen.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 19, 2013, 06:16:07 am
trueTransformation:

It works like this: you transform temporarily into some creature. Just after that takes effect, the plugin changes your "base" unit type to be something else. When the transformation wears off, you turn into the other thing.

Example usage:

[SYNDROME]
[CE_BODY_TRANSFORMATION:PROB:100:START:0:END:5]
[CE:CREATURE:BIRD_DUCK:MALE]
[SYN_CLASS:\PERMANENT]
[SYN_CLASS:HUMAN]
[SYN_CLASS:MALE]

Permanently transforms the target into a human male after 5 ticks (or 6, ask a better raw modder). Do NOT apply it to male ducks or it will crash the game.

edit: Will probably also crash the game without START:0. I could fix that if people want it, otherwise I won't bother.

edit2: This is useful because it allows you to transform again from the next form, either with a trueTransformation or a conventional one. Also, it might work better with special abilities. I've gotten weird things before with overlapped transformations and abilities. This should work better, unless the other way also works fine and I just messed it up or misremembered, in which case it'll work equally well.

So... what you are saying... is... that I could transform my dwarf into a "Magmamancer lvl1", and him again into a "Magmamancer lvl2", and him then into a "Magmamancer lvl3", because essentially this allows multiple transformations?

Because I can do three things with this.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 19, 2013, 06:25:54 am
Yup!
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 19, 2013, 06:27:16 am
Yep, that's amazing. I will definitely remake demon summoning using this plugin for my Summoning Circle.

By the way, is it possible to use "rename" plugin with autoSyndrome? It originally requires that you put a cursor over something, but is it possible to do it with \WORKER_ONLY?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 19, 2013, 06:44:06 am
No. All the scripts/plugins that use location require the cursor to be set. You would have to rewrite the code and compile it again, make a custom version that accepts the location from autosyndrome. And I dont know how to do that. ;)

Otherwise I would have a few ideas of my own.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 19, 2013, 02:31:01 pm
Alright, I can confirm that region-pops incr-all SPIDER_CAVE_GIANT 3000 and whatever other cave creature id's will restore cave creatures in adventure mode, temporarily at least.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 19, 2013, 02:50:02 pm
Your ratkin have no sprites...  and the alarm siren is not mentioned in the manual. Thats about it. :)
Title: Re: DFHack 0.34.11 r3
Post by: 0cu on March 19, 2013, 04:57:11 pm
Any chance to run the tweaks patrol-duty, military-color-assigned and military-training on DF startup without calling the commands?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 19, 2013, 04:58:40 pm
Yes, that should be possible by adding the scripts to the dfhack init. Just write whatever you would type into the dfhack command box into the dfhack init. Thats it.
Title: Re: DFHack 0.34.11 r3
Post by: 0cu on March 19, 2013, 05:03:29 pm
Yes, that should be possible by adding the scripts to the dfhack init. Just write whatever you would type into the dfhack command box into the dfhack init. Thats it.

worked like a charm. Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: RockBiterSon on March 20, 2013, 04:28:37 am
Something interesting happened to me. Thought I should let you guys know so that you can debug.

Spoiler (click to show/hide)
I applied the solution suggested by a forum-goer in that thread and modified the raws to be able to fly my companions down. That shouldn't have any effect as far as I can tell. I also fiddled with the paint tiletypes tool but couldn't do anything other than turn a few tiles into ramps (not useable ramps) That might have had an effect.
I used the adv-bodyswap extensively, both to fly them down and then much more later in the catacombs to dress my companions up in armour.

This is where it gets interesting.

It's too bad that I didn't get a screenshot before, but while bodyswapped, I looked at another companion and saw two units on that square.

Human Swordsman
Len the Meteor of Matches, Deity

So of course I tried to talk to God.

Spoiler (click to show/hide)

didn't work out.
Title: Re: DFHack 0.34.11 r3
Post by: RockBiterSon on March 20, 2013, 05:22:11 am
I managed to replicate it:
(http://i48.tinypic.com/2rc72ia.png)
This is erie. It's as if the Gods are hunting me down to punish me for breaking the physical laws of the universe. The deity that happens to appear exists on every tile by the way.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on March 20, 2013, 05:36:50 am
Being able to talk to deities is not new. Crashing is, but you've always been able to talk to dieties if you let a priest indoctrinate you. They just never talk back.
Title: Re: DFHack 0.34.11 r3
Post by: Eric Blank on March 20, 2013, 05:45:40 am
Ah, so it is the companions whom you swap into who worship these deities. Interesting. All they used to say was "..." Now they just tell the game to go die in a hole.

Also, sorry you ended up crashing your game with that. I should have mentioned that once you get your adventurer down to ground level and wait or sleep an hour, your companions should spawn on the ground around you, so you didn't need to drag each and every one of them down manually.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 20, 2013, 10:11:02 am
I get a crash-to-desktop when pressing 'e' or maybe 'alt-e' in the military screen. I got it twice, but cant relyably replicate it. I dont have any hotkeys set to e/alt-e. It happens when I want to open the equipment screen for squads. I know its not from modding, so it has to be one of three sources:

1. dfhack r3.
2. falconnes plugins.
3. Putnams scripts.

I will just leave that here, maybe someone knows something.
Title: Re: DFHack 0.34.11 r3
Post by: yamamushi on March 20, 2013, 10:19:14 am
Would anyone happen to have a copy of the patch files for OSX?

Or perhaps a pre-patched version of the OSX release?

I see that the git repo for dfhack only has the SDL (Windows) and Linux patches... I suppose, unless someone out there has a pre-patched version of the 0.34.11 OSX release, I'm going to have to commit myself to figuring out the memory values myself :-/
Title: Re: DFHack 0.34.11 r3
Post by: danaris on March 20, 2013, 10:24:17 am
Would anyone happen to have a copy of the patch files for OSX?

Or perhaps a pre-patched version of the OSX release?

I see that the git repo for dfhack only has the SDL (Windows) and Linux patches... I suppose, unless someone out there has a pre-patched version of the 0.34.11 OSX release, I'm going to have to commit myself to figuring out the memory values myself :-/

When you say "patched" do you mean "DF bundled with DFHack"? Or "DF with all the binpatches applied"?

Because the former is available from the first post. The latter...I'm not sure anyone has even attempted to build the appropriate binpatches for OS X.
Title: Re: DFHack 0.34.11 r3
Post by: yamamushi on March 20, 2013, 10:42:38 am
Would anyone happen to have a copy of the patch files for OSX?

Or perhaps a pre-patched version of the OSX release?

I see that the git repo for dfhack only has the SDL (Windows) and Linux patches... I suppose, unless someone out there has a pre-patched version of the 0.34.11 OSX release, I'm going to have to commit myself to figuring out the memory values myself :-/

When you say "patched" do you mean "DF bundled with DFHack"? Or "DF with all the binpatches applied"?

Because the former is available from the first post. The latter...I'm not sure anyone has even attempted to build the appropriate binpatches for OS X.

The latter :-/

I have dfhack running fine (luckily I already had all the dependencies built), I would just like to have the binary patches applied to get around the hospital stockpile bug that has been causing me so many headaches in my longer running forts.
Title: Re: DFHack 0.34.11 r3
Post by: danaris on March 20, 2013, 10:52:29 am
I have dfhack running fine (luckily I already had all the dependencies built), I would just like to have the binary patches applied to get around the hospital stockpile bug that has been causing me so many headaches in my longer running forts.

Then I would recommend coming into the IRC channel, where you can find me (for OS X specific knowledge) and those who built the binpatches in the first place, and hopefully find a way to get them working for OS X.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 20, 2013, 10:55:58 am
Porting the binpatches to OSX will require locating the relevant code in the OSX version and determining how to fix it, and this will probably not be a trivial task.
Title: Re: DFHack 0.34.11 r3
Post by: narhiril on March 20, 2013, 02:30:10 pm
trueTransformation:

It works like this: you transform temporarily into some creature. Just after that takes effect, the plugin changes your "base" unit type to be something else. When the transformation wears off, you turn into the other thing.

Example usage:

[SYNDROME]
[CE_BODY_TRANSFORMATION:PROB:100:START:0:END:5]
[CE:CREATURE:BIRD_DUCK:MALE]
[SYN_CLASS:\PERMANENT]
[SYN_CLASS:HUMAN]
[SYN_CLASS:MALE]

Permanently transforms the target into a human male after 5 ticks (or 6, ask a better raw modder). Do NOT apply it to male ducks or it will crash the game.

edit: Will probably also crash the game without START:0. I could fix that if people want it, otherwise I won't bother.

edit2: This is useful because it allows you to transform again from the next form, either with a trueTransformation or a conventional one. Also, it might work better with special abilities. I've gotten weird things before with overlapped transformations and abilities. This should work better, unless the other way also works fine and I just messed it up or misremembered, in which case it'll work equally well.

Does this play nice with AutoSyndrome?  As in, can I apply a "True Transformation" with AutoSyndrome?  If not, I suppose I could use an intermediary ability.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 20, 2013, 03:02:09 pm
I havent tested yet, but worst case you apply an interaction with autosyndrome that gives the ability to give the syndrome with the correct truetransformation syntax. I guess that what you meant with "intermediary" ;)

If I run some tests before expwnent posts here, I'll let you know.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 20, 2013, 03:04:27 pm
There some flag I can do to set a unit's relation with a civ? Such as removing enemy or criminal status?
Title: Re: DFHack 0.34.11 r3
Post by: narhiril on March 20, 2013, 03:55:13 pm
I havent tested yet, but worst case you apply an interaction with autosyndrome that gives the ability to give the syndrome with the correct truetransformation syntax. I guess that what you meant with "intermediary" ;)

If I run some tests before expwnent posts here, I'll let you know.

EDIT: I'll get back to you.  Just realized that my slash was facing the wrong way.  Derp.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 20, 2013, 04:13:16 pm
trueTransformation

blah blah blah

Does this play nice with AutoSyndrome?  As in, can I apply a "True Transformation" with AutoSyndrome?  If not, I suppose I could use an intermediary ability.

It should.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 20, 2013, 04:15:15 pm
Now that I think of it, yeah, you can just do 2 syndromes in the boiling rock. One with the transformation and the syntax of truetransform, the second one with the autosyndrome commands. :)
Title: Re: DFHack 0.34.11 r3
Post by: QuiteFranklyMyMaN on March 20, 2013, 04:27:25 pm
How do I get DFHack to work if im a newbie? Just download it?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 20, 2013, 04:30:04 pm
read the first post... 

Quote
How to install DFHack:
First, get the archive meant for your system. Extract the contents into your DF folder.
On Windows, you're ready to use DFHack. An extra command line window should appear when you run DF.
On Linux, use the 'dfhack' script from a terminal to run DF with DFHack. If you have stonesense problems, you might have to get your own allegro 5 libraries and delete the ones in stonesense/deplibs.
Title: Re: DFHack 0.34.11 r3
Post by: vjek on March 20, 2013, 04:34:29 pm
For those that have made inquiries, I have tested my dwarf-modifying DFHack .lua scripts (http://dwarffortresswiki.org/index.php/User:Vjek) with r3 and found no issues.

If anyone IS having a problem, please let me know right away.

Title: Re: DFHack 0.34.11 r3
Post by: QuiteFranklyMyMaN on March 20, 2013, 04:55:04 pm
read the first post... 

Quote
How to install DFHack:
First, get the archive meant for your system. Extract the contents into your DF folder.
On Windows, you're ready to use DFHack. An extra command line window should appear when you run DF.
On Linux, use the 'dfhack' script from a terminal to run DF with DFHack. If you have stonesense problems, you might have to get your own allegro 5 libraries and delete the ones in stonesense/deplibs.

how does it hook into the main game? does it overrite the .exe or what?
Title: Re: DFHack 0.34.11 r3
Post by: Rose on March 20, 2013, 04:57:49 pm
It over-writes SDL.dll
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on March 20, 2013, 05:08:22 pm
It might be taken for granted by anybody who does not use dfhack for the first time, but the line "Extract the contents into your DF folder." in the first post maybe could use some addition like "it will replace SDL.dll so agree if it tries to do so" with some OS specific details (I don't even know how the pop-up screen looks in any Windows versions other than my localized copy and even less for other OSs like Linux or OSX).
Title: Re: DFHack 0.34.11 r3
Post by: smakemupagus on March 20, 2013, 05:14:51 pm
The readme walks you through it pretty carefully, including writing over of the SDL, and how to use the init file.
Title: Re: DFHack 0.34.11 r3
Post by: QuiteFranklyMyMaN on March 20, 2013, 05:15:43 pm
It over-writes SDL.dll

ahhh, what IS the SDL.dll anyway?
Title: Re: DFHack 0.34.11 r3
Post by: Rose on March 20, 2013, 05:20:04 pm
It over-writes SDL.dll

ahhh, what IS the SDL.dll anyway?

It's an open-source library that DF uses to do its graphics. DFhack replaces it with its own version that, in turn, loads the original.

It might be taken for granted by anybody who does not use dfhack for the first time, but the line "Extract the contents into your DF folder." in the first post maybe could use some addition like "it will replace SDL.dll so agree if it tries to do so" with some OS specific details (I don't even know how the pop-up screen looks in any Windows versions other than my localized copy and even less for other OSs like Linux or OSX).
The os specific details /are/ in the readme.
Title: Re: DFHack 0.34.11 r3
Post by: QuiteFranklyMyMaN on March 20, 2013, 05:22:50 pm
It over-writes SDL.dll

ahhh, what IS the SDL.dll anyway?

It's an open-source library that DF uses to do its graphics. DFhack replaces it with its own version that, in turn, loads the original.

It might be taken for granted by anybody who does not use dfhack for the first time, but the line "Extract the contents into your DF folder." in the first post maybe could use some addition like "it will replace SDL.dll so agree if it tries to do so" with some OS specific details (I don't even know how the pop-up screen looks in any Windows versions other than my localized copy and even less for other OSs like Linux or OSX).
The os specific details /are/ in the readme.

oh now I get it.
Title: Re: DFHack 0.34.11 r3
Post by: danaris on March 20, 2013, 05:43:47 pm
It might be taken for granted by anybody who does not use dfhack for the first time, but the line "Extract the contents into your DF folder." in the first post maybe could use some addition like "it will replace SDL.dll so agree if it tries to do so" with some OS specific details (I don't even know how the pop-up screen looks in any Windows versions other than my localized copy and even less for other OSs like Linux or OSX).

What the dialog looks like on Linux and OS X is irrelevant, because DFHack hooks in in a different way, that doesn't require replacing libraries :)

On both those OSes, you just copy all the DFHack files into the DF folder, and then launch the "dfhack" script instead of the "df" script.
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on March 20, 2013, 05:55:19 pm
The readme walks you through it pretty carefully, including writing over of the SDL, and how to use the init file.

People tend to ingnore the readme. Don't ask why, they do it.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 20, 2013, 07:17:27 pm
I've been browsing shops in my mod and found this:

(http://img.ie/8n2jk.png)
It's decorated with " ".

Can DFHack show material IDs of item decoration or something? I really must find out what is it.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 20, 2013, 07:26:16 pm
Okay, I've found the "changeitem info" command, but it does not show decorations. Can someone tell me what can I use to check them (or could someone write a script for me?). I would be MOST grateful, it could be one of minor things which cause crashes which I can never pin down.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 20, 2013, 07:35:27 pm
Blank names of materials do not cause crashes. I use several blank entries on purpose, on plants, creatures and inorganics.

Dont know about the script.. nothing in the readme?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 20, 2013, 07:36:12 pm
Thankfully, it's a simple-ass script to make.

Code: [Select]
local function getItemImprovements(item)
for _,improvement in ipairs(item.improvements) do
printall(improvement)
end
end

getItemImprovements(dfhack.gui.getSelectedItem())

This will spew a bunch of stuff into the DFHack console when you run it. You'll probably find the relevant info there :V
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 20, 2013, 07:44:18 pm
Thanks, Putnam!

It shows this:
(http://img.ie/kt6zr.png)
How do I... understand it? I don't see the index of the material of decoration.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 20, 2013, 07:47:08 pm
I mean it looks like the material has index of 164 and type of 0... Any way I can list all materials in save or something to find out what it actually is?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 20, 2013, 07:53:57 pm
Aha--sorry about that. Since it's a mat type of zero, it's an inorganic. Go into the lua interface and type this:

printall(df.global.world.raws.inorganics.all[164])

I think that's it, at least. If it's not, I know for a fact that df.global.world.raws is correct, and you could navigate from there with liberal application of printall(table).
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 20, 2013, 08:05:01 pm
Now that is weird... 164 is standstone:

(http://img.ie/076fz.png)

Now why would that be not displayed as a decoration properly...
Title: Re: DFHack 0.34.11 r3
Post by: yamamushi on March 20, 2013, 09:40:42 pm

Then I would recommend coming into the IRC channel, where you can find me (for OS X specific knowledge) and those who built the binpatches in the first place, and hopefully find a way to get them working for OS X.

Cool, I'll try and find you in IRC when I have time to sit down with "The Cheat" again later today. I anticipate that it will be a pain, but I have gone through DF's memory addresses before in the past when porting an old version of Dwarf Therapist to OSX (back when there was no official release for OSX). I don't have IDA though, I guess I should grab the free copy.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 20, 2013, 09:52:37 pm
Oh my god I just tried advfort for the first time and giggled like a schoolgirl.

EDIT: I just had a dwarfgasm. This is literally the best thing ever.

Meph, meph, meph, this is like, super important for Masterwork, you don't even KNOW
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 20, 2013, 10:13:30 pm
For advfort, do I need to be holding material to use it, or does it need to be on the ground nearby?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 20, 2013, 10:17:30 pm
Oh my god I just tried advfort for the first time and giggled like a schoolgirl.

EDIT: I just had a dwarfgasm. This is literally the best thing ever.

Meph, meph, meph, this is like, super important for Masterwork, you don't even KNOW
I KNOW, shame somehow his version breaks the keybindings and made it so that you need to press 5 then Shift to do a job above you than Shift then 5. the pressing of 5 first causes you to do the job that's center of you this sucks when you're trying to remove the ceiling tile and end up breaking the floor tile instead, this will kill/maim an adventurer if their on the second floor. currently looking through the script to see if he alter it... though I guess it's another script he added on.

For advfort, do I need to be holding material to use it, or does it need to be on the ground nearby?
uhh a mix of both, you could haul the item or have the item under your foot.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 20, 2013, 10:19:29 pm
I've been playing it in MW and it's fine. Not sure what your problem is...
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 20, 2013, 10:42:17 pm
try decontructing a floor above you with out removing the floor under you.
that's my problem advfort now has this issue where it can't register SHIFT-5 but only unless you press 5 first.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 20, 2013, 10:45:12 pm
How do I build a statue that I have? I tried standing on it, I tried having it in my backpack, but it just makes another statue of "unknown material" that I can just walk through

EDIT: I see, I have to build again while standing on the statue item, the first time is just a designation.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 20, 2013, 10:46:33 pm
Did you try dropping it on the ground then waiting a bunch?
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 21, 2013, 03:20:20 am
Can you guys brainstorm how to apply syndrome to soap  so it would work on cleaning?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 21, 2013, 04:24:31 am
Guys, I know what advfort does. And that people can do 3-trillion things in adv-mode now. Like... all the buildings, and all the reactions... its included in Masterwork, I did not change any keybindings for it at all, and I simply dont care. This here is dwarven Starcraft. Not dwarven Skyrim. At least to me.  :P

Its like me listening to rock, and some guys comes by and says: This is the best, highest quality hiphop ever. It might be good, it might be exceptional, but I still wont like it. ;)

Of course its still included in the mod, for people that do. Maybe a big, easy, colorful manual with pictures would be nice, so that people get the point. Most dfhack readmes are rather slim and/or very technical. Which is not bad in itself, just not very accessable for non-techsavy people.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 21, 2013, 04:25:54 am
Guys, I know what advfort does. And that people can do 3-trillion things in adv-mode now. Like... all the buildings, and all the reactions... its included in Masterwork, I did not change any keybindings for it at all, and I simply dont care. This here is dwarven Starcraft. Not dwarven Skyrim. At least to me.  :P

Its like me listening to rock, and some guys comes by and says: This is the best, highest quality hiphop ever. It might be good, it might be exceptional, but I still wont like it. ;)

Of course its still included in the mod, for people that do.
hmm then what caused the key commands to shift then?
Title: Re: DFHack 0.34.11 r3
Post by: oasis789 on March 21, 2013, 04:29:39 am
How do I use binpatch to enable the following patch codes?

http://www.bay12games.com/dwarves/mantisbt/view.php?id=3100
http://www.bay12games.com/dwarves/mantisbt/view.php?id=5854

How do I enable the "Add Spatter" building?
Title: Re: DFHack 0.34.11 r3
Post by: RockBiterSon on March 21, 2013, 05:45:39 pm
Is there a way to make an abandonned fort into a friendly civilization site so that I can retire my adventurer there (and his companions?) and makeown him when I reclaim the site?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 21, 2013, 05:47:41 pm
Is there a way to make an abandonned fort into a friendly civilization site so that I can retire my adventurer there (and his companions?) and makeown him when I reclaim the site?

EDIT: Misread the question, I think that site claim script posted earlier may be of use to you.
Title: Re: DFHack 0.34.11 r3
Post by: vjek on March 21, 2013, 08:39:03 pm
question regarding create-items.rb

If I wanted to add 'leather' into the list of options, how would I go about doing that?

So far, I've got:
Code: [Select]
if mat_raw !~ /:/ and !(df.decode_mat(mat_raw) rescue nil)
list = df.world.raws.creatures.all.find_all { |cre|
cre.material.find { |mat| mat.id == 'LEATHER' }
}.map { |cre| cre.creature_id }
mat_raw = match_list(mat_raw, list)
mat_raw = "CREATURE:#{mat_raw}:LEATHER"
puts mat_raw
end
And when put inside an existing loop, it will create the item with the correct name, but it's material type is incorrect.

For example, by modifying 'webs' or 'boulders' or 'bars' with the above
[DFHack]# create-items webs duck 2
CREATURE:BIRD_DUCK:LEATHER
the script will create 'duck leather' in game, of the type of the respective material.

I don't know enough ruby to know what    cls = DFHack::ItemBarst is doing, but there are apparently a set number of those constants (Threads, Bars, Boulders, Woods) and Skin_Tanned is not among them, (despite they all being item tokens) as per:

E: NameError: ./hack/scripts/create-items.rb:117: uninitialized constant DFHack::ItemSkin_Tannedst
 ./hack/scripts/create-items.rb:117

Thoughts? Comments?  I just want to expand the functionality of the create-items.rb script to include the ability to create different types of leather. (and ideally things like skin, bone, horn, etc)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 21, 2013, 08:56:13 pm
item_skin_tannedst appears to be it...

https://github.com/peterix/df-structures/blob/master/df.items.xml
Title: Re: DFHack 0.34.11 r3
Post by: vjek on March 21, 2013, 09:30:19 pm
Doesn't like it...

It's either
E: NameError: ./hack/scripts/create-items.rb:117: uninitialized constant DFHack::Item_Skin_Tannedst

with matched case, or

E: NoMethodError: undefined method `item_skin_tannedst' for DFHack:Module ./hack/scripts/create-items.rb:117

without.   ???
Title: Re: DFHack 0.34.11 r3
Post by: RockBiterSon on March 21, 2013, 09:39:03 pm
Is there a way to make an abandonned fort into a friendly civilization site so that I can retire my adventurer there (and his companions?) and makeown him when I reclaim the site?

EDIT: Misread the question, I think that site claim script posted earlier may be of use to you.

Thanks. Err. How much earlier? There is over 200 pages of material to look through...
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 21, 2013, 09:42:12 pm
http://www.bay12forums.com/smf/index.php?topic=91166.msg4102163#msg4102163
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 21, 2013, 11:43:21 pm
hmm or you could use 2fort (https://gist.github.com/warmist/4198190#file-tofort-lua-L38)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 21, 2013, 11:45:10 pm
Hehe, or that.
Title: Re: DFHack 0.34.11 r3
Post by: Nokao on March 22, 2013, 05:08:14 am
Am I wrong, or the new package is not inside https://github.com/peterix/dfhack/downloads ?
Title: Re: DFHack 0.34.11 r3
Post by: Aerval on March 22, 2013, 05:12:49 am
Am I wrong, or the new package is not inside https://github.com/peterix/dfhack/downloads ?
:), you just have to look in the first post of pape one
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 22, 2013, 05:53:49 am
Github remove downloading on their site so Peterix has to build and dump the pack into a hosting site.
Title: Re: DFHack 0.34.11 r3
Post by: addictgamer on March 22, 2013, 05:19:39 pm
Well, here goes my first DFHack script(s).


A week or two ago searched through this thread and didn't find anything that let me add units to my fort's population. So, I spent my spare time the last two weeks writing two scripts that let me do just that.

Known problems:
 * When I took some guards for my civ's caravan, all of them except just sat around gathering bad thoughts until they went insane. In another fort, the dwarven caravan was ambushed and everybody except one caravan guard was killed. After he felled the last goblin, I took control of him and he became a normal worker in my fort.
 * I haven't yet found a unit that I took that I can add to my military. So all those caravan guards are not that useful...unless you need more peasants. Which, personally, I do.
 * All non-dwarven creatures (or, I assume, creatures not of your race -- haven't tried this script with other races as my race) are classified as "tame." So even though sentients usually show up in your "civilians" tab and they have professions and you can set their labors with v -> p -> l, all those goblins you captured aren't actually going to do anything other than walk around. I'd assume this can be fixed with something like companion (which, unfortunately, I don't have in Linux).
 * It doesn't seem you can assign captured units positions in your nobles and administrators screen.

If anybody has any idea how to fix those, please let me know.

Warning: These bug your save or crash your game. I'm not responsible for anything that goes wrong. You are using these scripts at your own risk.
 I've had no crashes or save-breaking problems yet, but don't come crying to me if something does go wrong in any way, shape, or form (though a bug report of sorts is appreciated).
I advise you to always save & additionally back up your save when playing with these (though this applies to DFHack in general) so that you can revert anything that goes wrong.

This first script adds the currently selected unit to your fort. Sentients should show up in your civilians tab and animals should show up in your pets/livestock tab.
Spoiler (click to show/hide)

This one loops through all of the units on the map and adds the ones with the specified ID to your fort.
The script will prompt you for the ID (though I should probably make it look at arguments passed to it).
Spoiler (click to show/hide)

I'm pretty sure there are other flags that could/should be set to make this work better, but I'm no expert

I appreciate any feedback, constructive criticism, and improvements you guys can offer.
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on March 22, 2013, 06:55:56 pm
A week or two ago searched through this thread and didn't find anything that let me add units to my fort's population. So, I spent my spare time the last two weeks writing two scripts that let me do just that.
[...]

Well... spending a couple of minutes reading the readme.rst which comes with dfhack might have saved you some headaches. I would suggest you take a look at the sourcecode for "tweak makeown" which forces a selected unit to become a member of your fort's civilization. It's far from being failsafe since the original intention was to fix bugged migrants/traders who sometimes appear on the map edge and never enter your fort (that's why "tweak fixmigrant" was written and "tweak makeown" is simply more more radical because why not) and I never tested how it works out if you try to makeown invaders for example. But you might get some ideas what flags need to be changed at the very least, maybe (probably) there is more to it if you really want to assimilate every possible kind of creature on your map.

One thing I can tell you for sure from looking at your script is that you need fix the ownership for clothes if you try to confiscate dwarves from caravans.  If you don't they will strip naked, get bad thoughts from being naked and in the worst case go insane because of that - which I think might be happening for you from reading the post. Inside the tweak plugin there is the function "fix_clothing_ownership()" which you should look at for that. Confiscating non-dwarves kinda works, but DF will treat them as semi-pets. IIRC you can assign jobs to them (if the race supports those kind of jobs), but you won't be able to give them bedrooms etc. I don't know if there is any way to overcome this limitation, I don't think there is because probably the player's race might be hardcoded to be the only one which you can fully control in fortress mode and being able to assign jobs to non-dwarves (or non-player-race creatures) is already pretty astounding.
Title: Re: DFHack 0.34.11 r3
Post by: addictgamer on March 22, 2013, 07:27:18 pm
Well... spending a couple of minutes reading the readme.rst which comes with dfhack might have saved you some headaches. I would suggest you take a look at the sourcecode for "tweak makeown" which forces a selected unit to become a member of your fort's civilization.
Oops. I'll take a look at that and see if I can learn something.

One thing I can tell you for sure from looking at your script is that you need fix the ownership for clothes if you try to confiscate dwarves from caravans.  If you don't they will strip naked, get bad thoughts from being naked and in the worst case go insane because of that - which I think might be happening for you from reading the post. Inside the tweak plugin there is the function "fix_clothing_ownership()" which you should look at for that.
Ah, that'd probably explain it. I'll take a look at that.

Confiscating non-dwarves kinda works, but DF will treat them as semi-pets. IIRC you can assign jobs to them (if the race supports those kind of jobs), but you won't be able to give them bedrooms etc. I don't know if there is any way to overcome this limitation, I don't think there is because probably the player's race might be hardcoded to be the only one which you can fully control in fortress mode and being able to assign jobs to non-dwarves (or non-player-race creatures) is already pretty astounding.
I'm pretty sure companion would work around this, but I'm unable to test it (unless I completely missed a Linux port of companion).
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 22, 2013, 09:09:14 pm
Oy. The lua implementation for DFHack not having unpack(table) is kinda bothering me. Got a working implementation running, but it kinda bothered me at first.
Title: Re: DFHack 0.34.11 r3
Post by: RockBiterSon on March 23, 2013, 01:49:51 am
http://www.bay12forums.com/smf/index.php?topic=91166.msg4102163#msg4102163

So if I understand, this creates a three by three tile site meant to be used as a workshop. Once the workshop is created you can retire your adventurer in it? And he'll still be there when you play dwarf mode?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 23, 2013, 02:23:07 am
http://www.bay12forums.com/smf/index.php?topic=91166.msg4102163#msg4102163

So if I understand, this creates a three by three tile site meant to be used as a workshop. Once the workshop is created you can retire your adventurer in it? And he'll still be there when you play dwarf mode?
Yes it will be there forever. And yes you can retire there.
Title: Re: DFHack 0.34.11 r3
Post by: ag on March 23, 2013, 02:56:20 am
Oy. The lua implementation for DFHack not having unpack(table) is kinda bothering me. Got a working implementation running, but it kinda bothered me at first.

You mean table.unpack? http://www.lua.org/manual/5.2/manual.html#pdf-table.unpack (http://www.lua.org/manual/5.2/manual.html#pdf-table.unpack)
Title: Re: DFHack 0.34.11 r3
Post by: Heimdall86 on March 23, 2013, 03:16:07 am
Could one of you amazingly talented modders make a gui for tiletypes like you did with liquids. I would love to be able to change any tile at will like i can with obsidian in the liquids function.
Title: Re: DFHack 0.34.11 r3
Post by: Timeless Bob on March 23, 2013, 05:24:53 am
Here's an interesting thought for dwarven economy: Being able to become a wagon in adventurer mode. 

Crazy right? 

Suppose using advfort a character were able to build a wagon using 3 logs and 2 "pet" horses/cows/ect...  then using forcing a character swap, that character becomes the wagon + horses with their former body and whomever they've convinced to travel with them as caravan gaurds.  The wagon-creature is able to haul all sorts of crap but has only the usual "hoof of death kung fu" that wagons usually have in fort mode.  A wagon that gets killed (ie, the horses/camels/ect... are dead) is "scuttled" and produces three logs of wood once more.  Wagons could end up with awesome names, which would make Legends mode a bit... different... too.

Ok, so that all seems a bit reasonable, but here's the next part which might be harder to do:
The wagon decides to retire at a hamlet or something - the wagon "dies", the adventurer pops back into his/her original body and that civ gains the inventory of that wagon as part of their trade goods.  Seeing as how using dfhack, fortresses can be made to live on past abandonment, this means that they can in effect trade with each other by having adventurer wagons pick stuff up at one fortress and "sell" it to the civ of another fortress.  If those trade-goods are then able to be resold to the fortress in fort mode, they've just become a link in a caravan trade economy. Trading coins would be useful again and kobold/bandit attacks would make more sense as caravan thieves.

Thoughts?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 23, 2013, 06:18:04 am
Here's an interesting thought for dwarven economy: Being able to become a wagon in adventurer mode. 

Crazy right? 

Suppose using advfort a character were able to build a wagon using 3 logs and 2 "pet" horses/cows/ect...  then using forcing a character swap, that character becomes the wagon + horses with their former body and whomever they've convinced to travel with them as caravan gaurds.  The wagon-creature is able to haul all sorts of crap but has only the usual "hoof of death kung fu" that wagons usually have in fort mode.  A wagon that gets killed (ie, the horses/camels/ect... are dead) is "scuttled" and produces three logs of wood once more.  Wagons could end up with awesome names, which would make Legends mode a bit... different... too.

Ok, so that all seems a bit reasonable, but here's the next part which might be harder to do:
The wagon decides to retire at a hamlet or something - the wagon "dies", the adventurer pops back into his/her original body and that civ gains the inventory of that wagon as part of their trade goods.  Seeing as how using dfhack, fortresses can be made to live on past abandonment, this means that they can in effect trade with each other by having adventurer wagons pick stuff up at one fortress and "sell" it to the civ of another fortress.  If those trade-goods are then able to be resold to the fortress in fort mode, they've just become a link in a caravan trade economy. Trading coins would be useful again and kobold/bandit attacks would make more sense as caravan thieves.

Thoughts?
I did this way back with a so called wagon mode
Code: [Select]
function scuttle(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
if unit.flags3.scuttle==false then
unit.flags3.scuttle=true
end
entry=getline()
unit.flags1.dead=false
unit.flags2.killed=false
end
menu:add("wagon",scuttle)
where you take a companion (or anyone) and turn them into a wagon (they will die then you have to reflip the dead flag to revive them). over time we found ways to deal with the issue of a non moving unit via learning how to drag creatures in adventure mode. also setting up a caravan by dumping items and what not. I successfully completed the ability to act as a caravan back in 2012 though what was of it is a tamed horse companion a random animal(this could be replaced with a created unit) turn into a wagon, and making the horse the drag the wagon through Dragger and draggee Id links. though fast traveling will break the dragger and draggee links it was a close to great simulation. though after that I kinda gave up on working on wagons due to I done all I could with the project.
though this bit about trading goods seems like a good idea to work on though. only to jump the hurdle that is do shops even keep record of the stuff you sold them or do they just vanish and pick up a new name? oh and trading coins will never be usefull with the huge wealth exchange dropping worth of a coin to 1 uristbuck when you take it to another area.

here's 3 different types of CORPSE EXPLOSION spells have fun including them since most of them are test of the flow mechanics.


Code: [Select]
{name="corpse piece explosion",f=function (unit_list,pos)
  local items={}
  for _,checked_item in pairs(df.global.world.items.all) do --actually you could iterate over only corpse pieces... But i'm too lazy
    if df.item_corpsepiecest:is_instance(checked_item) and checked_item.flags.on_ground then --add/remove more checks before then if you want to explode not ALL the corpses
      table.insert(items,checked_item) --add to the list of target items
    end
  end

if #items==0 then
print"no corpses"
else
  for k,v in pairs(items) do
  upos=copyall(v.pos)
  dfhack.timeout(100,"ticks",function() dfhack.maps.spawnFlow(upos,6,6,6,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  end
  end
      return true
end},
{name="corpse explosion",f=function (unit_list,pos,item_list)
  local items={}
  for _,checked_item in pairs(df.global.world.items.other.ANY_CORPSE) do --actually you could iterate over only corpse pieces... But i'm too lazy
    if checked_item.flags.on_ground then --add/remove more checks before then if you want to explode not ALL the corpses
      table.insert(items,checked_item) --add to the list of target items
    end
  end
if #items==0 then
    print"no corpses"
else
local Corp={}
local Corp=getcorpse(df.global.world.items.other.ANY_CORPSE)
  for k,v in pairs(Corp) do
local   upos=copyall(v.pos)
  print(k.."test")
  dfhack.timeout(10,"ticks",function() dfhack.maps.spawnFlow(upos,4,2,2,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(50,"ticks",function() dfhack.maps.spawnFlow(upos,3,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(60,"ticks",function() dfhack.maps.spawnFlow(upos,3,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(70,"ticks",function() dfhack.maps.spawnFlow(upos,3,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(80,"ticks",function() dfhack.maps.spawnFlow(upos,3,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  end
  end
        return true
end},
{name="Mega Corpse-Explosion",f=function (unit_list)
  local items={}
  for _,checked_item in pairs(df.global.world.items.other.ANY_CORPSE) do --actually you could iterate over only corpse pieces... But i'm too lazy
    if checked_item.flags.on_ground then --add/remove more checks before then if you want to explode not ALL the corpses
      table.insert(items,checked_item) --add to the list of target items
    end
  end
if #items==0 then
    print"no corpses"
else
local Corp={}
local Corp=getcorpse(df.global.world.items.other.ANY_CORPSE)
  for k,v in pairs(Corp) do
local   upos=copyall(v.pos)
  print(k.."test")
  dfhack.timeout(10,"ticks",function() dfhack.maps.spawnFlow(upos,4,2,2,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(50,"ticks",function() dfhack.maps.spawnFlow(upos,3,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(60,"ticks",function() dfhack.maps.spawnFlow(upos,3,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(70,"ticks",function() dfhack.maps.spawnFlow(upos,9,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(70,"ticks",function() dfhack.maps.spawnFlow(upos,10,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(70,"ticks",function() dfhack.maps.spawnFlow(upos,11,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(70,"ticks",function() dfhack.maps.spawnFlow(upos,12,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(70,"ticks",function() dfhack.maps.spawnFlow(upos,8,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(10,"ticks",function() dfhack.maps.spawnFlow(upos,8,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(15,"ticks",function() dfhack.maps.spawnFlow(upos,8,2,10,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(20,"ticks",function() dfhack.maps.spawnFlow(upos,8,3,14,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(25,"ticks",function() dfhack.maps.spawnFlow(upos,8,4,16,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(30,"ticks",function() dfhack.maps.spawnFlow(upos,8,5,18,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(90,"ticks",function() dfhack.maps.spawnFlow(upos,13,5,18,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(90,"ticks",function() dfhack.maps.spawnFlow(upos,15,5,18,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  dfhack.timeout(80,"ticks",function() dfhack.maps.spawnFlow(upos,7,2,11,50000) end) --this spawns dragonfire after 100 ticks(you could change "100" to e.g. "math.random(0,1000)" for random timeouts)
  end
  end
        return true
end},

Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 23, 2013, 10:54:27 am
I have a quick question about truetransform.

If I transformed a creature A using truetransform into creature B... can I still transform creature B into creature C for a short time, using a normal transformation, with START:0:END:1000 ? Can a truetransformed creature still be normally targeted by transformations that dont use truetransform?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 23, 2013, 01:05:58 pm
I have a quick question about truetransform.

If I transformed a creature A using truetransform into creature B... can I still transform creature B into creature C for a short time, using a normal transformation, with START:0:END:1000 ? Can a truetransformed creature still be normally targeted by transformations that dont use truetransform?

Yes. Once the true transformation completes, it will be just like they had always been whatever they transformed into.
Title: Re: DFHack 0.34.11 r3
Post by: Lycaeon on March 23, 2013, 01:14:24 pm
There's a bug with the autosyndrome plugin in which the reaction will affect one creature other than the worker if it's also in the workshop, even with \WORKER_ONLY appended to the material. I've mitigated this with SYN_AFFECTED_CREATURE, but it's impossible to make a syndrome that only affects the worker otherwise.

Here's the code for an example inorganic material I used (IS_STONE and 9000 boiling point is in the material template).

Code: [Select]
[INORGANIC:DESIGNATE_HEALING]
[USE_MATERIAL_TEMPLATE:LIGHT3_TEMPLATE]
[PREFIX:NONE]
[SYNDROME]
[SYN_CLASS:\WORKER_ONLY]
[SYN_NAME:designator]
[SYN_AFFECTED_CREATURE:PONY_STABLE:ALL]
[CE_SPEED_CHANGE:SPEED_PERC:1:START:0:END:600]
[CE_CAN_DO_INTERACTION:START:0:END:600]
[CDI:INTERACTION:DESIGNATE_HEALING]
[CDI:ADV_NAME:designate patient]
[CDI:TARGET:A:LINE_OF_SIGHT]
[CDI:TARGET_RANGE:A:5]
[CDI:MAX_TARGET_NUMBER:A:1]
[CDI:TARGET_VERB:are designated for healing:is designated for healing]
[CDI:WAIT_PERIOD:900]
[CDI:FREE_ACTION]

Also, the DFhack command window often displays Line 284: Couldn’t find unit -1. It's not in red, and so far doesn't seem to have an effect on gameplay, but it spams the window.

Thank you expwnent for your excellent plugins. Trutransformation is also awesome! :D
Title: Re: DFHack 0.34.11 r3
Post by: Timeless Bob on March 23, 2013, 01:17:34 pm
I suppose that not relying on the shops at all, but just copying the list of wagon stuff into a quick file then sticking it into the inventory of trader's goods once they hit the Depot might be a work-around (to get past the "I can't carry that much" problem).  Make it a workshop reaction using the Depot as a workshop, for instance.  (By the way, I don't know what's possible or impossible, so this is all in "wouldn't this be neat" territory.)

Of course, if your Depot also uploaded a list of items a trader was removing during fort mode and saved the game at the point that they left, that could be used as a departure point for a new adventurer and wagon who would need to bear a copy of that inventory elsewhere.  Might be another nice way to tie the fort and adventure mode systems together.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 23, 2013, 03:02:42 pm
There's a bug with the autosyndrome plugin in which the reaction will affect one creature other than the worker if it's also in the workshop, even with \WORKER_ONLY appended to the material. I've mitigated this with SYN_AFFECTED_CREATURE, but it's impossible to make a syndrome that only affects the worker otherwise.

Here's the code for an example inorganic material I used (IS_STONE and 9000 boiling point is in the material template).

Code: [Select]
[INORGANIC:DESIGNATE_HEALING]
[USE_MATERIAL_TEMPLATE:LIGHT3_TEMPLATE]
[PREFIX:NONE]
[SYNDROME]
[SYN_CLASS:\WORKER_ONLY]
[SYN_NAME:designator]
[SYN_AFFECTED_CREATURE:PONY_STABLE:ALL]
[CE_SPEED_CHANGE:SPEED_PERC:1:START:0:END:600]
[CE_CAN_DO_INTERACTION:START:0:END:600]
[CDI:INTERACTION:DESIGNATE_HEALING]
[CDI:ADV_NAME:designate patient]
[CDI:TARGET:A:LINE_OF_SIGHT]
[CDI:TARGET_RANGE:A:5]
[CDI:MAX_TARGET_NUMBER:A:1]
[CDI:TARGET_VERB:are designated for healing:is designated for healing]
[CDI:WAIT_PERIOD:900]
[CDI:FREE_ACTION]

http://www.bay12forums.com/smf/index.php?topic=91166.msg4108566#msg4108566

This will be fixed in the next version.

Also, the DFhack command window often displays Line 284: Couldn’t find unit -1. It's not in red, and so far doesn't seem to have an effect on gameplay, but it spams the window.

I'm pretty sure I already fixed this for the next release. Does it say a file name?
Title: Re: DFHack 0.34.11 r3
Post by: Lycaeon on March 23, 2013, 03:14:16 pm
It mentioned the autosyndrome plugin and the DFhack file, but nothing else.

Thanks! :) When can we expect the new version?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 23, 2013, 04:23:02 pm
@expwnent: That is very, very good news. Otherwise I would have hade to rewrite ~300 transformations. ^^ But it seems that all is good. The modding can commence. Thank you. :)
Title: Re: DFHack 0.34.11 r3
Post by: erekwednar on March 24, 2013, 08:25:39 am
TEXT mode:
I can't seem to get any plugin that needs to be aware of the UI to work, they all throw up the message about the context they need to be in.  Dwarf manipulator, search, and automaterial all do seem to work however.  I'm playing in a screen session, on an old install of Debian 64

edit:
nevermind, solved it, had killed previous instances of dfhack by killing the screen window and was connecting to one of them with dfhack-run instead
killing all the spare dwarf-fortress processes fixed
Title: Re: DFHack 0.34.11 r3
Post by: mordrax on March 24, 2013, 08:52:17 am
trying to use extirpate to clean up some farmland, can't figure out how it works.

have selected a shrub or growing tree with the cursor either through q, v, k or mouse pointer and typed extirpate into dfhack term, no msg and nothing happened to the plant.
tried on several plants. am i doing something wrong?
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on March 24, 2013, 09:09:53 am
have selected a shrub or growing tree with the cursor either through q, v, k or mouse pointer and typed extirpate into dfhack term, no msg and nothing happened to the plant.

Did you unpause the game after using it? It works just fine but the effect doesn't happen until the game runs again.
Title: Re: DFHack 0.34.11 r3
Post by: mordrax on March 24, 2013, 06:51:08 pm
ah! no i did not, got used to most features happening either instantly or when refreshing UI.
thanks for the quick reply, will try tonight
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 24, 2013, 07:01:22 pm
Argh. Any way to pass an arg through dfhack.timeout?

EDIT: Arg indeed. Found it.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 24, 2013, 07:19:51 pm
I suppose that not relying on the shops at all, but just copying the list of wagon stuff into a quick file then sticking it into the inventory of trader's goods once they hit the Depot might be a work-around (to get past the "I can't carry that much" problem).  Make it a workshop reaction using the Depot as a workshop, for instance.  (By the way, I don't know what's possible or impossible, so this is all in "wouldn't this be neat" territory.)

Of course, if your Depot also uploaded a list of items a trader was removing during fort mode and saved the game at the point that they left, that could be used as a departure point for a new adventurer and wagon who would need to bear a copy of that inventory elsewhere.  Might be another nice way to tie the fort and adventure mode systems together.
well first we need to get access to setting up personal shops in adventure mode, which we currently do not have(we could figure out how to get the shop flag on a player site though) the tying up fort mode and adventure mode is already possible with a pound of Role play and a bag of codes, seeing how you could set up a settler band. though to be clear with what I'm saying.
I already did the whole wagon trader script before and could do it again if it wasn't for my goals(for it) is setting up means of trading first, since there nothing special to the wagon since it's a moving chest you hold stuff in. while having a moving chest sounds fun, it's really just a chest.
Title: Re: DFHack 0.34.11 r3
Post by: D_E on March 25, 2013, 12:04:24 am
trueTransformation:

It works like this: you transform temporarily into some creature. Just after that takes effect, the plugin changes your "base" unit type to be something else. When the transformation wears off, you turn into the other thing.

Example usage:

[SYNDROME]
[CE_BODY_TRANSFORMATION:PROB:100:START:0:END:5]
[CE:CREATURE:BIRD_DUCK:MALE]
[SYN_CLASS:\PERMANENT]
[SYN_CLASS:HUMAN]
[SYN_CLASS:MALE]

Permanently transforms the target into a human male after 5 ticks (or 6, ask a better raw modder). Do NOT apply it to male ducks or it will crash the game.

edit: Will probably also crash the game without START:0. I could fix that if people want it, otherwise I won't bother.

edit2: This is useful because it allows you to transform again from the next form, either with a trueTransformation or a conventional one. Also, it might work better with special abilities. I've gotten weird things before with overlapped transformations and abilities. This should work better, unless the other way also works fine and I just messed it up or misremembered, in which case it'll work equally well.

This doesn't work for me. Is there something else I have to do to enable the plugin? There's a file named trueTransformation.plug.dll sitting in the plugins folder, but when I try to test it nothing happens. I'm using the following reaction:

Quote
[INORGANIC:SHIELD_MAGIC]
   [USE_MATERIAL_TEMPLATE:CREATURE_EXTRACT_TEMPLATE]
   [STATE_COLOR:LIQUID:RED]
   [STATE_COLOR:GAS:RED]
   [STATE_NAME_ADJ:ALL:shield magic]
   [MATERIAL_VALUE:1]
   [DISPLAY_COLOR:4:0:1]
   [SOLID_DENSITY:8250]
   [LIQUID_DENSITY:8020]
   [MELTING_POINT:10050]
   [BOILING_POINT:10051]
   [HEATDAM_POINT:10000]
    MAT_FIXED_TEMP:10070
   [SYNDROME]
      [SYN_CONTACT]
      [CE_BODY_TRANSFORMATION:PROB:100:START:0:END:5]
         [CE:CREATURE:RABBIT:MALE]
         [SYN_CLASS:\PERMANENT]
         [SYN_CLASS:CAT]
         [SYN_CLASS:FEMALE]
The targets turn into rabbits then back into whatever they started as, not cats  >:(. I get no errors or anything else on the terminal, so it looks like the plugin isn't on. Does it not work int arena mode?

______________________________________________________________________________________

Huh. Looks like trueTransform only works in Fortress mode ???. Does this sound accurate?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 25, 2013, 02:29:30 am
<...>
Huh. Looks like trueTransform only works in Fortress mode ???. Does this sound accurate?
My guess trueTransform only does not work in arena mode.
Title: Re: DFHack 0.34.11 r3
Post by: D_E on March 25, 2013, 02:48:39 am
<...>
Huh. Looks like trueTransform only works in Fortress mode ???. Does this sound accurate?
My guess trueTransform only does not work in arena mode.

I had been testing it in adventure mode a little before the fort mode test, and it didn't work. Can't swear I didn't have a faulty syndrome, though.
Title: Re: DFHack 0.34.11 r3
Post by: RockBiterSon on March 25, 2013, 04:02:39 am
http://www.bay12forums.com/smf/index.php?topic=91166.msg4102163#msg4102163

So if I understand, this creates a three by three tile site meant to be used as a workshop. Once the workshop is created you can retire your adventurer in it? And he'll still be there when you play dwarf mode?
Yes it will be there forever. And yes you can retire there.

Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 25, 2013, 05:52:41 am
http://www.bay12forums.com/smf/index.php?topic=91166.msg4102163#msg4102163

So if I understand, this creates a three by three tile site meant to be used as a workshop. Once the workshop is created you can retire your adventurer in it? And he'll still be there when you play dwarf mode?
Yes it will be there forever. And yes you can retire there.

Thanks!
like to note you can't retire at the site if you use a outcast or one of the adventurers who start with no civ.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 25, 2013, 07:40:12 am
trueTransformation does not work in arena mode. I thought I tested it in adventure mode, but I forget.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 25, 2013, 11:10:05 am
How can I track if a hero is ambushed in adventure mode? There's a message popping up, so I am sure there're some noticeable scripts it should be possible to do it...

I want to force "itemsyndrome force" line every time an adventurer is ambusherd. Could someone give me a hand?
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 25, 2013, 12:42:58 pm
Is there a way to retire an adventurer to a lair or other already existent but nonstandard site? As a bandit/outcast that could possibly be a kill quest target? I know outsiders can retire in bandit camps and such already, but aren't marked as bandits.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 25, 2013, 12:59:00 pm
How can I check which syndromes already exist on creature?
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 25, 2013, 01:56:18 pm
Ahem, this:
Code: [Select]
[INORGANIC:CYBERDOG_TRANSFORMATION]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME:ALL:sparks]
[STATE_ADJ:ALL:sparks]
[SOLID_DENSITY:55520]
[MATERIAL_VALUE:1]
[NO_STONE_STOCKPILE]
[SYNDROME]
[SYN_NAME:cyberdog transformation]
[SYN_INJECTED]
[SYN_CONTACT]
[SYN_INHALED]
[SYN_INGESTED]
[SYN_AFFECTED_CREATURE:dog]
[CE_BODY_TRANSFORMATION:PROB:100:START:0:END:5]
[CE:CREATURE:cryo pod:DEFAULT]
[SYN_CLASS:\PERMANENT]
[SYN_CLASS:cyberdog]
[SYN_CLASS:DEFAULT]
does not work. It quickly turns dogs into cryopods and back.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 25, 2013, 02:37:34 pm
How can I check which syndromes already exist on creature?

I insist upon END times of at most 200 because of the stacking issue. Transformations have been fixed to reequip all items correctly, by the way.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 25, 2013, 04:53:17 pm
Sometimes they still stack! I think it relates to leaving SC_WORLD_LOADED out to keep refreshing status when you travel in adv mode.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 25, 2013, 05:08:47 pm
I doubt that, since syndromes ignore start and end times when you travel (automatically ending if they have an end and starting if they have a start but no end)
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 25, 2013, 05:16:04 pm
Dude, my power armor has END:150 and I keep getting over 9999 str and 9000 speed over time.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 25, 2013, 05:20:29 pm
Eep.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 25, 2013, 06:36:57 pm
so I just recently made a fork to warmist spellbook that holds most of but not all my scripts I used pre-R3 r3 dfhack. (https://gist.github.com/Rumrusher) I'm also going to start dumping scripts there for easier use for others.

Title: Re: DFHack 0.34.11 r3
Post by: Torrasque666 on March 25, 2013, 10:53:26 pm
Is there any way to add custom reactions to the workflow script?
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on March 26, 2013, 07:36:21 am
So, I've got an interesting problem that I'm hoping DFHack can fix.  During a swarm of mod critters attacking my fort, I ended up with the last one stuck in a projectile state in the air above my fort, but was motionless.  Absolutely no idea how that happened, but I couldn't get my military to kill it in that state.  So, I did something that was probably a terrible idea and removed the projectile flag from the creature.  That let it fall to the ground where the military could kill it.

Trouble is, I'm getting massive spam in the combat logs about it slamming into an obstacle at the spot where it was originally stuck, even though it is long dead (I don't recall if it was doing that before I removed the projectile flag, but it was stuck there).  Any ideas on how to fix that?  Is there a feature of the map tile I need to configure?   Will setting a flag on the unit help?  Will just atomsmashing its body fix the problem?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 26, 2013, 07:52:58 am
Ahem, this:
Code: [Select]
[INORGANIC:CYBERDOG_TRANSFORMATION]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME:ALL:sparks]
[STATE_ADJ:ALL:sparks]
[SOLID_DENSITY:55520]
[MATERIAL_VALUE:1]
[NO_STONE_STOCKPILE]
[SYNDROME]
[SYN_NAME:cyberdog transformation]
[SYN_INJECTED]
[SYN_CONTACT]
[SYN_INHALED]
[SYN_INGESTED]
[SYN_AFFECTED_CREATURE:dog]
[CE_BODY_TRANSFORMATION:PROB:100:START:0:END:5]
[CE:CREATURE:cryo pod:DEFAULT]
[SYN_CLASS:\PERMANENT]
[SYN_CLASS:cyberdog]
[SYN_CLASS:DEFAULT]
does not work. It quickly turns dogs into cryopods and back.

[CREATURE:DOG]

If this is how the creature is created in the raws, you should use DOG not dog. Otherwise it doesn't know which name to check.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 26, 2013, 08:47:40 am
My creature is "dog". Also since it affects it and turns in cryo and back, it's an irrelevant comment.

The problem is that they turn back into dogs.
Title: Re: DFHack 0.34.11 r3
Post by: D_E on March 26, 2013, 02:06:33 pm
My creature is "dog". Also since it affects it and turns in cryo and back, it's an irrelevant comment.

The problem is that they turn back into dogs.

Are you testing it in Fortress Mode? Based on my recent experiences, trueTransform only works in Fort mode, not in the arena or in adventure mode.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 26, 2013, 02:08:46 pm
Of course I do. It's Robotics Bay from my Fallout mod.
Title: Re: DFHack 0.34.11 r3
Post by: smakemupagus on March 26, 2013, 02:31:04 pm
My creature is "dog". Also since it affects it and turns in cryo and back, it's an irrelevant comment.

The problem is that they turn back into dogs.

A very uninformed guess here, but is it possible that they inhale the stone too and the "vanilla" version of the syndrome somehow precedes the autosyndrome?
Title: Re: DFHack 0.34.11 r3
Post by: Deon on March 26, 2013, 05:15:50 pm
They inhale it... It could be it... Thanks for the idea, I will test it!
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 26, 2013, 08:40:50 pm
If you don't use PRESERVE_ROCK that won't be a problem. It deletes the rock by default to prevent that.

I'll play around with it when I get a chance and see what's happening.

In the mean time, you can get rid of all the SYN_INJECTED, SYN_INHALED, SYN_CONTACT stuff. You don't need it. The plugin doesn't even check for it.
Title: Re: DFHack 0.34.11 r3
Post by: Gahagan on March 26, 2013, 10:22:15 pm
I'm having trouble getting the tweak subcommands to work, things like military-training and stable-temp. I'm entering "tweak stable-temp" for example, and it's just telling me how I'm supposed to use the tweak command. What am I doing wrong?

I'm running dfhack 0.34.11 r3 and df 34.11.

EDIT: Fixed this. Turns out that I had installed r3 incorrectly. Reinstalled and it works now.
Title: Re: DFHack 0.34.11 r3
Post by: Heimdall86 on March 26, 2013, 10:50:58 pm
So, I've got an interesting problem that I'm hoping DFHack can fix.  During a swarm of mod critters attacking my fort, I ended up with the last one stuck in a projectile state in the air above my fort, but was motionless.  Absolutely no idea how that happened, but I couldn't get my military to kill it in that state.  So, I did something that was probably a terrible idea and removed the projectile flag from the creature.  That let it fall to the ground where the military could kill it.

Trouble is, I'm getting massive spam in the combat logs about it slamming into an obstacle at the spot where it was originally stuck, even though it is long dead (I don't recall if it was doing that before I removed the projectile flag, but it was stuck there).  Any ideas on how to fix that?  Is there a feature of the map tile I need to configure?   Will setting a flag on the unit help?  Will just atomsmashing its body fix the problem?

Easy fix just type slayrace into the dfhack console and see the list of all the creatures in the area, when you figured out what the modded creature is called just type slayrace creaturename
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on March 26, 2013, 10:57:04 pm
Does slayrace kill everything (of that creature type) on the map, or in the entire world?
Title: Re: DFHack 0.34.11 r3
Post by: Rose on March 26, 2013, 11:02:06 pm
Just in the fort

However, you can also type "slayrace him" to just kill a single unit.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 27, 2013, 05:19:50 am
I do have s suggestions to make, which probably helps people unfamiliar with dfhack quite a lot. With all the new plugins, scripts, and endless possibilites in the dfhack init, if would be very nice if people could read the hotkeys ingame. I would suggest an addition to the ingame menu that says: Press "whatever button here" to show dfhack hotkeys.

Like this:
(http://i.imgur.com/YMHBJAP.png)

I just think that many people dont use dfhack to the extent they could, simply because its inaccessable and requires reading the readme, memorizing hotkeys or altering the dfhack init themselves, and no ingame help. Thats why falconnes plugins get such great feedback, he puts attention to the user interface and accessability.
Title: Re: DFHack 0.34.11 r3
Post by: Askot Bokbondeler on March 27, 2013, 05:29:24 am
i support that, but shift - D is already depot access. i'd suggest crtl - shift - H
Title: Re: DFHack 0.34.11 r3
Post by: Aerval on March 27, 2013, 05:42:26 am

I just think that many people dont use dfhack to the extent they could, simply because its inaccessable and requires reading the readme, memorizing hotkeys or altering the dfhack init themselves, and no ingame help.
Seriously? That's exactly what DF itself is about ;D
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 27, 2013, 06:05:20 am
Its an example ^^ I still stay with the principle though. ;)

I have 21 hotkeys in my init atm, and without a visual reminder now and then even I have to look them up, and I am the one who wrote them in the init. I cant expect players of the mod to simply remember them from reading them once on the release post.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on March 27, 2013, 07:38:09 am
Easy fix just type slayrace into the dfhack console and see the list of all the creatures in the area, when you figured out what the modded creature is called just type slayrace creaturename

Thanks, I'll try that.  It's already dead though, will this help in ways that just killing it didn't?
Title: Re: DFHack 0.34.11 r3
Post by: Undeadlord on March 27, 2013, 07:44:46 am
Its an example ^^ I still stay with the principle though. ;)

I have 21 hotkeys in my init atm, and without a visual reminder now and then even I have to look them up, and I am the one who wrote them in the init. I cant expect players of the mod to simply remember them from reading them once on the release post.

I second this! DFHack is amazing, but man I barely use half of it just because I forget that functionality is there.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 27, 2013, 10:47:14 am
Its an example ^^ I still stay with the principle though. ;)

I have 21 hotkeys in my init atm, and without a visual reminder now and then even I have to look them up, and I am the one who wrote them in the init. I cant expect players of the mod to simply remember them from reading them once on the release post.

I second this! DFHack is amazing, but man I barely use half of it just because I forget that functionality is there.
hmm I think Dfhack has hit the point where the power it can do is far over the heads of the people. Like only folks like the good folks who hang out at the irc daily maybe me could write up a mod and do magical things with it. I'm still having a mind overload on how to implement some of these scripts into a mod, also the new r3 being completely different and breaking half of the new scripts that never pop up in r2 that I had in pre-r3.
though I don't use all or most of what dfhack has outside of Dfusion/lua and Gm-editor/scripts. also I kinda worried that most of the new scripts are interrupting each other leading to new bugs.
Title: Re: DFHack 0.34.11 r3
Post by: smakemupagus on March 27, 2013, 03:31:36 pm
Is the temperature threshhold for autoSyndrome still 9000?  I find that my wood/bone buildings still get destroyed by temperature damage even when using a boiling stone at 9005 urists.

Although 9005 is below the colddam point for wood, this destruction didn't happen pre-DFHack r3 (or even much colder temperatures are still safe if  I 'unload all' at the DFHack terminal).  So I infer that autoSyndrome is responsible for somehow more thoroughly applying the damage to the workshop.

Do you think it is possible to undo the building destruction aspects, at least for the 9005 temperature materials but ideally for everything?  It would be nice to be able to use bone/wood for buildings, but if it is impossible I will try to work around it.

edit.
Shoot, sorry... I don't think it's autoSyndrome after all.
unload all -- they don't damage
unload autoSyndrome -- still get damage

any thoughts what else is new in DFHack r3 that can be causing this?  Or is it more appropriate for me to ask Meph what changes there have been in the scripts he loads in Masterwork?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 27, 2013, 06:25:42 pm
Again, unless you use PRESERVE_ROCK it won't be an issue.

Also, it looks at the boiling temperature, not the default temperature that it has when it's created, however that works.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on March 27, 2013, 06:41:18 pm
I didnt change any scripts. I said its my change to the stone_vapor_template. If it isnt, I am just as dumbfounded as you. No idea what else could be the cause.
Title: Re: DFHack 0.34.11 r3
Post by: smakemupagus on March 27, 2013, 07:09:00 pm
I didnt change any scripts. I said its my change to the stone_vapor_template. If it isnt, I am just as dumbfounded as you. No idea what else could be the cause.

I wouldn't have thought that your change to a very cold stone_vapor_template is the cause, because the template thermal property tokens are overwritten in the material definition anyway.  But at this point I have no idea really.  :-\

Code: [Select]
[INORGANIC:KNOWLEDGE_STONE] produced in transmutation
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]  ## this template will produce super cold stones b/c of boiling point settings
[STATE_NAME_ADJ:ALL_SOLID:knowledge]
[STATE_NAME_ADJ:LIQUID:knowledge]
[STATE_NAME_ADJ:GAS:knowledge]
[DISPLAY_COLOR:5:7:1][TILE:'*']
[MELTING_POINT:7000]
[BOILING_POINT:7005]  ## but those boiling point settings are overwritten here
[SOLID_DENSITY:55520]
[MATERIAL_VALUE:1]

*  Even setting the melting & boiling point temp to 7005 or 9005 in the [INORGANIC:] definition, the workshop is still damaged if not destroyed. 
*  After "dfhack>> unload autoSyndrome" the workshop is still destroyed.  I used the DFHack command that shows you the list of plugins active to make sure it was unloaded, too.
*  When set to relatively high boiling points like 7005, the solid vapor stone doesn't actually melt or vaporize, even though it seems like it should at room temp.  There is solid vapor stone found in the rubble of workshop and lasts a long time, it gets hauled away and stockpiled.
*  With "dfhack>> unload all" there are no residual vapor stones and the workshop is NOT destroyed, or even damaged, even after months of continuous use.
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on March 27, 2013, 07:12:20 pm
I just think that many people dont use dfhack to the extent they could, simply because its inaccessable and requires reading the readme, memorizing hotkeys or altering the dfhack init themselves, and no ingame help. Thats why falconnes plugins get such great feedback, he puts attention to the user interface and accessability.

This is sadly true. Personally I play DF with the dfhack.init opened in Ultraedit to be able to look up hotkeys I don't use very often and dfhack's readme.rst opened in a web browser. And Dwarf Therapist, of course. So that's a total of 3-4 external applications (4 if you count dfhack, but at least it automatically starts together with DF) and "a lot" of windows to switch between to get stuff done. I disagree with the claim that dfhack is "inaccessable" since the documentation is extensive and you will get almost all necessary information either from the readme file or from using the internal help function provided by plugins. I will agree, however, that it could help a lot to move away from plugins which can only be used by hacking in some "cryptic" commands which many users will never bother with and give them a "proper" user interface. Now this is finally possible to realize without too much work, so I think you can expect dfhack to become a lot more user-friendly in the future.
Title: Re: DFHack 0.34.11 r3
Post by: smakemupagus on March 27, 2013, 09:17:54 pm
when I load a game and type
[DFHack]# plug
it shows that "misery" is active.  I can
#unload misery
and it goes away.  How can I start a game without misery enabled?  It's not in my dfhack.init.

or...
the fact that it's in the list just means it's available?  sorry if this is dumb question :P
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on March 27, 2013, 09:56:51 pm
when I load a game and type
[DFHack]# plug
it shows that "misery" is active.  I can
#unload misery
and it goes away.  How can I start a game without misery enabled?  It's not in my dfhack.init.

or...
the fact that it's in the list just means it's available?  sorry if this is dumb question :P

It's just a list of available (loaded) plugins. Almost all of them are inactive before you explicitly start them and the majority only runs once and won't do stuff behind your back.
Title: Re: DFHack 0.34.11 r3
Post by: smakemupagus on March 27, 2013, 10:01:02 pm
OK, cool.  That was my guess once I thought about it more, but thanks for confirming :)
Title: Re: DFHack 0.34.11 r3
Post by: IamanElfCollaborator on March 28, 2013, 12:42:21 pm
...would it be possible to make a plugin that creates a creature from a reaction? Just posing a question that would be awesome.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 28, 2013, 12:43:53 pm
Yes.

AFAIK, it's buggy as hell.

I could try writing a script for it.
Title: Re: DFHack 0.34.11 r3
Post by: IamanElfCollaborator on March 28, 2013, 12:45:18 pm
I was planning to use a script of that kind to make a golemcrafting reaction/turretbuilding reaction.

If it can't be helped, I guess I could do something else with it.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 28, 2013, 01:25:00 pm
It should be possible. A little finicky though. I'll look into it when I get a chance.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 28, 2013, 03:03:18 pm
Anything suspect about this function?

Code: [Select]
local function insertMistThought(unit)
unit.status.recent_events:insert('#',
    {
        new = df.unit_thought,
        type = 162
        subtype = -1,
        severity = 0
        }
        )
end
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 28, 2013, 03:06:56 pm
The indentation is wrong.

I think it should have some kind of duration.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 28, 2013, 03:13:20 pm
Odd. The indentation appears to be 4 spaces in Notepad++ and a tab here.

Anyway, actually looking at thoughts generated by the game reveal only a type, age, subtype and severity.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 28, 2013, 03:40:18 pm
The "age" is the duration expwnent is referring to, and it's something you should initialize to zero (which should happen by default) - it increments once per frame, and its value affects the happiness adjustment (old thoughts do less, and really old thoughts do nothing at all and get forgotten).
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 28, 2013, 03:41:01 pm
Oh wow--I thought that I had that already, hehe. Remind me not to glance too much.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 28, 2013, 06:33:51 pm
Yes.

AFAIK, it's buggy as hell.

I could try writing a script for it.
well for starters it's buggy as hell due to many factors, one being spawning said unit might die and crash the game.
though that wasn't there before and I think it's the cause of lua scripting being broken.
it's quite a shame that r3 some how broke half the scripts we made, and now deemed non user friendly enough to not warrant a try.
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on March 28, 2013, 08:52:52 pm
(deleted post because obsolete now)
Title: Re: DFHack 0.34.11 r3
Post by: outofpractice on March 29, 2013, 12:30:56 am
Question, with the new r3 release and new dfusion, how do you change the starting number of dwarves now? For the life of me, I can't figure it out.
Title: Re: DFHack 0.34.11 r3
Post by: IamanElfCollaborator on March 29, 2013, 06:50:45 am
How do you use the friendship/embark plugins? I have NO experience with LUA so I can't for the life of me figure it out.
Title: Re: DFHack 0.34.11 r3
Post by: Goncyn on March 30, 2013, 12:32:13 am
The work you guys have done on this in the past year is just amazing. I love all the new in-game UI plugins. They are fantastic.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on March 30, 2013, 06:48:00 pm
autoSyndrome.plug.dll is causing crashes in my game (see accmod in my sig)

here's my errorlog.txt (last few lines)

Spoiler (click to show/hide)

I have the save if needed, what weird is it's a new embark, so I'm not sure where the werebeast is coming from (must be offscreen stuff).

anyways, I moved the dll into it's own "bug" folder inside the plugins folder to hopefully avoid the crashes
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 30, 2013, 07:19:13 pm
What are the example interactions doing in the objects folder? O_o
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on March 30, 2013, 07:48:00 pm
I suck... I thought I saved it, I don't know where the f it went...  I did a search for region*.* and region*.7z and region*.zip and still couldn't find it, I fail...

nm...
found it
http://www.mediafire.com/?jszcb51y4c8k437

I was trying to dig into the earth with some bronze picks, that's what WAS starting the ruckus before I moved the dll
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on March 30, 2013, 08:04:54 pm
The "prospect" command in DFHack can be used before embark to identify layer stones and minerals that should be at the site. There is a vague warning about this use of the command, that it may not be accurate.

1. Which of the identified memory structures is the stone/mineral data coming from?
2. What causes the potential inaccuracy?
3. How feasible is it to make a script that searches the entire world and provides coordinates for mineral deposits that meet preselected specifications (the most common search being "iron ore + flux")?
4. How feasible is it to make a better site finder, with some kind of UI?

Since you can target specific blob-shaped biomes that make up the highlighted embark site with F1, F2, etc. and check the minerals in those biomes, we should be able to browse the structure of biomes and assemble a list of biomes that contain all the desired stones. IF the biomes don't contain their own locations, we could then scan the world embark tiles and list the XY coordinates whenever one of those biomes appears.
Title: Re: DFHack 0.34.11 r3
Post by: ag on March 31, 2013, 06:46:23 am
1. Which of the identified memory structures is the stone/mineral data coming from?
2. What causes the potential inaccuracy?

The root cause of the inaccuracy is that the world is generated using a multiple level of detail approach, and without cloning the generation algorithm with 100% accuracy it is only possible to see what is currently generated in memory. The existing levels of detail are:


Since the actual tiles of veins and layers are only generated in phase 3, it is impossible to tell exactly how many tiles of the given type there will be, only the sort-of average expected amount. Veins in particular are chosen randomly based on their probability, and then their tiles are again randomized. They can also be cut away by caverns, which are again random - the only thing you can tell before phase 3 is the depth range where they will be located. Finally, the way it decides how many soil layers will be present is something of a mystery, so prospect can get it wrong, thus shifting the whole stack in z dimension, and possibly announcing soil types that won't be there at all. Currently it uses a heuristic based on elevation, since that seems to be what the embark screen is doing when deciding whether to display or not display soil on the right - i.e. the higher the elevation the less soil there is, culminating in mountains. It is also possible for adjacent biomes to intrude on the margins of the embark area, like it happens on bigger scale with region biomes; although this is probably mostly irrelevant for calculating veins, only layer materials.

3. How feasible is it to make a script that searches the entire world and provides coordinates for mineral deposits that meet preselected specifications (the most common search being "iron ore + flux")?
4. How feasible is it to make a better site finder, with some kind of UI?

An issue here is that the level of detail phase 2 is also lazily generated, so you would have to feed key presses to the regular embark screen to move its cursor to the region you want; just setting variables won't do it. This is completely feasible, and not that hard at that, except that it may cause confusing flicker in the ui.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on March 31, 2013, 08:37:30 am
3. How feasible is it to make a script that searches the entire world and provides coordinates for mineral deposits that meet preselected specifications (the most common search being "iron ore + flux")?
4. How feasible is it to make a better site finder, with some kind of UI?

An issue here is that the level of detail phase 2 is also lazily generated, so you would have to feed key presses to the regular embark screen to move its cursor to the region you want; just setting variables won't do it. This is completely feasible, and not that hard at that, except that it may cause confusing flicker in the ui.
Actually no. All you need to do is run the inbuilt site-finder once, and it'll generate the whole world.
Title: Re: DFHack 0.34.11 r3
Post by: IamanElfCollaborator on March 31, 2013, 08:44:21 am
Anyone going to help with the questions? I can't figure out how to use friendship/embark.
Title: Re: DFHack 0.34.11 r3
Post by: StephenJacob on April 01, 2013, 09:12:56 am
I've been trying to reattach my left leg for a few hours and I can't seem to get it right .
I finally found the missing part flag in unit.body.components.body_part_status (I was looking in unit.body.body_plan.body_parts ...duh ) but it only reattaches the limb and not its layers (skin,bone,muscle) .
I tried changing any variable I could find with "layer" in its name but so far nothing ...
Does anyone know where I can find those flags, if they even exist ?
Title: Re: DFHack 0.34.11 r3
Post by: Lycaeon on April 01, 2013, 10:09:01 pm
I get a crash-to-desktop when pressing 'e' or maybe 'alt-e' in the military screen. I got it twice, but cant relyably replicate it. I dont have any hotkeys set to e/alt-e. It happens when I want to open the equipment screen for squads. I know its not from modding, so it has to be one of three sources:

1. dfhack r3.
2. falconnes plugins.
3. Putnams scripts.

I will just leave that here, maybe someone knows something.

I can also confirm having this problem, though falconne's plugins are ruled out - the military screen crashes still happened after they were removed.

Needless to say, this is seriously inconveniencing for modders and players using dfhack, and I hope this can be looked into. :(
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 01, 2013, 11:13:01 pm
I get a crash-to-desktop when pressing 'e' or maybe 'alt-e' in the military screen. I got it twice, but cant relyably replicate it. I dont have any hotkeys set to e/alt-e. It happens when I want to open the equipment screen for squads. I know its not from modding, so it has to be one of three sources:

1. dfhack r3.
2. falconnes plugins.
3. Putnams scripts.

I will just leave that here, maybe someone knows something.

I can also confirm having this problem, though falconne's plugins are ruled out - the military screen crashes still happened after they were removed.

Needless to say, this is seriously inconveniencing for modders and players using dfhack, and I hope this can be looked into. :(

The culprit seems to be the search plugin. I can reproduce the crash with the following steps (but only in a couple of my savegames):
enter military screen (m), select a squad, go to the candidates column on the right, press e

This will reliably crash my game while the search plugin is loaded. I'm now trying to reproduce it in a fresh game, maybe it depends on something like the size of the unit list as I was unable to crash it like that with creating a squad on a fresh embark so far.

Well for the time being make sure that you don't press e while you are in the candidates column then you should be on the safe side until the bug is fixed.
Title: Re: DFHack 0.34.11 r3
Post by: Lycaeon on April 01, 2013, 11:31:49 pm
Thanks! So I guess deleting the search plugin file will fix the problem for the time being. :)
Title: Re: DFHack 0.34.11 r3
Post by: falconne on April 01, 2013, 11:57:02 pm
The culprit seems to be the search plugin. I can reproduce the crash with the following steps (but only in a couple of my savegames):
enter military screen (m), select a squad, go to the candidates column on the right, press e

This will reliably crash my game while the search plugin is loaded. I'm now trying to reproduce it in a fresh game, maybe it depends on something like the size of the unit list as I was unable to crash it like that with creating a squad on a fresh embark so far.

Well for the time being make sure that you don't press e while you are in the candidates column then you should be on the safe side until the bug is fixed.

Do you still have a save game where the crash can be reproduced?
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 02, 2013, 12:19:28 am
Do you still have a save game where the crash can be reproduced?
Yeah, I'll upload one after I had some coffee. I created a fresh pocket world and a 1x1 embark and tried to reproduce it with minimal conditions (and to keep the save game size as small as possible). It seems to be related to the number of dwarves as everything works fine with the embarking seven. After I got the first wave of migrants I can reliably crash it.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 02, 2013, 12:26:32 am
I did it with the starting seven twice. Its not related to the number of dwarves. Maybe names?
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 02, 2013, 12:37:25 am
Ok, here's the savegame: http://dffd.wimbli.com/file.php?id=7525

Reproducing the crash:
enter (m)ilitary screen,
(c)reate squad,
select one of the armor templates (leather, metal, archer - note that crash will not occur if template "no uniform" is used!),
move cursor to the candidate column, press e

I was assuming that it might be related to the number of units as I was not able to crash the game with the founding seven. But it seems also to be related to the uniforms, as selecting "no uniform" for the squad seems to work.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 02, 2013, 01:18:08 am
I've been trying to reattach my left leg for a few hours and I can't seem to get it right .
I finally found the missing part flag in unit.body.components.body_part_status (I was looking in unit.body.body_plan.body_parts ...duh ) but it only reattaches the limb and not its layers (skin,bone,muscle) .
I tried changing any variable I could find with "layer" in its name but so far nothing ...
Does anyone know where I can find those flags, if they even exist ?
dfusion has a heal unit script that will repair your legs, you need to select your adventurer to get it to work.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on April 02, 2013, 03:35:28 am
Ok, here's the savegame: http://dffd.wimbli.com/file.php?id=7525

Thanks, looking into it. Proving tricky to track down.
Edit: Think I know what's going on...
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 02, 2013, 03:59:50 am
Thanks, looking into it. Proving tricky to track down.
Edit: Think I know what's going on...
Check ag's fork. I think he already fixed it.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on April 02, 2013, 05:15:53 am
I'm including the fixed search plugin in my download archive (http://dffd.wimbli.com/file.php?id=7248) now until the next release of dfhack.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on April 02, 2013, 11:43:30 am
Truetransformation still doesn't work.

Code: [Select]
[INORGANIC:CASTE_ANVIL]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME:ALL:smoke]
[STATE_ADJ:ALL:smoke]
[STATE_COLOR:ALL:GRAY]
[MATERIAL_VALUE:1]
[NO_STONE_STOCKPILE]
[SYNDROME]
[CE_BODY_TRANSFORMATION:PROB:100:START:0:END:5]
[CE:CREATURE:ALBATROSS:MALE]
[SYN_CLASS:\PERMANENT]
[SYN_CLASS:DWARF]
[SYN_CLASS:MALE_ANVIL]

Dwarf transforms to albatross and back without caste change.
Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on April 02, 2013, 12:50:01 pm
Would it be possible to make a script that allows pathing fliers in fort mode, so we can have an army of flying creatures? If you are too busy to do that yourself, can you tell me what the address is for the pathing thing? I imagine that it would just take suppressing the the thing that stops creatures from pathing into space, but I don't know. Also, would such a script apply to swimming creatures?
Title: Re: DFHack 0.34.11 r3
Post by: Rose on April 02, 2013, 01:27:31 pm
Not doable. fort mode only uses a single pathing grid, which is what all units use to check if they can go from point a to point b, and breaking that breaks everything.
Title: Re: DFHack 0.34.11 r3
Post by: Dragoon209 on April 02, 2013, 03:24:44 pm
Is there a command that can be run to return what screen Dwarf Fortress is currently on?  If so, does it work in both Fortress and Adventure mode?

I'm attempting a mouse-driven interface that is context-sensitive to what you are doing.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 02, 2013, 04:13:16 pm
Just typing "keybinding" gives you your current context.
Title: Re: DFHack 0.34.11 r3
Post by: Dragoon209 on April 02, 2013, 04:34:21 pm
Just typing "keybinding" gives you your current context.

That's a great start, thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Guthbug on April 02, 2013, 04:43:55 pm
Ok, I've got a strange one ...

Can I change biomes from within a game? I want to change the biome the fortress is in to an evil one, or at least to simulate doing so with some of the affects you find in an evil biome.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on April 02, 2013, 07:51:03 pm
Is there a command that can be run to return what screen Dwarf Fortress is currently on?  If so, does it work in both Fortress and Adventure mode?

I'm attempting a mouse-driven interface that is context-sensitive to what you are doing.

You can take a look at my mouse plugin https://github.com/Falconne/dfhack/blob/master/plugins/mousequery.cpp too see how it figures out the current context. There's also a couple of big switch statements in Gui.cpp that are for printing out the current context... the code used there is what you want.
Title: Re: DFHack 0.34.11 r3
Post by: turabeasel on April 02, 2013, 07:58:42 pm
I tried running the digfort script on osx and received this error

E: RuntimeError: ./hack/scripts/digfort.rb:3: usage: digfort <plan filename>
 ./hack/scripts/digfort.rb:3
 (eval):1:in `load'
 (eval):1
 (eval):1:in `catch'
 (eval):1

Is there anyway to fix that or does the digfort script not work? Or maybe I'm not using it as intended, can anyone help?

Thanks
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on April 02, 2013, 08:13:38 pm
so no one commented on my autosyndrome error?
http://www.bay12forums.com/smf/index.php?topic=91166.msg4142448#msg4142448
Title: Re: DFHack 0.34.11 r3
Post by: Dragoon209 on April 02, 2013, 08:23:58 pm
You can take a look at my mouse plugin https://github.com/Falconne/dfhack/blob/master/plugins/mousequery.cpp too see how it figures out the current context. There's also a couple of big switch statements in Gui.cpp that are for printing out the current context... the code used there is what you want.

Thanks!! I'll have a look
Title: Re: DFHack 0.34.11 r3
Post by: Cato on April 02, 2013, 09:38:40 pm
Thought I'd go ahead and mention it here, I posted the details (with save) on the bug tracker but I'm getting a repeatable crash error relating to job cancellation. In short anytime a particular reaction ([REACTION:BLOCK_BOULDER], it's a masterwork reaction) is cancelled while active, whether I do it at the workshop screen or the dwarf does it because he doesn't have enough blocks it crashes to desktop. It doesn't appear to be the reaction itself though (or at least not independently of dfhack) because if I run the save without dfhack and cancel the job it proceeds normally.

@turabeasel I've used the digfort script on osx so it's not intrinsic to that. What was the command you activated it with? Alternatively could be the csv file itself, if I export to csv from numbers by default it doesn't use the correct separator that digfort is looking for, it uses "," instead of ";", but the script itself does work on osx so it's not that
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 02, 2013, 10:13:27 pm
Thought I'd go ahead and mention it here, I posted the details (with save) on the bug tracker but I'm getting a repeatable crash error relating to job cancellation. In short anytime a particular reaction ([REACTION:BLOCK_BOULDER], it's a masterwork reaction) is cancelled while active, whether I do it at the workshop screen or the dwarf does it because he doesn't have enough blocks it crashes to desktop. It doesn't appear to be the reaction itself though (or at least not independently of dfhack) because if I run the save without dfhack and cancel the job it proceeds normally.

@turabeasel I've used the digfort script on osx so it's not intrinsic to that. What was the command you activated it with? Alternatively could be the csv file itself, if I export to csv from numbers by default it doesn't use the correct separator that digfort is looking for, it uses "," instead of ";", but the script itself does work on osx so it's not that

Generally I think you shouldn't use the bugtracker for problems which are caused by modding the game. From my understanding the bugtracker is to be used to help Toady keep track of bugs of the vanilla version and not for mods. As for dfhack, much of what it does is independent of what certain crazy people add to the game. Some of the plugins and scripts will only work properly on vanilla raws and break on modded scenarios. Don't blame dfhack if you mod the raws and something blows up into your face. Instead, come to the dfhack thread (oh, you did that :) ) and complain about it.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 02, 2013, 10:32:14 pm
Mods can reveal bugs in vanilla that normally wouldn't show up; however, I don't think DFHack is really a standard mod, so...
Title: Re: DFHack 0.34.11 r3
Post by: Cato on April 02, 2013, 10:44:15 pm
By bug tracker I meant the dfhack bug tracker (on git hub, from the first page of this thread) if I understand the dfhack release properly it's at least partially connected to dfhack. I say this because when I test it by running the fort with the df script I can cancel the job and the game proceeds normally. If I then run the dfhack script and try the same thing then after unpausing it crashes. If I correctly understand that the df script (as opposed to the dfhack) script in the r3 release runs dwarf fortress without dfhack then it is at least partially connected to dfhack, not sure about the whys or hows but thought I'd bring it up.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 03, 2013, 03:45:23 am
okay if I remember warmist made a companion option to allow you to order them to do jobs.
at the time I didn't do much with this due to there was no way to mass order commands.
(like telling one to go dig means you need to chaperone the guy to dig out a tunnel and not like say designate a path and just order him.)
so I didn't do much with this. since r3 is out best drop the code.
Code: [Select]
function getLastJobLink()
    local st=df.global.world.job_list
    while st.next~=nil do
        st=st.next
    end
    return st
end
function AddNewJob(job)
    local nn=getLastJobLink()
    local nl=df.job_list_link:new()
    nl.prev=nn
    nn.next=nl
    nl.item=job
    job.list_link=nl
end
function MakeDig(unit,pos,job_type)
    local nj=df.job:new()
    nj.id=df.global.job_next_id
    df.global.job_next_id=df.global.job_next_id+1
    nj.flags.special=true
    nj.job_type=job_type
    nj.completion_timer=-1
    nj.unk4a=12
    nj.unk4b=0
    nj.pos:assign(pos)
    nj.general_refs:insert("#",{new=df.general_ref_unit_workerst,unit_id=unit.id})
   
    AddNewJob(nj)
    unit.job.current_job=nj
    pos.x=pos.x-1
    unit.path.dest:assign(pos)
end

{name="channel",f=function(unit_list,pos)
    if not CheckCursor(pos) then
        return false
    end
    for k,unit in pairs(unit_list) do
        MakeDig(unit,pos,df.job_type.FellTree)
    end
    return true
end},
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on April 03, 2013, 10:23:08 am
I am aware there are problems with autoSyndrome and trueTransformation but I can't work on them right now. Please document any problems in as much detail as possible, and if you have time, see if you can play around with them and find out exactly when the problem happens.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on April 03, 2013, 11:29:17 am
Expwnent, any idea why it doesn't work for me at all? I've posted the raws on the previous page.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on April 03, 2013, 12:35:53 pm
There are still some weird requirements with boiling temperature that I'm going to remove in the next version. But you said that the first transformation DID happen so that can't be it.

Try different intermediate/final forms, different durations, etc.

There's a small chance that it doesn't work in combination with autoSyndrome, but that's a HUGE flaw if true, and I'm 90% sure I tested that myself. Try the same syndrome with an interaction and see if it works.
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 03, 2013, 01:15:06 pm
By bug tracker I meant the dfhack bug tracker (on git hub, from the first page of this thread)

Alright, I thought you used DF's official bug tracker at Mantis which should only be used for problems with the vanilla game. I didn't look at your savegame yet but I imagine the problem *might* be caused by workflow trying to check if it should protect a repeat job which uses a modded custom reaction.
Title: Re: DFHack 0.34.11 r3
Post by: Cato on April 03, 2013, 03:40:07 pm
The problem would have to be more specific than just workflow on a custom reaction because I have lots of other custom (from masterwork) reactions running with workflow on and managing them without any problems. It's just that particular reaction that causes problems. I don't see anything immediately stand out about the reaction itself either.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on April 03, 2013, 03:59:53 pm
I didn't look at your savegame yet but I imagine the problem *might* be caused by workflow trying to check if it should protect a repeat job which uses a modded custom reaction.

I did a quick check before coming to work this morning to make sure it wasn't a workflow problem and I don't think it is. The crash happens here (https://github.com/peterix/dfhack/blob/master/plugins/autoSyndrome.cpp#L326) in autoSyndrome because "bob->mat_index" is -1.

Just guessing here without knowing anything about the code, but might it also be a bug that the autoSyndrome is processing the job as if it completed successfully, even though it was actually cancelled?
Title: Re: DFHack 0.34.11 r3
Post by: Dragoon209 on April 03, 2013, 04:29:40 pm
Hello!

While working on my mouse-driven project, I was attempting to make a plugin to do the very simple task of outputting the current screen, like it does if you run 'keybinding' without any arguments.  instead of parsing all the text, and extracting the last line, I wanted to make it only export the current screen.

I am running into a problem, and in this case, I know what it is: I don't know C++.  :P

Here is the code:
Spoiler: MouseStatus.cpp (click to show/hide)

and here is the error:
Spoiler: Build Error (click to show/hide)


Now, from the little I remember from my computer science classes, It has to do with the function call command_result mousestatus () being wrong.  I know its probably a simple fix, but I don't know where to go from here.  I think its not declaring what it needs properly, but I'm not sure what it should be.

I edited the skeleton plugin, and then copied the line from Core.cpp that listed the GUI's current screen.  I changed it to an out.print command instead of con <<, because that is what was being used earlier in the skeleton plugin to display text.  I included another library at the top too, but I don't think I need it, and it most likely should be removed.

Long term, I'm looking to make a plugin-assisted AutoHotKey menu that allows the player to right click, and get a set commands based on what they are doing.  In the case of designations, I would like to allow box drawing like Falconne's construction additions to automaterial.  Perhaps some sort of 'macro' or run history of commands as well, which would allow the user to save a list of commonly used commands, and execute them at will, instead of just mapping them to keys.  In case you are wondering, I am only using AutoHotKey because I know it already, and its easy to use.  After I get something working, I would like to eventually port it to something a little more universal, but that is a long way out.

If somebody could point me in the right direction, or better yet, reply with fixed code, I would be very thankful.  Either way, thanks for looking!
Title: Re: DFHack 0.34.11 r3
Post by: Rose on April 03, 2013, 04:39:33 pm
to get a const char* out of an std::string, you need to do string.c_str()

So
Code: [Select]
out.print(Gui::getFocusString(Core::getTopViewscreen())); becomes
Code: [Select]
out.print(Gui::getFocusString(Core::getTopViewscreen()).c_str()); or maybe
Code: [Select]
out.print("%s\n", Gui::getFocusString(Core::getTopViewscreen()).c_str());
Title: Re: DFHack 0.34.11 r3
Post by: Dragoon209 on April 03, 2013, 05:01:25 pm
to get a const char* out of an std::string, you need to do string.c_str()

So
Code: [Select]
out.print(Gui::getFocusString(Core::getTopViewscreen())); becomes
Code: [Select]
out.print(Gui::getFocusString(Core::getTopViewscreen()).c_str()); or maybe
Code: [Select]
out.print("%s\n", Gui::getFocusString(Core::getTopViewscreen()).c_str());

Thanks!  The latter one worked.
Title: Re: DFHack 0.34.11 r3
Post by: turabeasel on April 03, 2013, 08:04:28 pm
@turabeasel I've used the digfort script on osx so it's not intrinsic to that. What was the command you activated it with? Alternatively could be the csv file itself, if I export to csv from numbers by default it doesn't use the correct separator that digfort is looking for, it uses "," instead of ";", but the script itself does work on osx so it's not that

Yea I was guessing that maybe I was improperly using the script, how should it be used or how should the plugin be called up?
Title: Re: DFHack 0.34.11 r3
Post by: Cato on April 04, 2013, 12:04:54 am
First you need your plan which should be a csv file with ; seperators, so something like from the readme example

d;d;u;d;d;skip this tile;d
d;d;d;i

where the "skip this tile" part is actually arbitrary, anything other than what it is looking for which is in the readme (though downstairs are actually j, not d, the readme is off on that part) is treated as a skip. Save that file in the same folder that you launch dwarf fortress from. Then you point your cursor at the upper left corner of what you want designated and in the dfhack terminal type digfort fileName. Where fileName is whatever you called the plan, potentially including the extension which depending on how you created it might be hidden in the finder. So if I make a Plan_Kitchen.csv file, then I'd type "digfort Plan_Kitchen.csv" and the designations should appear, with the upper left corner matching wherever the cursor is.

Then it should go through and do whatever designations are contained in the csv file.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on April 04, 2013, 09:24:06 am
I didn't look at your savegame yet but I imagine the problem *might* be caused by workflow trying to check if it should protect a repeat job which uses a modded custom reaction.

I did a quick check before coming to work this morning to make sure it wasn't a workflow problem and I don't think it is. The crash happens here (https://github.com/peterix/dfhack/blob/master/plugins/autoSyndrome.cpp#L326) in autoSyndrome because "bob->mat_index" is -1.

Just guessing here without knowing anything about the code, but might it also be a bug that the autoSyndrome is processing the job as if it completed successfully, even though it was actually cancelled?

That's probably *a* problem, even if it isn't THE problem. I'll fix that in the next version. Thanks.

It does distinguish between cancelled and completed jobs. It's possible to get them mixed up, but unlikely.
Title: Re: DFHack 0.34.11 r3
Post by: turabeasel on April 04, 2013, 11:04:57 am
First you need your plan which should be a csv file with ; seperators, so something like from the readme example

d;d;u;d;d;skip this tile;d
d;d;d;i

where the "skip this tile" part is actually arbitrary, anything other than what it is looking for which is in the readme (though downstairs are actually j, not d, the readme is off on that part) is treated as a skip. Save that file in the same folder that you launch dwarf fortress from. Then you point your cursor at the upper left corner of what you want designated and in the dfhack terminal type digfort fileName. Where fileName is whatever you called the plan, potentially including the extension which depending on how you created it might be hidden in the finder. So if I make a Plan_Kitchen.csv file, then I'd type "digfort Plan_Kitchen.csv" and the designations should appear, with the upper left corner matching wherever the cursor is.

Then it should go through and do whatever designations are contained in the csv file.

OK, now I do not get an error anymore so long as the cursor is in a location on the screen. Now though it just says "done" after the command but nothing happens in game.
Title: Re: DFHack 0.34.11 r3
Post by: Cato on April 04, 2013, 12:04:35 pm
What was the csv plan like? Done is all that should show up, if there are no designations that occur it could be a problem with csv file, anything it doesn't recognize it treats as a do nothing instruction. Inside the spoiler is an example of a plan I've used successfully, does yours look something like that format wise?

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: turabeasel on April 04, 2013, 12:24:41 pm
I just tried a .csv file that is included with quickfort.

#dig Simple bedroom example.         
d   d   d   #
d   d   d   #
d   d   d   #
   d      #
#   #   #   #

It says done but nothing happens on screen.
Title: Re: DFHack 0.34.11 r3
Post by: turabeasel on April 04, 2013, 12:30:29 pm
I just tried making my own in excel:

;d;d;d;
;d;d;d;

and nothing happend either except "done".
Title: Re: DFHack 0.34.11 r3
Post by: Cato on April 04, 2013, 07:29:22 pm
The first one wouldn't work because it lacks the ";" separators, not sure about the second one though. If I take it and put it into a text file called test.txt then call it, I get

[DFHack]# digfort test.txt
done

and 6 squares designated for digging starting one square to the right of it where my cursor is. If it doesn't work for you then I'm not sure what is going wrong for you.
Title: Re: DFHack 0.34.11 r3
Post by: turabeasel on April 04, 2013, 07:36:56 pm
Hmm...well that worked! Although it designates six blocks but there one space to the right and six spaces down?
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on April 05, 2013, 01:29:52 am
There any easy way to have a syndrome or creature interaction change the weather?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 05, 2013, 01:32:33 am
EDIT: wrong topic :X

Yeah, there should be one.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 05, 2013, 04:18:38 am
If you mean rain, snow and clear skies, then yes. For special rains, fogs and such, no.

Code: [Select]
-[REACTION:WEATHER_CLEAR]-
[NAME:Clear the skies]
[BUILDING:WEATHER_CONTROL:CUSTOM_C]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:WEATHER_CLEAR]

-[REACTION:WEATHER_RAIN]-
[NAME:Call down the rain]
[BUILDING:WEATHER_CONTROL:CUSTOM_R]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:WEATHER_RAIN]

-[REACTION:WEATHER_SNOW]-
[NAME:Call down a snow storm]
[BUILDING:WEATHER_CONTROL:CUSTOM_S]
[PRODUCT:100:1:BOULDER:NONE:INORGANIC:WEATHER_SNOW]

Code: [Select]
[INORGANIC:WEATHER_CLEAR]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:blinding flash of light]
[STATE_NAME_ADJ:LIQUID:molten failure stone26]
[STATE_NAME_ADJ:GAS:Clear Skies]
    [SYNDROME]   
 [SYN_CLASS:\COMMAND] autosyndrome command begins here
   [SYN_CLASS:weather]
   [SYN_CLASS:clear]
         [SYN_NAME:doesnt matter]
         [SYN_CONTACT]
         [SYN_INHALED]
         [SYN_AFFECTED_CREATURE:DWARF:ALL][SYN_AFFECTED_CREATURE:KOBOLD_CAMP:ALL]
[CE_SPEED_CHANGE:SPEED_PERC:100:START:0:END:1]
[DISPLAY_COLOR:4:4:1][TILE:'*']
[MELTING_POINT:900]
[BOILING_POINT:905]
[SOLID_DENSITY:55520]
[MATERIAL_VALUE:1]

[INORGANIC:WEATHER_RAIN]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:blinding flash of light]
[STATE_NAME_ADJ:LIQUID:molten failure stone26]
[STATE_NAME_ADJ:GAS:Rain]
    [SYNDROME]   
 [SYN_CLASS:\COMMAND] autosyndrome command begins here
   [SYN_CLASS:weather]
   [SYN_CLASS:rain]
         [SYN_NAME:doesnt matter]
         [SYN_CONTACT]
         [SYN_INHALED]
         [SYN_AFFECTED_CREATURE:DWARF:ALL][SYN_AFFECTED_CREATURE:KOBOLD_CAMP:ALL]
[CE_SPEED_CHANGE:SPEED_PERC:100:START:0:END:1]
[DISPLAY_COLOR:4:4:1][TILE:'*']
[MELTING_POINT:900]
[BOILING_POINT:905]
[SOLID_DENSITY:55520]
[MATERIAL_VALUE:1]

[INORGANIC:WEATHER_SNOW]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:blinding flash of light]
[STATE_NAME_ADJ:LIQUID:molten failure stone26]
[STATE_NAME_ADJ:GAS:Snow]
    [SYNDROME]   
 [SYN_CLASS:\COMMAND] autosyndrome command begins here
   [SYN_CLASS:weather]
   [SYN_CLASS:snow]
         [SYN_NAME:doesnt matter]
         [SYN_CONTACT]
         [SYN_INHALED]
         [SYN_AFFECTED_CREATURE:DWARF:ALL][SYN_AFFECTED_CREATURE:KOBOLD_CAMP:ALL]
[CE_SPEED_CHANGE:SPEED_PERC:100:START:0:END:1]
[DISPLAY_COLOR:4:4:1][TILE:'*']
[MELTING_POINT:900]
[BOILING_POINT:905]
[SOLID_DENSITY:55520]
[MATERIAL_VALUE:1]
Title: Re: DFHack 0.34.11 r3
Post by: StephenJacob on April 05, 2013, 01:56:21 pm
I've been trying to reattach my left leg for a few hours and I can't seem to get it right .
I finally found the missing part flag in unit.body.components.body_part_status (I was looking in unit.body.body_plan.body_parts ...duh ) but it only reattaches the limb and not its layers (skin,bone,muscle) .
I tried changing any variable I could find with "layer" in its name but so far nothing ...
Does anyone know where I can find those flags, if they even exist ?
dfusion has a heal unit script that will repair your legs, you need to select your adventurer to get it to work.

Yeah, but it heals every wound. Your post gave me an hint as to where the layers were but it doesn't answer my question .
I can't seem to make sense of this organization. I've found that body_layer_338 seems to control skin and bones states and body_layer_348 takes care of the fat , I have no idea what all the other layers do as changing some of their value doesn't seem to affect my adventurer's description .
Now the problem is there are 88 body parts in body.body_plan.body_parts and using their index I can reattach them setting myAdv.body.components.body_part_status[bodyPartIndex].whole to 0 .

I've devised this code to do so :
Code: [Select]
function reattachLimb(name)
    for k,v in pairs(myAdv.body.body_plan.body_parts) do
        if v.name_singular[0][0]==name then
for i,j in pairs(myAdv.body.components.body_part_status[k]) do
                myAdv.body.components.body_part_status[k][i] = false
            end
        end
    end
end


But I can't apply the same technique to the body layers, the length of body_layer_338 and 348 are 245, which isn't a multiple of 88 so I assume some body parts don't have bone or don't have skin or some stuff like that but then how am I supposed to find the index of the specific body part's skin, bone and fat ?

Again any insight appreciated .
Title: Re: DFHack 0.34.11 r3
Post by: hurtmypony on April 05, 2013, 02:21:26 pm
Hello!

Not sure if I should put this as an independent message or keep it here, since I am using DFHack to defeat a DF bug of sorts.

I was having issues with the population cap not being respected by my game.  I haven't played in a couple of years, and I wanted to keep the population under 23. 

I have child cap at 0:0
I originally had the pop cap at 23.
I am using LazyNewb, but I updated DFHack manually to 34.11 R3.  It shows as the correct version in the command prompt.


Since I was having population issues in my other maps, I started a new one with the settings above.

Immediately upon starting the game, I tried to run the script "population-cap". 
Since it was a new game and no caravan had visited yet, it threw the error and told me to run "fix/population-cap" script. 
I did that, adn I got the "home civ notified" message.

I got my first two waves, before any caravan, which put me right at 23. 
Each time after, I ran "population-cap" script.  Got the confirmation message.
So far, so good.
Now a season or so after the first dwarf Caravan, and immediately after the first elf one, I got another wave of 14 or so dwarves, putting me at 32 dwarves.  Well over my set 23.


Did I do something wrong?  Is there any way to stop the inflow?  I would rather manage my population at my own pace with my first game back in years.  Does anyone have any advice?  I'd appreciate it.



Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on April 05, 2013, 09:53:28 pm
Where can I fiind the dfusion embark plugin? The new dfusion doesn't show it in any menus.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 06, 2013, 02:34:25 am
Where can I fiind the dfusion embark plugin? The new dfusion doesn't show it in any menus.
hack/lua/dfusion.

Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on April 06, 2013, 01:07:14 pm
Yes, but what command?
Title: Re: DFHack 0.34.11 r3
Post by: Cavgunner on April 06, 2013, 08:48:53 pm
Hey guys,

I have the Lazy Newb pack installed.  I installed DF Hack separately.  However, when starting up the DF hack prompt the command window doesn't open (it very briefly appears and then disappears). 

Any thoughts as to what might be happening here?
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 06, 2013, 10:24:43 pm
I have the Lazy Newb pack installed.  I installed DF Hack separately.  However, when starting up the DF hack prompt the command window doesn't open (it very briefly appears and then disappears). 

First, what do you mean with "installed seperately"? You need to follow the installation instructions and copy dfhack into your DF folder (on Windows SDL.dll needs to be replaced). Second, what do you mean with "DF hack prompt"? I suspect you are trying to "start" it with the dfhack-run.exe which is wrong. Read the manual, please:

https://github.com/peterix/dfhack#getting-started (https://github.com/peterix/dfhack#getting-started)

Quote
If DFHack is installed correctly, it will automatically pop up a console window once DF is started as usual on windows. Linux and Mac OS X require running the dfhack script from the terminal, and will use that terminal for the console.

NOTE: The dfhack-run executable is there for calling DFHack commands in an already running DF+DFHack instance from external OS scripts and programs, and is not the way how you use DFHack normally.
Title: Re: DFHack 0.34.11 r3
Post by: Cavgunner on April 07, 2013, 11:22:46 am
Never mind, I reinstalled the whole LN pack and everything works fine now.
Title: Re: DFHack 0.34.11 r3
Post by: Nokao on April 07, 2013, 03:24:47 pm
Hi there, is it possible to make a "watersource here" command like for magma for next versions ?

How do I do that now ?
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 07, 2013, 09:06:09 pm
https://github.com/peterix/dfhack#magmasource
The command is "magmasource here" with an active cursor.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 07, 2013, 11:01:24 pm
"Like for magma", meaning that he wants that, but for water.
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 08, 2013, 12:10:37 am
Oh sorry, I read that the other way round. It's possible as well, with liquids. If you use the keybinding from the dfhack.init example you can press Alt-L (you need a cursor active), then press p a couple times until it says "River Source", and place a rectangle which then will start to spawn water.
Title: Re: DFHack 0.34.05 r1
Post by: There Is No Vic on April 08, 2013, 11:39:08 am
thanks, did all that.  Now what you guys think.  Where can I learn to do some dfhack plugins/scripts.  I know how to program in C++, but I'm really green.
Well, there are just a few things I can tell you:
  • the documentation is non-existent, because nobody has the time to write some.
  • Even thought there's no documentation, there's an example plugin that 'does nothing'. So you can start by looking at it. (https://github.com/peterix/dfhack/tree/master/plugins/skeleton) There's a source file, an empty header and a CMake file which is set up for a much bigger plugin than the skeleton one to show how things can be done with the build system.
  • You can look at the other plugins (https://github.com/peterix/dfhack/tree/master/plugins).
  • When you have the DFHack build environment set up, it generates a lot of files in library/include/df/. Those describe many of the game's data structures and are referenced by the plugins.
  • Look at the modular API stuff (https://github.com/peterix/dfhack/tree/master/library/include/modules) - sometimes it makes things easier to do or discover.

I'm a complete cpp newb, so please be patient.

Following the directions from the Windows compile doc (https://github.com/peterix/dfhack/blob/master/Compile.rst#id11), I managed to get an MSVC solution that is very pretty.

However, in several of the .cpp files, I find error messages for the includes, notably:
Code: [Select]
#include "df/unit.h"
#include "df/unit_soul.h"

I find unit.h on my local drive in ..\dfhack\library\include\modules\, but not in \df\.
..\dfhack\library\include\df\ contains only a directory \custom\.
unit_soul.h is nowhere on my local drive, and I cannot locate it on github.

My questions:

1) Are these missing headers cause for concern?
2) If so, how can I prestidigitate the missing headers into their proper locations?
3) Am I completely out of my depth, trying to dive into c++ by learning the mysteries of dfhack?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 08, 2013, 12:18:59 pm
Yes, but what command?
oh yeah it doesn't exist in new Dfusion...Sorry.
Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on April 08, 2013, 12:27:28 pm
How can I add it in?
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on April 08, 2013, 01:36:20 pm
Following the directions from the Windows compile doc (https://github.com/peterix/dfhack/blob/master/Compile.rst#id11), I managed to get an MSVC solution that is very pretty.  [...]

1) Are these missing headers cause for concern?
2) If so, how can I prestidigitate the missing headers into their proper locations?
3) Am I completely out of my depth, trying to dive into c++ by learning the mysteries of dfhack?

1), 2) Yes that will cause concern. Did you really follow the instructions from the Compile.rst step by step? One common mistake is to only pull dfhack and not the submodules. Though in your case it sounds like the generated headers are missing. Did you build your MSVC solution using one of those batch file? use dfhack/build/generate-MSVC-all.bat to build a MSVC solution for all of it, then best you use build-release.bat from the same directory to build dfhack for the first time. If one of the batch files fails to run that's an indication that something with your cloned repository is wrong.

3) DFHack is a huge and advanced project so if this is your first time with C++ it might be a feat to get into it. Besides, it's not 100% C++, some parts are written in Perl, lua and Ruby (though just for modifying one of the existing plugins a bit or writing a simple new one you won't need to bother with that).

Edit: if you are positive that you followed all instructions and still have trouble compiling it for the first time I'd suggest you come to the IRC channel (see first post) and describe your problems.
Title: Re: DFHack 0.34.05 r1
Post by: There Is No Vic on April 08, 2013, 03:00:58 pm
Following the directions from the Windows compile doc (https://github.com/peterix/dfhack/blob/master/Compile.rst#id11), I managed to get an MSVC solution that is very pretty.  [...]

1) Are these missing headers cause for concern?
2) If so, how can I prestidigitate the missing headers into their proper locations?
3) Am I completely out of my depth, trying to dive into c++ by learning the mysteries of dfhack?

1), 2) Yes that will cause concern. Did you really follow the instructions from the Compile.rst step by step? One common mistake is to only pull dfhack and not the submodules. Though in your case it sounds like the generated headers are missing. Did you build your MSVC solution using one of those batch file? use dfhack/build/generate-MSVC-all.bat to build a MSVC solution for all of it, then best you use build-release.bat from the same directory to build dfhack for the first time. If one of the batch files fails to run that's an indication that something with your cloned repository is wrong.

3) DFHack is a huge and advanced project so if this is your first time with C++ it might be a feat to get into it. Besides, it's not 100% C++, some parts are written in Perl, lua and Ruby (though just for modifying one of the existing plugins a bit or writing a simple new one you won't need to bother with that).

Edit: if you are positive that you followed all instructions and still have trouble compiling it for the first time I'd suggest you come to the IRC channel (see first post) and describe your problems.

Thanks for the quick response. I did pop onto freenode#dfhack a few times, but IRC is also a new experience.

I did pull the submodules init and update, as per the instructions. I did use dfhack/build/generate-MSVC-all.bat.

From Compile.rst
Quote
Then you can either open the solution with MSVC or use one of the msbuild scripts:

I just opened the solution with MSVC without using one of the msbuild scripts.

After running build-release.bat, the missing header messages are gone.

So much for jumping into coding fun. I guess I've got more babyfood in c++ to digest first.

Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on April 08, 2013, 03:20:01 pm
After running build-release.bat, the missing header messages are gone.
So much for jumping into coding fun. I guess I've got more babyfood in c++ to digest first.

Seems you are mostly fine to go now. While it *is* possible to use MSVC for compiling the whole project there are still some caveats. Most notably that it usually it tries to build a debug version by default which just won't work, you need some sort of 'release with debug options' version if you wanna debug. That's why I recommended the batch file for building if it's your first time. Have fun trying to get into dfhack!

As for IRC you need to keep in mind that people have lives, sometimes you ask a question and will get an answer 20 hours later. That's how it is. Still a bit faster than posting in this thread which not everybody monitors that closely.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on April 08, 2013, 03:55:55 pm
After running build-release.bat, the missing header messages are gone.
So much for jumping into coding fun. I guess I've got more babyfood in c++ to digest first.

Seems you are mostly fine to go now. While it *is* possible to use MSVC for compiling the whole project there are still some caveats. Most notably that by default it usually it tries to build a debug version by default which just won't work, you need some sort of 'release with debug options' version if you wanna debug. That's why I recommended the batch file for building if it's your first time. Have fun trying to get into dfhack!

Nope. Once you generate an MSVC solution with one of the batch files (Use the GUI one, it's nice) the default compile option is release. the only other option is release with debug info.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on April 08, 2013, 04:13:35 pm
Once you generate an MSVC solution with one of the batch files (Use the GUI one, it's nice) the default compile option is release. the only other option is release with debug info.

No it's not. You can still end up with "compile debug" option (I know I did). Well, whatever.
Title: Re: DFHack 0.34.05 r1
Post by: Rose on April 08, 2013, 04:18:23 pm
Once you generate an MSVC solution with one of the batch files (Use the GUI one, it's nice) the default compile option is release. the only other option is release with debug info.

No it's not. You can still end up with "compile debug" option (I know I did). Well, whatever.

I don't know when the last time you tried it is, but...

Title: Re: DFHack 0.34.11 r3
Post by: Nokao on April 08, 2013, 04:55:49 pm
Oh sorry, I read that the other way round. It's possible as well, with liquids. If you use the keybinding from the dfhack.init example you can press Alt-L (you need a cursor active), then press p a couple times until it says "River Source", and place a rectangle which then will start to spawn water.

great thanks ! I'm projecting a quickfort megaproject and don't have the time for make things clean ;)

bye
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 08, 2013, 05:16:17 pm
How can I add it in?
uhh well you could add it back in by going into the Dfusion init page and adding in a menu to the list one that connects it to the embark file. though embark hasn't been touch since r1 and lua scripting code been messed with so much that running it might just crash the game.
Title: Re: DFHack 0.34.05 r1
Post by: robertheinrich on April 08, 2013, 07:51:56 pm
I don't know when the last time you tried it is, but...
I 'tried" today with dfhack r3 pulled ca. 2 weeks ago.

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Rose on April 08, 2013, 08:04:47 pm
When was the last time you rebuilt the solution from scratch?
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 08, 2013, 09:00:37 pm
When was the last time you rebuilt the solution from scratch?
As I said, maybe 2-3 weeks ago. Deleted the dfhack/build folder, then called generate-MSVC-all.bat
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on April 08, 2013, 09:03:21 pm
What version of CMake are you using?
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 08, 2013, 09:18:16 pm
What version of CMake are you using?
2.8.7
Title: Re: DFHack 0.34.11 r3
Post by: Rose on April 09, 2013, 12:32:01 am
That might effect things.

I have 2.8.10
Title: Re: DFHack 0.34.11 r3
Post by: vjek on April 09, 2013, 12:42:50 pm
Regarding Ghosts.

Setting the unit flags for dead and killed removes them from view, and after a period of time, they disappear entirely from the active units list.

What I'd like to know... what is causing this "cleanup" after time has passed, and is it possible to trigger this immediately after flagging them as dead and killed?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 09, 2013, 04:17:14 pm
Regarding Ghosts.

Setting the unit flags for dead and killed removes them from view, and after a period of time, they disappear entirely from the active units list.

What I'd like to know... what is causing this "cleanup" after time has passed, and is it possible to trigger this immediately after flagging them as dead and killed?
uhh you could also revive ghosts to become normal citizens by flipping off their ghostly flag(and healing all their wounds).
Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on April 11, 2013, 01:41:12 pm
Is there a command to run a dfusion script directly without the gui?
Title: Re: DFHack 0.34.11 r3 "water here" - river source
Post by: Timeless Bob on April 12, 2013, 12:36:22 am
(http://images.wikia.com/aceattorney/images/1/10/Eureka.gif)

Imagine a custom workshop triggering a 1x1 rectangle for the "river source" for a tick or two then deleting it.  Have it be required to be built over a hole in the floor...

I think I may have the process for dwarven sewage... especially if that spot of water "muddies" the floor beneath it...
Title: Re: DFHack 0.34.11 r3
Post by: There Is No Vic on April 12, 2013, 09:54:23 am
I fatfingered some command. Now I have an item placement tool in the build menu.

http://dffd.wimbli.com/file.php?id=7563 (http://dffd.wimbli.com/file.php?id=7563)

How can I make this magic happen again?
How can I make it stop? It's messing with my Quickfort templates.
Title: Re: DFHack 0.34.11 r3 "water here" - river source
Post by: Rose on April 12, 2013, 10:17:58 am
(http://images.wikia.com/aceattorney/images/1/10/Eureka.gif)

Imagine a custom workshop triggering a 1x1 rectangle for the "river source" for a tick or two then deleting it.  Have it be required to be built over a hole in the floor...

I think I may have the process for dwarven sewage... especially if that spot of water "muddies" the floor beneath it...
no need to even make a river source. Just make a single chunk of water over the hole.
Title: Re: DFHack 0.34.11 r3 "water here" - river source
Post by: robertheinrich on April 12, 2013, 10:46:42 am
Imagine a custom workshop triggering a 1x1 rectangle for the "river source" for a tick or two then deleting it.  Have it be required to be built over a hole in the floor...

I think I may have the process for dwarven sewage... especially if that spot of water "muddies" the floor beneath it...
no need to even make a river source. Just make a single chunk of water over the hole.
The real task will be making dwarves use those custom workshops and under what circumstances. What's the input material? Can it be 'nothing'? Maybe some sort of toilet paper (either regular cloth or a custom product crafted at another workshop)? And another problem is that workshops are tied to labors, isn't it?
Title: Re: DFHack 0.34.11 r3
Post by: Greiger on April 12, 2013, 11:49:42 am
I am both amused and horrified at what DFhack is being used to simulate here.

Though the question is, how would one go about making sure every dwarf performs the task at least once per period of time?
Title: Re: DFHack 0.34.11 r3
Post by: falconne on April 12, 2013, 02:59:21 pm
I fatfingered some command. Now I have an item placement tool in the build menu.

http://dffd.wimbli.com/file.php?id=7563 (http://dffd.wimbli.com/file.php?id=7563)

How can I make this magic happen again?
How can I make it stop? It's messing with my Quickfort templates.

You have this (http://www.bay12forums.com/smf/index.php?topic=121858.0). As it says on screen, press "p" to enable/disable.
Title: Re: DFHack 0.34.11 r3
Post by: There Is No Vic on April 12, 2013, 05:27:26 pm
I fatfingered some command. Now I have an item placement tool in the build menu.

http://dffd.wimbli.com/file.php?id=7563 (http://dffd.wimbli.com/file.php?id=7563)

How can I make this magic happen again?
How can I make it stop? It's messing with my Quickfort templates.

You have this (http://www.bay12forums.com/smf/index.php?topic=121858.0). As it says on screen, press "p" to enable/disable.

Thank you.

I could have sworn I looked at other build items and didn't see anything. So much of my playing is just muscle memory.
Title: Re: DFHack 0.34.11 r3
Post by: Timeless Bob on April 12, 2013, 06:39:11 pm
So maybe the chunk of water produced also creates a "happy thought" ie: "Urist McRelieved has enjoyed a good bowel movement".  The labor could be tied to "eat/drink/sleep" labours, where that labour is immediately generated by the completion of eating, drinking or sleeping.  Come to think of it, it might just work like a "fill pond" designation, just without a bucket.

Since fortress mode exists within a level of abstraction, which dwarf completes the labour shouldn't really be a factor - just that for N number of dwarves, N number of "natural dwarven excretions" are created per season.

Just saying, my day gets much better after I've used the jakes - I certainly get a happy thought from it.  Why keep dwarves from similar joys?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 12, 2013, 06:41:51 pm
No new thought types, just new thoughts.
Title: Re: DFHack 0.34.11 r3
Post by: Timeless Bob on April 12, 2013, 06:54:29 pm
Urist McRelieved has admired a masterful toilet stall....
Title: Re: DFHack 0.34.11 r3
Post by: Rose on April 13, 2013, 12:06:33 am
Urist Mc Relieved has admired a fine waterfall lately.
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 13, 2013, 12:42:48 am
Urist Mc Relieved has admired a fine waterfall lately.
Going by that logic people should build those toilets above their dining hall so that everybody gets happy thoughts from the mist they create.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on April 13, 2013, 12:45:26 am
Urist Mc Relieved has admired a fine waterfall lately.
Going by that logic people should build those toilets above their dining hall so that everybody gets happy thoughts from the mist they create.
Exactly.
Title: Re: DFHack 0.34.11 r3
Post by: peregarrett on April 13, 2013, 05:29:55 am
A question about binpatch.exe
When I use binpatch plugin, 'binpatch apply deconstruct-teleport' works fine. When I try to use 'binpatch.exe apply DF.exe deconstruct-teleport' it says "No lines recognised" and obviuosly does nothing.
Where could the problem be?
Title: Re: DFHack 0.34.11 r3
Post by: snakesoul on April 13, 2013, 07:23:42 am
I need to eliminate a mummy's curse from my adventurer, is this possible with dfhack? Someone could tell me the command to do this?

Thank you
Title: Re: DFHack 0.34.11 r3
Post by: Dwarf73 on April 13, 2013, 08:38:57 am
How get siege engines gui to work, have been trying ctrl-A when catapult is selected but nothing happens and once opened dfhack.init and tried to understand that mess got headic :P
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 13, 2013, 09:21:23 am
How get siege engines gui to work, have been trying ctrl-A when catapult is selected but nothing happens and once opened dfhack.init and tried to understand that mess got headic :P
The default keybinding is Alt-A, not Ctrl-A. And you have to be in the (q)uery building mode.
Title: Re: DFHack 0.34.11 r3
Post by: Dwarf73 on April 13, 2013, 09:33:32 am
How get siege engines gui to work, have been trying ctrl-A when catapult is selected but nothing happens and once opened dfhack.init and tried to understand that mess got headic :P
The default keybinding is Alt-A, not Ctrl-A. And you have to be in the (q)uery building mode.

so I press q and take x on catapult and press alt-a, nothing happens still  ???
Title: Re: DFHack 0.34.11 r3
Post by: Greiger on April 13, 2013, 10:13:42 am
I ended up having to rename the dfhacks init example file as my copy appeared to be missing a default one.  Once I did that everything worked..
Title: Re: DFHack 0.34.11 r3
Post by: Dwarf73 on April 13, 2013, 10:28:42 am
I ended up having to rename the dfhacks init example file as my copy appeared to be missing a default one.  Once I did that everything worked..

THANK YOU!  :)
Title: Re: DFHack 0.34.11 r3
Post by: ag on April 13, 2013, 11:05:31 am
When I use binpatch plugin, 'binpatch apply deconstruct-teleport' works fine. When I try to use 'binpatch.exe apply DF.exe deconstruct-teleport' it says "No lines recognised" and obviuosly does nothing.

The exe file wants a full file name, not just part of it. It doesn't know whether it should use "patches/v0.34.11 SDL/deconstruct-teleport.dif", or "patches/v0.34.11 linux/deconstruct-teleport.dif" or whatever other version there is. The script version does know which version it is loaded into, so it supplies that for you.
Title: Re: DFHack 0.34.11 r3
Post by: snakesoul on April 13, 2013, 12:26:30 pm
I need to eliminate a mummy's curse from my adventurer, is this possible with dfhack? Someone could tell me the command to do this?

Thank you
help please!
Title: Re: DFHack 0.34.11 r3
Post by: Greiger on April 13, 2013, 12:44:24 pm
I would love to help but I'm not sure such a tool exists.

If there isn't a interaction removal tool that would probably be something that folks would appreciate though.  I'm sure more than a few people would love to be able to revert a husked miner or cure a vampire or were-lemur.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 13, 2013, 01:33:07 pm
Should be easy enough, unless there's more than the curse and syndrome structs.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 13, 2013, 02:18:30 pm
I would love to help but I'm not sure such a tool exists.

If there isn't a interaction removal tool that would probably be something that folks would appreciate though.  I'm sure more than a few people would love to be able to revert a husked miner or cure a vampire or were-lemur.
grab gm-editor dive into your character data by highlighting the adventurer then  poke through the curses and syndrome section until you find something, then delete the syndrome/curse or set it to be something else. it's tricky and may take Save scumming trial and error.
Title: Re: DFHack 0.34.11 r3
Post by: gchristopher on April 14, 2013, 03:23:13 am
Is anyone aware of how the game determines what map edges tiles are eligible for diplomats/traders/migrants and whether it can be changed?

It looks like the initial position of the embark wagon determines map edge eligibility. Does the game record the initial position of the wagon somewhere? The building record seems to be removed when the wagon is deconstructed.

Does the game dynamically figure out where the wagon should have appeared each time if processes a migrant, caravan or diplomat event? Can you trick it at that point by changing the surface tile types beforehand to create a new set of path-eligible map edges? (Actually, that's easily testable. I'll try it.)

edit: Modifying the map tiletypes to change which map area connects to the original wagon location updates world.map.map_blocks.walkable, but does not affect where caravans and liasons appear. Maybe that indicates the map edge is somehow flagged?

Is it a flag stored somewhere per-tile? I'm pretty sure it's not any data under df.global.world.map. Editing bap_blocks.walkable doesn't change it. Maybe it's in memory that dfhack doesn't index?
Title: Re: DFHack 0.34.11 r3
Post by: Greiger on April 14, 2013, 03:08:24 pm
Probably a stupid question but when I search this topic for steam engine I don't seem to come up with answers.  How do these things work?  I built a magma cistern, I made a down stair to it on the level above and placed it so that the down stair is the south middle square of the steam engine (which seemed to be the only place where it would allow the stair and engine to coexist).

The cistern is full up of 7/7 magma but it still says I need magma in one of the 8 squares.  I was thinking maybe it needed water too, but if there's only one place it would allow me to have a down stair I don't see how I could build it to have access to both.

Am I missing something really obvious?
Title: Re: DFHack 0.34.11 r3
Post by: MightyDorf on April 14, 2013, 03:29:24 pm
I have a little question too : is it possible to "fill" with constant 7/7 water a brook's edge via dfhack ? Mine is causing some nasty fps drop because of flowing liquid.
Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on April 14, 2013, 05:18:12 pm
 How do I add something to a dfusion menu?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 14, 2013, 08:07:16 pm
How do I add something to a dfusion menu?
go to hack/lua/plugins/dfusion to find about 4 files... though you might need flash developer or Notepad++ to properly add or write in script since you might end up with a compressed lua file.
Title: Re: DFHack 0.34.11 r3
Post by: gchristopher on April 15, 2013, 12:51:17 am
I have a little question too : is it possible to "fill" with constant 7/7 water a brook's edge via dfhack ? Mine is causing some nasty fps drop because of flowing liquid.
Assuming that the water flowing off the map edge at the brook is really what's causing your FPS drop, then there are some options. You can dam the brook or you could change those edge tiles from out-flow to in-flow. The brook will keep filling itself, but won't drain water off the map properly anymore in that case.

Here's some off-the-cuff lua to try. Put the map cursor on the brook tile on the edge of the map you want to change. (The actual 7/7 water brook tile, not the space above it.) I don't know if there's a helper function to make finding a block in df.global.world.map easier than this.
Code: [Select]
for ii = 0,#df.global.world.map.map_blocks-1 do
  block = df.global.world.map.map_blocks[ii];
  for dx = 0,15 do
    for dy = 0,15 do
      if (block.map_pos.x + dx)  == df.global.cursor.x and (block.map_pos.y + dy)  == df.global.cursor.y and block.map_pos.z == df.global.cursor.z then
        block.occupancy[dx][dy].edge_flow_in = true;
      end
    end
  end
end
Title: Re: DFHack 0.34.11 r3
Post by: ag on April 15, 2013, 02:20:57 am
which seemed to be the only place where it would allow the stair and engine to coexist

Sounds like the plugin is not active. When it is, it alters the game ui response to allow down stairs under any tile of the engine. And it does need water.
Title: Re: DFHack 0.34.11 r3
Post by: Kromgar on April 15, 2013, 08:42:37 am
How do I take over the body of an adventurer who isn't my companion? It says I need to force the bodyswap or something.

I am using adv-bodyswap
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 15, 2013, 08:53:13 am
adv-bodyswap force
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 15, 2013, 05:55:35 pm
or just use dfusion which also has bodyswap it's under the misc option. Sadly kinda force you to select and look at the person stats before you can switch and not have the X pointer over their head, it's possible to change the script to do so.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on April 16, 2013, 12:32:55 pm
Looking through the catsplosion plugin, not really familiar with how dfhack interacts with DF but it seems that the only part that references cats is

    list<string> s_creatures;
    // only cats for now.
    s_creatures.push_back("CAT");
    // make the creature list unique ... with cats. they are always unique
    s_creatures.unique();
    // SUSPEND THE CORE! ::Evil laugh::
    CoreSuspender susp;

So to make it work for other creatures all I need to do is change the "CAT" to say "DOG"?
Title: Re: DFHack 0.34.11 r3
Post by: turabeasel on April 16, 2013, 03:25:46 pm
Is there anyway in Dwarf Manipulator to sort by idle dwarves?
Title: Re: DFHack 0.34.11 r3
Post by: comham on April 17, 2013, 02:47:30 pm
I feel like I should be able to figure this out myself, but I can't; is there a command to deconstruct a building or free a prisoner? Autodump doesn't work. Last two dwarves in the fort are locked up vampires, and I want the fort to wither.
Title: Re: DFHack 0.34.11 r3
Post by: robertheinrich on April 17, 2013, 03:53:13 pm
I feel like I should be able to figure this out myself, but I can't; is there a command to deconstruct a building or free a prisoner? Autodump doesn't work. Last two dwarves in the fort are locked up vampires, and I want the fort to wither.
Right now your would still need masons/carpenters/whatever to deconstruct stuff. There is no plugin (yet) which allows you magically deconstruct buildings without having workers do it.
Title: Re: DFHack 0.34.11 r3
Post by: vjek on April 17, 2013, 04:51:34 pm
I feel like I should be able to figure this out myself, but I can't; is there a command to deconstruct a building or free a prisoner? Autodump doesn't work. Last two dwarves in the fort are locked up vampires, and I want the fort to wither.
If there is any natural stone anywhere nearby that an exit path can be made from, liquids -> obsidian floor will let you create that path.
But constructed walls/buildings?  nope.
Title: Re: DFHack 0.34.11 r3
Post by: armeggedonCounselor on April 17, 2013, 05:50:08 pm
The first post says that superdwarf can be used in Adventure Mode. How do I use it? Does my adventurer have to be a dwarf?
Title: Re: DFHack 0.34.11 r3
Post by: BigFatStupidHead on April 17, 2013, 05:54:06 pm
Hey folks, correct me if I'm wrong, but I've heard the bugged immigrant traders that sometimes show up will leave your site with the dwarven caravan. Could fixmigrant be reversed so that you can exile unwanted citizens?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 17, 2013, 06:21:19 pm
The first post says that superdwarf can be used in Adventure Mode. How do I use it? Does my adventurer have to be a dwarf?
you should be able to place the cursor on the adventurer.
Title: Re: DFHack 0.34.11 r3
Post by: armeggedonCounselor on April 17, 2013, 07:06:09 pm
The first post says that superdwarf can be used in Adventure Mode. How do I use it? Does my adventurer have to be a dwarf?
you should be able to place the cursor on the adventurer.

Using 'l'ook? Or do I need to use something else?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 17, 2013, 07:43:45 pm
The first post says that superdwarf can be used in Adventure Mode. How do I use it? Does my adventurer have to be a dwarf?
you should be able to place the cursor on the adventurer.

Using 'l'ook? Or do I need to use something else?
look or talk

edit: okay so I just got spawnunit (https://gist.github.com/Rumrusher/5416231) to work in r3, though it's the one warmist made originally and not his more recent version but at least now I can do something else.
oh and known quirks with spawnunit:
spawning more than 1 unit at a time will crash the game when you unload the area. the names don't match up when you talk to ungbuga. while you can attack ungbuga you might not land a hit so best not provoke ungbuga unless you have some firebreath or syndrome base attack to do damage. the script currently spawns a peasant who doesn't attack any one.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 19, 2013, 06:01:35 pm
That sounds great. :)

What narihil/deon/me would be using this ingame for is running a reaction in a workshop that spawns a creature on it. I could get as far is making a workshop, creating a rock that triggers autosyndrome, and the syndrome runs "\command \spawnunit". That way the dwarf runs the script in fortress mode. It only needs to know the location of the workshop or dwarf, and some kind of input for the creature id. "spawnunit cat" and "spawnunit goblin", something like that.

Quote
spawning more than 1 unit at a time will crash the game when you unload the area.
This sounds like a serious obstacle ^^
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 19, 2013, 06:51:21 pm
Well, spawning units is really, really hard.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 20, 2013, 12:13:44 am
Well, spawning units is really, really hard.
well that's only for adventure mode, fort mode perfectly fine with spawning that many units... spawning that many units in fort mode in unison will make it impossible to save right away. though I don't know what causes that to happen. best bet is adventure mode spawn one then unload the area then spawn another.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on April 20, 2013, 04:05:23 am
I have made an adaptation of unsuspend.rb and autounsuspend.rb for the purposes of fixing handedness on gloves created through custom reactions.

fixhandedness.rb
Spoiler (click to show/hide)

autofixhandedness.rb
Spoiler (click to show/hide)

I set the auto check to 100 ticks and I think it can be set longer 2400 ticks for once every 2 dwarf days as I don't expect custom reaction gloves to be created frequently. 

*edited to increase the auto ticks, give start/stop feedback, to have a help string in the dfhack console's script listing, and improve the comments.
Title: Re: DFHack 0.34.11 r3
Post by: xcorps on April 20, 2013, 09:25:26 am
The link in the OP is down, anyone have an alternate source for downloading?
Title: Re: DFHack 0.34.11 r3
Post by: gchristopher on April 20, 2013, 04:50:05 pm
Is anyone aware of how the game determines what map edges tiles are eligible for diplomats/traders/migrants and whether it can be changed?

It looks like the initial position of the embark wagon determines map edge eligibility. Does the game record the initial position of the wagon somewhere? The building record seems to be removed when the wagon is deconstructed.

Does the game dynamically figure out where the wagon should have appeared each time if processes a migrant, caravan or diplomat event? Can you trick it at that point by changing the surface tile types beforehand to create a new set of path-eligible map edges? (Actually, that's easily testable. I'll try it.)

edit: Modifying the map tiletypes to change which map area connects to the original wagon location updates world.map.map_blocks.walkable, but does not affect where caravans and liasons appear. Maybe that indicates the map edge is somehow flagged?

Is it a flag stored somewhere per-tile? I'm pretty sure it's not any data under df.global.world.map. Editing bap_blocks.walkable doesn't change it. Maybe it's in memory that dfhack doesn't index?
I still haven't had any luck finding something in the lua-addressable dfhack interface that relates to where visitors can appear.

Does anyone have an evidence of the accessible edge tiles varying by civilization?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on April 20, 2013, 04:59:21 pm
Is anyone aware of how the game determines what map edges tiles are eligible for diplomats/traders/migrants and whether it can be changed?

It looks like the initial position of the embark wagon determines map edge eligibility. Does the game record the initial position of the wagon somewhere? The building record seems to be removed when the wagon is deconstructed.

Does the game dynamically figure out where the wagon should have appeared each time if processes a migrant, caravan or diplomat event? Can you trick it at that point by changing the surface tile types beforehand to create a new set of path-eligible map edges? (Actually, that's easily testable. I'll try it.)

edit: Modifying the map tiletypes to change which map area connects to the original wagon location updates world.map.map_blocks.walkable, but does not affect where caravans and liasons appear. Maybe that indicates the map edge is somehow flagged?

Is it a flag stored somewhere per-tile? I'm pretty sure it's not any data under df.global.world.map. Editing bap_blocks.walkable doesn't change it. Maybe it's in memory that dfhack doesn't index?
I still haven't had any luck finding something in the lua-addressable dfhack interface that relates to where visitors can appear.

Does anyone have an evidence of the accessible edge tiles varying by civilization?

 I had a fort where I made a covered road from the map edge to my depot by way of raised bridges on the side and constructed floors above it at the edge before it went underground.  After some forgotten beasts made a mess of things I reclaimed and that section of covered edge was no longer a valid spawning point for caravans (and probably others) even after deconstructing the floor above.  If I knew were to look I could try to see if there is data value involved.  I suppose another reclaim after uncovering those edge tiles might fix it too,  but the other reclaim bugs I had made that fort rather disappointing.
Title: Re: DFHack 0.34.11 r3
Post by: gchristopher on April 21, 2013, 12:40:27 am
I had a fort where I made a covered road from the map edge to my depot by way of raised bridges on the side and constructed floors above it at the edge before it went underground.  After some forgotten beasts made a mess of things I reclaimed and that section of covered edge was no longer a valid spawning point for caravans (and probably others) even after deconstructing the floor above.  If I knew were to look I could try to see if there is data value involved.  I suppose another reclaim after uncovering those edge tiles might fix it too,  but the other reclaim bugs I had made that fort rather disappointing.
That would be consistent with it being re-calculated on each embark, then stored with the site data for the duration of that embark.

Oh hey! I found a likely data sequence in world.sav that matches this theory!

Bastardizing the bt hex edit format from the world parsing thread, something like this, where they're all 16 bit integers.

short count_x;
short x_coords[count_x];
short count_y;
short y_coords[count_y];
short count_z;
short z_coords[count_z];

Where all the count_.'s are the same, and the resulting coordinates appear to match the edge tiles. I can see gaps in the sequence where trees are growing on the map edge. I'll try editing this section and see if my caravan moves around.

Um, this might not relate to dfhack anymore, except to maybe help identify how the migrant/caravan/diplomat-eligible tiles might appear in memory. Please tell me if it should move to another thread.

Edit: Success! :) The visitor-eligible tiles are definitely determined at embark, and stored in a static set of coordinates that can be edited to change where they may appear. That doesn't completely rule out other sets of coordinates for other civilizations.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on April 21, 2013, 07:37:00 am
The values you found were probably ui.map_edge.* (or possibly ui.unk_mapedge_[xyz].
Title: Re: DFHack 0.34.11 r3
Post by: gchristopher on April 21, 2013, 02:52:47 pm
The values you found were probably ui.map_edge.* (or possibly ui.unk_mapedge_[xyz].
Yep. The values appear to match df.global.ui.map_edge.surface_[xyz].

That's probably what controls the locations for diplomats, caravans and migrants.

Thanks!

I wonder what would happen if you added non-edge coordinates to the list? Build a microcline box around the spot and make a diplomat TARDIS?
Title: Re: DFHack 0.34.11 r3
Post by: BriseRotule on April 22, 2013, 04:26:59 am
So looking at generating combat log outside of the reports screen menus ifoudn a link between
unit->reports.log[0] and the world->reports structure. Those int32 in the first structure are id for the second. That way i'm able to regenerate the reports menu.I can't check it right now, but i think the vector unit->reports.log[1], unit->reports.log[2] might be linked to sparring session and something (have to investigate further).

I think this is usefull and should be mentionned in the xml file as comment to put in the headers, who should i contact once my work is done on those fields ?
Title: Re: DFHack 0.34.11 r3
Post by: ag on April 22, 2013, 06:41:50 am
I think this is usefull and should be mentionned in the xml file as comment to put in the headers, who should i contact once my work is done on those fields ?

It's all already known...

https://github.com/peterix/df-structures/blob/master/df.units.xml#L230 (https://github.com/peterix/df-structures/blob/master/df.units.xml#L230)
Title: Re: DFHack 0.34.11 r3
Post by: BriseRotule on April 22, 2013, 06:58:20 am
I'm talking about :
Code: [Select]
<compound name='reports'>
    <static-array name='log' count='3' index-enum='unit_report_type'>
        <stl-vector type-name='int32_t' ref-target='report'/>
     </static-array>

     -- Garbage when the matching vector is empty:
     <static-array type-name='int32_t' name='last_year' count='3' index-enum='unit_report_type'/>
     <static-array type-name='int32_t' name='last_year_tick' count='3' index-enum='unit_report_type'/>
</compound>
And in fact the 3 vector probably are for combat/sparring/hunting. should have looked at the xml files.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on April 22, 2013, 08:43:09 am
i found a link between unit->reports.log[0] and the world->reports structure. Those int32 in the first structure are id for the second.

The "ref-target='report'" means that the integers in the vector refer to a "report" object by its key-field (in this case, "ID").

i think the vector unit->reports.log[1], unit->reports.log[2] might be linked to sparring session and something
The "index-enum='unit_report_type'" on the array means that unit.reports[0] is Combat, unit.reports[1] is Sparring, and unit.reports[2] is Hunting.
Title: Re: DFHack 0.34.11 r3
Post by: BriseRotule on April 22, 2013, 09:25:09 am
Well, i'm looking like a fool don't I :S
Not quite used to read xml structures. Will be more carefull in the future.
Title: Re: DFHack 0.34.11 r3
Post by: ag on April 22, 2013, 10:35:24 am
There is a document that describes the format of xml definitions, although it may be rather brief in places:

https://github.com/peterix/df-structures/blob/master/SYNTAX.rst (https://github.com/peterix/df-structures/blob/master/SYNTAX.rst)
Title: Re: DFHack 0.34.11 r3
Post by: Edwardspoonhands on April 22, 2013, 12:56:21 pm
Hello, wouldn't it be cool if you had a script that let you make bedrooms on every single bed on the map, or maybe in a rectangle, to speed up the process of making bedrooms instead of having to q every single bed individually?
Title: Re: DFHack 0.34.11 r3
Post by: falconne on April 22, 2013, 03:10:57 pm
Hello, wouldn't it be cool if you had a script that let you make bedrooms on every single bed on the map, or maybe in a rectangle, to speed up the process of making bedrooms instead of having to q every single bed individually?

I have a todo task to add that to my building planner plugin.
Title: Re: DFHack 0.34.11 r3
Post by: Edwardspoonhands on April 22, 2013, 03:51:21 pm
Hello, wouldn't it be cool if you had a script that let you make bedrooms on every single bed on the map, or maybe in a rectangle, to speed up the process of making bedrooms instead of having to q every single bed individually?

I have a todo task to add that to my building planner plugin.

Awesome.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 22, 2013, 05:05:32 pm
I am still having problems starting the siege engine script, that allows custom ammo and aiming. I have this in my init:

# siege engine control
keybinding add Ctrl-A@dwarfmode/QueryBuilding/Some/SiegeEngine gui/siege-engine

But when I hover with 'q' over a ballista/catapult and press ctrl+a nothing happens. Does anyone know what might cause this? Or does anyone have a working set up for this, maybe with different init entry that he could post?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 22, 2013, 05:57:40 pm
I am still having problems starting the siege engine script, that allows custom ammo and aiming. I have this in my init:

# siege engine control
keybinding add Ctrl-A@dwarfmode/QueryBuilding/Some/SiegeEngine gui/siege-engine

But when I hover with 'q' over a ballista/catapult and press ctrl+a nothing happens. Does anyone know what might cause this? Or does anyone have a working set up for this, maybe with different init entry that he could post?
is gui/siege-engine in quotes?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 22, 2013, 06:05:26 pm
No, it is exactly as I posted.

I had a look and some things are in quotes, some other arent. I assume all one-word commands are not in quotes, and all multi-word commands need to be in quotes?

Which means that this would work?
# siege engine control
keybinding add Ctrl-A@dwarfmode/QueryBuilding/Some/SiegeEngine "gui/siege-engine"
Title: Re: DFHack 0.34.11 r3
Post by: ash88 on April 22, 2013, 06:27:55 pm
Link in OP isn't completing.

Google-fu found this link: http://dethware.org/dfhack/download/

Disclaimer: When downloading from an unofficial third party site ... yadda yadda yadda ... death awaits with nasty sharp pointy teeth.
Title: Re: DFHack 0.34.11 r3
Post by: Asva on April 22, 2013, 07:48:40 pm
I am still having problems starting the siege engine script, that allows custom ammo and aiming. I have this in my init:

# siege engine control
keybinding add Ctrl-A@dwarfmode/QueryBuilding/Some/SiegeEngine gui/siege-engine

But when I hover with 'q' over a ballista/catapult and press ctrl+a nothing happens. Does anyone know what might cause this? Or does anyone have a working set up for this, maybe with different init entry that he could post?
Just tested it on masterwork 2g+ with updated to r3 DFhack. Both ballistae and catapults are working as intended. Init entry is default.
Title: Re: DFHack 0.34.11 r3
Post by: peterix on April 22, 2013, 07:55:43 pm
Link in OP isn't completing.
Google-fu found this link: http://dethware.org/dfhack/download/
That's my site, and the place where the link in OP goes. The hosting company has a lot of trouble actually serving the files. I'm looking into adding mirrors and possibly torrent downloads.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on April 22, 2013, 09:37:07 pm
Is there a reliable way to transform a creature from one caste to another?  I've tried setting the number of the caste in the unit itself, which has the interesting effect of immediately changing back when I unpause the game, with an announcement that the creature has transformed back to its original caste.

I'm certain this is related to the were curse stuff from .34.x, but I can't figure out how the game knows what the original caste was.  I've tried changing it in the historical figure, the soul and the unit itself, but the unit's caste number always gets changed back with that announcement (the others appear to be left alone).

Any ideas?

Note that this is a modded game and I'm not just swapping castes of dwarves with different genders.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 22, 2013, 09:40:18 pm
Search for the caste's specific CASTE:(X) token in the creature's raw and use the number of the caste found with that?
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on April 22, 2013, 10:25:23 pm
That's what I've been doing, more or less.  If I save the game after making the change but without unpausing it, when I load the game again they're the correct caste.  They immediately change to their original again with the announcement that they've transformed though.  Very mysterious.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 22, 2013, 10:28:13 pm
you might need to change the were caste or the caste in the status section of the unit.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on April 22, 2013, 10:52:34 pm
The status section?  You mean in the current soul, or is there a caste field elsewhere in the status section?  I'll check that again.  Where is the were caste stored?  I poked through the syndrome and curse structures using the Lua interface but didn't find anything obvious.
Title: Re: DFHack 0.34.11 r3
Post by: drayath on April 23, 2013, 07:21:13 am
Is there any way to show what syndromes are affected one/all dwarves?
Title: Re: DFHack 0.34.11 r3
Post by: drayath on April 23, 2013, 11:19:42 am
I was bored so to answer my own question here is a script to show units affected by syndromes.

It assumes the syndrome has a sensible (any!) name to show which is not necessarly the case. If anyone is also feeling bored you could modify the script to also print out the details of each syndrome.

nb: This is my first ruby script and first usage of dfhack, so apologies in advance for the low quality.

Code: [Select]
# Show syndromes affecting units and the remaining and maximum duration. Call with help on the command line for further options.

print_syndromes = lambda { |unit, showrace, showall| 

if !unit.syndromes.active.empty? or showall
if showrace
puts "#{df.world.raws.creatures.all[unit.race].name[0]}#{unit.name == '' ? "" : ": "}#{unit.name}"
else
puts "#{unit.name}"
end
end

unit.syndromes.active.each { |s|
syndrome = df.world.raws.syndromes.all[s.type]
duration = syndrome.ce.minmax_by{ |ce| ce.end }

if duration[0].end == -1
durationStr = "Permanent"
else
if duration[0].end == duration[1].end
durationStr = "#{s.ticks} of #{duration[0].end}"
else
durationStr = "#{s.ticks} of #{duration[0].end}-#{duration[1].end}"
end
end

puts " - #{syndrome.syn_name} [#{durationStr}]"
}
}

showall = false
dwarves = false
livestock = false
wildanimals = false
hostile = false

if $script_args.any?{ |arg| arg == "help" or arg == "?" or arg == "-?" }
puts "Use one or more of the following options:"
puts "    showall: Show units even if not affected by any syndrome"
puts "    dwarves: Show dwarves"
puts "    livestock: Show livestock"
puts "    wildanimals: Show wild animals"
puts "    hostile: Show hostiles (e.g. invaders, thieves, forgeten beasts etc)"
puts ""
puts "Will show all syndromes affecting each units with the maximum and present duration."
elsif $script_args.empty?
dwarves = true
else
if $script_args.any?{ |arg| arg == "showall" } then showall=true end
if $script_args.any?{ |arg| arg == "dwarves" } then dwarves=true end
if $script_args.any?{ |arg| arg == "livestock" } then livestock=true end
if $script_args.any?{ |arg| arg == "wildanimals" } then wildanimals=true end
if $script_args.any?{ |arg| arg == "hostile" } then hostile=true end
end

if dwarves
puts "Dwarves"
df.unit_citizens.each { |unit|
print_syndromes[unit, false, showall]
}
puts "\n"
end

if livestock
puts "LiveStock"
df.world.units.active.find_all { |u| df.unit_category(u) == :Livestock }.each { |unit|
print_syndromes[unit, true, showall]
}
puts "\n"
end

if wildanimals
df.world.units.active.find_all { |u| df.unit_category(u) == :Other and  df.unit_other_category(u) == :Wild }.each { |unit|
print_syndromes[unit, true, showall]
}
puts "\n"
end

if hostile
puts "Hostile"
df.unit_hostiles.each { |unit|
print_syndromes[unit, true, showall]
}
puts "\n"
end

#puts "All Syndromes"
#df.world.raws.syndromes.all.each { |syndrome|
# puts "#{syndrome.syn_name}"
#}
usage: save into the dfhack folder as "scripts\showunitsyndromes.rb". Can then enter showunitsyndromes on the dfhack console to run it.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 23, 2013, 11:33:01 am
Thats neat. :)

It would be awesome if people could see this ingame directly, maybe in the units description somehow. I know I suggested this before at some place, but I still think its a good idea. ;)
Title: Re: DFHack 0.34.11 r3
Post by: drayath on April 23, 2013, 12:42:36 pm
If you ignore my (admittable unresearched) abject horror at writeing code that touchs the df ui, the major issue i see is that the names or all of the vanilla syndomes are not very descriptive (e.g. usally <creaturetype> sickness).

Would need to show the list of actal effects which i doubt there would be room to add to the existing unit screen.

Alternatives would be to add a new effects status screen to show all the details, or use the actual effects of the syndrome to programatically make up a name (e.g. if reduces strength calll it Weakening sickness) may be hard to do syndromes with multiple effects.

I playing arround with printing out effects in a human readable manner at the moment so we will see how it goes.

On that note does anyone know precisly how PEAK modifies things, e.g. if  +1000 strength, start 0, end 1000, peak 250. How much actual strength is added at 0, 250, 500, 1000 duration?
Can't check the unit stats to determine this as it look as though the unit aways stores just the base stats, and adds in syndrome effects every time a stat test is made (why stat bonuses show in the unit screen description, but the numberse dont change in dwarf therepist)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 23, 2013, 01:57:11 pm
ACtual effects dont matter, names are enough.. to quote myself from another thread:
Quote
the name does not have to be "poison", modders could simply rename it to "Desert Scorpion Sting; Very poisonous, affects lungs and heart, can cause paralysis. Resistable, Size dilutes."

Same trick I use for the rune coatings. I just called the materials "blablabla bonus given by the intricate runes coating", done.

Even all vanilla syndromes (at least those in creatures) can be given a more descriptive name, if so desired.

So yeah, I posted that as a Dwarf Therapist Suggestion, and its possible there as well. :)
Title: Re: DFHack 0.34.11 r3
Post by: drayath on April 23, 2013, 06:43:10 pm
Well its not ui intergration, but now
 - Shows all active effects assoiciated with a syndrome (incuding basic detailes of added interactions)
 - allows export to file
 - allows viewing all syndromes and their effects in your world (you see the odd amuzing FB syndrome). Note information about how these apply, application chance etc is not included.


Code: [Select]
# Show syndromes affecting units and the remaining and maximum duration (v2). Call with help on the command line for further options.

#TODO: When showing effects on a unit, show the actual change to the unit
#       E.g. if +150%, +500 strength show actual total bonus baed on the unit stats.
#TODO: for this also need to know
# how does size_delays affect the start/peak/end time
# how does size_diluts affect the Severity, does it also affect the phy/mental stat adjustments?
# how does peak affect the Severity, does it also affect the phy/mental stat adjustments?
#TODO: Add interaction infor needs to dispal a bit more data, but the required structures are not yet decoded

#TODO: Several of the unk_xxx fields have been identifed here, and can get some more by comparing the raws with the printed interaction and effect information


def print_help()
puts "Use one or more of the following options:"
puts "    showall: Show units even if not affected by any syndrome"
puts "    showeffects: shows detailed effects of each syndrome"
puts "    dwarves: Show dwarves"
puts "    livestock: Show livestock"
puts "    wildanimals: Show wild animals"
puts "    hostile: Show hostiles (e.g. invaders, thieves, forgeten beasts etc)"
puts "    world: Show all defined syndromes in the world"
puts "    export:<filename> Write the output to a file instead of the console."
puts ""
puts "Will show all syndromes affecting each units with the maximum and present duration."
end

class MyLogger
attr_accessor :fileLogger
 
def initialize(filename)
if filename==nil
@fileLogger = nil
else
@fileLogger = File.new(filename, "w")
end
end  

def close()
if @fileLogger != nil
@fileLogger.flush
@fileLogger.close
@fileLogger = nil
end
end

def log(text)
if @fileLogger == nil
puts(text)
else
@fileLogger.puts(text)
end
end
end

def get_mental_att(att_index)

# TODO: Surly i can use the names from MentalAttributeType somehow!!!!!
# case att_index
        # when "ANALYTICAL_ABILITY"
# return "Analytical Ability"
        # when "FOCUS"
# return "Focus"
# when "WILLPOWER"
# return "Willpower"
# when "CREATIVITY"
# return "Creativity"
# when "INTUITION"
# return "Intuition"
# when "PATIENCE"
# return "Patience"
# when "MEMORY"
# return "Memory"
# when "LINGUISTIC_ABILITY"
# return "Linguistics"
# when "SPATIAL_SENSE"
# return "Spacial Sense"
# when "MUSICALITY"
# return "Musicality"
# when "KINESTHETIC_SENSE"
# return "Kinestetic Sense"
# when "EMPATHY"
# return "Empathy"
# when "SOCIAL_AWARENESS"
# return "Social Awareness"
# end

case att_index
        when 0
return "Analytical Ability"
        when 1
return "Focus"
when 2
return "Willpower"
when 3
return "Creativity"
when 4
return "Intuition"
when 5
return "Patience"
when 6
return "Memory"
when 7
return "Linguistics"
when 8
return "Spacial Sense"
when 9
return "Musicality"
when 10
return "Kinestetic Sense"
when 11
return "Empathy"
when 12
return "Social Awareness"
else
return "Unknown"
end
end

def get_physical_att(att_index)

# TODO: Surly i can use the names from PhysicalAttributeType somehow!!!!!
# case att
        # when "STRENGTH"
# return "Strength"
# when "AGILITY"
# return "Agility"
# when "TOUGHNESS"
# return "Toughness"
# when "ENDURANCE"
# return "Endurance"
# when "RECUPERATION"
# return "Recuperation"
# when "DISEASE_RESISTANCE"
# return "Disease Resistance"
# end

case att_index
        when 0
return "Strength"
when 1
return "Agility"
when 2
return "Toughness"
when 3
return "Endurance"
when 4
return "Recuperation"
when 5
return "Disease Resistance"
else
return "Unknown"
end
end

def get_effect_target(target)

values = []

limit = target.key.length - 1
for i in (0..limit)

if(target.mode[i].to_s() != "")

case target.mode[i].to_s()
when "BY_TYPE"
item = "Type("
when "BY_TOKEN"
item = "Token("
when "BY_CATEGORY"
item = "Category("
end

if(target.key[i].to_s()!="")
item = item + target.key[i].to_s()
end

if(target.key[i].to_s()!="" and target.tissue[i].to_s()!="")
item = item + ":"
end

if(target.tissue[i].to_s()!="")
item = item + target.tissue[i].to_s()
end

item = item + ")"

values.push(item)
end

end

if values.length == 0
return ""
else
return " Target=" + values.join(", ")
end
end

def get_att_pairs(values, percents, physical)

items = []

limit = values.length - 1
for i in (0..limit)
if (values[i]!=0 or percents[i]!=100)

if physical
item = "#{get_physical_att(i)}("
else
item = "#{get_mental_att(i)}("
end

if(values[i]!=0)
item = item + "%+d" % values[i]
end

if (values[i]!=0 and percents[i]!=100)
item = item + ", "
end

if (percents[i]!=100)
item = item + "%+d" % percents[i] + "%"
end

item = item + ")"

items.push(item)
end
end

return items.join(", ") 
end

def get_interaction(interaction)

# name, USAGE_HINT, range, wait period are probally all we really want to show.

#result = "a=#{interaction.unk_6c} b=#{interaction.unk_7c} c=#{interaction.unk_8c} d=#{interaction.unk_a8} e=#{interaction.unk_c4} f=#{interaction.unk_e4} "
#result = result + "g=#{interaction.unk_e0} h=#{interaction.unk_e4} i=#{interaction.unk_100} j=#{interaction.unk_11c} k=#{interaction.unk_138} l=#{interaction.unk_154} "
#result = result + "m=#{interaction.unk_170} n=#{interaction.unk_18c} o=#{interaction.unk_1a8} p=#{interaction.unk_1c4} q=#{interaction.unk_1e8} r=#{interaction.unk_25c} "
#result = result + "s=#{interaction.unk_278}"

return "Ability=#{interaction.unk_25c}, Delay=#{interaction.unk_278}"
end

def get_effect_flags(flags)

values = []

if(flags.SIZE_DELAYS) then values.push("Size Delays") end
if(flags.SIZE_DILUTES) then values.push("Size Dilutes") end
if(flags.VASCULAR_ONLY) then values.push("Vascular Only") end
if(flags.MUSCULAR_ONLY) then values.push("Musles Only") end
if(flags.RESISTABLE) then values.push("Resistable") end
if(flags.LOCALIZED) then values.push("Localized") end

return values.join(",")
end

def get_tag1_flags(flags)
   
values = []

        if(flags.EXTRAVISION) then values.push("Extravision") end
        if(flags.OPPOSED_TO_LIFE) then values.push("Attack the living") end
        if(flags.NOT_LIVING) then values.push("Undead") end
        if(flags.NOEXERT) then values.push("Does not tire") end
        if(flags.NOPAIN) then values.push("Does not feel pain") end
        if(flags.NOBREATHE) then values.push("Does not breathe") end
        if(flags.HAS_BLOOD) then values.push("Has blood") end
        if(flags.NOSTUN) then values.push("Can't be stunned") end
        if(flags.NONAUSEA) then values.push("Does not get nausea") end
        if(flags.NO_DIZZINESS) then values.push("Does not get dizzy") end
        if(flags.NO_FEVERS) then values.push("Does not get fever") end
        if(flags.TRANCES) then values.push("Can enter trance") end
        if(flags.NOEMOTION) then values.push("Feels no emotion") end
        if(flags.LIKES_FIGHTING) then values.push("Like fighting") end
        if(flags.PARALYZEIMMUNE) then values.push("Can't be paralazed") end
        if(flags.NOFEAR) then values.push("Does not feel fear") end
        if(flags.NO_EAT) then values.push("Does not eat") end
        if(flags.NO_DRINK) then values.push("Does not drink") end
        if(flags.NO_SLEEP) then values.push("Does not sleep") end
        if(flags.MISCHIEVOUS) then values.push("Mischievous") end
        if(flags.NO_PHYS_ATT_GAIN) then values.push("Physical stats cant improve") end
        if(flags.NO_PHYS_ATT_RUST) then values.push("Physical stats do not rust") end
        if(flags.NOTHOUGHT) then values.push("Stupid") end
        if(flags.NO_THOUGHT_CENTER_FOR_MOVEMENT) then values.push("No brain needed to move") end
        if(flags.CAN_SPEAK) then values.push("Can speak") end
        if(flags.CAN_LEARN) then values.push("Can learn") end
        if(flags.UTTERANCES) then values.push("Utterances") end
        if(flags.CRAZED) then values.push("Crazed") end
        if(flags.BLOODSUCKER) then values.push("Drinks Blood") end
        if(flags.NO_CONNECTIONS_FOR_MOVEMENT) then values.push("Can move without nerves") end
        if(flags.SUPERNATURAL) then values.push("Supernatural") end
return values.join(",")
end

def get_tag2_flags(flags)
values = []
        if(flags.NO_AGING) then values.push("Does not age") end
        if(flags.MORTAL) then values.push("Mortal") end
        if(flags.STERILE) then values.push("Can't have children") end
        if(flags.FIT_FOR_ANIMATION) then values.push("Can be animated") end
        if(flags.FIT_FOR_RESURRECTION) then values.push("Can be resurected") end
return values.join(",")
end

print_effect = lambda { |logger, ce, duration|

flags = get_effect_flags(ce.flags)
if flags != ""
flags = " (#{flags})"
end

if ce.end == -1
duration = " [Permanent]"
elsif ce.start >= ce.peak or ce.peak <= 1
duration = " [#{ce.start}-#{ce.end}]"
else
duration = " [#{ce.start}-#{ce.peak}-#{ce.end}]"
end

case ce.getType().to_s()
when "PAIN"
name = "Pain"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "SWELLING"
name = "Swelling"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "OOZING"
name = "Oozing"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "BRUISING"
name = "Bruising"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "BLISTERS"
name = "Blisters"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "NUMBNESS"
name = "Numbness"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "PARALYSIS"
name = "Paralysis"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "FEVER"
name = "Fever"
desc = "Power=#{ce.sev}"
when "BLEEDING"
name = "Bleeding"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "COUGH_BLOOD"
name = "Cough Blood"
desc = "Power=#{ce.sev}"
when "VOMIT_BLOOD"
name = "Vomit Blood"
desc = "Power=#{ce.sev}"
when "NAUSEA"
name = "Nausea"
desc = "Power=#{ce.sev}"
when "UNCONSCIOUSNESS"
name = "Unconsciousness"
desc = "Power=#{ce.sev}"
when "NECROSIS"
name = "Necrosis"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "IMPAIR_FUNCTION"
name = "Impairs"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
when "DROWSINESS"
name = "Drowsiness"
desc = "Power=#{ce.sev}"
when "DIZZINESS"
name = "Dizziness"
desc = "Power=#{ce.sev}"
when "ADD_TAG"
name = "Add"
desc = "#{get_tag1_flags(ce.tags1)},#{get_tag2_flags(ce.tags2)}"
when "REMOVE_TAG"
name = "Remove"
desc = "#{get_tag1_flags(ce.tags1)},#{get_tag2_flags(ce.tags2)}"
when "DISPLAY_TILE"
name = "Tile"
desc = "Tile=#{ce.unk_6c}, Colour=#{ce.unk_70}"
when "FLASH_TILE"
name = "Flash"
color = ce.sym_color >> 8
tile = ce.sym_color - (color * 256)
desc = "Tile = #{tile} Colour=#{color} Time=#{ce.period} Period=#{ce.time}"
when "SPEED_CHANGE"
name = "Physical"
desc = "Speed("

if(ce.unk_6c!=0)
desc = desc + "%+d" % ce.unk_6c
end

if (ce.unk_6c!=0 and ce.unk_70!=100)
desc = desc + ", "
end

if (ce.unk_70!=100)
desc = desc + "%+d" % ce.unk_70 + "%"
end

desc = desc + ")"
when "CAN_DO_INTERACTION"
name = "Add Interaction"
desc = "#{get_interaction(ce)}"
when "SKILL_ROLL_ADJUST"
name = "Skill Check"
desc = "Percent=#{ce.unk_6c}, Chance=#{ce.unk_70}%"
when "BODY_TRANSFORMATION"
name = "Transformation"
if ce.caste_str != "DEFAULT"
caste = ", Caste=#{ce.caste_str}"
else
caste = ""
end
desc = "Chance=#{ce.unk_6c} Race=#{ce.race_str}#{caste}"
when "PHYS_ATT_CHANGE"
name = "Physical"
desc = "#{get_att_pairs(ce.phys_att_unk, ce.phys_att_perc, true)}"
when "MENT_ATT_CHANGE"
name = "Mental"
desc = "#{get_att_pairs(ce.ment_att_unk, ce.ment_att_perc, false)}"
when "MATERIAL_FORCE_MULTIPLIER"
# Material reference + top/bottom number of a fraction
name = "Material Force Multiplier"
desc = "a=#{ce.unk_6c}, b=#{ce.unk_88}, c=#{ce.unk_a4}, d=#{ce.unk_c0}, e=#{ce.unk_c4}, f=#{ce.unk_c8}, g=#{ce.unk_cc}"
when "BODY_MAT_INTERACTION"
# interactionId, SundromeTriggerType
name = "Body Material Interaction"
desc = "a=#{ce.unk_6c}, b=#{ce.unk_88}, c=#{ce.unk_8c}, d=#{ce.unk_90}, e=#{ce.unk_94}"
when "BODY_APPEARANCE_MODIFIER"
# !!! seems to be missing info class !!!
# should be enum and value
name = "Body Appearence"
desc = "<TODO>"
when "BP_APPEARANCE_MODIFIER"
name = "Body Part Appearence"
desc = "Value=#{ce.value} change_type_enum?=#{ce.unk_6c}#{get_effect_target(ce.target)}"
when "DISPLAY_NAME"
name = "Set Display Name"
desc = "#{ce.name}"
else
name = "Unknown effect type"
end

logger.log " - + #{name}#{duration}#{flags} #{desc}"
}

print_syndromes = lambda { |logger, unit, showrace, showall, showeffects| 

if !unit.syndromes.active.empty? or showall
if showrace
logger.log "#{df.world.raws.creatures.all[unit.race].name[0]}#{unit.name == '' ? "" : ": "}#{unit.name}"
else
logger.log "#{unit.name}"
end
end

unit.syndromes.active.each { |s|
syndrome = df.world.raws.syndromes.all[s.type]
duration = syndrome.ce.minmax_by{ |ce| ce.end }

if duration[0].end == -1
durationStr = "Permanent"
else
if duration[0].end == duration[1].end
durationStr = "#{s.ticks} of #{duration[0].end}"
else
durationStr = "#{s.ticks} of #{duration[0].end}-#{duration[1].end}"
end
end

logger.log " - #{syndrome.syn_name} [#{durationStr}]"

if showeffects
syndrome.ce.each { |effect| print_effect[logger, effect, s.ticks] }
end
}
}

def starts_with?(str, prefix)
  prefix = prefix.to_s
  str[0, prefix.length] == prefix
end

showall = false
showeffects = false
dwarves = false
livestock = false
wildanimals = false
hostile = false
world = false

if $script_args.any?{ |arg| arg == "help" or arg == "?" or arg == "-?" }
print_help()
elsif $script_args.empty?
dwarves = true
showeffects = true
else
if $script_args.any?{ |arg| arg == "showall" } then showall=true end
if $script_args.any?{ |arg| arg == "showeffects" } then showeffects=true end
if $script_args.any?{ |arg| arg == "dwarves" } then dwarves=true end
if $script_args.any?{ |arg| arg == "livestock" } then livestock=true end
if $script_args.any?{ |arg| arg == "wildanimals" } then wildanimals=true end
if $script_args.any?{ |arg| arg == "hostile" } then hostile=true end
if $script_args.any?{ |arg| arg == "world" } then world=true end
if $script_args.any?{ |arg| starts_with?(arg, "export:") } 
exportfile = $script_args.find{ |arg| starts_with?(arg, "export:") }.gsub("export:", "")
export=true
end
end

if export
logger = MyLogger.new(exportfile)
else
logger = MyLogger.new(nil)
end

if dwarves
logger.log "Dwarves"
df.unit_citizens.each { |unit|
print_syndromes[logger, unit, false, showall, showeffects]
}
logger.log"\n"
end

if livestock
logger.log "LiveStock"
df.world.units.active.find_all { |u| df.unit_category(u) == :Livestock }.each { |unit|
print_syndromes[logger, unit, true, showall, showeffects]
}
logger.log"\n"
end

if wildanimals
logger.log "Wild Animals"
df.world.units.active.find_all { |u| df.unit_category(u) == :Other and  df.unit_other_category(u) == :Wild }.each { |unit|
print_syndromes[logger, unit, true, showall, showeffects]
}
logger.log"\n"
end

if hostile
logger.log "Hostile Units"
df.unit_hostiles.each { |unit|
print_syndromes[logger, unit, true, showall, showeffects]
}
logger.log"\n"
end

if world
logger.log "All Syndromes"
df.world.raws.syndromes.all.each { |syndrome|
logger.log " - #{syndrome.syn_name == "" ? "mystery" : syndrome.syn_name}"
if showeffects
syndrome.ce.each { |effect| print_effect[logger, effect, 0] }
end
}
end

logger.close
Title: Re: DFHack 0.34.11 r3
Post by: Eldrick Tobin on April 23, 2013, 11:03:51 pm
Alternatives would be to add a new effects status screen to show all the details, or use the actual effects of the syndrome to programatically make up a name (e.g. if reduces strength calll it Weakening sickness) may be hard to do syndromes with multiple effects.

"This is a masterwork syndrome. It nauseates, makes you crazy, and husks."

Or alternatively go blizzard style "Vomitous Insanity Syndrome of Husking" but that would be messier. And silly.  :D
Title: Re: DFHack 0.34.11 r3
Post by: drayath on April 24, 2013, 04:06:20 pm
Had a look at showing the data in the a window in df, but it looks like this requires LUA and i have no intension of converting the script. If you bind the script to a hotkey as "showunitsyndrome dwarves showall showeffects export:<file>", can hit the hotkey and refresh your browser to see a formatted list of the present status of all your dwarves which is good enough for me at the moment.

New: Can show details on a selected unit (showunitsyndrome selected showeffects). Work with friendly and enemy units.
New: Export now generates formatted html file, including color coding for good/bad syndromes and effects.

Know Issue: It may well indicate which dwarves that have hidden curses (e.g. vampires), need to actually get a vampire in my fort to correct this.
Know Issue: error Bad File Descriptor, cause: file trying to export to is locked by you web browser. Usally just wait a second and run the script again.
Know Issue: Following effects are not fully decoded: Material Force Multiplier, Body Material Interaction, Body Appearence, Body Part Appearence

Code: [Select]
# Show syndromes affecting units and the remaining and maximum duration (v3). Call with help on the command line for further options.

def print_help()
puts "Use one or more of the following options:"
puts "    showall: Show units even if not affected by any syndrome"
puts "    showeffects: shows detailed effects of each syndrome"
puts "    showdisplayeffects: show effects that only change the look of the unit"
puts "    ignorehiddencurse: Hides syndomes the user should not be able to know about (TODO)"
puts "    selected: Show selected unit"
puts "    dwarves: Show dwarves"
puts "    livestock: Show livestock"
puts "    wildanimals: Show wild animals"
puts "    hostile: Show hostiles (e.g. invaders, thieves, forgeten beasts etc)"
puts "    world: Show all defined syndromes in the world"
puts "    export:<filename> Write the output to a file instead of the console."
puts ""
puts "Will show all syndromes affecting each units with the maximum and present duration."
end

class Output
attr_accessor :fileLogger, :indent_level
 
def initialize(filename)
indent_level = ""
if filename==nil
@fileLogger = nil
else
@fileLogger = File.new(filename + ".html", "w")
@fileLogger.puts("<html><body>")
end
end  

RED = "red"
GREEN = "green"
DEFAULT = "black"
HIGHLIGHT = "black\" size=\"+1"

def colorize(text, color_code)
  "<font color=\"#{color_code}\">#{text}</font>"
end

def indent()
if @fileLogger == nil
@indent_level = "#{@indent_level} - "
else
@fileLogger.puts("<ul>")
end
end

def unindent()
if @fileLogger == nil
@indent_level = @indent_level.chomp(" - ")
else
@fileLogger.puts("</ul>")
end
end

def break()
if @fileLogger == nil
puts("\n")
else
@fileLogger.puts("</br>")
end
end

def close()
if @fileLogger != nil
@fileLogger.puts("</body></html>")
@fileLogger.flush
@fileLogger.close
@fileLogger = nil
end
end

def log(text, color=nil)
if @fileLogger == nil
puts("#{@indent_level}#{text}")
elsif color==nil
@fileLogger.puts(text+"<br/>")
elsif @indent_level == ""
@fileLogger.puts(colorize(text, color))
else
@fileLogger.puts("<li>" + colorize(text, color)+"</li>")
end
end
end

def colorize(text, color_code)
  "<font color=\"#{color_code}\">#{text}</font>"
end

def get_mental_att(att_index)

# TODO: Surly i can use the names from MentalAttributeType somehow!!!!!
# case att_index
        # when "ANALYTICAL_ABILITY"
# return "Analytical Ability"
        # when "FOCUS"
# return "Focus"
# when "WILLPOWER"
# return "Willpower"
# when "CREATIVITY"
# return "Creativity"
# when "INTUITION"
# return "Intuition"
# when "PATIENCE"
# return "Patience"
# when "MEMORY"
# return "Memory"
# when "LINGUISTIC_ABILITY"
# return "Linguistics"
# when "SPATIAL_SENSE"
# return "Spacial Sense"
# when "MUSICALITY"
# return "Musicality"
# when "KINESTHETIC_SENSE"
# return "Kinestetic Sense"
# when "EMPATHY"
# return "Empathy"
# when "SOCIAL_AWARENESS"
# return "Social Awareness"
# end

case att_index
        when 0
return "Analytical Ability"
        when 1
return "Focus"
when 2
return "Willpower"
when 3
return "Creativity"
when 4
return "Intuition"
when 5
return "Patience"
when 6
return "Memory"
when 7
return "Linguistics"
when 8
return "Spacial Sense"
when 9
return "Musicality"
when 10
return "Kinestetic Sense"
when 11
return "Empathy"
when 12
return "Social Awareness"
else
return "Unknown"
end
end

def get_physical_att(att_index)

# TODO: Surly i can use the names from PhysicalAttributeType somehow!!!!!
# case att
        # when "STRENGTH"
# return "Strength"
# when "AGILITY"
# return "Agility"
# when "TOUGHNESS"
# return "Toughness"
# when "ENDURANCE"
# return "Endurance"
# when "RECUPERATION"
# return "Recuperation"
# when "DISEASE_RESISTANCE"
# return "Disease Resistance"
# end

case att_index
        when 0
return "Strength"
when 1
return "Agility"
when 2
return "Toughness"
when 3
return "Endurance"
when 4
return "Recuperation"
when 5
return "Disease Resistance"
else
return "Unknown"
end
end

def get_effect_target(target)

values = []

limit = target.key.length - 1
for i in (0..limit)

if(target.mode[i].to_s() != "")

case target.mode[i].to_s()
when "BY_TYPE"
item = "Type("
when "BY_TOKEN"
item = "Token("
when "BY_CATEGORY"
item = "Category("
end

if(target.key[i].to_s()!="")
item = item + target.key[i].to_s()
end

if(target.key[i].to_s()!="" and target.tissue[i].to_s()!="")
item = item + ":"
end

if(target.tissue[i].to_s()!="")
item = item + target.tissue[i].to_s()
end

item = item + ")"

values.push(item)
end

end

if values.length == 0
return ""
else
return " Target=" + values.join(", ")
end
end

def get_att_pairs(values, percents, physical)

items = []

color = Output::DEFAULT

limit = values.length - 1
for i in (0..limit)
if (values[i]!=0 or percents[i]!=100)

if physical
item = "#{get_physical_att(i)}("
else
item = "#{get_mental_att(i)}("
end

if(values[i]!=0)
item = item + "%+d" % values[i]
end

if (values[i]!=0 and percents[i]!=100)
item = item + ", "
end

if (percents[i]!=100)
item = item + "%d" % percents[i] + "%"
end

item = item + ")"

if values[i] >0 && percents[i] >100
color = Output::GREEN
elsif values[i] <0 || percents[i] <100
color = Output::RED
end

items.push(item)
end
end

return items.join(", "), color
end

def get_interaction(interaction)

# name, USAGE_HINT, range, wait period are probally all we really want to show.

#result = "a=#{interaction.unk_6c} b=#{interaction.unk_7c} c=#{interaction.unk_8c} d=#{interaction.unk_a8} e=#{interaction.unk_c4} f=#{interaction.unk_e4} "
#result = result + "g=#{interaction.unk_e0} h=#{interaction.unk_e4} i=#{interaction.unk_100} j=#{interaction.unk_11c} k=#{interaction.unk_138} l=#{interaction.unk_154} "
#result = result + "m=#{interaction.unk_170} n=#{interaction.unk_18c} o=#{interaction.unk_1a8} p=#{interaction.unk_1c4} q=#{interaction.unk_1e8} r=#{interaction.unk_25c} "
#result = result + "s=#{interaction.unk_278}"

return "Ability=#{interaction.unk_25c}, Delay=#{interaction.unk_278}"
end

def get_effect_flags(flags)

values = []

if(flags.SIZE_DELAYS) then values.push("Size Delays") end
if(flags.SIZE_DILUTES) then values.push("Size Dilutes") end
if(flags.VASCULAR_ONLY) then values.push("Vascular Only") end
if(flags.MUSCULAR_ONLY) then values.push("Musles Only") end
if(flags.RESISTABLE) then values.push("Resistable") end
if(flags.LOCALIZED) then values.push("Localized") end

return values.join(",")
end

def get_tag1_flags(flags, add)
   
values = []

good = false
bad = false

if add
good_color = Output::GREEN
bad_color = Output::RED
else
good_color = Output::RED
bad_color = Output::GREEN
end

if(flags.EXTRAVISION)
values.push(colorize("Extravision", good_color))
good = true
end

if(flags.OPPOSED_TO_LIFE)
values.push(colorize("Attack the living", bad_color))
bad = true
end

if(flags.NOT_LIVING)
values.push(colorize("Undead", Output::DEFAULT))
end 

if(flags.NOEXERT)
values.push(colorize("Does not tire", good_color))
good = true
end

if(flags.NOPAIN)
values.push(colorize("Does not feel pain", good_color))
good = true
end

if(flags.NOBREATHE)
values.push(colorize("Does not breathe", good_color))
good = true
end

if(flags.HAS_BLOOD)
values.push(colorize("Has blood", Output::DEFAULT))
end

if(flags.NOSTUN)
values.push(colorize("Can't be stunned", good_color))
good = true 
end

if(flags.NONAUSEA)
values.push(colorize("Does not get nausea", good_color))
good = true
end

if(flags.NO_DIZZINESS)
values.push(colorize("Does not get dizzy", good_color))
good = true
end

if(flags.NO_FEVERS)
values.push(colorize("Does not get fever", good_color))
good = true
end

if(flags.TRANCES)
values.push(colorize("Can enter trance", good_color))
good = true
end

if(flags.NOEMOTION)
values.push(colorize("Feels no emotion", good_color))
good = true
end

if(flags.LIKES_FIGHTING)
values.push(colorize("Like fighting", Output::DEFAULT))
end

if(flags.PARALYZEIMMUNE)
values.push(colorize("Can't be paralazed", good_color))
good = true
end
if(flags.NOFEAR)
values.push(colorize("Does not feel fear", good_color))
good = true
end

if(flags.NO_EAT)
values.push(colorize("Does not eat", good_color))
good = true
end

if(flags.NO_DRINK)
values.push(colorize("Does not drink", good_color))
good = true 
end

if(flags.NO_SLEEP)
values.push(colorize("Does not sleep", good_color))
good = true
end
if(flags.MISCHIEVOUS)
values.push(colorize("Mischievous", Output::DEFAULT))
end

if(flags.NO_PHYS_ATT_GAIN)
values.push(colorize("Physical stats cant improve", good_color))
good = true
end

if(flags.NO_PHYS_ATT_RUST)
values.push(colorize("Physical stats do not rust", good_color))
good = true
end

if(flags.NOTHOUGHT)
values.push(colorize("Stupid", bad_color))
bad = true
end

if(flags.NO_THOUGHT_CENTER_FOR_MOVEMENT)
values.push(colorize("No brain needed to move", good_color))
good = true
end

if(flags.CAN_SPEAK)
values.push(colorize("Can speak", good_color))
good = true
end

if(flags.CAN_LEARN)
values.push(colorize("Can learn", good_color))
good = true
end

if(flags.UTTERANCES)
values.push(colorize("Utterances", Output::DEFAULT))
end

if(flags.CRAZED)
values.push(colorize("Crazed", bad_color))
bad = true
end

if(flags.BLOODSUCKER)
values.push(colorize("Drinks Blood", bad_color))
bad = true
end

if(flags.NO_CONNECTIONS_FOR_MOVEMENT)
values.push(colorize("Can move without nerves", good_color))
good = true
end

if(flags.SUPERNATURAL)
values.push(colorize("Supernatural", good_color))
good = true
end

if add
if bad
color = Output::RED
elsif good
color = Output::GREEN
else
color = Output::DEFAULT
end
else
if good
color = Output::RED
elsif bad
color = Output::GREEN
else
color = Output::DEFAULT
end
end

return values.join(","), color
end

def get_tag2_flags(flags, add)
values = []

good = false
bad = false

if add
good_color = Output::GREEN
bad_color = Output::RED
else
good_color = Output::RED
bad_color = Output::GREEN
end

if(flags.NO_AGING)
good = true
values.push(colorize("Does not age", good_color)) 
end

if(flags.MORTAL)
bad = true
values.push(colorize("Mortal", bad_color))
end

if(flags.STERILE)
values.push(colorize("Can't have children", Output::DEFAULT)) 
end

if(flags.FIT_FOR_ANIMATION)
values.push(colorize("Can be animated", Output::DEFAULT))
end

if(flags.FIT_FOR_RESURRECTION)
good = true
values.push(colorize("Can be resurected", Output::DEFAULT))
end

if add
if bad
color = Output::RED
elsif good
color = Output::GREEN
else
color = Output::DEFAULT
end
else
if good
color = Output::RED
elsif bad
color = Output::GREEN
else
color = Output::DEFAULT
end
end

return values.join(","), color
end

def get_effect(ce, duration, showdisplayeffects)

flags = get_effect_flags(ce.flags)
if flags != ""
flags = " (#{flags})"
end

if ce.end == -1
duration = " [Permanent]"
elsif ce.start >= ce.peak or ce.peak <= 1
duration = " [#{ce.start}-#{ce.end}]"
else
duration = " [#{ce.start}-#{ce.peak}-#{ce.end}]"
end

case ce.getType().to_s()
when "PAIN"
name = "Pain"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::RED
when "SWELLING"
name = "Swelling"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::RED
when "OOZING"
name = "Oozing"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::RED
when "BRUISING"
name = "Bruising"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::RED
when "BLISTERS"
name = "Blisters"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::RED
when "NUMBNESS"
name = "Numbness"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::GREEN
when "PARALYSIS"
name = "Paralysis"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::RED
when "FEVER"
name = "Fever"
desc = "Power=#{ce.sev}"
color = Output::RED
when "BLEEDING"
name = "Bleeding"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::RED
when "COUGH_BLOOD"
name = "Cough Blood"
desc = "Power=#{ce.sev}"
color = Output::RED
when "VOMIT_BLOOD"
name = "Vomit Blood"
desc = "Power=#{ce.sev}"
color = Output::RED
when "NAUSEA"
name = "Nausea"
desc = "Power=#{ce.sev}"
color = Output::RED
when "UNCONSCIOUSNESS"
name = "Unconsciousness"
desc = "Power=#{ce.sev}"
color = Output::RED
when "NECROSIS"
name = "Necrosis"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::RED
when "IMPAIR_FUNCTION"
name = "Impairs"
desc = "Power=#{ce.sev}#{get_effect_target(ce.target)}"
color = Output::RED
when "DROWSINESS"
name = "Drowsiness"
desc = "Power=#{ce.sev}"
color = Output::RED
when "DIZZINESS"
name = "Dizziness"
desc = "Power=#{ce.sev}"
color = Output::RED
when "ADD_TAG"
name = "Add"
tags1 = get_tag1_flags(ce.tags1, true)
tags2 = get_tag2_flags(ce.tags2, true)
desc = "#{tags1[0]},#{tags2[0]}"

if tags1[1] == Output::RED || tags2[1] == Output::RED
color = Output::RED
elsif tags1[1] == Output::GREEN || tags2[1] == Output::GREEN
color = Output::GREEN
else
color = Output::DEFAULT
end
when "REMOVE_TAG"
name = "Remove"
tags1 = get_tag1_flags(ce.tags1, true)
tags2 = get_tag2_flags(ce.tags2, true)
desc = "#{tags1[0]},#{tags2[0]}"

if tags1[1] == Output::RED || tags2[1] == Output::RED
color = Output::RED
elsif tags1[1] == Output::GREEN || tags2[1] == Output::GREEN
color = Output::GREEN
else
color = Output::DEFAULT
end
when "DISPLAY_TILE"
if !showdisplayeffects then return "", Output::DEFAULT end
name = "Tile"
desc = "Tile=#{ce.unk_6c}, Colour=#{ce.unk_70}"
color = Output::DEFAULT
when "FLASH_TILE"
if !showdisplayeffects then return "", Output::DEFAULT end
name = "Flash"
color = ce.sym_color >> 8
tile = ce.sym_color - (color * 256)
desc = "Tile = #{tile} Colour=#{color} Time=#{ce.period} Period=#{ce.time}"
color = Output::DEFAULT
when "SPEED_CHANGE"
name = "Physical"
desc = "Speed("

if(ce.unk_6c!=0)
desc = desc + "%+d" % ce.unk_6c
end

if (ce.unk_6c!=0 and ce.unk_70!=100)
desc = desc + ", "
end

if (ce.unk_70!=100)
desc = desc + "%d" % ce.unk_70 + "%"
end

desc = desc + ")"

if ce.unk_6c >=0 && ce.unk_70 >=100
color = Output::GREEN
else
color = Output::RED
end

when "CAN_DO_INTERACTION"
name = "Add Interaction"
desc = "#{get_interaction(ce)}"
color = Output::GREEN
when "SKILL_ROLL_ADJUST"
name = "Skill Check"
desc = "Percent=#{ce.unk_6c}, Chance=#{ce.unk_70}%"

if ce.unk_6c >=100
color = Output::GREEN
else
color = Output::RED
end

when "BODY_TRANSFORMATION"
name = "Transformation"
if ce.caste_str != "DEFAULT"
caste = ", Caste=#{ce.caste_str}"
else
caste = ""
end

if ce.unk_6c > 0
chance = "Chance=#{ce.unk_6c} "
else
chance = ""
end

desc = "#{chance}Race=#{ce.race_str}#{caste}"
color = Output::DEFAULT
when "PHYS_ATT_CHANGE"
name = "Physical"
data = get_att_pairs(ce.phys_att_unk, ce.phys_att_perc, true)
desc = data[0]
color = data[1]
when "MENT_ATT_CHANGE"
name = "Mental"
data = get_att_pairs(ce.ment_att_unk, ce.ment_att_perc, false)
desc = data[0]
color = data[1]
when "MATERIAL_FORCE_MULTIPLIER"
# Material reference + top/bottom number of a fraction
name = "Material Force Multiplier"
desc = "a=#{ce.unk_6c}, b=#{ce.unk_88}, c=#{ce.unk_a4}, d=#{ce.unk_c0}, e=#{ce.unk_c4}, f=#{ce.unk_c8}, g=#{ce.unk_cc}"
color = Output::DEFAULT
when "BODY_MAT_INTERACTION"
# interactionId, SundromeTriggerType
name = "Body Material Interaction"
desc = "a=#{ce.unk_6c}, b=#{ce.unk_88}, c=#{ce.unk_8c}, d=#{ce.unk_90}, e=#{ce.unk_94}"
color = Output::DEFAULT
when "BODY_APPEARANCE_MODIFIER"
if !showdisplayeffects then return "", Output::DEFAULT end
# !!! seems to be missing info class !!!
# should be enum and value
name = "Body Appearence"
desc = "<TODO>"
color = Output::DEFAULT
when "BP_APPEARANCE_MODIFIER"
if !showdisplayeffects then return "", Output::DEFAULT end
name = "Body Part Appearence"
desc = "Value=#{ce.value} change_type_enum?=#{ce.unk_6c}#{get_effect_target(ce.target)}"
color = Output::DEFAULT
when "DISPLAY_NAME"
if !showdisplayeffects then return "", Output::DEFAULT end
name = "Set Display Name"
desc = "#{ce.name}"
color = Output::DEFAULT
else
name = "Unknown effect type"
color = Output::HIGHLIGHT
end

return "#{name}#{duration}#{flags} #{desc}", color
end


print_syndromes = lambda { |logger, unit, showrace, showall, showeffects, showhiddencurse, showdisplayeffects|

if showhiddencurse
syndromes = unit.syndromes.active
else
syndromes = unit.syndromes.active
# TODO: syndromes = unit.syndromes.active.select{ |s| visible_syndrome?(unit, s) }
end

if !syndromes.empty? or showall
if showrace
logger.log "#{df.world.raws.creatures.all[unit.race].name[0]}#{unit.name == '' ? "" : ": "}#{unit.name}", Output::HIGHLIGHT
else
logger.log "#{unit.name}", Output::HIGHLIGHT
end
end

syndromes.each { |syndrome| print_syndrome[logger, syndrome, showeffects, showdisplayeffects] }
}


print_syndrome = lambda { |logger, syndrome, showeffects, showdisplayeffects| 
rawsyndrome = df.world.raws.syndromes.all[syndrome.type]
duration = rawsyndrome.ce.minmax_by{ |ce| ce.end }

if duration[0].end == -1
durationStr = "Permanent"
else
if duration[0].end == duration[1].end
durationStr = "#{syndrome.ticks} of #{duration[0].end}"
else
durationStr = "#{syndrome.ticks} of #{duration[0].end}-#{duration[1].end}"
end
end

effects = rawsyndrome.ce.collect { |effect| get_effect(effect, syndrome.ticks, showdisplayeffects) }

if effects.any?{ |text, color| color==Output::RED }
color = Output::RED
elsif effects.any?{|text, color| color==Output::GREEN }
color = Output::GREEN
else
color = Output::DEFAULT
end

name = rawsyndrome.syn_name == "" ? "mystery" : rawsyndrome.syn_name

logger.indent()
logger.log "#{name} [#{durationStr}]", color

if showeffects
logger.indent()
effects.each{ |text, color| if text!="" then logger.log text, color end }
logger.unindent()
end
logger.unindent()
}

print_raw_syndrome = lambda { |logger, rawsyndrome, showeffects, showdisplayeffects| 

effects = rawsyndrome.ce.collect { |effect| get_effect(effect, 0, showdisplayeffects) }

if effects.any?{ |item| item[1]==Output::RED }
color = Output::RED
elsif effects.any?{|item| item[1]==Output::GREEN }
color = Output::GREEN
else
color = Output::DEFAULT
end

name = rawsyndrome.syn_name == "" ? "mystery" : rawsyndrome.syn_name

logger.indent()
logger.log name, color

if showeffects
logger.indent()
effects.each{ |text, color| if text!="" then logger.log text, color end }
logger.unindent()
end
logger.unindent()
}

def starts_with?(str, prefix)
  prefix = prefix.to_s
  str[0, prefix.length] == prefix
end

showall = false
showeffects = false
selected = false
dwarves = false
livestock = false
wildanimals = false
hostile = false
world = false
showhiddencurse = false
showdisplayeffects = false

if $script_args.any?{ |arg| arg == "help" or arg == "?" or arg == "-?" }
print_help()
elsif $script_args.empty?
dwarves = true
showeffects = true
else
if $script_args.any?{ |arg| arg == "showall" } then showall=true end
if $script_args.any?{ |arg| arg == "showeffects" } then showeffects=true end
if $script_args.any?{ |arg| arg == "ignorehiddencurse" } then showhiddencurse=true end
if $script_args.any?{ |arg| arg == "showdisplayeffects" } then showdisplayeffects=true end
if $script_args.any?{ |arg| arg == "selected" } then selected=true end
if $script_args.any?{ |arg| arg == "dwarves" } then dwarves=true end
if $script_args.any?{ |arg| arg == "livestock" } then livestock=true end
if $script_args.any?{ |arg| arg == "wildanimals" } then wildanimals=true end
if $script_args.any?{ |arg| arg == "hostile" } then hostile=true end
if $script_args.any?{ |arg| arg == "world" } then world=true end
if $script_args.any?{ |arg| starts_with?(arg, "export:") } 
exportfile = $script_args.find{ |arg| starts_with?(arg, "export:") }.gsub("export:", "")
export=true
end
end

if export
logger = Output.new(exportfile)
else
logger = Output.new(nil)
end

if selected
print_syndromes[logger, df.unit_find(), true, showall, showeffects, showhiddencurse, showdisplayeffects]
logger.break()
end

if dwarves
logger.log "Dwarves", Output::HIGHLIGHT
df.unit_citizens.each { |unit|
print_syndromes[logger, unit, false, showall, showeffects, showhiddencurse, showdisplayeffects]
}
logger.break()
end

if livestock
logger.log "LiveStock", Output::HIGHLIGHT
df.world.units.active.find_all { |u| df.unit_category(u) == :Livestock }.each { |unit|
print_syndromes[logger, unit, true, showall, showeffects, showhiddencurse, showdisplayeffects]
}
logger.break()
end

if wildanimals
logger.log "Wild Animals", Output::HIGHLIGHT
df.world.units.active.find_all { |u| df.unit_category(u) == :Other and  df.unit_other_category(u) == :Wild }.each { |unit|
print_syndromes[logger, unit, true, showall, showeffects, showhiddencurse, showdisplayeffects]
}
logger.break()
end

if hostile
logger.log "Hostile Units", Output::HIGHLIGHT
df.unit_hostiles.each { |unit|
print_syndromes[logger, unit, true, showall, showeffects, showhiddencurse, showdisplayeffects]
}
logger.break()
end

if world
logger.log "All Syndromes", Output::HIGHLIGHT
df.world.raws.syndromes.all.each { |syndrome| print_raw_syndrome[logger, syndrome, showeffects, showdisplayeffects] }
end

logger.close()
Title: Re: DFHack 0.34.11 r3
Post by: falconne on April 25, 2013, 05:21:49 am
I was wondering if whoever added the mouse tracking functionality to enabler.h knows if it's possible to detect a "mouse button up" event? There are currently mouse_rbut_lift and mouse_lbut_lift variables, but these aren't set when either button is lifted (and lifting a button doesn't generate an input event). I was going to try adding "click and drag to move the viewport" functionality to my mouse plugin, but it looks like it's currently not possible to detect mouse up events in DF.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 25, 2013, 06:19:00 am
good news I figure out that rider_mount_id controls which unit the rider is on. so changing that will lead to the rider to warp to who ever you set it to. this proves that mounts don't have that much code to be set unlike their rider counterparts and I'm one foot closer to teaching dwarfs how to ride carp into battle.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on April 25, 2013, 02:51:15 pm
I have made an adaptation of unsuspend.rb and autounsuspend.rb for the purposes of fixing handedness on gloves created through custom reactions.

fixhandedness.rb
Spoiler (click to show/hide)

autofixhandedness.rb
Spoiler (click to show/hide)

I set the auto check to 100 ticks and I think it can be set longer 2400 ticks for once every 2 dwarf days as I don't expect custom reaction gloves to be created frequently. 

I updated my scripts to increase the auto ticks, to give start and stop feedback, to have a help string in the dfhack console's script listing, and improve the comments.

Also, looking at the how I am using the onupdate_register function, I am thinking that if someone issued the auto script to start twice, then it might have 2 versions of itself registered, and only the most recent would be stopped with the scripts stop command.  Therefore I am thinking about adding a check so that the script doesn't onupdate_register twice.  Alternatively we might want to consider making sure the onupdate_register function doesn't add duplicate description keys (perhaps updated the existing one when it happens).  I haven't taken a deep look into that so I don't know if it is an issue.



Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 25, 2013, 02:56:47 pm
Kurik Amudnil, sorry to be so blunt, but could you repeat this in plain english please? You made an update, and something improved. I am just not entirely sure what. Auto ticks, start and stop feedback?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on April 25, 2013, 04:28:03 pm
The update adds feedback to the dfhack console when starting and stopping.  So issuing
Code: [Select]
autofixhandedness startin the dfhack console or by way of the dfhack.init will print a nice message about having been successfully started, or stopped in the case of the stop argument.  This way if starting by way of the dfhack.init, there is an identifiable message from autofixhandedness with the other startup messages.

I set the auto script to run every 2400 ticks rather than the 100 I had previously, 2400 being once every 2 dwarf days

when issuing the ls command to the dfhack console, at the bottom of the listing of commands is a list of scripts with an associated message acquired from a comment on the first line of the script so I added a comment on the first line to show up in the dfhack ls listing

I reorganized and updated/added the other comments in a hope to improve clarity.

Overall, it is functionally identical, other than changing the default frequency to 2400 ticks, the changes are cosmetic so that it would be more appropriate for inclusion with provided scripts in future releases of dfhack.  On that note, I don't yet know what the procedure is for adding scripts to the repository.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 25, 2013, 05:12:25 pm
Ah, thank you. :) I did that change of the ticks myself, completely forgot that you had it set to 100 here. Thats why I was surprised a bit. There is also feedback whenever the script finds gloves and adds the handedness tags.

somehow I get the feeling that profit should start a "dfhack" section in this list, with all the links to custom written scripts and plugins. Otherwise these things get lost so fast...
Title: Re: DFHack 0.34.11 r3
Post by: Ogamaga on April 25, 2013, 05:56:27 pm
Has anyone tried to use "simple embark" with r3 or know how to try it?
Title: Re: DFHack 0.34.11 r3
Post by: TDarksword on April 26, 2013, 03:37:03 pm
The status section?  You mean in the current soul, or is there a caste field elsewhere in the status section?  I'll check that again.  Where is the were caste stored?  I poked through the syndrome and curse structures using the Lua interface but didn't find anything obvious.

Did you get anywhere with this Telgin?

I am having basically the same problem.
Changing unit.caste causes it just to change immediately back after I unpause even if unit.status.current_soul.caste and unit.status.souls[0].caste have been changed (and those two don't change back after unpause)

Has anyone tried to use "simple embark" with r3 or know how to try it?
I think I saw mention somewhere earlier in the thread that it is broke as there is a requirement to embark with 7 dwarves. I think there was a work around mentioned though by using the multi-race embark to get around this.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on April 26, 2013, 03:57:19 pm
Did you get anywhere with this Telgin?

I am having basically the same problem.
Changing unit.caste causes it just to change immediately back after I unpause even if unit.status.current_soul.caste and unit.status.souls[0].caste have been changed (and those two don't change back after unpause)

Not yet.  Admittedly I haven't had much time to play with it since then.  I'm sure the answer is simple, probably just changing the caste number somewhere else.  Darned if I know where though.  Maybe somewhere not in the units vector?  Can't imagine why it would be elsewhere.
Title: Re: DFHack 0.34.11 r3
Post by: TDarksword on April 26, 2013, 05:14:24 pm
Did you get anywhere with this Telgin?

I am having basically the same problem.
Changing unit.caste causes it just to change immediately back after I unpause even if unit.status.current_soul.caste and unit.status.souls[0].caste have been changed (and those two don't change back after unpause)

Not yet.  Admittedly I haven't had much time to play with it since then.  I'm sure the answer is simple, probably just changing the caste number somewhere else.  Darned if I know where though.  Maybe somewhere not in the units vector?  Can't imagine why it would be elsewhere.

I tried changing it in historic too, no effect.. Hmmm wonder where else it is.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 26, 2013, 05:55:02 pm
Did you get anywhere with this Telgin?

I am having basically the same problem.
Changing unit.caste causes it just to change immediately back after I unpause even if unit.status.current_soul.caste and unit.status.souls[0].caste have been changed (and those two don't change back after unpause)

Not yet.  Admittedly I haven't had much time to play with it since then.  I'm sure the answer is simple, probably just changing the caste number somewhere else.  Darned if I know where though.  Maybe somewhere not in the units vector?  Can't imagine why it would be elsewhere.

I tried changing it in historic too, no effect.. Hmmm wonder where else it is.
you could change it under the enemy section of the unit list. which has the were caste and wererace files needed.
Title: Re: DFHack 0.34.11 r3
Post by: Ashery on April 26, 2013, 10:53:25 pm
Alright, time for some basic questions and such about .lua scripting as I'm tired of digging through a bunch of sources and trying to reinvent the wheel.

The core functionality I'm looking for is the ability to modify the skill levels of certain dwarves, and while there are a bunch of examples in the last twenty odd pages that do just that (Most based off of vjek's), they all only utilize two methods for selecting who'll be modified: All dwarves (Useless to me) and the currently selected dwarf (Impractical as I'll be modifying 18-90 dwarves for each trial and likely doing over two dozen trials per world, although only one world is planned at the moment). They also all don't currently include more nuanced modifications, but that would be straightforward to modify.

My first thought regarding the selection process revolves around giving all dwarves a numeric nickname and adjusting the skills of all dwarves with nicknames divisible by x (n = n + x), but I've no idea about both where to start implementing that on the scripting side and if it's even possible to do so. Alternatively, I might be able to do the same with something a bit more hard coded, but that'd likely require a bunch of filters for dead units and the like as well as not necessarily leaving me with 1/x of the dwarves modified.

Once the selection process is tackled, the scripting necessary to allow the user a finer degree of control over the skill levels should be straightforward (Define a bunch of local variables that require user input and call it a day). Hell, I could just modify the script directly/hard code the values it changes the skill level to for each trial.

I might also need to zero out all dwarves with preexisting military skills, but if the nickname method works, I can simply not give them a nickname and exclude them from the sample that way. There are also a number of preexisting scripts for this and, unlike the portion where I increase skills, this is something that will only be done on a per-world basis and so there'll be a lot less effort involved if I have to brute force it.

Outside of that, the only other scripts I'm looking at are the one that triggers a migrant wave (I'm assuming it bypasses the liaison check/set pop cap, so correct me if I'm wrong) and the object creation one (Uniform gear quality. Less variables the better), both of which I'd be able to wrap my head around easily on my own. With both of those setup, I'd be able to get a new world ready for trials in <30min. But that still leaves me needing to figure out how to get the skill modification script setup...
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 27, 2013, 12:00:39 am
You want the dwarf manipulator to have a abililty to edit the skills of a unit? I think someone here made a morul script.
Title: Re: DFHack 0.34.11 r3
Post by: GiantUrist on April 27, 2013, 06:44:31 am
I've been trying to use binpatch on the Mac OS X version of dwarfort.exe, but no luck. I tried both binary binpatch from the command-line as well as the script when DFHack is running. I saw that the hack/patches folder only has SDL and Linux patches, so I am guessing that there aren't any binary patches for OS X (yet).

Can somebody confirm and/or shed some light on this issue? I am willing to learn how to make those patches myself if that is at all possible.

Thanks in advance,
Title: Re: DFHack 0.34.11 r3
Post by: TDarksword on April 27, 2013, 06:48:30 am
Did you get anywhere with this Telgin?

I am having basically the same problem.
Changing unit.caste causes it just to change immediately back after I unpause even if unit.status.current_soul.caste and unit.status.souls[0].caste have been changed (and those two don't change back after unpause)

Not yet.  Admittedly I haven't had much time to play with it since then.  I'm sure the answer is simple, probably just changing the caste number somewhere else.  Darned if I know where though.  Maybe somewhere not in the units vector?  Can't imagine why it would be elsewhere.

I tried changing it in historic too, no effect.. Hmmm wonder where else it is.
you could change it under the enemy section of the unit list. which has the were caste and wererace files needed.

Ahh ha, yep changing unit.enemy.normal_caste fixed it. Though I did need to make sure I was upgraded to find that, as in dfhack 34.11r2 that didn't exist :)

But yeah Telgin you need to change
unit.enemy.normal_caste (changing this is what causes the transformation message. So if you change this and not unit.caste, unit.caste will be updated with a transformation message)
unit.current_soul.caste (not sure this is needed, though might mess some things up if soul and actual caste's don't match)
and probably the historical figure caste (for completeness).
Title: Re: DFHack 0.34.11 r3
Post by: danaris on April 27, 2013, 10:09:29 am
I've been trying to use binpatch on the Mac OS X version of dwarfort.exe, but no luck. I tried both binary binpatch from the command-line as well as the script when DFHack is running. I saw that the hack/patches folder only has SDL and Linux patches, so I am guessing that there aren't any binary patches for OS X (yet).

Can somebody confirm and/or shed some light on this issue? I am willing to learn how to make those patches myself if that is at all possible.

Thanks in advance,

There has, as yet, been no official effort to get binpatches working for OS X. The Linux ones may have some applicability, or may not.

If you come to the #dfhack channel on Freenode and ping Delvin (me), assuming I've got some free time I'm willing to help you stumble about in the dark trying to find stuff... (This will be more likely during weekdays in American Eastern time.)
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on April 27, 2013, 09:04:11 pm
Did you get anywhere with this Telgin?

I am having basically the same problem.
Changing unit.caste causes it just to change immediately back after I unpause even if unit.status.current_soul.caste and unit.status.souls[0].caste have been changed (and those two don't change back after unpause)

Not yet.  Admittedly I haven't had much time to play with it since then.  I'm sure the answer is simple, probably just changing the caste number somewhere else.  Darned if I know where though.  Maybe somewhere not in the units vector?  Can't imagine why it would be elsewhere.

I tried changing it in historic too, no effect.. Hmmm wonder where else it is.
you could change it under the enemy section of the unit list. which has the were caste and wererace files needed.

That did the trick.  I was confused and never found these numbers because in my version of DFHack at least, it's under a unit's unknown8 struct.  Perhaps that was renamed in the most recent release?

Either way, setting the normal_caste number and stepping or unpausing the game caused the victim to immediately change to what I wanted.
Title: Re: DFHack 0.34.11 r3
Post by: TDarksword on April 28, 2013, 12:21:17 pm
Did you get anywhere with this Telgin?

I am having basically the same problem.
Changing unit.caste causes it just to change immediately back after I unpause even if unit.status.current_soul.caste and unit.status.souls[0].caste have been changed (and those two don't change back after unpause)

Not yet.  Admittedly I haven't had much time to play with it since then.  I'm sure the answer is simple, probably just changing the caste number somewhere else.  Darned if I know where though.  Maybe somewhere not in the units vector?  Can't imagine why it would be elsewhere.

I tried changing it in historic too, no effect.. Hmmm wonder where else it is.
you could change it under the enemy section of the unit list. which has the were caste and wererace files needed.

That did the trick.  I was confused and never found these numbers because in my version of DFHack at least, it's under a unit's unknown8 struct.  Perhaps that was renamed in the most recent release?

Either way, setting the normal_caste number and stepping or unpausing the game caused the victim to immediately change to what I wanted.

Yep same problem I had. in 34.11r2 it is under .unk8, need to update to 34.11r3 for it to be under .enemy.
Title: Re: DFHack 0.34.11 r3
Post by: vjek on April 28, 2013, 10:45:11 pm
Spoiler (click to show/hide)
You could always just iterate through the first however-many-you-want with remove_all_skills and then use a modified armoks_blessing on the same however many.

If you don't want to pick them manually or automatically, pick the first 18 or 90.

On the other hand, whatever your goal is, the Object Testing Arena may help?
Title: Re: DFHack 0.34.11 r3
Post by: Maklak on April 29, 2013, 04:13:15 am
I play a mod with spells and I would find the "showunitsyndromes.rb" script quite useful, but I just got a bunch of errors from it. I saved the r3 version to hack/scripts directory, loaded the game and run the script, but it didn't work. I'm using the WINE version of Dwarf Fortress with dfhack r3, under Linux Mint. Other things work normally for me.

Here are the errors:
[DFHack]# showunitsyndrome
Dwarves
`Pierce' townvalley trianglebook cherish
E: NameError: undefined local variable or method `print_syndrome' for main:Object
 ./hack/scripts/showunitsyndrome.rb:786
 ./hack/ruby/ruby-autogen-defs.rb:390:in `each'
 ./hack/ruby/ruby-autogen-defs.rb:390:in `each'
 ./hack/scripts/showunitsyndrome.rb:786
 ./hack/scripts/showunitsyndrome.rb:904:in `[]'
 ./hack/scripts/showunitsyndrome.rb:904
 ./hack/scripts/showunitsyndrome.rb:903:in `each'
 ./hack/scripts/showunitsyndrome.rb:903
[DFHack]# showunitsyndromes
E: Errno::ENOSPC: ./hack/scripts/showunitsyndromes.rb:33:in `write': No space left on device
 ./hack/scripts/showunitsyndromes.rb:33
 ./hack/scripts/showunitsyndromes.rb:33
 (eval):787:in `load'
 (eval):787
 (eval):787:in `catch'
 (eval):787
[DFHack]# showunitsyndromes
E: Errno::ENOSPC: ./hack/scripts/showunitsyndromes.rb:33:in `write': No space left on device
 ./hack/scripts/showunitsyndromes.rb:33
 ./hack/scripts/showunitsyndromes.rb:33
 (eval):34:in `load'
 (eval):34
 (eval):34:in `catch'
 (eval):34

After a reset:
[DFHack]# showunitsyndromes
Dwarves
`Pierce' townvalley trianglebook cherish
E: NameError: undefined local variable or method `print_syndrome' for main:Object
 ./hack/scripts/showunitsyndromes.rb:786
 ./hack/ruby/ruby-autogen-defs.rb:390:in `each'
 ./hack/ruby/ruby-autogen-defs.rb:390:in `each'
 ./hack/scripts/showunitsyndromes.rb:786
 ./hack/scripts/showunitsyndromes.rb:904:in `[]'
 ./hack/scripts/showunitsyndromes.rb:904
 ./hack/scripts/showunitsyndromes.rb:903:in `each'
 ./hack/scripts/showunitsyndromes.rb:903
[DFHack]# showunitsyndromes
E: Errno::ENOSPC: ./hack/scripts/showunitsyndromes.rb:33:in `write': No space left on device
 ./hack/scripts/showunitsyndromes.rb:33
 ./hack/scripts/showunitsyndromes.rb:33
 (eval):787:in `load'
 (eval):787
 (eval):787:in `catch'
 (eval):787
[DFHack]#
Title: Re: DFHack 0.34.11 r3
Post by: zzedar on April 29, 2013, 06:23:48 am
Not sure if this is the correct place to post this info, but: I've figured out the meaning of two of the fields that are currently marked as unknown in DFHack. The unk2 field of body_part_layer_raw (currently found on line 394 of df.creature-raws.xml) is a scale number that represents the relative thickness of that layer in the body part; basically, it works like RELATIVE_THICKNESS does in the raws. The unk2 field of body_part_raw (currently found on line 430 of df.creature-raws.xml) is simply the sum of the the thicknesses for all layers of that body part.
Title: Re: DFHack 0.34.11 r3
Post by: Imperator314 on April 29, 2013, 09:05:25 pm
Sorry if this is a repeat or common question, but I poked around and couldn't find this anywhere. I made the mistake of locking my Legendary Siege Operator inside the control room for a little too long, and he starved to death. I'd really like to resurrect him. I found this script. This leaves me with 2 questions: how do I modify this to resurrect a dwarf, not just heal them, and how do I actually use the code? I've spend a good while trying to figure out how to use dfusion and just can't. Thanks in advance for any help.
Code: [Select]
function tools.heal2(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
unit.body.wounds:resize(0) -- memory leak here :/
unit.body.blood_count=unit.body.blood_max
--set flags for standing and grasping...
unit.status2.able_stand=4
unit.status2.able_stand_impair=4
unit.status2.able_grasp=4
unit.status2.able_grasp_impair=4
--should also set temperatures, and flags for breath etc...
unit.flags1.dead=false
unit.flags2.calculated_bodyparts=false
unit.flags2.calculated_nerves=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.counters.winded=0
unit.counters.unconscious=0
for k,v in pairs(unit.body.components) do
for kk,vv in pairs(v) do
v[kk]=0
end
end
end
tools.menu:add("heal2",tools.heal2)
Title: Re: DFHack 0.34.11 r3
Post by: Bludragon on April 29, 2013, 10:10:12 pm
Does anybody know how to change the number of dwarves we can embark with?  There seems to be ways to do with older versions of the game and mods but nothing recent that works. I would really like to be able to do this.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on April 30, 2013, 12:10:50 am
The DFusion commands in DFHack will allow it.  I can't remember the exact sequence, but it's under the DFusion menu inside DFHack.  Just remember to run it before you go to the embark screen.

Quote from: Imperator314
Sorry if this is a repeat or common question, but I poked around and couldn't find this anywhere. I made the mistake of locking my Legendary Siege Operator inside the control room for a little too long, and he starved to death. I'd really like to resurrect him. I found this script. This leaves me with 2 questions: how do I modify this to resurrect a dwarf, not just heal them, and how do I actually use the code? I've spend a good while trying to figure out how to use dfusion and just can't. Thanks in advance for any help.

It looks like that's supposed to be loaded as part of DFHack's startup scripts somehow, but I don't know how that works.  If you use the following code:

Code: [Select]
function heal2()
unit = getCreatureAtPos(getxyz())
unit.flags1.dead = false
if unit.caste == 0 then
unit.caste = 1
end
if unit.caste == 1 then
unit.caste = 0
end
end
heal2()

and paste that into a file called heal2.lua in your /hack/scripts directory, that should add a new command called heal2 that you can run directly from DFHack's command line.  In theory, putting the cursor over a wounded dwarf and running heal2 will heal them completely.  The theory here is that it would bring them back to life, if dead, then change their caste to the other dwarf caste.  This heals all wounds as per a werecreature curse.  The game realizes immediately that they're not suffering from a curse, and changes them back, however, but keeping their wounds healed.

This has some problems (and is untested and so maybe even has syntax errors), but should work.  I believe it may change physical stats when it runs, so be careful.

It also won't bring the dead back to life, I don't think, since the game won't recognize creatures if you mouse over their corpse.  To get around that, you'd need to get a reference to their unit through some other means.  If there's an easy way to do that, I don't know what it is.  In the past I've just done a manual search of the df.global.world.units.all list to find them, but I know there has to be a better way.
Title: Re: DFHack 0.34.11 r3
Post by: Imperator314 on April 30, 2013, 02:05:13 am

Quote from: Imperator314
Sorry if this is a repeat or common question, but I poked around and couldn't find this anywhere. I made the mistake of locking my Legendary Siege Operator inside the control room for a little too long, and he starved to death. I'd really like to resurrect him. I found this script. This leaves me with 2 questions: how do I modify this to resurrect a dwarf, not just heal them, and how do I actually use the code? I've spend a good while trying to figure out how to use dfusion and just can't. Thanks in advance for any help.

It looks like that's supposed to be loaded as part of DFHack's startup scripts somehow, but I don't know how that works.  If you use the following code:

Code: [Select]
function heal2()
unit = getCreatureAtPos(getxyz())
unit.flags1.dead = false
if unit.caste == 0 then
unit.caste = 1
end
if unit.caste == 1 then
unit.caste = 0
end
end
heal2()

and paste that into a file called heal2.lua in your /hack/scripts directory, that should add a new command called heal2 that you can run directly from DFHack's command line.  In theory, putting the cursor over a wounded dwarf and running heal2 will heal them completely.  The theory here is that it would bring them back to life, if dead, then change their caste to the other dwarf caste.  This heals all wounds as per a werecreature curse.  The game realizes immediately that they're not suffering from a curse, and changes them back, however, but keeping their wounds healed.

This has some problems (and is untested and so maybe even has syntax errors), but should work.  I believe it may change physical stats when it runs, so be careful.

It also won't bring the dead back to life, I don't think, since the game won't recognize creatures if you mouse over their corpse.  To get around that, you'd need to get a reference to their unit through some other means.  If there's an easy way to do that, I don't know what it is.  In the past I've just done a manual search of the df.global.world.units.all list to find them, but I know there has to be a better way.

When I try to run the script, I get this error: \Dwarf Fortress\hack\scripts/heal2.lua:2: attempt to call global 'getxyz' (a nil value) stack traceback: \Dwarf Fortress\hack\scripts/heal2.lua2: in function 'heal2' \Dwarf Fortress\hack\scripts/heal2.lua:11: in main chunk (...tail calls...)   When I type ls in the DFhack console, heal2 does show up as a possible command, don't know if that's any help.
Title: Re: DFHack 0.34.11 r3
Post by: Trev_lite on April 30, 2013, 02:09:02 am
The DFusion commands in DFHack will allow it.  I can't remember the exact sequence, but it's under the DFusion menu inside DFHack.  Just remember to run it before you go to the embark screen.

i cannot find simple_embark in dfhack r3 anywhere.
i think it was removed. if it is still there can you tell me how to find it. its not simple_embark or under the dfusion menu

hope that some one can tell me were to find simple_embark for dfhack r3
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 30, 2013, 06:39:44 am
The DFusion commands in DFHack will allow it.  I can't remember the exact sequence, but it's under the DFusion menu inside DFHack.  Just remember to run it before you go to the embark screen.

i cannot find simple_embark in dfhack r3 anywhere.
i think it was removed. if it is still there can you tell me how to find it. its not simple_embark or under the dfusion menu

hope that some one can tell me were to find simple_embark for dfhack r3
simple embark as in embark anywhere or the bit that allows you to alter how many units can spawn on the map simple embark?
because embark anywhere has been converted into a lua script called embark.
Title: Re: DFHack 0.34.11 r3
Post by: Trev_lite on April 30, 2013, 06:41:23 am
the old dfusion script simple_embark. the one that let you change how many units you start with.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on April 30, 2013, 07:25:21 am
When I try to run the script, I get this error: \Dwarf Fortress\hack\scripts/heal2.lua:2: attempt to call global 'getxyz' (a nil value) stack traceback: \Dwarf Fortress\hack\scripts/heal2.lua2: in function 'heal2' \Dwarf Fortress\hack\scripts/heal2.lua:11: in main chunk (...tail calls...)   When I type ls in the DFhack console, heal2 does show up as a possible command, don't know if that's any help.

Try this instead:

Code: [Select]
function heal2()
unit = dfhack.gui.getSelectedUnit()
unit.flags1.dead = false
if unit.caste == 0 then
unit.caste = 1
end
if unit.caste == 1 then
unit.caste = 0
end
end
heal2()

That will still require you to select a unit with the 'v' or 'k' keys in fort mode (no idea for adventure mode, but 'l' I think).  Again, this won't directly allow you to revive dead things without a reference to the dead unit instead of the dfhack.gui.getSelectedUnit() line.
Title: Re: DFHack 0.34.11 r3
Post by: drayath on April 30, 2013, 07:47:46 am
Maklak, try the following version. It definatly works on my machine at least but it has only been tested under windows. If you are getting error writing the file try just export:filename rather than export:c:\path\filename or export:\usr\me\filename, not quite sure how the ruby filename parsing works via wine.

--

Fix: stupid typo that prevented script running (note to self: stop making changes between testing and uploading!!!)
Enh: Various display improvements in html output
New: If only some effects in a syndrome are presently active, inactive effects are marked.

Spoiler (click to show/hide)

For example output www.brightsoft.net/examplesyndromereport.html (http://www.brightsoft.net/examplesyndromereport.html) (only good syndromes in this case which is why they are all green)
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on April 30, 2013, 08:45:15 am
The lack of proper capitalization!  It burns my eyes!   :P

Seriously though, that's an awesome script.  I'll have to start playing with it.  Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: drayath on April 30, 2013, 12:18:42 pm
People are never happy  :P

ShowUnitSyndromes.rb v6
Fix: Capitalization, spelling, missing commas and spaces
Fix: Quick code tidy up
Enh: Decode transformation race and caste to nice names.
Enh: Material force multiplier now shows material if the bonus if for a certain type (e.g. werewolf's vs silver)

Spoiler (click to show/hide)

New example showing all syndromes in the world so you can see some of the different types: www.brightsoft.net/examplesyndromereport2.html
Title: Re: DFHack 0.34.11 r3
Post by: Imperator314 on April 30, 2013, 12:36:56 pm

Try this instead:

Code: [Select]
function heal2()
unit = dfhack.gui.getSelectedUnit()
unit.flags1.dead = false
if unit.caste == 0 then
unit.caste = 1
end
if unit.caste == 1 then
unit.caste = 0
end
end
heal2()

That will still require you to select a unit with the 'v' or 'k' keys in fort mode (no idea for adventure mode, but 'l' I think).  Again, this won't directly allow you to revive dead things without a reference to the dead unit instead of the dfhack.gui.getSelectedUnit() line.

This script does run, thanks. Now where is df.global.world.units.all located?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 30, 2013, 01:37:47 pm
New example showing all syndromes in the world so you can see some of the different types: www.brightsoft.net/examplesyndromereport2.html
These look familiar.. seems like I have some work cut out, giving all of them proper names... Would you be willing to write a short readme for this, so I can include it in MasterworkDF?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on April 30, 2013, 03:07:24 pm

Try this instead:

Code: [Select]
function heal2()
unit = dfhack.gui.getSelectedUnit()
unit.flags1.dead = false
if unit.caste == 0 then
unit.caste = 1
end
if unit.caste == 1 then
unit.caste = 0
end
end
heal2()

That will still require you to select a unit with the 'v' or 'k' keys in fort mode (no idea for adventure mode, but 'l' I think).  Again, this won't directly allow you to revive dead things without a reference to the dead unit instead of the dfhack.gui.getSelectedUnit() line.

This script does run, thanks. Now where is df.global.world.units.all located?

I would recommend using the dead/missing units list to highlight the intended recipient as dfhack.gui.getSelectedUnit() works from there.  Also, I would change those if statements to
Code: [Select]
if unit.caste == 0 then
unit.caste = 1
else
unit.caste = 0
end
so that female dwarfs will be regenerated too.

Also, some way to make sure the unit is regenerated in a valid location might be useful as I think that using this script on a dwarf who went swimming in magma would just get incinerated again.  Also dwarfs who became encased in ice or obsidian might have problems if their position is still impassable.
Title: Re: DFHack 0.34.11 r3
Post by: Imperator314 on April 30, 2013, 03:29:28 pm

Try this instead:

Code: [Select]
function heal2()
unit = dfhack.gui.getSelectedUnit()
unit.flags1.dead = false
if unit.caste == 0 then
unit.caste = 1
end
if unit.caste == 1 then
unit.caste = 0
end
end
heal2()

That will still require you to select a unit with the 'v' or 'k' keys in fort mode (no idea for adventure mode, but 'l' I think).  Again, this won't directly allow you to revive dead things without a reference to the dead unit instead of the dfhack.gui.getSelectedUnit() line.

This script does run, thanks. Now where is df.global.world.units.all located?

I would recommend using the dead/missing units list to highlight the intended recipient as dfhack.gui.getSelectedUnit() works from there.  Also, I would change those if statements to
Code: [Select]
if unit.caste == 0 then
unit.caste = 1
else
unit.caste = 0
end
so that female dwarfs will be regenerated too.

Also, some way to make sure the unit is regenerated in a valid location might be useful as I think that using this script on a dwarf who went swimming in magma would just get incinerated again.  Also dwarfs who became encased in ice or obsidian might have problems if their position is still impassable.


This script did work. Since she (turns out it was a female dwarf, thanks for that fix) starved to death, location wasn't a problem. However, all of her body parts are gone. Could this have something to do with the fact that her body is sitting in a stockpile, but she resurrected on top of the spot that she died? Right now, all of her body parts are grayed out (missing), and her health status says winded, ability to breathe lost, vision lost, ability to stand lost, ability to grasp lost. Is there a script to replace all of her body parts?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on April 30, 2013, 03:46:49 pm
.. snip ..
Code: [Select]
if unit.caste == 0 then
unit.caste = 1
else
unit.caste = 0
end
so that female dwarfs will be regenerated too.

This script did work. Since she (turns out it was a female dwarf, thanks for that fix) starved to death, location wasn't a problem. However, all of her body parts are gone. Could this have something to do with the fact that her body is sitting in a stockpile, but she resurrected on top of the spot that she died? Right now, all of her body parts are grayed out (missing), and her health status says winded, ability to breathe lost, vision lost, ability to stand lost, ability to grasp lost. Is there a script to replace all of her body parts?

The missing body parts are the reason for the change to the if statements since the second if statement undid the change of the first one.  what changing the caste here does is make it so that they go through the magical transformation back to themselves like a were creature and regenerate everything.  run the script again with her unit selected and with the if fix and she should regenerate her missing parts.

Another thing I have noticed is that units brought back from the dead with this script won't show up in dwarf therapist
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on April 30, 2013, 03:55:39 pm
Good catch on the if statement, I didn't test it and sure enough that would have caused a problem.

I don't know if the game updates a unit's position as their corpse is hauled around (probably not), and if it doesn't that would mean she'd pop up back where she kicked the bucket.  Having random body parts lying around shouldn't matter, so far as I know.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on April 30, 2013, 04:05:04 pm
Good catch on the if statement, I didn't test it and sure enough that would have caused a problem.

I don't know if the game updates a unit's position as their corpse is hauled around (probably not), and if it doesn't that would mean she'd pop up back where she kicked the bucket.  Having random body parts lying around shouldn't matter, so far as I know.

True, unit position is not updated by corpse movement.  I tested this on two deaths, one was a military dwarf that wandered too far from the station point and stepped on the rising bridge and was atomized.  He retained his position.  The other was a female baby (the only female death I could test on) who had been stabbed by a snatcher.  Interestingly, her position when resurrected was not where she died, and not at her coffin, but with her mother.  Apparently babies follow their mothers in death as well as in life.
Title: Re: DFHack 0.34.11 r3
Post by: Imperator314 on April 30, 2013, 04:12:30 pm

The missing body parts are the reason for the change to the if statements since the second if statement undid the change of the first one.  what changing the caste here does is make it so that they go through the magical transformation back to themselves like a were creature and regenerate everything.  run the script again with her unit selected and with the if fix and she should regenerate her missing parts.

Another thing I have noticed is that units brought back from the dead with this script won't show up in dwarf therapist

Ah, found the problem. When I modified the script, I pasted the new code in without deleting the old section, so it stopped running before it got to the second part. As for Dwarf Therapist, you were right. Oh well. All she does is sit around in the control room waiting to pull levers and shoot the ballista. Thanks for the help, guys  :)
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on April 30, 2013, 06:21:34 pm

The missing body parts are the reason for the change to the if statements since the second if statement undid the change of the first one.  what changing the caste here does is make it so that they go through the magical transformation back to themselves like a were creature and regenerate everything.  run the script again with her unit selected and with the if fix and she should regenerate her missing parts.

Another thing I have noticed is that units brought back from the dead with this script won't show up in dwarf therapist

Ah, found the problem. When I modified the script, I pasted the new code in without deleting the old section, so it stopped running before it got to the second part. As for Dwarf Therapist, you were right. Oh well. All she does is sit around in the control room waiting to pull levers and shoot the ballista. Thanks for the help, guys  :)

I found why they don't show up in Dwarf Therapist.  DT filters out dwarfs who have flags2.killed == true , therefore we can revise the script to add flags2.killed = false so that DT won't filter them.

Code: [Select]
function heal2()
unit = dfhack.gui.getSelectedUnit()
unit.flags1.dead = false
unit.flags2.killed = false
if unit.caste == 0 then
unit.caste = 1
else
unit.caste = 0
end
end
heal2()
Title: Re: DFHack 0.34.11 r3
Post by: Maklak on May 01, 2013, 08:09:55 pm
Thanks Drayath, 6th version of your script works for me and displays stuff in the dfhack console. This is just something from a new fort, testing shotguns that fire 8 pellets at once by material emissions: http://www.bay12forums.com/smf/index.php?topic=118893.msg4218316#msg4218316

[DFHack]# ShowUnitSyndromes
Dwarves
wheat seedplot
 - Shotgun battle saddle [196 of 300]
 -  - Add interaction [0-300] ability=Reload shotguns, delay=600, actionType=TODO, range=TODO, maxTargets=TODO
 - Shotgun battle saddle [46 of 300]
 -  - Add interaction [0-300] ability=Reload shotguns, delay=600, actionType=TODO, range=TODO, maxTargets=TODO
blaze blotbud
 - Shotgun battle saddle [196 of 300]
 -  - Add interaction [0-300] ability=Reload shotguns, delay=600, actionType=TODO, range=TODO, maxTargets=TODO
 - Shotgun battle saddle [46 of 300]
 -  - Add interaction [0-300] ability=Reload shotguns, delay=600, actionType=TODO, range=TODO, maxTargets=TODO

EDIT:
v6 works once, then spits a bunch of errors when I run it again. There isn't even anything in line 43 that could cause an error.
[DFHack]# ShowUnitSyndromes
E: Errno::ENOSPC: ./hack/scripts/ShowUnitSyndromes.rb:43:in `write': No space left on device
 ./hack/scripts/ShowUnitSyndromes.rb:43
 ./hack/scripts/ShowUnitSyndromes.rb:43
 (eval):2:in `load'
 (eval):2
 (eval):2:in `catch'
 (eval):2

I also have a feature request: Give me an option to print just one dwarf, filtered by name "ShowUnitSyndromes -u Urist" or something similar. Yes, I can generate a html, then reload it, then search in that, but it would be really convenient to have that info in the dfhack console, frame by frame.
Title: Re: DFHack 0.34.11 r3
Post by: Ashery on May 02, 2013, 10:20:28 pm
Spoiler (click to show/hide)
You could always just iterate through the first however-many-you-want with remove_all_skills and then use a modified armoks_blessing on the same however many.

If you don't want to pick them manually or automatically, pick the first 18 or 90.

On the other hand, whatever your goal is, the Object Testing Arena may help?

Sorry about the slow response.

The first suggestion would technically work, but it'd require a substantial increase in the amount of time I spend setting up each trial. If I can automate the script around numeric nicknames, it'd take all of thirty seconds to get an entire new trial up and running (Barring using non-standard training numbers, which I'll definitely be doing a few of).

Object testing arena won't help as I'm going to be looking at the rate of skill gain in training.

I suppose the most succinct way to solve my problem is this: What other ways, beyond the gui bit, are there to select dwarves?
Title: Re: DFHack 0.34.11 r3
Post by: vjek on May 03, 2013, 09:08:45 am
If you know how many you need you could make it an argument passed to the script, and it would only adjust exactly that many dwarves. (from first to n)

One command, 18 modified, done.  Or, one command, 90 modified, done.  Or any quantity you want.  No extra time required.
Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on May 03, 2013, 11:35:43 am
Will we get dfusion embark back in the next version?
Title: Re: DFHack 0.34.11 r3
Post by: Ashery on May 03, 2013, 11:36:54 am
If you know how many you need you could make it an argument passed to the script, and it would only adjust exactly that many dwarves. (from first to n)

One command, 18 modified, done.  Or, one command, 90 modified, done.  Or any quantity you want.  No extra time required.

Yup. Something like that was my primary backup if the nickname method didn't work (And the nickname method is only a slightly more fancy version of it. The main advantage with the nicknames being that each squad would be clustered together in the spreadsheet so spotting trends would be easier. Ie, I'd modify all dwarves with a nickname equal to 0 mod 9 and group the dwarves 0-8 in the first squad and so on. Not necessary by any means, but it'd allow squads that are constantly over/under performing across multiple trials to be easily picked out and allow me to get a bit of extra information out of the testing beyond the main point on training. The nicknames would also allow me to just exclude the military dwarves from the test outright and get a more accurate representation of the stats of an untrained dwarf).

The problem is that I still don't know how to select a dwarf beyond the gui method, as that's both easily understandable and the only method I've seen used.

You want the dwarf manipulator to have a abililty to edit the skills of a unit? I think someone here made a morul script.

This the script you're talking about? http://dwarffortresswiki.org/index.php?title=Utility:DFusion#How_to

It's more useful in terms of teaching me a bit about how the scripting functions, but it still relies entirely on the gui method of selection.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 03, 2013, 02:46:23 pm
--snip--

I suppose the most succinct way to solve my problem is this: What other ways, beyond the gui bit, are there to select dwarves?

scripts/siren.lua in the stop rest loop, finds all citizens.  It also has some in checks for units that are currently in a burrow by position or something.

some possibilities:

by id:
Spoiler (click to show/hide)

active units who have a numeric custom profession:
Spoiler (click to show/hide)

In my personal experience, I have noticed nicknames to be a little flaky in that they sometimes get lost, so I would recommend using custom professions instead.
Title: Re: DFHack 0.34.11 r3
Post by: CLA on May 03, 2013, 03:50:30 pm
I have some requests/suggestions for the Dwarf Manipulator:
I think generally the plugins would benefit from a little less information, or less exact information. It makes the plugins feel so exploity in some cases.

Specifically, I think it would be great if you could see Happiness not as numerical value, but only as the 5-tiered color code already in place. I think Dwarf Therapist already has a similar setting. Similarly, I propose switching off the exact experience numbers and just showing the general level of expertise (dabbling, legendendary, etc). Basically - don't show more exact information that the game would present the player without DFhack.

It sounds trivial, and I'd do it myself, but I literally have absolutely no experience with this kind of thing.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 03, 2013, 03:58:40 pm
Speaking of the dwarf manipulator, which I hear and see about the very first time (I vaguely knew of its existence somewhere in its beta stages, but never realized it was finished and released) I do have a question about it:

Would it be possible if it reads out the professions from the raws? It does get the correct creatures sprites using the graphic-raws, but the profession games are vanilla. That is a bit unfitting if your "blowgunner" is actually a "gundwarf" and a "lye maker" is a "chemist".
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on May 05, 2013, 10:30:21 am
so I just finish 2 modifications on companion order  (https://gist.github.com/Rumrusher/5519984)and advfort (https://gist.github.com/Rumrusher/5518662) though companion order script kinda broke on me after I publish this so I need to dive into it some more...
Title: Re: DFHack 0.34.11 r3
Post by: drayath on May 05, 2013, 02:54:03 pm
Maklak, as requested can now provide a filter, though have a look a the 'selected' argument as it may do what you want.
MethMeph ;D, as requested with readme. If adding to masterworks i suggest adding the dfhack.ini file setting with the export:SyndromeReport will write file to the Dwarf Fortress folder which user likely has write permissions to.

Does anyone know if you can add a infomation screen to dwarf fortress (e.g. like the workflow info screen) using ruby script, if so a pointer on where to start would be appreciated.

showunitsyndromes - v7
Fix: Few more formatting issues and spellings.
Enh: Can now provide a regex to filter shown units (see 'filter' help), still need to specifiy the appropiate dwarves/livestock/wildlife/hostile arguments. If you know nothing about regular expressions, see the following quick tips. filter:xxx will show units with xxx anywhere in their name; filter:xxx|yyy will show units with xxx or yyy on their name; filter:^xxx will show units if the name starts with xxx.
Enh: Added usage guide to the comment header.

Full readme
Spoiler (click to show/hide)

showunitsyndromes.rb - V7
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 05, 2013, 02:58:24 pm
Meth
Not even once.

I will have a look, I really like this utilty. :) Especially in a mod with so many syndromes and effects flying around.
Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on May 05, 2013, 03:23:44 pm
Meth
Not even once.

I will have a look, I really like this utilty. :) Especially in a mod with so many syndromes and effects flying around.
Meph, if you can get it working, you might want to consider using the caste-choosing embark plugin for themed embarks.
Title: Re: DFHack 0.34.11 r3
Post by: oxiboost on May 08, 2013, 11:17:02 pm
I have a question regarding DFHack: is there any way to rename a dwarf (as in, first name last name, not the nickname)? If so, how?
Title: Re: DFHack 0.34.11 r3
Post by: Wormsign on May 09, 2013, 04:22:21 am
Greetings!

I decided to download Stonesense after checking out a beautiful screenshots thread, but I'm having an issue.
Typing 'stonesense' in the DFHack command prompt window causes another window (presumably Stonesense) to quickly open then close. DFHack tells me in red text: al_create_display failed

I'm at a loss. The only other utility I use is Lazy Newb Pack. I'm not sure if that would cause problems or not. I tested launching DF on its own and from LNP with the same results. I have not tested any other features of DFHack at this time. Any help would be much appreciated. In exchange for your information, I am prepared to sacrifice this years trade caravan to Armok on your behalf.

Also, I just want to give everyone who has contributed and continues to contribute to this game, my appreciation.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on May 09, 2013, 06:55:20 am
Something on your system is causing incompatibility with stonesense. What OS and specs do you have?
Title: Re: DFHack 0.34.11 r3
Post by: Wormsign on May 09, 2013, 07:29:33 am
Something on your system is causing incompatibility with stonesense. What OS and specs do you have?

Win7 Ultimate 32bit.
Intel Core 2 Duo CPU @ 2.66 GHz and 2.67 GHz - 2 GB Ram.
ATI FireGL V5200 graphics card.
I also use dual monitors if that makes a difference.

Double checked to make sure I downloaded the files for Windows and not the others by mistake. I downloaded the correct ones.

EDIT: Added more specs.
Title: Re: DFHack 0.34.11 r3
Post by: oggimog on May 09, 2013, 12:02:16 pm
Hi, I have a question on the siren lua script. Is it possible to add 'skip drink / eat' to the script? Would be great.
If yes, could someone tell me how this could be done / what thoughts could end this job?

ps: I would have a suggestion for a script that cancles usually uncancleable jobs. That would be really great ;).
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 09, 2013, 02:58:00 pm
Hi, I have a question on the siren lua script. Is it possible to add 'skip drink / eat' to the script? Would be great.
If yes, could someone tell me how this could be done / what thoughts could end this job?

ps: I would have a suggestion for a script that cancles usually uncancleable jobs. That would be really great ;).

I imagine that it could be possible to follow a similar process to the scripts method for cancel sleep/break however I suspect that they will still be hungry/thirst and might just pick it up again.  Secondly, those "jobs" include the use of an item which could complicate things, especially food.
Title: Re: DFHack 0.34.11 r3
Post by: oggimog on May 09, 2013, 03:05:32 pm
Hi, I have a question on the siren lua script. Is it possible to add 'skip drink / eat' to the script? Would be great.
If yes, could someone tell me how this could be done / what thoughts could end this job?

ps: I would have a suggestion for a script that cancles usually uncancleable jobs. That would be really great ;).

I imagine that it could be possible to follow a similar process to the scripts method for cancel sleep/break however I suspect that they will still be hungry/thirst and might just pick it up again.  Secondly, those "jobs" include the use of an item which could complicate things, especially food.

Hmm, ok. The problem that they try to eat something else is ok for me. The problem I have is that they try to eat something out of a minecart, that I can not empty right now. But when it is more complicated then changing 'stop sleap' to 'stop drink', I think it is not worth the effort.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 10, 2013, 02:48:29 am
Hi, I have a question on the siren lua script. Is it possible to add 'skip drink / eat' to the script? Would be great.
If yes, could someone tell me how this could be done / what thoughts could end this job?

ps: I would have a suggestion for a script that cancles usually uncancleable jobs. That would be really great ;).

I imagine that it could be possible to follow a similar process to the scripts method for cancel sleep/break however I suspect that they will still be hungry/thirst and might just pick it up again.  Secondly, those "jobs" include the use of an item which could complicate things, especially food.

Hmm, ok. The problem that they try to eat something else is ok for me. The problem I have is that they try to eat something out of a minecart, that I can not empty right now. But when it is more complicated then changing 'stop sleep' to 'stop drink', I think it is not worth the effort.

yeah, it is annoying when they pick the food/drink waiting to go to the food/drink stockpiles.  Makes me think we need a script/plugin to look for eat/drink jobs and reassign job item by finding an appropriate item in an appropriate stockpile.   Again, effort.
Title: Re: DFHack 0.34.11 r3
Post by: Wormsign on May 10, 2013, 10:58:09 am
Something on your system is causing incompatibility with stonesense. What OS and specs do you have?

Win7 Ultimate 32bit.
Intel Core 2 Duo CPU @ 2.66 GHz and 2.67 GHz - 2 GB Ram.
ATI FireGL V5200 graphics card.
I also use dual monitors if that makes a difference.

Double checked to make sure I downloaded the files for Windows and not the others by mistake. I downloaded the correct ones.

EDIT: Added more specs.

Thought of another bit of info I should have mentioned. Allegro. Before I get the error message DFHack says 'Using allegro version 5.0.5 r1'.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on May 10, 2013, 06:04:53 pm
I'm looking for a thing that I saw somebody using in a topic somewhere.

It shows the overall happiness of your fortress in the border of the game screen, using coloured numbers to show how many dwarves are at each happiness level.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 10, 2013, 06:35:43 pm
Sutremaine: DwarfMonitor.dll, see falconnes utilitiy plugins. http://www.bay12forums.com/smf/index.php?topic=119575.0 (http://www.bay12forums.com/smf/index.php?topic=119575.0)
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on May 11, 2013, 02:53:37 pm
welp, looks like freenode just up and died, is there another way to get access to dfhack chat?
so testing the marry script and found that line 60 can't write field histfig_hf_spousest.anon1 due to it's not found...
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on May 11, 2013, 04:35:04 pm
Sutremaine: DwarfMonitor.dll, see falconnes utilitiy plugins. http://www.bay12forums.com/smf/index.php?topic=119575.0 (http://www.bay12forums.com/smf/index.php?topic=119575.0)
Ooh, that's a nice set of plugins. Thanks.
Title: Re: DFHack 0.34.11 r3
Post by: TDarksword on May 11, 2013, 06:44:57 pm
Is it possible to use DFhack to change which civilisation of a race is your trading partner?
Title: Re: DFHack 0.34.11 r3
Post by: drayath on May 12, 2013, 09:33:00 am
Bug Report:

Registering for the JOB_COMPLETED event seem to behaviour incorrectly for repeated jobs, in that while the job is on repeat the callback method is not called.

Testing with autosyndrome (with some logging added)

Registers with
    EventManager::EventHandler handle(processJob, 5);
    EventManager::registerListener(EventManager::EventType::JOB_COMPLETED, handle, plugin_self);

Print statement as the first line of processJob(...) is only appears to be called when a none-repeating job completes.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 12, 2013, 09:53:57 am
Thanks! I'll fix that for the next version.
Title: Re: DFHack 0.34.11 r3
Post by: drayath on May 12, 2013, 11:16:49 am
While i remeber here are some unk_XXX's that i have identified in the syndrome classes.

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 12, 2013, 12:06:03 pm
This lua script dumps a list of the extracts that the player's civ can bring in trade
Code: (lua script) [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)

printall(my_entity.resources.misc_mat.extracts.mat_type)
print(" ")
printall(my_entity.resources.misc_mat.extracts.mat_index)

Example output:
Spoiler: hidden for length (click to show/hide)

I can't figure out how to:
a) Identify the materials, given the type and index
b) Delete items from the list, to prevent civs from bringing blood, ichor, etc. but allow "nice" extracts such as milk

Ideally, a script would purge all entities in the world from being able to bring blood, ichor, etc.
Title: Re: DFHack 0.34.11 r3
Post by: drayath on May 12, 2013, 12:29:09 pm
Try having a look at the \hack\ruby\material.rb file

Converts a material type and material id to a token (unless you find a better solution might need to either convert it to lua or write your script in ruby)

E.g. material = df.decode_mat(id, type )
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 12, 2013, 01:02:54 pm
Try having a look at the \hack\ruby\material.rb file

Converts a material type and material id to a token (unless you find a better solution might need to either convert it to lua or write your script in ruby)

E.g. material = df.decode_mat(id, type )

OK so now I have my original lua script:
Code: (lua script) [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)

printall(my_entity.resources.misc_mat.extracts.mat_type)
print(" ")
printall(my_entity.resources.misc_mat.extracts.mat_index)

and a ruby script which I manually edit to get the material ID:
Code: [Select]
puts df.decode_mat(422,43)If I use 422,43 I get PLANT_MAT:POD_SWEET:EXTRACT
If I use (43,558) or some of the other (type,index) values from my first list, I get things like CREATURE_MAT:BOBCAT:BLOOD

I don't know ruby (yet), so I don't get how to find and delete all of the BLOOD items.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 12, 2013, 01:17:04 pm
https://github.com/expwnent/dfhack/blob/f92e859f499105abfbb40d008189bc36e88323f5/Readme.rst#mod-interaction

I have (finally) written the documentation for the NEXT version of autoSyndrome/syndromeTrigger. The rules are slightly different from the way they are now, but they make more sense this way and should only require minimal changes. The main changes: boiling temperature is now ignored, you need to have a \AUTO_SYNDROME tag, and instead of \WORKER_ONLY, there's \ALLOW_NONWORKER_TARGETS, which does the opposite of what \WORKER_ONLY did (it makes more sense for worker only to be the default).

The short version: autoSyndrome allows you to instantly attach syndromes to units with custom building reactions. syndromeTrigger lets you trigger commands or do true transformations whenever a unit becomes afflicted with a syndrome, regardless of the cause of the syndrome. It should work whether it's from "natural causes", an interaction, autoSyndrome, and hopefully even for itemsyndrome.

edit: also, both autoSyndrome and syndromeTrigger are disabled by default to help FPS for those who don't need it. It is recommended that if you want to use them you add the following to your dfhack.init file:

Code: [Select]
autoSyndrome enable
syndromeTrigger enable
Title: Re: DFHack 0.34.11 r3
Post by: scriver on May 12, 2013, 02:26:45 pm
So, since I can't find any clear answer anywhere. Is there currently any way to change the number of embarking dwarf with this?
Title: Re: DFHack 0.34.11 r3
Post by: drayath on May 12, 2013, 03:03:30 pm
https://github.com/expwnent/dfhack/blob/f92e859f499105abfbb40d008189bc36e88323f5/Readme.rst#mod-interaction

I have (finally) written the documentation for the NEXT version of autoSyndrome/syndromeTrigger. The rules are slightly different from the way they are now, but they make more sense this way and should only require minimal changes. The main changes: boiling temperature is now ignored, you need to have a \AUTO_SYNDROME tag, and instead of \WORKER_ONLY, there's \ALLOW_NONWORKER_TARGETS, which does the opposite of what \WORKER_ONLY did (it makes more sense for worker only to be the default).

Could i make a request for a tag to:
A) Tell it to not apply the syndrome if it is already present.
B) Tell it to reset the duration on the syndrome if it already exists, rrather than applying a second copy, or using the above option to block it entirly

I am just testing something with the existing code
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 12, 2013, 03:54:13 pm
Sounds simple enough. I can add that.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 12, 2013, 08:46:49 pm
SUCCESS! I managed to make the dwarf caravan come without bringing any blood barrels - actually it only brought alcohol and dwarven syrup since I resized the vector of the extract trade data to 1 and the syrup was the first entry. The data change persists across saving, quitting, and loading the game.

The concept works, but I need a way to only remove the entries that are for BLOOD, ICHOR, and GOO. Maybe there is a way to remove entries and make the list shorter? I know if you set the values in the list to -1, you will get "liquid" barrels.

If this was implemented as a DFHack tweak, it would be irreversible once done, not something you could toggle on and off.
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 13, 2013, 02:51:52 am
I suggest you read this document: https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#material-info-lookup (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#material-info-lookup)
Title: Re: DFHack 0.34.11 r2
Post by: gchristopher on May 13, 2013, 02:55:14 am
Question about makeown:

I used it on a dwarven caravan guard, but he's not listed as a citizen or member of anything (no blue text in his description). I can force him into a squad using DT and he'll follow station orders, but he won't go and train or put on a uniform, or in fact any clothes at all. He was wearing them at one point, but then dropped everything when I forced him into a squad. Removing him from the squad via DT doesn't make him wear anything either.

Is there any way of making him a full member of the fortress, or does makeown only work for making civilians?
I noticed that after tweak makeown, a caravan guard doesn't appear in Dwarf Therapist or in the military squads screen. The guards I was looking at didn't have historical figure entries, but it seems that if I create a minimal entry that associates the guard with the fortress, then they show up in Therapist and the squads screen.

Maybe this will fill in the gaps in behavior for converting caravan guards?

Here's the code to create the historical figure record. I looked at founders and babies for examples. It looks like the majority of the data is optional.
Code: [Select]
function create_hist_fig(unit)
  if unit.flags1.important_historical_figure == true then
    print("Already a historical figure.")
    return
  end
 
  new_fig_id = df.global.hist_figure_next_id

  new_hist_fig = df.historical_figure:new()
  new_hist_fig.profession = unit.profession
  new_hist_fig.race = unit.race
  new_hist_fig.caste = unit.caste
  new_hist_fig.sex = unit.sex
  new_hist_fig.appeared_year = unit.relations.birth_year
  new_hist_fig.born_year = unit.relations.birth_year
  new_hist_fig.born_seconds = unit.relations.birth_time
  new_hist_fig.curse_year = unit.relations.curse_year
  new_hist_fig.curse_seconds = unit.relations.curse_time
  new_hist_fig.anon_1 = unit.relations.anon_2
  new_hist_fig.anon_2 = unit.relations.anon_3
  new_hist_fig.old_year = unit.relations.old_year
  new_hist_fig.old_seconds = unit.relations.old_time
  new_hist_fig.died_year = -1
  new_hist_fig.died_seconds = 1
  new_hist_fig.name:assign(unit.name)
  new_hist_fig.civ_id = unit.civ_id
  new_hist_fig.population_id  = unit.population_id
  new_hist_fig.breed_id = -1
  new_hist_fig.unit_id = unit.id
  new_hist_fig.id = new_fig_id
 
  civ_link = df.histfig_entity_link_memberst:new()
  civ_link.entity_id = df.global.ui.civ_id
  civ_link.link_strength =  100
 
  fort_link = df.histfig_entity_link_memberst:new()
  fort_link.entity_id = df.global.ui.group_id
  fort_link.link_strength =  100
 
  new_hist_fig.entity_links:insert('#', civ_link)
  new_hist_fig.entity_links:insert('#', fort_link)
 
  df.global.world.history.figures:insert('#', new_hist_fig)
  df.global.hist_figure_next_id = df.global.hist_figure_next_id + 1
 
  unit.flags1.important_historical_figure = true
  unit.flags2.important_historical_figure = true
  unit.hist_figure_id = new_fig_id
  unit.hist_figure_id2 = new_fig_id
end

unit = dfhack.gui.getSelectedUnit()
create_hist_fig(unit)

I'm currently testing this for bugs and side-effects. Creating new data is probably pretty dangerous.
Title: Re: DFHack 0.34.11 r2
Post by: ag on May 13, 2013, 03:09:17 am
I'm currently testing this for bugs and side-effects. Creating new data is probably pretty dangerous.

For one, there is a df.global.hist_figure_next_id variable, and you must use that value and properly increment it afterwards. Also, to copy names, you can just do foo.name:assign(bar.name).
Title: Re: DFHack 0.34.11 r2
Post by: gchristopher on May 13, 2013, 03:22:34 am
I'm currently testing this for bugs and side-effects. Creating new data is probably pretty dangerous.

For one, there is a df.global.hist_figure_next_id variable, and you must use that value and properly increment it afterwards. Also, to copy names, you can just do foo.name:assign(bar.name).
Thanks! Making both changes to the original post.

Looks like they also needed to be added to the fortress entity and civilization entity histfig_ids and his_figures lists. Once that is done:

More preliminary testing: they seem to respect labor orders and squads, will put on uniforms and train, and will attack when ordered.

Still failing: they are listed in the nobles screen, but assignments to noble positions don't work yet.
Title: Re: DFHack 0.34.11 r3
Post by: 0x517A5D on May 13, 2013, 12:23:49 pm
So, since I can't find any clear answer anywhere. Is there currently any way to change the number of embarking dwarf with this?

I don't think so.  There is a script (at hack/lua/plugins/dfusion/embark.lua) that looks like it has the capability, but it is not exposed to the user.

If you're comfortable hacking Lua code, you could probably pull the necessary code out of the CustomEmbark:SetEmbarkParty routine in that file.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on May 13, 2013, 02:22:24 pm
or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)
Title: Re: DFHack 0.34.11 r3
Post by: TigerHunter on May 13, 2013, 05:25:55 pm
Hi all. DF freezes my computer every so often (even when I limit the FPS to basically nothing), so I've taken to saving frequently. However, lately it's taken to freezing while I'm in the process of saving, corrupting the save and causing me to lose the game altogether.

To cope with this, I would like to edit DFHack's autosave script to automatically create a backup after the save is complete. Here's the code:
Code: [Select]
-- Makes the game immediately save the state.

if not dfhack.isMapLoaded() then
    qerror("World and map aren't loaded.")
end

local ui_main = df.global.ui.main
local flags4 = df.global.d_init.flags4

local function restore_autobackup()
    if ui_main.autosave_request and dfhack.isMapLoaded() then
        dfhack.timeout(10, 'frames', restore_autobackup)
    else
        flags4.AUTOBACKUP = true
    end
end

-- Request auto-save
ui_main.autosave_request = true

-- And since it will overwrite the backup, disable it temporarily
if flags4.AUTOBACKUP then
    flags4.AUTOBACKUP = false
    restore_autobackup()
end

print 'The game should save the state now.'

I know how to write the backup script in python, so the simplest way to accomplish this would be add in a line of code telling it to run the python interpreter on the .py file after turning autobackup back on. Is this possible? If not, would someone mind explaining the basic steps I would need to go through to make the lua script copy the save folder to a new directory?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 13, 2013, 10:41:37 pm
I suggest you read this document: https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#material-info-lookup (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#material-info-lookup)

Thanks!

Final product:
Code: (blooddel.lua) [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" "
local k=0
local v=1

for x,y in pairs(df.global.world.entities.all) do
my_entity=y
k=0
while k < #my_entity.resources.misc_mat.extracts.mat_index do
v=my_entity.resources.misc_mat.extracts.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.extracts.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="BLOOD") then
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
end
if(sText.material.id=="ICHOR") then
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
end
if(sText.material.id=="GOO") then
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
end
--VENOM
--POISON
--FLUID
--MILK
--EXTRACT

end
k=k+1
end
end

EDIT: for people who haven't been following my recent posts in this thread, the above script prevents all civilizations in the world from bringing blood, ichor, and "liquid" barrels in caravans. If used before embark (at the screen where you choose your site location), it prevents you from being able to embark with barrels of blood, considerably shortening the extracts list. It also shortens the list that you use to request extracts from the liaison.
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on May 14, 2013, 10:31:16 am
Final product:
Code: (blooddel.lua) [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" "
local k=0
local v=1

for x,y in pairs(df.global.world.entities.all) do
my_entity=y
k=0
while k < #my_entity.resources.misc_mat.extracts.mat_index do
v=my_entity.resources.misc_mat.extracts.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.extracts.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="BLOOD") then
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
end
if(sText.material.id=="ICHOR") then
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
end
if(sText.material.id=="GOO") then
my_entity.resources.misc_mat.extracts.mat_type:erase(k)
my_entity.resources.misc_mat.extracts.mat_index:erase(k)
k=k-1
end
--VENOM
--POISON
--FLUID
--MILK
--EXTRACT

end
k=k+1
end
end

EDIT: for people who haven't been following my recent posts in this thread, the above script prevents all civilizations in the world from bringing blood, ichor, and "liquid" barrels in caravans. If used before embark (at the screen where you choose your site location), it prevents you from being able to embark with barrels of blood, considerably shortening the extracts list. It also shortens the list that you use to request extracts from the liaison.

I'm really glad that you're here doing the things that you do. This little snag has ground my gears for so long.
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on May 14, 2013, 01:31:51 pm
I, for one, enjoy adding [EDIBLE_COOKED] to blood and having my dorfs make black pudding.  Of course, YMMV.
Title: Re: DFHack 0.34.11 r3
Post by: 0x517A5D on May 14, 2013, 02:13:08 pm
I've got a dfhack-internals question for peterix or anyone else who knows.

The sample plugin skeleton.cpp has a comment that dfhack console commands are called from a different thread than the main DF thread.

Is this only true of the console commands?  Or do plugin_* run in a different thread?

I assume that vtable hooks must run in DF's main thread, at least.


(I know, I know, I should write test code and figure it out myself.  DFHack is dauntingly complex, and I'm trying to get a handle on how it all fits together.)
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 14, 2013, 06:32:26 pm
I am working on a script to display information about a unit such as birth day (civ members/pets), max age (currently as an average), body size estimate,  milkable, and grazer info.  I have it respecting assumed identities for the birth/age/name and can display animals with/without "Stray".

However, I am having some trouble figuring out how to determine that a unit is supposed to have "Corpse" in the name.  Black Mamba Man Corpse comes out as Black Mamba Man.  Since the zombie looks very similar to vampires in code I don't know what to base the decision to tack on "corpse" to the name/profession.  I am also curious as to how many other name/profession modifications I might need for units such as necromancers, ghosts, demons, clowns, husks, etc

I would also like to show "missing" units as missing with perhaps the time they were reported missing, but I am uncertain if the game records that date.  If it also recorded a last known location I might want to allow centering on that location.

I am also currently trying to print the basic description provided by the caste definition but am finding it difficult to find the printable width of my lua screen / widget so that I can insert appropriate NEWLINE breaks.  I am probably trying to perform that logic in the wrong place (:init of my framed screen class).  I think I ought to break up the info chunks into their own individual widget labels too.

I am currently calling it more-unit-info.lua and binding it to Alt-I but eventually it might be able to duplicate the "thoughts and preferences" screen so maybe another name would be more appropriate.
My Current Draft:
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on May 14, 2013, 06:47:36 pm
The first thing I can think of is that zombies don't have souls.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 14, 2013, 07:13:31 pm
The first thing I can think of is that zombies don't have souls.

The example zombies I have in my fort are from the curious structure in the bottom cavern, and a quick peak shows that they do have a current_soul reference

dfhack.TranslateName( unit ) returns ""
dfhack.units.getProfessionName(unit) returns "Black Mamba Man"
game displays "Black Mamba Man Corpse"

*edit

found a reference in unit.enemy.undead on my "Corpse" zombies and not my vampire so I can use that for now.  I may need to make changes once I get examples for the other types of undead (zombies, husks, murked, reanimated, etc)

also found unit.flags1.zombie .  I don't know how I missed that one before, but strangely these "Corpse" are flags1.zombie == false.

on another note:  unit.flags3.unk21 == missing
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 15, 2013, 04:42:09 am
also found unit.flags1.zombie .  I don't know how I missed that one before, but strangely these "Corpse" are flags1.zombie == false.
on another note:  unit.flags3.unk21 == missing

That zombie flag is obsolete and not used any more. Also, if you mean discovered/not discovered death, it is stored in a completely different object.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on May 15, 2013, 06:22:01 am
How difficult would it be to add an option for the init file for the game and hack windows?  For example - starting the DF window maximised and on top, so that I wouldn't have to shuffle and resize each time but could just get straight into the game. 

I ask because to the pack for newbs in my sig, where an option that makes it clear which window to use first would be rather useful - as part of a general program which includes the LNP gui enabling minimized/maximized launch, the game would fill the screen with soundsense and dfhack minimized.  (utilities can now auto-launch with the latest LNP)

Is this possible?  Not going to happen?  Coming in a specific timeframe?


ps - PTW an awesome tool
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on May 15, 2013, 08:24:37 am
the above script prevents all civilizations in the world from bringing blood, ichor, and "liquid" barrels in caravans. If used before embark (at the screen where you choose your site location), it prevents you from being able to embark with barrels of blood, considerably shortening the extracts list.
How do you use it? I've got blooddel.lua in the plugins folder, but I can't tell if it's done anything because I don't have a trade agreement to look at. I've looked at the lua section of the readme, but while I can run the file I can't do anything with it.
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on May 15, 2013, 10:41:48 am
How do you use it? I've got blooddel.lua in the plugins folder, but I can't tell if it's done anything because I don't have a trade agreement to look at. I've looked at the lua section of the readme, but while I can run the file I can't do anything with it.

No, you put it in the \hack\scripts folder. Then you can run the command "blooddel" while you're hanging around in the site selection screen. If it worked, your embark preparations menu should have nothing but syrup, milk and poison available in the Extracts category.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 15, 2013, 12:06:38 pm
also found unit.flags1.zombie .  I don't know how I missed that one before, but strangely these "Corpse" are flags1.zombie == false.
on another note:  unit.flags3.unk21 == missing

That zombie flag is obsolete and not used any more. Also, if you mean discovered/not discovered death, it is stored in a completely different object.

its good to know that flags1.zombie is obsolete.

As for flags3.unk21, it appears to only be true when a person is missing such as when my miner burned to death channeling a magma hole.  Yes it probably parallels discovered/not discovered death.  At the moment, said miner is the only missing unit in my fort, and is the only unit in units.all that has unk21 == true.

*edit:  i suppose I am jumping to conclusions since it just occurred to me that it might represent being on fire instead

**edit:  setting units on fire didn't do it, at least not right away, but units in the smoke cloud seem to be getting the flag after a time.  Some wounded/bleeding, some not.  Will need to see if the flag gets set when walking through miasma or other cloud
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on May 15, 2013, 01:13:45 pm
If a creature is lost in a cloud of smoke and not seen for X time, are they counted as missing?

Also, the flames are by tissue/object, not the entire entity.  The dorfs in question eventually die of blood loss currently.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on May 15, 2013, 02:31:21 pm
No, you put it in the \hack\scripts folder. Then you can run the command "blooddel" while you're hanging around in the site selection screen.
Cool, thanks.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 15, 2013, 03:29:06 pm
If a creature is lost in a cloud of smoke and not seen for X time, are they counted as missing?

Also, the flames are by tissue/object, not the entire entity.  The dorfs in question eventually die of blood loss currently.

I believe that a unit can only go missing if they die without a witness.  I would like to verify that though.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 16, 2013, 12:19:04 am
OK, so I changed the dwarven civ to only have elves as wagon-pullers by editing the relevant vector, and the caravan just arrived being pulled by elves. I didn't have to give the elves any of the tokens that normally causes this. Other amusing things are probably possible by editing the list of resources that a civilization can bring to your fort.
Title: Re: DFHack 0.34.11 r2
Post by: gchristopher on May 16, 2013, 12:20:05 am
Question about makeown:

I used it on a dwarven caravan guard, but he's not listed as a citizen or member of anything (no blue text in his description). I can force him into a squad using DT and he'll follow station orders, but he won't go and train or put on a uniform, or in fact any clothes at all. He was wearing them at one point, but then dropped everything when I forced him into a squad. Removing him from the squad via DT doesn't make him wear anything either.

Is there any way of making him a full member of the fortress, or does makeown only work for making civilians?
We were trying to make this work over in the ☼Masterwork Succession Fortress: Exultationhexxed☼ (http://www.bay12forums.com/smf/index.php?topic=124444.0) game, because migration never started beyond the hardcoded waves. 

Here's my current attempt to supplement tweak makeown by creating a new historical figure record. It's still clearly incomplete.

Code: [Select]
function find_entity(id)
  for ii = 0,#df.global.world.entities.all - 1 do
    if df.global.world.entities.all[ii].id == id then
      return ii
    end
  end
  return -1
end

function create_hist_fig(unit)
  if unit.flags1.important_historical_figure == true then
    print("Already a historical figure.")
    return
  end
 
  new_fig_id = df.global.hist_figure_next_id

  new_hist_fig = df.historical_figure:new()
  new_hist_fig.profession = unit.profession
  new_hist_fig.race = unit.race
  new_hist_fig.caste = unit.caste
  new_hist_fig.sex = unit.sex
  new_hist_fig.appeared_year = unit.relations.birth_year
  new_hist_fig.born_year = unit.relations.birth_year
  new_hist_fig.born_seconds = unit.relations.birth_time
  new_hist_fig.curse_year = unit.relations.curse_year
  new_hist_fig.curse_seconds = unit.relations.curse_time
  new_hist_fig.anon_1 = unit.relations.anon_2
  new_hist_fig.anon_2 = unit.relations.anon_3
  new_hist_fig.old_year = unit.relations.old_year
  new_hist_fig.old_seconds = unit.relations.old_time
  new_hist_fig.died_year = -1
  new_hist_fig.died_seconds = 1
  new_hist_fig.name:assign(unit.name)
  new_hist_fig.civ_id = unit.civ_id
  new_hist_fig.population_id  = unit.population_id
  new_hist_fig.breed_id = -1
  new_hist_fig.unit_id = unit.id
  new_hist_fig.id = new_fig_id
 
  civ_link = df.histfig_entity_link_memberst:new()
  civ_link.entity_id = df.global.ui.civ_id
  civ_link.link_strength =  100
 
  fort_link = df.histfig_entity_link_memberst:new()
  fort_link.entity_id = df.global.ui.group_id
  fort_link.link_strength =  100
 
  new_hist_fig.entity_links:insert('#', civ_link)
  new_hist_fig.entity_links:insert('#', fort_link)
 
  df.global.world.history.figures:insert('#', new_hist_fig)
  df.global.hist_figure_next_id = df.global.hist_figure_next_id + 1
 
  unit.flags1.important_historical_figure = true
  unit.flags2.important_historical_figure = true
  unit.hist_figure_id = new_fig_id
  unit.hist_figure_id2 = new_fig_id
 
  newhist_loc = df.global.world.history.figures[#df.global.world.history.figures - 1]
 
  df.global.ui.main.fortress_entity.histfig_ids:insert('#', new_fig_id)
  df.global.ui.main.fortress_entity.hist_figures:insert('#', newhist_loc)
 
  civ_index = find_entity(df.global.ui.main.fortress_entity.entity_links[0].target)
  df.global.world.entities.all[civ_index].histfig_ids:insert('#', new_fig_id)
  df.global.world.entities.all[civ_index].hist_figures:insert('#', newhist_loc)
end

unit = dfhack.gui.getSelectedUnit()
create_hist_fig(unit)
The guards, when converted, will:
- show up in Dwarf Therapist (because their histfig's are listed for the fortress entity)
- can set and will obey labor preferences
- claim bedrooms
- have strange moods
- join squads (not lead them)
- equip uniforms and weapons as soldiers
- go to training
- obey squad orders to attack, move, etc.

The game doesn't seem to break, and in particular, it will keep creating more historical entities without complaint. (Thanks, Ag!)

The biggest problem is noble assignments and squad leadership. They show up in the list to be made a noble, but once you exit the window, the position remains unfilled.

I think that's an improvement over just tweak makeown, but doesn't do everything necessary to truly add the dwarf to the fortress.
Title: Re: DFHack 0.34.11 r3
Post by: scriver on May 16, 2013, 04:20:02 am
or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 16, 2013, 09:38:20 pm
There was some interest in a lua script that would make the player's civ (dwarven civ) bring barrels of clean water. This also allows you to embark with barrels of water[5]. Dwarves WON'T drink the water directly from the barrel, so modders have to write a reaction for a workshop (say, the still) which transfers the water from the barrels to buckets. Possibly useful for some harsh embarks.

Code: [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)
my_entity.resources.misc_mat.extracts.mat_type:insert(#my_entity.resources.misc_mat.extracts.mat_type,6)
my_entity.resources.misc_mat.extracts.mat_index:insert(#my_entity.resources.misc_mat.extracts.mat_index,0)

Attempting to embark with barrels of magma didn't work, as all I got were barrels full of cold solid material. It appears that all embark materials appear at room temperature.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 16, 2013, 10:25:43 pm
Urist Da Vinci: I once tried adding poisonous giant mushrooms to the first cavern. You cant distinguish them from the other giant mushroom trees, but when felled they generated an evaporating log that had a slightly-harmful syndrome attached.

In short, cutting mushrooms in the caverns had a little danger attached to it.

The problem I encountered is that the wagon, any wooden embark item, and any wooden caravan item has a chance to consist of this wood. The caravan appears on the map, the wood evaporates, caravans is affected and turns around. Or you wagon deconstructs at embark, same for barrels holding your booze.

Question: Can your script remove this specific wood from a civs embark/trading, so that I can add poisonous mushrooms back into the caverns?
Title: Re: DFHack 0.34.11 r3
Post by: Hommit on May 17, 2013, 08:37:52 am
can someone make script (or point me to tutorial and example) to make hotkey actions on gem stockpile to allow|forbid only certain types of gems according to their value (Ornamental/Semi-Precious/Precious/Rare according to http://dwarffortresswiki.org/index.php/DF2012:Gem) ?
(not really sire if belongs here, point me if i wrong plz, thx)
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 17, 2013, 10:01:36 am
There isn't actually any in-game designation for ornamental/semi/precious/rare - all you have is the material value, which is enough for the stock raws (all ornamental gems are value 2-10, semi-precious are value 15-30, precious are value 40, and rare are value 60).

Those categories actually existed back in the old 2D versions (0.23.130.23a and earlier), where they were used to determine how deep into the mountain they were placed and were also the only way to restrict stockpiling of them (i.e. it was impossible to have a stockpile which only stored rock crystals - no matter what, you would also get turquoises, aventurines, and rose quartzes).
Title: Re: DFHack 0.34.11 r3
Post by: Hommit on May 17, 2013, 12:37:49 pm
So there isn't any easy way to designate stockpile to certain value-types of gems? this is really sucks(
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on May 17, 2013, 01:28:18 pm
Value type, no.  But you can assign only specific precious stones by name.

So, you could have the nice ones go to the stockpile linked to the gem cutting workshop that only allows Skilled and above gem cutters/setters.  Then another stockpile that takes all the crumby gems linked to the "training" gem shop.
Title: Re: DFHack 0.34.11 r3
Post by: Hommit on May 17, 2013, 02:11:32 pm
So, you could have the nice ones go to the stockpile linked to the gem cutting workshop that only allows Skilled and above gem cutters/setters.  Then another stockpile that takes all the crumby gems linked to the "training" gem shop.
That was the idea, yes.. but checking about a hundred of gems, unsorted alphabetically/by value/in any way, in small interface window, for atleast 3 piles... uhhh, no. just no
maybe only rares for artifacts...

hmm... is plugin for sorting gem list by material value possible?
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on May 17, 2013, 02:59:00 pm
hmm... is plugin for sorting gem list by material value possible?

Look at the gem stockpile list. Then open up inorganic_stone_gem.txt. What you should notice is that the list is arranged in the exact same order that they are in the file. Just shuffle them around to your liking and voilà.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 17, 2013, 04:27:54 pm
It probably wouldn't be too difficult to write a script to do it - it would just require iterating across all inorganics, filtering out which ones are gems, and further filtering their "category" according to their value.
Title: Re: DFHack 0.34.11 r3
Post by: drayath on May 17, 2013, 06:52:24 pm
A quick helper script for cleaning up fired ammo.
Useful both for map cleaning, and destroying fired ammo so that workflow will replace it.
Sets all ammo in stack sizes of 1 for dumping and unforbids it. Use 'autodump'/'autodump destroy' afterwards to move/destroy marked ammo.

nb/ If you are using a mod that create a single unit of some special ammo type, this will also get marked for dumping.

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 17, 2013, 07:48:28 pm
Is there anything in this that we can use to force them to put an injured dwarf back in bed or diagnose one?
Title: Re: DFHack 0.34.11 r3
Post by: drayath on May 17, 2013, 09:47:14 pm
crossmr, try the following script. Marks the selected dwarf (main game or unit list) as needing diagnosis and requiring someone to carry them to hospital.

This should force re-diagnosis of an injury and get dwarf to a valid bed, it does nothing special to force an injured dwarf to stay in bed.


Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 18, 2013, 12:49:29 am
crossmr, try the following script. Marks the selected dwarf (main game or unit list) as needing diagnosis and requiring someone to carry them to hospital.

This should force re-diagnosis of an injury and get dwarf to a valid bed, it does nothing special to force an injured dwarf to stay in bed.


Spoiler (click to show/hide)

I've never used a script before... is there a guide somewhere on how to set this up?
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 18, 2013, 01:12:06 am
well I created an injureddwarffix.rb file and pasted that text into it, and selected the dwarf in game, when I try to call the script i just says error loading script. No idea if I'm doing it right though.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 18, 2013, 01:16:19 am
Urist Da Vinci: I once tried adding poisonous giant mushrooms to the first cavern. You cant distinguish them from the other giant mushroom trees, but when felled they generated an evaporating log that had a slightly-harmful syndrome attached.

In short, cutting mushrooms in the caverns had a little danger attached to it.

The problem I encountered is that the wagon, any wooden embark item, and any wooden caravan item has a chance to consist of this wood. The caravan appears on the map, the wood evaporates, caravans is affected and turns around. Or you wagon deconstructs at embark, same for barrels holding your booze.

Question: Can your script remove this specific wood from a civs embark/trading, so that I can add poisonous mushrooms back into the caverns?

Yep. The following script will allow you to SEE what wood that the player's civ can bring:
Code: [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)

for k,v in pairs(my_entity.resources.organic.wood.mat_type) do
sText=dfhack.matinfo.decode(v,my_entity.resources.organic.wood.mat_index[k])
print(sText)

if (sText==nil) then
--print("nil")
else
--print("OK")
print(sText.plant.id)
end
end

FAKEEDIT: It's a bit more complicated.
Can't just purge the wood type - that only prevents them from bringing logs (and the embark wagon itself), training weapons, trap components, toys, instruments, and tools. Presumably also wood armor for elves.

Have to also seperately find and drop the wood from the crafts, barrels, buckets, splints, and crutches. Will take a few more minutes to code.

EDIT:

Remove the dreaded CEDAR trees from all spots that I could find in the resources of all civs in the world! Do a text replace if you want to target another tree type. Run the script before embark if you don't want a 2% chance of the embark wagon exploding in poison gas.
Code: [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" "
local k=0
local v=1

for x,y in pairs(df.global.world.entities.all) do
my_entity=y

k=0
while k < #my_entity.resources.organic.wood.mat_index do
v=my_entity.resources.organic.wood.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.organic.wood.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.crafts.mat_index do
v=my_entity.resources.misc_mat.crafts.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.crafts.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.barrels.mat_index do
v=my_entity.resources.misc_mat.barrels.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.barrels.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.wood2.mat_index do
v=my_entity.resources.misc_mat.wood2.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.wood2.mat_index[k])
if (sText==nil) then
--LIQUID wood2
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.cages.mat_index do
v=my_entity.resources.misc_mat.cages.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.cages.mat_index[k])
if (sText==nil) then
--LIQUID cages
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="CEDAR") then
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end


end
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 18, 2013, 03:59:38 am
As it was, 8 months after he was last worked on, someone finally put him back in a bed and he got his dressing, but he still needs 6 immobilizations.
would still like to know how to make this script work though.
Title: Re: DFHack 0.34.11 r3
Post by: scriver on May 18, 2013, 05:23:48 am
or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.

Got it working fine, so thanks again. Is there ant particular reason this isn't already in the... Program, or whatever you call it? And would anyone mind if I added this information to the wiki page so more people can see it?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on May 18, 2013, 06:29:45 am
or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.

Got it working fine, so thanks again. Is there ant particular reason this isn't already in the... Program, or whatever you call it? And would anyone mind if I added this information to the wiki page so more people can see it?
It's in the next release of it (i think).
Title: Re: DFHack 0.34.11 r3
Post by: drayath on May 18, 2013, 10:30:00 am
Paste the text in to a notepad, save it to \dfhack\scripts\medic.rb
Added some error checking that you actually have a dwarf selected as not doing so would have given an error.


# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 18, 2013, 10:45:59 am
Paste the text in to a notepad, save it to \dfhack\scripts\medic.rb
Added some error checking that you actually have a dwarf selected as not doing so would have given an error.


# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end
Trying this now...
I'm still getting the same error. I put medic.rb in the directory, and then I type: script medic
and I get:
"error loading script"
I unzipped DFHack and copied all the files into my dwarf fortress directory.
anything else I need to do?

Not just this, all scripts. I tried script drybuckets and it also failed.
Title: Re: DFHack 0.34.11 r3
Post by: 0x517A5D on May 18, 2013, 06:16:39 pm
Paste the text in to a notepad, save it to \dfhack\scripts\medic.rb
Added some error checking that you actually have a dwarf selected as not doing so would have given an error.


# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end
Trying this now...
I'm still getting the same error. I put medic.rb in the directory, and then I type: script medic
and I get:
"error loading script"
I unzipped DFHack and copied all the files into my dwarf fortress directory.
anything else I need to do?

Not just this, all scripts. I tried script drybuckets and it also failed.

The script command isn't what you use to run ruby or lua scripts.  It's confusing, I know.  script is only for running console commands in a kind of batch mode.

To run a ruby or lua script, put the script in the hack/scripts/ directory (I think you've done this) and just type the script name, without the .rb or .lua extension.

So just type medic at the dfhack command prompt.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 18, 2013, 06:56:40 pm
Paste the text in to a notepad, save it to \dfhack\scripts\medic.rb
Added some error checking that you actually have a dwarf selected as not doing so would have given an error.


# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end
Trying this now...
I'm still getting the same error. I put medic.rb in the directory, and then I type: script medic
and I get:
"error loading script"
I unzipped DFHack and copied all the files into my dwarf fortress directory.
anything else I need to do?

Not just this, all scripts. I tried script drybuckets and it also failed.

The script command isn't what you use to run ruby or lua scripts.  It's confusing, I know.  script is only for running console commands in a kind of batch mode.

To run a ruby or lua script, put the script in the hack/scripts/ directory (I think you've done this) and just type the script name, without the .rb or .lua extension.

So just type medic at the dfhack command prompt.

That's a good start. Is there a way to force them to get treated?
That dwarf is too injured to do anything.. He's got red body parts, he actually has open wounds.. but when I mark him needing a doctor, he just runs out of the hospital (as fast as he can hobble)

I also had a migrant show up, at the edge of the map, with no red body parts, but having sustained major injury, with a bruised lower spine. He blinks all the time and moves extremely slow.. I tagged him for needing a medic but nada...
okay well I tagged him multiple times and this time he stayed in bed and got diagnosed for cleaning..but they don't seem to want to do anything about the smashed open bones.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 19, 2013, 04:11:38 am
So I ran the merchant and diplomat fix on my fort.. just for curiousity mostly.. i thought it'd be nice to make trade agreements with the humans (no lignite/bit coal on my map) and I was curious about the elf diplomat...but.. since i've done that.. i haven't seen a single caravan. It's been like a year in game. Would either of these changes do anything like that? Mind you.. the last couple of caravans got slaughtered..
not my fault. The game still insists on spawning 99% of sieges and caravans at the same time. There is usually no chance at all to save them unless you're sitting right on top of them with 25 lord level dwarves.

Title: Re: DFHack 0.34.11 r3
Post by: bennerman on May 19, 2013, 11:49:34 am
What's the command to add a foreign or wild unit to your fort?

Edit: I'm playing an orc fortress mod. Could I, for example, create an ogre, or really strong orc in arena control with "mode set" and then add it to my fort? I want it to be like a peasant, not like a tame animal, so it can do work and join the army
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 19, 2013, 07:20:19 pm
Is there a way to remove all wounds from a dwarf and return him to perfect health?
I've got a migrant, who showed up at the edge of the map with a bruised spine. Somehow he got in a fight off map.
Despite sending him to the hospital they can do nothing, and after a couple years, he's not healing on his own.
Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on May 19, 2013, 07:25:10 pm
Is there a way to remove all wounds from a dwarf and return him to perfect health?
I've got a migrant, who showed up at the edge of the map with a bruised spine. Somehow he got in a fight off map.
Despite sending him to the hospital they can do nothing, and after a couple years, he's not healing on his own.
Without cheating? No.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on May 19, 2013, 07:31:52 pm
You're in the dfhack topic, tahujdt.
Title: Re: DFHack 0.34.11 r3
Post by: tahujdt on May 19, 2013, 07:36:04 pm
You're in the dfhack topic, tahujdt.
For some reason, I though this was 'What's going on in your fort?' Sorry.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on May 20, 2013, 07:48:28 am
Just starting using r3 and found two plugins that were loading themselves without being asked, automaterial and autosyndrome.

I removed them from /hack to stop that, but I was wondering if there were any other plugins/scripts setup to run without explicit invocation?
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 20, 2013, 08:51:17 am
Define explicit invocation.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on May 20, 2013, 10:17:12 am
Define explicit invocation.
I type something in the console window, like 'automaterial 1', to turn that feature on.  Instead of it turning itself on at startup.

Nevermind anyway, I've just pulled all the plugins except the few I use.  Problem solved.
Title: Re: DFHack 0.34.11 r3
Post by: bennerman on May 20, 2013, 11:03:00 am
What's the command to add a foreign or wild unit to your fort?

Edit: I'm playing an orc fortress mod. Could I, for example, create an ogre, or really strong orc in arena control with "mode set" and then add it to my fort? I want it to be like a peasant, not like a tame animal, so it can do work and join the army

Anyone? :c

Gunna get attacked eventually. could really use those ogres xP
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 20, 2013, 11:31:20 am
There's essentially no reason that those two would be a problem, but we changed it a few months ago so that in the next version, everything should be off by default.
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 20, 2013, 12:07:56 pm
I type something in the console window, like 'automaterial 1', to turn that feature on.  Instead of it turning itself on at startup.

That's not appropriate for instance for some things like autosyndrome or steam engine, which provide functionality to support enhanced raws. A steam engine workshop without plugin support behaves wrongly in a very unintuitive way. What they should be doing (and steam engine actually does) is check once on world load if there is anything in the raws for them, and if not, do absolutely nothing until another world is loaded.

It is also silly to clutter up the command list just so that something can be enabled or disabled, so maybe we need a centralized enable command that can contact the relevant plugin. There is also an issue that users don't read readme, so authors of things like LNP or mod packs are quite likely to include a config file that enables everything anyway.

Regarding automaterial, since falconne initially distributes his plugins separately, they tend to assume that if they are installed, the user surely wants them to be active, even if they aren't just adding something rather non-intrusive like a hotkey to activate dwarf manipulator in the unit list screen, or even search prompts.

Eventually, the most basic problem is there is no viable universal configuration system in dfhack, and every plugin has to implement its controls individually as it sees fit; and developers tend to assume that everybody wants their thing. :)
Title: Re: DFHack 0.34.11 r3
Post by: leafar on May 20, 2013, 03:44:47 pm
in the latest version of the masterwork-mod some skillnames have been changed within the executable, however this feature wasn't provided for linux - which i am using
now i've applied these changes on the linux-executable myself
starting df normally it runs fine, but using dfhack it crashes with a segmentation fault (with and without plugins - the stderr.log seems fine, though)
???

what could be the problem?
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 20, 2013, 05:20:28 pm
I guess my question got lost,
does anyone have a script to totally heal a dwarf or remove all wounds as it were?
Title: Re: DFHack 0.34.11 r3
Post by: Andux on May 20, 2013, 07:05:36 pm
I guess my question got lost,
does anyone have a script to totally heal a dwarf or remove all wounds as it were?

Code: (healunit.lua) [Select]
-- Repairs all health issues except for syndromes and severed limbs.
local unit=dfhack.gui.getSelectedUnit()
if unit then
print("Erasing wounds...")
while #unit.body.wounds > 0 do
unit.body.wounds:erase(#unit.body.wounds-1)
end
unit.body.wound_next_id=1

print("Refilling blood...")
unit.body.blood_count=unit.body.blood_max

print("Resetting status flags...")
unit.status2.able_stand_impair=unit.status2.able_stand
unit.status2.able_grasp_impair=unit.status2.able_grasp

unit.flags2.has_breaks=false
unit.flags2.gutted=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.flags2.breathing_good=true
unit.flags2.breathing_problem=false

unit.flags2.calculated_nerves=false
unit.flags2.calculated_bodyparts=false

print("Resetting counters...")
unit.counters.winded=0
unit.counters.stunned=0
unit.counters.unconscious=0
unit.counters.webbed=0
unit.counters.pain=0
unit.counters.nausea=0
unit.counters.dizziness=0

unit.counters2.paralysis=0
unit.counters2.fever=0
unit.counters2.exhaustion=0
unit.counters2.hunger_timer=0
unit.counters2.thirst_timer=0
unit.counters2.sleepiness_timer=0
unit.counters2.vomit_timeout=0

end

I probably need to update that for r3.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 20, 2013, 07:21:47 pm
I guess my question got lost,
does anyone have a script to totally heal a dwarf or remove all wounds as it were?

I don't know where I got it from but I have a heal script.  I thought it came preinstalled with dfhack but maybe that was an older version.  Looking at the zip I can't seem to find it.  Also, I had to fix a couple of lines to be compatible with dfhack r3.  It won't restore lost limbs, but here it is:  hack/scripts/heal.lua

Fake edit: my heal.lua is Andux's healunit.lua (he posted while I was composing) but I have updated my copy for r3.  If I remember correctly the only changes I made to it were  unit.status2.limbs_stand_count=unit.status2.limbs_stand_max and unit.status2.limbs_grasp_count=unit.status2.limbs_grasp_max

Code: [Select]
-- Repairs all health issues except for syndromes and severed limbs.
local unit=dfhack.gui.getSelectedUnit()
if unit then
print("Erasing wounds...")
while #unit.body.wounds > 0 do
unit.body.wounds:erase(#unit.body.wounds-1)
end
unit.body.wound_next_id=1

print("Refilling blood...")
unit.body.blood_count=unit.body.blood_max

print("Resetting status flags...")
unit.status2.limbs_stand_count=unit.status2.limbs_stand_max
unit.status2.limbs_grasp_count=unit.status2.limbs_grasp_max

unit.flags2.has_breaks=false
unit.flags2.gutted=false
unit.flags2.circulatory_spray=false
unit.flags2.vision_good=true
unit.flags2.vision_damaged=false
unit.flags2.vision_missing=false
unit.flags2.breathing_good=true
unit.flags2.breathing_problem=false

unit.flags2.calculated_nerves=false
unit.flags2.calculated_bodyparts=false

print("Resetting counters...")
unit.counters.winded=0
unit.counters.stunned=0
unit.counters.unconscious=0
unit.counters.webbed=0
unit.counters.pain=0
unit.counters.nausea=0
unit.counters.dizziness=0

unit.counters2.paralysis=0
unit.counters2.fever=0
unit.counters2.exhaustion=0
unit.counters2.hunger_timer=0
unit.counters2.thirst_timer=0
unit.counters2.sleepiness_timer=0
unit.counters2.vomit_timeout=0

end

The other script I have is for resurrecting or restoring lost limbs, name it what you like (heal2.lua or resurrect.lua or whatever):
Code: [Select]
-- Resurrect and/or restore lost limbs
function heal2()
unit = dfhack.gui.getSelectedUnit()
unit.flags1.dead = false
unit.flags2.killed = false
if unit.caste == 0 then
unit.caste = 1
else
unit.caste = 0
end
end
heal2()

Title: Re: DFHack 0.34.11 r3
Post by: Roses on May 20, 2013, 07:33:56 pm
Is it possible to change a dwarf's skill level using DFHack? I seem to remember a utility that could in the past, but don't remember if it was this
Title: Re: DFHack 0.34.11 r3
Post by: Worryn on May 20, 2013, 08:46:13 pm
What's the command to add a foreign or wild unit to your fort?

Edit: I'm playing an orc fortress mod. Could I, for example, create an ogre, or really strong orc in arena control with "mode set" and then add it to my fort? I want it to be like a peasant, not like a tame animal, so it can do work and join the army

Anyone? :c

Gunna get attacked eventually. could really use those ogres xP

Your current race is tracked. i.e. if your play orcs you can only have orcs but for military purposes you can create blank squad entries then use gm-editor to change the tame creature's squad reference then just order the squad around currently i haven't found a way to make them do actual work. it seems "Tame" is a job priority that is set rather high. hope this was helpful
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on May 20, 2013, 09:16:30 pm
in the latest version of the masterwork-mod some skillnames have been changed within the executable, however this feature wasn't provided for linux - which i am using
now i've applied these changes on the linux-executable myself
starting df normally it runs fine, but using dfhack it crashes with a segmentation fault (with and without plugins - the stderr.log seems fine, though)
???

what could be the problem?
https://github.com/peterix/dfhack/blob/master/Readme.rst#id9
You need to add <md5-hash value="..."/> to symbols.xml (use md5 dwarfort.exe to determine it).
Also, I've found segfaults occur most often when you change the length of the skill name - using an abbreviated version with the same number of letters should work (I'm not entirely sure why this doesn't crash on Windows).
Title: Re: DFHack 0.34.11 r3
Post by: breadman on May 20, 2013, 11:17:30 pm
Is there a convenient way to determine whether a given item can be stored in a given stockpile?  The canStoreItem virtual method on buildings looks tempting, but always returns false for stockpiles.

I could reverse engineer from stockpile settings and item properties, but that's more work than I really want to put in for this use case.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 21, 2013, 03:35:38 am
thanks guys I'll try that script, but exactly which command is it that removes infection?
I just cleaned up a unit, because he for some silly reason (the one who had weird healthcare issues) was treated several times but left with like 3 or 4 infections. I wouldn't mind just cleaning those up but leaving old scars or things like that.

Title: Re: DFHack 0.34.11 r3
Post by: Telgin on May 21, 2013, 07:40:41 am
That heal2 script should fix infections.  It abuses the way werecreatures are handled by the game and makes the game think your dwarf is currently suffering from a werecurse that has expired.  They transform back instantaneously and any health problems are immediately resolved.  There's no actual werecurse or lasting harm from doing it though.  The only caution that I'd provide is unless I'm imagining things, it can cause the physical attributes of the dwarf to be rerolled.  When I was screwing around with doing that manually, I believe I saw the physical attributes of a soldier (who was very strong and tough at the time) be rerolled into something worse after I applied it.

Other than abusing werecurses, I'm not sure if infections are stored in the wounds vector or not.  One of the healing scripts shown earlier had a section for erasing wounds in the wounds vector, and if infections are stored there that should in theory remove them if you put just that snippet in a script file.  It would remove all wounds though, aside from presumably severed limbs if I recall a comment in the script.  Not sure if it affects scars.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on May 21, 2013, 07:41:44 am
hmm doesn't Dfusion have a heal script you can use?
Title: Re: DFHack 0.34.11 r3
Post by: leafar on May 21, 2013, 12:52:19 pm
You need to add <md5-hash value="..."/> to symbols.xml (use md5 dwarfort.exe to determine it).
Quote
the stderr.log seems fine
means in particular no 'wrong md5-sum' error, as i changed it accordingly

Quote
Also, I've found segfaults occur most often when you change the length of the skill name - using an abbreviated version with the same number of letters should work (I'm not entirely sure why this doesn't crash on Windows).
Quote
starting df normally it runs fine
as i haven't changed any string's length (if the replacement was shorter i padded zero-bytes)

so that's not it :(
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 21, 2013, 01:47:57 pm
Be warned that editing strings in the Linux version of DF can potentially have "interesting" results due to GCC's method of string optimization, where strings that overlap at the end get combined - for example, "Object" would be treated as 11 characters into "Melt Metal Object", so changing "Melt Metal Object" to "Melt Something" would cause "Object" to become "ing".
Title: Re: DFHack 0.34.11 r3
Post by: breadman on May 21, 2013, 01:51:20 pm
Quote
Also, I've found segfaults occur most often when you change the length of the skill name - using an abbreviated version with the same number of letters should work (I'm not entirely sure why this doesn't crash on Windows).
Quote
starting df normally it runs fine
as i haven't changed any string's length (if the replacement was shorter i padded zero-bytes)

so that's not it :(

Does padding with spaces work?
Title: Re: DFHack 0.34.11 r3
Post by: InsanityPrelude on May 21, 2013, 02:41:40 pm
I tried to run DFHack with the patched .exe from Modest Mod (since the readme mentioned binary patches that aren't included with DFHack), but DF crashed on startup. Should I assume DFHack isn't compatible with Modest Mod, or am I doing something wrong?


Edit: Also, if I use binpatch through the client rather than binpatch.exe, are the patches applied permanently or do I need to run the command again every time I start DF? I'm sorry if this sounds like a total noob question, but I wasn't totally clear after reading the readme.

Edit 2: I wasn't able to replicate the crash. Guess I don't have to choose between sets of bugfixes after all. :)
Title: Re: DFHack 0.34.11 r3
Post by: leafar on May 21, 2013, 02:46:56 pm
Quote
Does padding with spaces work?
it's the same: works fine without dfhack, crashes with it
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 21, 2013, 03:02:38 pm
Maybe if you run it as "./dfhack -g" the backtrace for the crash would contain something useful.

Also, if I use binpatch through the client rather than binpatch.exe, are the patches applied permanently or do I need to run the command again every time I start DF?

You do need to rerun the binpatch script after restart; the most reasonable way to do that is to use dfhack.init.
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on May 21, 2013, 03:12:40 pm
You need to add <md5-hash value="..."/> to symbols.xml (use md5 dwarfort.exe to determine it).
Quote
the stderr.log seems fine
means in particular no 'wrong md5-sum' error, as i changed it accordingly

Quote
Also, I've found segfaults occur most often when you change the length of the skill name - using an abbreviated version with the same number of letters should work (I'm not entirely sure why this doesn't crash on Windows).
Quote
starting df normally it runs fine
as i haven't changed any string's length (if the replacement was shorter i padded zero-bytes)

so that's not it :(

Oh, I thought stderr.log was from DF, not dfhack. Oops.
I guess this isn't what I thought it was... :( something similar to this happened to me when I was editing the executable, but it crashed even when I ran DF normally.
Out of curiosity, what hex editor do you use?
Title: Re: DFHack 0.34.11 r3
Post by: leafar on May 21, 2013, 03:22:50 pm
well i ran it with -g option:
Spoiler (click to show/hide)
not quite sure what this tells me, though

Quote
Out of curiosity, what hex editor do you use?
i normally use GHex, but for this i did write a python script
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 21, 2013, 03:44:17 pm
Code: [Select]
0xf7bfa3bd in DFHack::Core::doUpdate(DFHack::color_ostream&, bool) () from ./hack/libdfhack.so
not quite sure what this tells me, though

Well, it says that it crashes somewhere here:

https://github.com/peterix/dfhack/blob/master/library/Core.cpp#L1149 (https://github.com/peterix/dfhack/blob/master/library/Core.cpp#L1149)

Which is rather hard to explain unless perhaps you added that md5 tag to the data for the wrong version of df - there are several in symbols.xml.
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on May 21, 2013, 03:54:52 pm
I tried editing it again and didn't get a crash... weird.
Those errors definitely seem to be a dfhack problem, like ag pointed out, rather than a problem with the executable. Maybe reinstalling dfhack would help, but I can't be certain :(

On a related note, have you tried running this specific dfhack installation with the vanilla executable? If that fails as well, it's likely a dfhack-related problem and not a problem with your patch.
Title: Re: DFHack 0.34.11 r3
Post by: leafar on May 22, 2013, 01:40:05 am
Quote
Which is rather hard to explain unless perhaps you added that md5 tag to the data for the wrong version of df - there are several in symbols.xml.
:o

that was it! thank you!
i didn't notice there were different entries...
Title: Re: DFHack 0.34.11 r3
Post by: ORCACommander on May 22, 2013, 12:09:30 pm
does anyone have a problem with revflood crashing dwarf fortress? i tried to use it to reveal the complete lay out of my caverns on a 5x5 embark using ironhand graphics. Only thing i can think of is it is somehow triggering the ram limit.
Title: Re: DFHack 0.34.11 r3
Post by: Hommit on May 22, 2013, 02:07:47 pm
hmm... is plugin for sorting gem list by material value possible?

Look at the gem stockpile list. Then open up inorganic_stone_gem.txt. What you should notice is that the list is arranged in the exact same order that they are in the file. Just shuffle them around to your liking and voilà.

so, i did just that
but for whatever reason it completely wrecked worldgen.
no ores and aquifers at all in whole world, and when test embark, some tiles is flashing. on mouse hover, they show very fast cycling of all gems
file: http://rghost.ru/private/46189159/5c61bfde8908d607643faadc228b5270
any idea wtf?
(probably belongs to modding, but...)
up: hm, if backup file was in the same folder, will it conflict with original one?
Title: Re: DFHack 0.34.11 r3
Post by: drayath on May 22, 2013, 02:28:50 pm
Yes, duplicate raws (file duplicates or single entry duplicates) are the modders version of !FUN!  ;)
Title: Re: DFHack 0.34.11 r3
Post by: ash88 on May 22, 2013, 03:04:02 pm
tl;dr problem: Queen isn't a dwarf - anything I can do?

Hey guys - I'm bummed out because I made my best fortress ever, and the queen showed up, and it is a drow elf.  I'm using masterworkDF.  Anyways, as you know I can't assign them rooms if they aren't dwarves (bug #4611 - in vanilla it's the same thing with Goblins ), and they don't show up in Dwarf Therapist... etc.  They are just running around outside... fortunately the siege-ers haven't found them yet...

Is there some way to change the race of a unit?  If I did this would my noble become room-assignable and DwarfTherapist viewable?  I'm willing to try something messy and extreme.

I'm hoping I don't have to abandon for such a un-satisfying reason.  This fortress really is my best ever.  Might have to start randomly digging down and find a FUN-NER conclusion to Mountainhome Gloombitch...

Cheers.
Title: Re: DFHack 0.34.11 r3
Post by: ORCACommander on May 22, 2013, 03:38:12 pm
there is an lua script that can designate monarchs:

hack\scripts\make-monarch.lua

I think to work it just hit k select a dorf and run the script
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on May 23, 2013, 06:54:44 am
tl;dr problem: Queen isn't a dwarf - anything I can do?

Hey guys - I'm bummed out because I made my best fortress ever, and the queen showed up, and it is a drow elf.  I'm using masterworkDF.  Anyways, as you know I can't assign them rooms if they aren't dwarves (bug #4611 - in vanilla it's the same thing with Goblins ), and they don't show up in Dwarf Therapist... etc.  They are just running around outside... fortunately the siege-ers haven't found them yet...

Is there some way to change the race of a unit?  If I did this would my noble become room-assignable and DwarfTherapist viewable?  I'm willing to try something messy and extreme.

I'm hoping I don't have to abandon for such a un-satisfying reason.  This fortress really is my best ever.  Might have to start randomly digging down and find a FUN-NER conclusion to Mountainhome Gloombitch...

Cheers.
you got yourself a DROW Cacame.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 23, 2013, 08:48:21 am
Reading all this about adding caravan guards to your fort, and changing the race of nobles got me thinking:

Animal men can learn.
Animal men can be bought in caravans.
Animal men can't do labor... could this be fixed?

It would be nice if races could buy other minor races (goblin buy trolls for example, or undeads buy skeletons) that can do labor in the fort. Any sort of automated script possible, to make them civ-members?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on May 23, 2013, 09:55:57 am
Reading all this about adding caravan guards to your fort, and changing the race of nobles got me thinking:

Animal men can learn.
Animal men can be bought in caravans.
Animal men can't do labor... could this be fixed?

It would be nice if races could buy other minor races (goblin buy trolls for example, or undeads buy skeletons) that can do labor in the fort. Any sort of automated script possible, to make them civ-members?
There are two ways to "fix" them not doing labors: 1) -not recommended- dfusion friendship. This hacks the code to fool df into thinking that your main race is multiple races and thus citizens can be anything. 2) start a script that assigns jobs (or replaces dwarf jos) to animal men. Example here: https://gist.github.com/warmist/5636653 Best used with onReactionComplete + custom reaction (e.g. immigration office?). Note: script is not perfect. It does not check burrows and general reachability, but the general idea is simple.
Title: Re: DFHack 0.34.11 r3
Post by: Tierre on May 23, 2013, 01:32:01 pm
what is the essential list of commands you always start then playing? In init and manually? I add
binpatch armorstand-capacity
binpatch custom-reagent-size
binpatch deconstruct-heapfall
binpatch deconstruct-teleport
binpatch hospital-overstocking
binpatch training-ammo
binpatch weaponrack-unassign

keybinding add Alt-V digv
keybinding add Alt-O "liquids-here"
keybinding add Alt-Q "changeitem q 5"
keybinding add Alt-C "clean all"
keybinding add Alt-S "sort-units"
to Init file and use

fixmerchants
fixdiplomats

on embark.

I was thinking of making a script to turn on after loading a game with all the tweak fixes and all but i wanted input on those commands as i am afraid i don;t know them all.
Title: Re: DFHack 0.34.11 r3
Post by: peterix on May 23, 2013, 02:12:03 pm
I've got a dfhack-internals question for peterix or anyone else who knows.

The sample plugin skeleton.cpp has a comment that dfhack console commands are called from a different thread than the main DF thread.

Is this only true of the console commands?  Or do plugin_* run in a different thread?

I assume that vtable hooks must run in DF's main thread, at least.


(I know, I know, I should write test code and figure it out myself.  DFHack is dauntingly complex, and I'm trying to get a handle on how it all fits together.)

I guess you already found out yourself, but I'll reply anyway, just in case :)

There are several threads in DF with DFHack installed. The main simulation thread, the graphics thread, DFHack console thread and DFHack hotkey thread (just waits for hotkey events). A plugin can potentially have code that runs in any and all of them.

Commands need to acquire a lock to work with the game data, which is unlocked every time the game updates (see CoreSuspender and Core::Suspend). The lock has a queue/stack of condition variables that keeps track of all the plugins/threads which requested a suspend. Those are woken up as soon as the simulation thread is in a safe spot (onUpdate()).

Plugins can have callback functions that get called when a particular event happens/is detected. This is called from onUpdate and in turn, from the simulation thread.

So, you could easily have any number of threads and synchronize with the game by using Core::Suspend or the much nicer, CoreSuspender object :)
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 23, 2013, 02:49:08 pm
Plugins can have callback functions that get called when a particular event happens/is detected. This is called from onUpdate and in turn, from the simulation thread.

So, you could easily have any number of threads and synchronize with the game by using Core::Suspend or the much nicer, CoreSuspender object :)

One additional detail related to vmethod hooks: Normally the CoreSuspender lock is recursive, i.e. suspending again from a nested function call is safe. This applies to methods like plugin_onupdate, etc. However, since vmethod hooks are usually called directly by DF code, they implicitly have full right to access game data because of that, but the bookkeeping for the lock isn't properly updated, and CoreSuspender would deadlock. Therefore, if a vmethod hook needs to call something that uses CoreSuspender, it should use a special CoreSuspendClaimer object, which updates the bookkeeping info to officially declare that implicit lock ownership.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on May 23, 2013, 02:59:34 pm
Another random idea: make gui scriptlets for selecting units, items, buildings, etc... and then sort-of standartize scripts to accept parameters from them. Sort of like you have a script that makes a creature immortal then using gui would be as simple as gui.dialogs.unitSelect(immortal) (ofc it will have more parameters, like what is acceptable what is not...), also some chaining to allow selecting two units (e.g. makes one unit follow/ride the other), maybe a unit and a few items?

The script itself could accept some generic parameter pack (e.g. selected={units={unit1,unit2,...}, items={item1,item2,...}, syndromes={},...} and then the rest parameters.
This way it would be more modular, and gui friendly.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on May 23, 2013, 05:57:50 pm
What's the hack to stop migrants bringing their entire extended families with them? I just lost a fort to starvation due to getting flooded with useless kids on the first wave.
Title: Re: DFHack 0.34.11 r3
Post by: ash88 on May 23, 2013, 10:28:49 pm
there is an lua script that can designate monarchs:

hack\scripts\make-monarch.lua

I think to work it just hit k select a dorf and run the script

Yes!  Worked like a charm.  Thanks ORCAACommander!

The citizens of Gloombitch overthrow their evil Drow leaders and reestablish a true Dwarven blood monarchy.  They have survived! .... for now.  (MWHAhaahahahhahhahhahaahah)
Title: Re: DFHack 0.34.11 r3
Post by: ORCACommander on May 24, 2013, 12:14:07 am
kinda want to see the legend entry for that :P

so no one has any idea why revflood is crashing me df?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 24, 2013, 06:15:11 am
Warmist: I could download the script, make a lua, add a "start/enable scriptname" and then call it by running a reaction in a workshop, using /COMMAND and SCRIPTNAME in the syn classes, while having an animal person pastured on the workshop... but would it work? Anything else I would have to do?

Unrelated, here another question: Would this work? I renamed the steam engine, dont know if the script can still find it or not.

Code: [Select]
[REACTION:STOKE_BOILER_KOBOLD]
[NAME:Produce steam power]
[BUILDING:STEAM_ENGINE_KOBOLD:CUSTOM_S]
[SKILL:OPERATE_PUMP]
Dimension is the number of days it can produce 100 power * 100.
I.e. with 2000 it means energy of 1 job = 1 water wheel for 20 days.
[PRODUCT:100:1:LIQUID_MISC:NONE:WATER][PRODUCT_DIMENSION:2000]
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on May 24, 2013, 07:50:44 am
Warmist: I could download the script, make a lua, add a "start/enable scriptname" and then call it by running a reaction in a workshop, using /COMMAND and SCRIPTNAME in the syn classes, while having an animal person pastured on the workshop... but would it work? Anything else I would have to do?
Obviously you will need to modify the script a bit (now it has fixed race). There is no need for start/enable scriptname, you should be able to use /COMMAND SCRIPTNAME to do it. Also no need to pasture animal men, it searches through all (your) units and replaces dwarf jobs with another worker.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on May 24, 2013, 08:06:46 am
What's the hack to stop migrants bringing their entire extended families with them? I just lost a fort to starvation due to getting flooded with useless kids on the first wave.

The only command for this sort of thing that I know about is fix/population-cap.  That just immediately applies your ini file's pop cap though.  Is there really a command that prevents dwarves bringing family members?
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on May 24, 2013, 10:19:40 am
I haven't seen such a family oriented hack if it exists.  Sounds like a job for the DAS!!!!!
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 24, 2013, 10:57:50 am
DAS?
Title: Re: DFHack 0.34.11 r3
Post by: ORCACommander on May 24, 2013, 11:02:54 am
well confirmed my problem was because df ran out of ram. use a large address aware exe to fix
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 24, 2013, 11:07:24 am
Smaller world sizes can help a lot with RAM usage and save/load time.
Title: Re: DFHack 0.34.11 r3
Post by: snakesoul on May 24, 2013, 11:11:25 am
In adventure mode, anyway of getting a pick with dfhack?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 24, 2013, 11:18:23 am
In adventure mode, anyway of getting a pick with dfhack?

Might be helpful:

https://github.com/peterix/dfhack#createitem
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on May 24, 2013, 01:15:48 pm
D.A.S. = Dwarven Atom Smasher

Dwarves were harnessing sub-atomic physics before harnessing sub-atomic physics was sexy.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on May 24, 2013, 02:00:34 pm
Is there a way I can teleport all my livestock to their pasture? They were there for the longest time, but suddenly they'd decided to come to the dining hall to starve to death.
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on May 24, 2013, 02:48:16 pm
Sounds like your pasture zone(s) got messed with.

You could FastDwarf and then your little beardies would teleport them to their newly assigned home once they got the job assignment.  I think it still works to instantaneously move even with the Pasture Large Animal job active.  Also, I'm not sure how high priority Pasture Large Animal is.  Mind you, I haven't tried this, as I don't use FastDwarf.  Do haulers move boulders, heavy furnitue, caged GSW's etc. instantly under FastDwarf?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 24, 2013, 03:04:32 pm
When fastdwarf is in teleportation mode, dwarves will teleport unless they're doing something special like escorting a prisoner/animal or following someone. Unless there's a subtle bug we don't know about.

They do have to be able to path to the target location, of course, and normal pathfinding still happens so it won't help your fps directly.
Title: Re: DFHack 0.34.11 r3
Post by: Aaarrgh! on May 24, 2013, 03:09:15 pm
(dfhack-0.34.11-r3-Linux)
Speaking of fastdwarf... I had this problem a few months ago, but I was burning out on DF at the time anyway so I didn't chase it. When I enable fast dwarf (with fastdwarf 1 1), the game crashes citing a segmentation fault. I've overwritten the folder with a local copy of DF, and a fresh download of DFHack, and it still occurs.  This doesn't happen on the Windows version, any ideas?

EDIT: Specifically...
Code: [Select]
[DFHack]# fastdwarf 1 1
Current state: fast = 1, teleport = 1.
[DFHack]# Segmentation fault (core dumped)
                                          -e
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on May 24, 2013, 04:53:03 pm
They have a wide open path, they're just stupid.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on May 24, 2013, 06:25:32 pm
How would I paint an empty space in tiletypes? "Paint shape EMPTY" just clears all the stuff off of the tile, without changing it's shape. I'm trying to clear ramps from a magma area but all this does is clear the magma.

EDIT:Sorry for double post
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on May 24, 2013, 07:28:04 pm
Just designate the ramps for removal normally and purge them instantly with deramp.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on May 24, 2013, 07:43:11 pm
That would leave a floor behind, though, supporting the section I'm trying to drop. But anyway, I figured out how:

It's "paint mat air", then "paint shape empty"

The game doesn't update the gravity, though, so to get it to fall I had to make some lava above it with liquids, and some water above that lava to make a block which would fall.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 24, 2013, 09:35:39 pm
@warmist: So dfhack would slap jobs on them, instead of just having them choose themselves, acording to their skills?

Curiously enough, fishing works as it is. An animal person with intelligent and natural skill in fishing will go and fish. If they lack hands they will spam "too injured to fish", but otherwise it works fine. Hunting doesnt seem to work though, sadly. That would have been awesome.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on May 25, 2013, 12:39:56 am
@warmist: So dfhack would slap jobs on them, instead of just having them choose themselves, acording to their skills?

Curiously enough, fishing works as it is. An animal person with intelligent and natural skill in fishing will go and fish. If they lack hands they will spam "too injured to fish", but otherwise it works fine. Hunting doesnt seem to work though, sadly. That would have been awesome.
hunting is just setting them to attack random animals then carting their corpses to the stock pile.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 25, 2013, 12:47:59 am
What do you mean by this? I'd be happy if they would actually roam the countryside and do that, but intelligent pets with natural hunting skill just sit around, doing nothing...
Title: Re: DFHack 0.34.11 r3
Post by: ORCACommander on May 25, 2013, 01:03:05 am
you have to assign them to a dwarf. iirc its under the labors section
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 25, 2013, 01:30:29 am
I am not speaking of animals trained for hunting as "TRAINABLE_HUNTER", I was speaking about INTELLIGENT pets with skill in hunting. They should go hunting by themselves, not with a hunter. Thats the point. ;)

The fisher gremlins I did work. :) But Troll-Haulers or Gnome Engineers would be nice ;)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on May 25, 2013, 01:48:58 am
@warmist: So dfhack would slap jobs on them, instead of just having them choose themselves, acording to their skills?
Yes. It would do that. Adding skill checks is possible, but this mimics more of the "vanilla" df behaviour. Meaning that any dwarf will do any job (if it's enabled). Feel free to improve though (like adding check for enabled jobs).
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 25, 2013, 02:27:13 am
Improve... haha. As if I'd understand the code you posted ;) Maybe I ask Putnam one fine day, otherwise I'll let this rest for now.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on May 25, 2013, 05:16:16 am
Anyone know the syntax for unassigning from cages with the zone plugin?

Currently I've tried
Code: [Select]
zone unassign all own egglayer minage 1
zone unassign all own egglayer
zone unassign all own
zone unassign all
zone unassign
zone unassign count 5 own egglayer minage 1
With the cage 'zone set', with the cage built, with the cage not built.  It just kicks me to the prompt and ignores me.

I am confused. Assigning to cages and zones is working fine.  But now I've got 400 peafowl I need to get back out.

Best I can do is assign them to a zone then delete the zone, but I'm wondering how unassign is supposed to work.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 25, 2013, 05:59:01 am
Anyone know the syntax for unassigning from cages with the zone plugin?

Currently I've tried
Code: [Select]
zone unassign all own egglayer minage 1
zone unassign all own egglayer
zone unassign all own
zone unassign all
zone unassign
zone unassign count 5 own egglayer minage 1
With the cage 'zone set', with the cage built, with the cage not built.  It just kicks me to the prompt and ignores me.

I am confused. Assigning to cages and zones is working fine.  But now I've got 400 peafowl I need to get back out.

it looks like unassign does not support built cages. nor does assign search built cages ... so deconstruct the cage then with a pen/pasture with at least one creature do

Code: [Select]
zone set
zone assign count 5 own race BIRD_PEAFOWL_BLUE caged female egglayer minage 1

or something like that, with your choice of count or all
Title: Re: DFHack 0.34.11 r3
Post by: Tierre on May 25, 2013, 07:19:28 am
Hmmm.... How can i change a number of dwarves in r3 DFhack? I can't find this function anymore:(
Also i thought there was a script or a tool to force caravan and migration events?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 25, 2013, 07:50:39 am
Hmmm.... How can i change a number of dwarves in r3 DFhack? I can't find this function anymore:(
Also i thought there was a script or a tool to force caravan and migration events?
http://www.bay12forums.com/smf/index.php?topic=91166.msg4244960#msg4244960

(dfhack-0.34.11-r3-Linux)
Speaking of fastdwarf... I had this problem a few months ago, but I was burning out on DF at the time anyway so I didn't chase it. When I enable fast dwarf (with fastdwarf 1 1), the game crashes citing a segmentation fault. I've overwritten the folder with a local copy of DF, and a fresh download of DFHack, and it still occurs.  This doesn't happen on the Windows version, any ideas?

EDIT: Specifically...
Code: [Select]
[DFHack]# fastdwarf 1 1
Current state: fast = 1, teleport = 1.
[DFHack]# Segmentation fault (core dumped)
                                          -e

I'll look into it. What else can you find out about the crash? Is it just with teleport mode on?
Title: Re: DFHack 0.34.11 r3
Post by: Aaarrgh! on May 25, 2013, 09:00:17 am
Hmmm.... How can i change a number of dwarves in r3 DFhack? I can't find this function anymore:(
Also i thought there was a script or a tool to force caravan and migration events?
http://www.bay12forums.com/smf/index.php?topic=91166.msg4244960#msg4244960

(dfhack-0.34.11-r3-Linux)
Speaking of fastdwarf... I had this problem a few months ago, but I was burning out on DF at the time anyway so I didn't chase it. When I enable fast dwarf (with fastdwarf 1 1), the game crashes citing a segmentation fault. I've overwritten the folder with a local copy of DF, and a fresh download of DFHack, and it still occurs.  This doesn't happen on the Windows version, any ideas?

EDIT: Specifically...
Code: [Select]
[DFHack]# fastdwarf 1 1
Current state: fast = 1, teleport = 1.
[DFHack]# Segmentation fault (core dumped)
                                          -e

I'll look into it. What else can you find out about the crash? Is it just with teleport mode on?
Fast will keep it going for a few seconds, but teleport crashes it instantly, with the same error messages.
EDIT: The same thing just happened with autodump. Hang on, I'll try some other DFHack tools.
EDIT2: Spawned several blocks of 7/7 water to deal with a forest fire problem (that was immediately replaced by an enormous flooding problem). The same thing happened - as normal, then seg fault. I'll try creating a new world now.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 25, 2013, 10:17:58 am
I just looked at it, and I fixed a different problem, but I really can't see how a segfault could happen there. Maybe someone else can.
Title: Re: DFHack 0.34.11 r3
Post by: Aaarrgh! on May 25, 2013, 11:07:03 am
I just looked at it, and I fixed a different problem, but I really can't see how a segfault could happen there. Maybe someone else can.
Well, you did your best. Any idea what that -e flag is?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 25, 2013, 01:28:22 pm
I think that just always happens when DFHack crashes.
Title: Re: DFHack 0.34.11 r3
Post by: Hugo_The_Dwarf on May 25, 2013, 02:07:21 pm
How hard would it be to create a lua script that goes through all the fortress members, finds their gender, and assigns their profession name to Male/Female. And a reverse script that would remove the Male/Female profession names leaving them to DF choosing?

Thought it would be an easier way to figure out who to put in the army (males in army, females out) because I don't want to lose children brought into battle.
Title: Re: DFHack 0.34.11 r3
Post by: vjek on May 25, 2013, 02:24:44 pm
How hard would it be to create a lua script that goes through all the fortress members, finds their gender, and assigns their profession name to Male/Female. And a reverse script that would remove the Male/Female profession names leaving them to DF choosing?

Thought it would be an easier way to figure out who to put in the army (males in army, females out) because I don't want to lose children brought into battle.
In Dwarf Therapist you can Group By: Sex, for Labors and/or Military.  This is an easy way to see who qualifies or who has been drafted so far.  The script shouldn't be too hard, just pointing this out in case it meets your needs already.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 25, 2013, 10:04:56 pm
Hugo, you dont need dfhack for that, you can do that in the raws, with caste_profession names. :) Just add the (male)(female) inside the profession names for the male and female castes. :)
Title: Re: DFHack 0.34.11 r3
Post by: Hugo_The_Dwarf on May 25, 2013, 10:56:59 pm
Hugo, you dont need dfhack for that, you can do that in the raws, with caste_profession names. :) Just add the (male)(female) inside the profession names for the male and female castes. :)
true but that is alot of extra work for aprox. 65 lines of code of CASTE_PROFFESSION_NAME:sing:plur x2 for male/female then xN for the different types of castes I have :P saddly I don't have my special utility setup for arrays yet, so all that copy pasta :P

would be easier if a script can go through all the current units and change profession to MALE/FEMALE and a script to reverse it lol
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 25, 2013, 11:01:58 pm
Hehe, true. Maybe try out Blast, that fancy modding helper tool. ;)

And I'd like to repeat my question: If I renamde the STEAM_ENGINE to STEAM_ENGINE_KOBOLD and the name of it to Steam Generator, can dfhack still find it? Will the renamed steam engine still work?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on May 25, 2013, 11:19:25 pm
Yeah, I think so.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 25, 2013, 11:41:25 pm
Hehe, true. Maybe try out Blast, that fancy modding helper tool. ;)

And I'd like to repeat my question: If I renamde the STEAM_ENGINE to STEAM_ENGINE_KOBOLD and the name of it to Steam Generator, can dfhack still find it? Will the renamed steam engine still work?

The dfhack readme says
Quote
The steam-engine plugin detects custom workshops with STEAM_ENGINE in their token, and turns them into real steam engines.

so.. I think it is saying STEAM_ENGINE_KOBOLD should work as it starts with the requisite STEAM_ENGINE.  The wording suggests that KOBOLD_STEAM_ENGINE should work too.  Naming it Steam Generator should be fine.  Someone will probably have to test the token id to be sure.

* Looking at the CPP code, it looks like the wording is correct in that if STEAM_ENGINE is in the token (start, end, in the middle, with or without underscores before/after, where ever) it should be detected.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 25, 2013, 11:52:12 pm
Thank you :)
Title: Re: DFHack 0.34.11 r3
Post by: whitecold on May 26, 2013, 12:58:38 am
Hi, I have two different problems with DFhack:

The first is regarding the steam engine, I have built a magma-powered one, when I stroke the boiler, the water appears and the little gears on the engine turn, but I can't tap that power. I built 4 gears right beside the ones of the engine, and they won't turn, and there is no other load currently.
Second is regarding stonesense, somehow when I'm in the stonesense window all keyboard input still goes to DF, so I can't toggle anything.

I'm using the mac version, anyone can help me?
Title: Re: DFHack 0.34.11 r3
Post by: Rose on May 26, 2013, 01:07:17 am
The mac stonesense keybinds not working is a known issue. Don't really know hot to fix it either.
Title: Re: DFHack 0.34.11 r3
Post by: whitecold on May 27, 2013, 12:24:11 am
Thanks for the answer,

Anyone can help with the engines? I have a huge room with a ton of engines, I really don't want to redesign the whole thing to water reactors.
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 27, 2013, 01:55:35 am
Did you build the connecting axles and/or gears after the engine, as it says in the readme in big letters?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 27, 2013, 02:18:57 pm
Thanks for the answer,

Anyone can help with the engines? I have a huge room with a ton of engines, I really don't want to redesign the whole thing to water reactors.

I have been having...

Yes, I built the gear boxes after the magma steam engine, yes they had enough water/magma.  I had some  partial success by replacing one of the two engine on the gearbox with a normal engine (and then replacing the gearbox).  I was surprised that that allowed the magma version to transfer power too.

What seems to have ultimately worked for me was building the magma engines with iron components (rather than the copper components I was using)

So.. it seems to me that there is a minor bug in the steam engine plugin that either doesn't allow magma steam engines built with copper unsafe materials to provide power during their short lifespan, or that allows them to generate power when a normal steam engine activates the gear.
Title: Re: DFHack 0.34.11 r3
Post by: CriticallyAshamed on May 28, 2013, 01:20:44 am
Is there any way to make DF slaughter only animals of a certain fatness/muscle? I'm trying to reduce the number of Skinny/Weak pigs and dogs I have but the autobutcher command seems to just remove everything based on age. Is it possible to do this? Failing that, am I correct in imagining that
      unit.flags2.slaughter=true
will allow me to alttab between hack and df and put my cursor over the units I want gone rather than checking via the unit list, v, c then slaughter?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 28, 2013, 02:13:12 am
Is there any way to make DF slaughter only animals of a certain fatness/muscle? I'm trying to reduce the number of Skinny/Weak pigs and dogs I have but the autobutcher command seems to just remove everything based on age. Is it possible to do this? Failing that, am I correct in imagining that
      unit.flags2.slaughter=true
will allow me to alttab between hack and df and put my cursor over the units I want gone rather than checking via the unit list, v, c then slaughter?

Yes, unit.flags2.slaughter=true marks the unit for slaughter and the dwarfs will go ahead and take the job.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on May 28, 2013, 07:29:20 am
It should be simple in principle.  I haven't yet figured out how to have a plugin / script fire an event automatically periodically (or however plugins like autobutcher work), but you should be able to modify autobutcher to create a new plugin that did this.  The most straightforward way I can think of is to check for a threshold on their strength and body fat level.  I believe strength is under unit.body.physical_attrs.strength.value, and fat levels are under unit.body or unit.health somewhere.  I don't have DFHack open at the moment and don't have time to check the df-structures Github.

You'll probably have to toy with the numbers to get the effect you want.  Any strength < 1000 is going to be weak on some level, but I can't remember the fat level numbers.  They range much higher typically, if memory serves.
Title: Re: DFHack 0.34.11 r3
Post by: Crashmaster on May 28, 2013, 12:15:29 pm
When painting trees and shrubs with the tiletypes tool I only get generic trees and shrubs which can be felled or gathered but give no logs or plants. Is there a syntax to define the specific plant material? I can make the trees dead and tried messing with the varients but no luck.

eg. ??  paint sh tree, paint m plant:oak   ??
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on May 28, 2013, 01:45:55 pm
Making a script to tag peafowl for slaughter that are big enough to yield bones.  This is what I got so far.

Code: (slaughter.lua) [Select]
local this = dfhack.gui.getSelectedUnit()
if this.body.blood_max >= 282 then
this.flags2.slaughter = true
end
print(this.body.blood_max)
Code: [Select]
keybinding add Shift-B slaughter
Works fine.  Put the cursor on a dude, big B, if it's large enough, it's tagged.  The actual number is between 285 and 280.  I'm still refining it, just waiting on the next generation to grow up.

My question is, does anyone know when animals grow?  It's been like 3 or 4 months I think and all the remaining birds are stuck at their current size.

Do I have to take them out of a cage for them to grow?  Or does the grow event only fire twice a year or something?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 28, 2013, 03:45:55 pm
When painting trees and shrubs with the tiletypes tool I only get generic trees and shrubs which can be felled or gathered but give no logs or plants. Is there a syntax to define the specific plant material? I can make the trees dead and tried messing with the varients but no luck.

eg. ??  paint sh tree, paint m plant:oak   ??
No, there is not, because the tree/shrub type is stored in a completely different object which needs to be created separately, and the tiletypes tool doesn't do any of that for you.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 28, 2013, 05:04:12 pm
Making a script to tag peafowl for slaughter that are big enough to yield bones.  This is what I got so far.

Code: (slaughter.lua) [Select]
local this = dfhack.gui.getSelectedUnit()
if this.body.blood_max >= 282 then
this.flags2.slaughter = true
end
print(this.body.blood_max)
Code: [Select]
keybinding add Shift-B slaughter
Works fine.  Put the cursor on a dude, big B, if it's large enough, it's tagged.  The actual number is between 285 and 280.  I'm still refining it, just waiting on the next generation to grow up.

My question is, does anyone know when animals grow?  It's been like 3 or 4 months I think and all the remaining birds are stuck at their current size.

Do I have to take them out of a cage for them to grow?  Or does the grow event only fire twice a year or something?

In the script I have been working on, I have been estimating body size based on age and the creature caste body growth scale followed by the height, width, and length body modifiers.  I hadn't noticed that my results for adults closely match (often equal) blood max.  For babies and children though it varies quite a bit, even to the point that my two babies have a greater blood max than many of my children. 

I am inclined to think that perhaps blood_max is not a reliable metric and that it recalculated at need rather than on any particular recurring schedule.

*edit trying to use a pressure plate to see if blood_max would change (induce an update to blood_max) on the premise that blood_max had a relationship to body size, did not have any effect on animals (I would have tested on my dwarf kids but I can't pasture them).  Manualy modified blood_max stayed modified.  I did take the opportunity to use the pressure plate to measure the effectiveness of my body size calculation.  Although I think the plates should work on weight rather than body size, resources suggest body size is the pressure plate trigger for creatures.  For the 2 critters I tested:
Code: [Select]
(blood_max)   (~body size)   (plate trigger size)
8                  61                8                            buck rabbit
2808             1006             3257                       wild boar piglet
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on May 28, 2013, 05:58:45 pm
Did the dfhack for version 34.07 have support for lua scripts?
Title: Re: DFHack 0.34.11 r3
Post by: CriticallyAshamed on May 28, 2013, 08:47:49 pm
Despite my best intentions to be good at this sort of thing (and work in the field..) I am very inexperienced with code. So far I've devised this but I know it's wrong.

unit=dfhack.gui.getSelectedUnit()
if unit.body.physical_attrs.STRENGTH.value<1200 then
unit.flags2.slaughter=true
else print('unit is not weak')
end

As it is just slaughtering everything. Also, my intentions are to do a global check ala Autobutcher rather than selectedunit. For now, crawling before walking and such. Can someone explain what's wrong here?
Title: Re: DFHack 0.34.11 r3
Post by: ORCACommander on May 28, 2013, 08:53:32 pm
Did the dfhack for version 34.07 have support for lua scripts?

yep it can do LUA.
Title: Re: DFHack 0.34.11 r3
Post by: jthill on May 28, 2013, 09:22:13 pm
it is just slaughtering everything ... Can someone explain what's wrong here?
Perhaps rather than testing the attributes, print them.
Title: Re: DFHack 0.34.11 r3
Post by: CriticallyAshamed on May 28, 2013, 09:47:24 pm
it is just slaughtering everything ... Can someone explain what's wrong here?
Perhaps rather than testing the attributes, print them.

Eugh. Such a good idea. Thank you. I should've thought of this...

Okay. Turns out it's fine, just most units are under 1200 strength unless "muscular". A fat horse is 1186 whilst a muscular peachick is 1400ish. I think I'll just make it check for either muscular OR fat and then kill off units that are neither.
Title: Re: DFHack 0.34.11 r3
Post by: Wynflaed on May 28, 2013, 11:50:05 pm
I'm using the DFHack that comes with the latest version of Masterwork Dwarf Fortress.  Anyway, DFusion seems to be bugged.  I can't use the 1st option, and keep getting this error:

Spoiler (click to show/hide)

What on earth is going on here?

(I'm aiming to use DFusion to increase my embark dwarfs for the good of my megaproject, but I can't even get this far...)
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 29, 2013, 12:03:34 am
continuing with my pressure plate as a scale tests I found that the pp creature trigger uses unit.body.physical_attr_tissues.STRENGTH (changing this value changes when the pp triggers).  I also noticed that unit.body.physical_attr_tissues.AGILITY seems to always equal blood_max, unless I manually change either of them.

Is physical_attr_tissues linked to a wrong enum?   Does anyone remember why it is named physical_attr_tissues?


Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 29, 2013, 12:14:14 am
I'm using the DFHack that comes with the latest version of Masterwork Dwarf Fortress.  Anyway, DFusion seems to be bugged.  I can't use the 1st option, and keep getting this error:

Spoiler (click to show/hide)

What on earth is going on here?

(I'm aiming to use DFusion to increase my embark dwarfs for the good of my megaproject, but I can't even get this far...)

I am uncertain as to what you are trying to do with dfusion there but changing the number of embark dwarfs is currently broken, but according to these previous posts, Warmist posted a script for expanding the number of dwarfs at embark that should be going into the next version.


or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.

Got it working fine, so thanks again. Is there ant particular reason this isn't already in the... Program, or whatever you call it? And would anyone mind if I added this information to the wiki page so more people can see it?
It's in the next release of it (i think).
Title: Re: DFHack 0.34.11 r3
Post by: whitecold on May 29, 2013, 12:29:51 am
Thanks for the answer,

Anyone can help with the engines? I have a huge room with a ton of engines, I really don't want to redesign the whole thing to water reactors.

I have been having...

Yes, I built the gear boxes after the magma steam engine, yes they had enough water/magma.  I had some  partial success by replacing one of the two engine on the gearbox with a normal engine (and then replacing the gearbox).  I was surprised that that allowed the magma version to transfer power too.

What seems to have ultimately worked for me was building the magma engines with iron components (rather than the copper components I was using)

So.. it seems to me that there is a minor bug in the steam engine plugin that either doesn't allow magma steam engines built with copper unsafe materials to provide power during their short lifespan, or that allows them to generate power when a normal steam engine activates the gear.

Thanks, this worked, all-iron steam engines provide the necessary power, could someone maybe make a note in the dfhack readme as the engine itself looks as if its working with unsafe materials but doesn't provide power.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on May 29, 2013, 01:06:26 am
Did the dfhack for version 34.07 have support for lua scripts?

yep it can do LUA.

Well, I need to figure out how to get Putnam's itransmission into 34.07, due to a glitch with a surface monster teleporting into the caverns.
Title: Re: DFHack 0.34.11 r3
Post by: Clatch on May 29, 2013, 01:27:02 am
Holy cow!  Behind the game here.  I'm running DFHack on a Mac without an emulator.  That's a development.  Awesome work.

Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 30, 2013, 04:35:56 am
So, just lost a dwarf to a strange mood..wanted shells.. I couldn't figure out how to spawn them, seems you can't spawn body parts. I've got a few turtles running around my fort now, but the fishers won't take them from there.
So I couldn't generate a shell in time..
so two questions:
1 - Is it possible to generate a shell in any way?
2 - Is there a script to fix an insane dwarf? (in this case melancholy)

If we have maps without anything to fish and caravans can't bring shells.. we at least need a fighting chance.

Title: Re: DFHack 0.34.11 r3
Post by: ORCACommander on May 30, 2013, 10:48:54 am
the slayrace script might have worked if you had a turtle highlighted. the turtle would then be brought to the refuse pile and from there to the fishery
Title: Re: DFHack 0.34.11 r3
Post by: Wynflaed on May 30, 2013, 11:21:43 am
I'm using the DFHack that comes with the latest version of Masterwork Dwarf Fortress.  Anyway, DFusion seems to be bugged.  I can't use the 1st option, and keep getting this error:

Spoiler (click to show/hide)

What on earth is going on here?

(I'm aiming to use DFusion to increase my embark dwarfs for the good of my megaproject, but I can't even get this far...)

I am uncertain as to what you are trying to do with dfusion there but changing the number of embark dwarfs is currently broken, but according to these previous posts, Warmist posted a script for expanding the number of dwarfs at embark that should be going into the next version.


or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.

Got it working fine, so thanks again. Is there ant particular reason this isn't already in the... Program, or whatever you call it? And would anyone mind if I added this information to the wiki page so more people can see it?
It's in the next release of it (i think).

Thanks so much.  I'll try that script and see if it works. 

What I was trying to do with DFusion was just press 1.  As in, I open dwarf fortress/dfhack.  I type "dfusion" and the three-item menu pops up.  I type "1" and I get the error I posted.  No idea why.

EDIT: Can't get it to work.  I always get this error:
Code: [Select]
E: Runtime Error: ./hack/scripts/startdwarf.rb:5: too low
./hack/scripts/startdwarf.rb:5
(eval):2:in `load'
(eval):2
(eval):2:in `catch'
(eval):2
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on May 30, 2013, 01:14:16 pm
I'm using the DFHack that comes with the latest version of Masterwork Dwarf Fortress.  Anyway, DFusion seems to be bugged.  I can't use the 1st option, and keep getting this error:

Spoiler (click to show/hide)

What on earth is going on here?

(I'm aiming to use DFusion to increase my embark dwarfs for the good of my megaproject, but I can't even get this far...)

I am uncertain as to what you are trying to do with dfusion there but changing the number of embark dwarfs is currently broken, but according to these previous posts, Warmist posted a script for expanding the number of dwarfs at embark that should be going into the next version.


or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.

Got it working fine, so thanks again. Is there ant particular reason this isn't already in the... Program, or whatever you call it? And would anyone mind if I added this information to the wiki page so more people can see it?
It's in the next release of it (i think).

Thanks so much.  I'll try that script and see if it works. 

What I was trying to do with DFusion was just press 1.  As in, I open dwarf fortress/dfhack.  I type "dfusion" and the three-item menu pops up.  I type "1" and I get the error I posted.  No idea why.
oh that's because run save script wasn't really fixed. though I have no idea what that option is used for, though it isn't the embark script or embark anywhere script.
Title: Re: DFHack 0.34.11 r3
Post by: whitecold on May 30, 2013, 02:22:17 pm
So I thought I found out what caused my steam engine problems. However they still seem to make problems. one works now without a hitch, but then I hooked up the others, and they refuse to generate power. They are all iron with basalt blocks, gears attached to the north of the engines, like the first one, but these one refuse to work. Can anyone help me?
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 30, 2013, 03:09:33 pm
Did you actually build the gears after the engines? And by build I mean actually have them be completed by the dwarves after the engine, not just designate them to be constructed in that order.

Btw, with gears toggling them with a lever may work as good as deconstructing and rebuilding them from the point of view of connecting to engines. You basically want to force the gear to recompute what it's connected to against an already existing engine, not the other way around, because one of those two possible checks can be hooked, and the other direction cannot.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on May 30, 2013, 03:25:30 pm
I really, really need to know how to teleport a monster, who's supposed to be on the surface, back up from the caverns. In adventure mode. In 34.07.

Or, how to prevent them spawning in the caverns when I enter their lair. Would setting  the caverns back to "not discovered" work? How would I do that?
Title: Re: DFHack 0.34.11 r3
Post by: Wynflaed on May 30, 2013, 03:43:28 pm
oh that's because run save script wasn't really fixed. though I have no idea what that option is used for, though it isn't the embark script or embark anywhere script.

D'oh!  Just typing "embark" gave me an "offset not found" error, so I assumed I had to do it from within dfusion.  And previous guides said to press "1" (although the menu they were talking about seems to have been veeeery different indeed), so that's what I was doing. 
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 30, 2013, 05:59:02 pm
So, just lost a dwarf to a strange mood..wanted shells.. I couldn't figure out how to spawn them, seems you can't spawn body parts. I've got a few turtles running around my fort now, but the fishers won't take them from there.
So I couldn't generate a shell in time..
so two questions:
1 - Is it possible to generate a shell in any way?
2 - Is there a script to fix an insane dwarf? (in this case melancholy)

If we have maps without anything to fish and caravans can't bring shells.. we at least need a fighting chance.

What I have done in the past is add [SHELL] to HORN_TEMPLATE , HOOF_TEMPLATE and CHITIN_TEMPLATE in material_template_default.txt .  If applied mid game, reload and then butcher a new animal.

I suppose that if you wanted to, you can pick a body part item and change material_amount.shell to be greater than 0 or equal to stack size (I am not sure that is enough for it to work though).

What I intend to do in the future for shells is to use a domestic creature mod that adds a shelled creature that can be butchered for its shell and perhaps used for other things.

As for fixing a dwarf who is melancholy, you could try setting unit.mood = -1
Code: (remove_mood) [Select]
dfhack.gui.getSelectedUnit().mood = -1
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 30, 2013, 07:17:50 pm
the slayrace script might have worked if you had a turtle highlighted. the turtle would then be brought to the refuse pile and from there to the fishery

Will they do that? I thought the turtles needed to be taken live?
What's the conditions for catching a turtle? Must they be in/near the water? There are no fish on the map, so the fishers don't even seem to go to the water. If they went there, I could have spawned the turtles so they'd be around the water.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 30, 2013, 07:43:04 pm
If you really need to create a shell, here's a method that should work:

1. use the (v)iew cursor and select a unit
2. createitem FISH_RAW POND_TURTLE:MALE
3. process it at a fishery
Title: Re: DFHack 0.34.11 r3
Post by: dagger on May 30, 2013, 08:33:30 pm
or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.

Got it working fine, so thanks again. Is there ant particular reason this isn't already in the... Program, or whatever you call it? And would anyone mind if I added this information to the wiki page so more people can see it?

Hi,

How did you get it working?
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 30, 2013, 08:53:01 pm
If you really need to create a shell, here's a method that should work:

1. use the (v)iew cursor and select a unit
2. createitem FISH_RAW POND_TURTLE:MALE
3. process it at a fishery

I did that, the turtles just ran around. None of the fishery workers would grab them.
Even with all labours enabled.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 30, 2013, 10:56:28 pm
If the turtles were running around, then you created a vermin, not a raw fish...
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 31, 2013, 12:17:22 am
Making a script to tag peafowl for slaughter that are big enough to yield bones.  This is what I got so far.

Code: (slaughter.lua) [Select]
local this = dfhack.gui.getSelectedUnit()
if this.body.blood_max >= 282 then
this.flags2.slaughter = true
end
print(this.body.blood_max)
Code: [Select]
keybinding add Shift-B slaughter
Works fine.  Put the cursor on a dude, big B, if it's large enough, it's tagged.  The actual number is between 285 and 280.  I'm still refining it, just waiting on the next generation to grow up.

My question is, does anyone know when animals grow?  It's been like 3 or 4 months I think and all the remaining birds are stuck at their current size.

Do I have to take them out of a cage for them to grow?  Or does the grow event only fire twice a year or something?

I have done some more testing with this and so far my findings are that animals don't grow.  Over the course of a year an a half with blue peafowl hatching and coming of age, they remained at their birth size.  The value body.physical_attr_tissues[1] controlled the slaughter outcome but in practice body.blood_max == body.physical_attr_tissues[1].  A stack of 4 bones was produced at 283, no bones at 282, and did not appear to be affected by animal type.  Also, I have yet to see dwarfs babies and children grow as they age.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on May 31, 2013, 01:21:12 am
Thanks for the reply!  I'm glad it's not just me.

Yeah, it looks like a universal bug so far.  I have yet to find a creature born in the fort that gets bigger or gives larger butcher returns.  Been testing several different animals over maybe 7 years.  Turned my fps to 500 to make things go faster.

Here's a weird upshot.  Turkeys and chickens never grow big enough to give bones.  I can't imagine how no one ever noticed that before.

Geese and peabirds are born big enough to slaughter for bones about 1/3 of the time.  Geese slightly more.  With smaller clutch sizes, so it about breaks even.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 31, 2013, 02:01:04 am
If the turtles were running around, then you created a vermin, not a raw fish...

Ah okay. Oops~
2 additional questions
1 - Can I remove "ability to stand lost" from a dwarf? I tried a medical script to no avail, and one I found that is specifically for it, but it's riddled with errors. All limbs are intact and all wounds healed.
2 - There is a bugfix script that restores guild reps and elven diplomats. I've never seen an elven diplomat show up with the caravan. I have gotten the guild rep. I've also read in other places that there is a hot fix for the exe to restore bodyguards for diplomats (and I assume guild reps). Is that hot fix compatible with DFhack or is there another way with DFhack to restore those bodyguards?
Title: Re: DFHack 0.34.11 r3
Post by: VerdantSF on May 31, 2013, 02:19:30 am
Also, I have yet to see dwarfs babies and children grow as they age.

In another thread (http://www.bay12forums.com/smf/index.php?topic=126558.0), several of us have been trying to solve the mystery of a legendary hammerdwarf who could barely kill a thing.  Turns out he was the only legendary hammerdwarf born in the fortress and was smaller than the rest by a good margin.  I think this bug is the most likely reason for his poor performance with blunt weapons. 

Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 31, 2013, 03:54:12 am
Also, I have yet to see dwarfs babies and children grow as they age.

In another thread (http://www.bay12forums.com/smf/index.php?topic=126558.0), several of us have been trying to solve the mystery of a legendary hammerdwarf who could barely kill a thing.  Turns out he was the only legendary hammerdwarf born in the fortress and was smaller than the rest by a good margin.  I think this bug is the most likely reason for his poor performance with blunt weapons.

Sounds like I am going to want to figure out the error in my size calculation so that its output matches the appropriate value at the appropriate time.  I suspect I need to evaluate each body part separately rather than the body as a whole.  This will need a better understanding of the relationship between body.physical_attr_tissues[0] (size to trigger pressure plate) and body.physical_attr_tissues[1] (size to determine butcher results), weight and perhaps those other values in body.physical_attr_tissues .  Then a script/plugin could be made to grow units periodically, unless someone beats me to it or finds a binary patch.
Title: Re: DFHack 0.34.11 r3
Post by: Wynflaed on May 31, 2013, 04:19:28 am
or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)

Thanks, I'll try that.

Got it working fine, so thanks again. Is there ant particular reason this isn't already in the... Program, or whatever you call it? And would anyone mind if I added this information to the wiki page so more people can see it?

Hi,

How did you get it working?

I have yet to manage it.  Can't get the darn script to run.  Wrong version, maybe?

In any case, I resorted to hex editing, and it has worked just fine, thankyouverymuch.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on May 31, 2013, 05:57:45 am
In case anyone ever needs it, here's a script to tag all peafowl for slaughter.
Code: (killallbirds.lua) [Select]
local birds = -1
for i,j in pairs(df.global.world.raws.creatures.all) do
if (j.creature_id == "BIRD_PEAFOWL_BLUE") then
birds = i
end
end
for i,j in pairs(df.global.world.units.active) do
if (j.race == birds) then
j.flags2.slaughter = true
end
end
600 birds are too much to do manually.  :)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 31, 2013, 09:07:02 am
Also, I have yet to see dwarfs babies and children grow as they age.

In another thread (http://www.bay12forums.com/smf/index.php?topic=126558.0), several of us have been trying to solve the mystery of a legendary hammerdwarf who could barely kill a thing.  Turns out he was the only legendary hammerdwarf born in the fortress and was smaller than the rest by a good margin.  I think this bug is the most likely reason for his poor performance with blunt weapons.

Sounds like I am going to want to figure out the error in my size calculation so that its output matches the appropriate value at the appropriate time.  I suspect I need to evaluate each body part separately rather than the body as a whole.  This will need a better understanding of the relationship between body.physical_attr_tissues[0] (size to trigger pressure plate) and body.physical_attr_tissues[1] (size to determine butcher results), weight and perhaps those other values in body.physical_attr_tissues .  Then a script/plugin could be made to grow units periodically, unless someone beats me to it or finds a binary patch.

Was body.physical_attr_tissues mislabeled/misidentified in DFHack? It currently returns a vector of STRENGTH, AGILITY, TOUGHNESS, ENDURANCE, RECUPERATION, and DISEASE_RESISTANCE. However, the behaviour as described above doesn't quite match.

Angavrilov investigated this and made the change (from "unknown") back in Sep 09, 2012 to df.units.xml.
Title: Re: DFHack 0.34.11 r3
Post by: ORCACommander on May 31, 2013, 09:21:55 am
ya i just marked 91 turkies for slaughter.... thank you autobutcher
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on May 31, 2013, 11:37:00 am
ya i just marked 91 turkies for slaughter.... thank you autobutcher

Did they produce any bones?  I'm trying to track down a growth bug.  If they were all born in the fort there should have been zero bones produced.  TIA!
Title: Re: DFHack 0.34.11 r3
Post by: ag on May 31, 2013, 01:25:55 pm
Was body.physical_attr_tissues mislabeled/misidentified in DFHack? It currently returns a vector of STRENGTH, AGILITY, TOUGHNESS, ENDURANCE, RECUPERATION, and DISEASE_RESISTANCE. However, the behaviour as described above doesn't quite match.

Misidentified is a too strong word. You should understand that unless some relevant code was directly checked (and sometimes even then), everything is a guess based on what the values looked like when checked. From the history it follows that the contents looked as if correlated to the attributes; and then later I noticed the first two values were correlated to the amount of muscle & vascular (blood) tissue, hence the current name. In general, a somewhat wrong but substantiated guess is better than just 'unknown', because it represents at least some information.

If you can figure out more about these fields, it can be updated and made even better ;)

Edit: IIRC, the specific reason it was renamed from physical_attr_unk to physical_attr_tissues is because I reverse-engineered this bit of code from the unit speed calculation, and using 'unknown' vars in code doesn't look nice:

https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L1213 (https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L1213)
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on May 31, 2013, 01:53:34 pm
Was body.physical_attr_tissues mislabeled/misidentified in DFHack? It currently returns a vector of STRENGTH, AGILITY, TOUGHNESS, ENDURANCE, RECUPERATION, and DISEASE_RESISTANCE. However, the behaviour as described above doesn't quite match.

Angavrilov investigated this and made the change (from "unknown") back in Sep 09, 2012 to df.units.xml.

Misidentified is a too strong word. You should understand that unless some relevant code was directly checked (and sometimes even then), everything is a guess based on what the values looked like when checked. From the history it follows that the contents looked as if correlated to the attributes; and then later I noticed the first two values were correlated to the amount of muscle & vascular (blood) tissue, hence the current name. In general, a somewhat wrong but substantiated guess is better than just 'unknown', because it represents at least some information.

If you can figure out more about these fields, it can be updated and made even better ;)

Edit: IIRC, the specific reason it was renamed from physical_attr_unk to physical_attr_tissues is because I reverse-engineered this bit of code from the unit speed calculation, and using 'unknown' vars in code doesn't look nice:

https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L1213 (https://github.com/peterix/dfhack/blob/master/library/modules/Units.cpp#L1213)

Thank you for clarifying the history of the naming.

If anyone wants to verify my results, this is approximately what I did:

for pressure plate size:
build a pressure plate with a creature trigger (I included the citizen flag), pasture the creature in question on the pressure plate.  set the pressure plate's plate_info.unit_min and plate_info.unit_max = unit.body.physical_attr_tissues[0], advance one frame and observe that plate.state == 101, vary plate.plate_info.unit_min and unit_max to not include unit.body.physical_attr_tissues[0] (advance a frame after changes) and observe plate.state begins to decrease as the trigger is no longer satisfied.  Return to plate.plate_info.unit_min == plate.plate_info.unit_max == unit.body.physical_attr_tissues[0] and plate.state returns to 101, vary unit.body.physical_attr_tissues[0] outside the unit_min unit_max range and plate_state again will count down to zero.

for butcher product results:
set unit.body.blood_max = 282 , unit.body.physical_attr_tissues[1] = 282, butcher, receive no bones
set unit.body.blood_max = 283 , unit.body.physical_attr_tissues[1] = 282, butcher, receive no bones
set unit.body.blood_max = 282 , unit.body.physical_attr_tissues[1] = 283, butcher, receive stack of 4 bones
set unit.body.blood_max = 1, unit.body.physical_attr_tissues[1] = 1000000, butcher, receive lots more stuff

*edit - fix wrong index for butcher products (to clarify index 0 == enum STRENGTH == pressure plate trigger / something to do with muscle mass ; index 1 == enum AGILITY == butcher product size / something to do with vascular tissue mass)
Title: Re: DFHack 0.34.11 r3
Post by: 0x517A5D on May 31, 2013, 01:56:28 pm
2 - There is a bugfix script that restores guild reps and elven diplomats. I've never seen an elven diplomat show up with the caravan. I have gotten the guild rep. I've also read in other places that there is a hot fix for the exe to restore bodyguards for diplomats (and I assume guild reps). Is that hot fix compatible with DFhack or is there another way with DFhack to restore those bodyguards?

Can you give a link to this info?  (I doubt your question can be answered without it.)
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on May 31, 2013, 02:32:53 pm
It's fixdiplomats and fixmerchants, I think.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 31, 2013, 04:41:27 pm
There is a bugfix script that restores guild reps and elven diplomats. I've never seen an elven diplomat show up with the caravan. I have gotten the guild rep.
Elven diplomats don't show up with the caravan - they show up a few weeks before or after it. They also don't show up until you have a baron.

I've also read in other places that there is a hot fix for the exe to restore bodyguards for diplomats (and I assume guild reps). Is that hot fix compatible with DFhack or is there another way with DFhack to restore those bodyguards?

The diplomat bodyguard fix is a 1-byte binary patch for the Win32 version of DF and can be found in the bug report (http://www.bay12games.com/dwarves/mantisbt/view.php?id=5854). It is currently not available for Linux or MacOS (because the patch hasn't been ported to those versions), and it doesn't come with DFHack itself (so you'll have to apply it manually).
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 31, 2013, 06:39:25 pm
There is a bugfix script that restores guild reps and elven diplomats. I've never seen an elven diplomat show up with the caravan. I have gotten the guild rep.
Elven diplomats don't show up with the caravan - they show up a few weeks before or after it. They also don't show up until you have a baron.

I've also read in other places that there is a hot fix for the exe to restore bodyguards for diplomats (and I assume guild reps). Is that hot fix compatible with DFhack or is there another way with DFhack to restore those bodyguards?

The diplomat bodyguard fix is a 1-byte binary patch for the Win32 version of DF and can be found in the bug report (http://www.bay12games.com/dwarves/mantisbt/view.php?id=5854). It is currently not available for Linux or MacOS (because the patch hasn't been ported to those versions), and it doesn't come with DFHack itself (so you'll have to apply it manually).

Thanks. It was this that I'd come across:
http://dffd.wimbli.com/file.php?id=6741

It says it's compatible with Dfhack, anyone use it? Can I just replace the exe with current version of dfhack and I'm good to go?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on May 31, 2013, 07:15:51 pm
Yep, this does work.  I included this version in my expanded LNP (http://dffd.wimbli.com/file.php?id=7622) with an extra hex edit to keep mouse fortress compatibility (though it's less useful now that the mousequery plugin has grown up).  Dfhack and every other utility included - which is many - still work perfectly, as far as I can tell.  It might be the most-changed vanilla version around...
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on May 31, 2013, 10:47:21 pm
Does it only add bodyguards to human diplomats? Do guild reps, elven diplomats and liaisons get guards?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 01, 2013, 12:17:27 am
Quote
still work perfectly, as far as I can tell.

I run the version with binary patches in MasterworkDF, and I include more or less all the utilities. All do work, no worries, it causes no issues.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 01, 2013, 12:55:50 am
OK, say we have creatures A and B. They are any creature in the game that have different BODY_SIZE. Body shape/parts doesn't matter. Each has the properties unit.body.physical_attr_tissues[X], abbreviated as A0, A1, ..., B0, B1, etc.

A0/B0 ~= BodySize(A)/BodySize(B)
A1/B1 ~= BodySize(A)/BodySize(B)
A2/B2 ~= BodySize(A)/BodySize(B)^(2/3)
A3/B3 ~= BodySize(A)/BodySize(B)^(2/3)
A4/B4 ~= BodySize(A)/BodySize(B)^(1/3)
A5/B5 ~= BodySize(A)/BodySize(B)^(1/3)

0 and 1 are identical for inorganic creatures.
2 and 3 are identical for inorganic creatures.
4 and 5 are identical for inorganic creatures.

When the three pairs are not identical (ie. organic creatures), the difference is somehow related to strength and perhaps other variables as well.

When a dwarf was given 5000 strength via RAW file:
A0/A1=2.041~=2
A2/A3=1.608~=2^(2/3)
A4/A5=1.271~=2^(1/3)

When a dwarf was given 0 strength via RAW file:
A0/A1=0.7915
A2/A3=0.857=0.7915^(2/3)
A4/A5=0.925=0.7915^(1/3)

Considering that BODY_SIZE is a volume unit, this looks like some kind of Square-cube law data. 0 and 1 are volume related, 2 and 3 are area related, 4 and 5 are length related. The difference between 0 and 1 are something like "The creature is actually this big, but has the strength and weight of something this big". Inorganic creatures don't have muscle tissue with [THICKENS_ON_STRENGTH].

EDIT:
If I disable [THICKENS_ON_ENERGY_STORAGE] and [THICKENS_ON_STRENGTH] in tissue_template_default.txt, then organic creatures suddenly have identical (0,1), (2,3), (4,5) pairs when created in the arena.

unit.body.physical_attr_tissues[0] is creature volume corrected for thickness of muscle and fat tissue.
unit.body.physical_attr_tissues[1] is base creature volume (adjusted from racial volume by appearance modifiers)
unit.body.physical_attr_tissues[2] is corrected area?
unit.body.physical_attr_tissues[3] is base area?
unit.body.physical_attr_tissues[4] is corrected length/height?
unit.body.physical_attr_tissues[5] is base length/height?

I haven't yet found any effects of changing properties 2-5.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 01, 2013, 01:10:32 am
any kind of toggle we can throw on a caravan to make it think it should still trade? Some of them are so sensitive that a stiff breeze makes them stop trading.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 01, 2013, 09:03:55 pm
I'm guessing something about unit wounds changed? I just tried another script that is supposed to fix ability to stand lost
Code: [Select]
repairhim = lambda { |u|
    # dirty
    if u.body.wounds.count > 0 then
      u.body.wounds = []
      puts "supermedic: cleared all wounds."
    end
    if u.status2.able_stand < 2 then
      u.status2.able_stand = 2
      puts "supermedic: repaired lost stand ability."
    end
    if u.status2.able_stand_impair < 2 then
      u.status2.able_stand_impair = 2
      puts "supermedic: repaired impaired stand ability."
    end
    # maybe dirty
    if u.job.current_job.job_type == :Rest then
      u.job.current_job.job_type = :CleanSelf
      puts "supermedic: released from 'Rest' job."
    end
}

if him = df.unit_find then
  repairhim[him]
end
but right away it throws an error on "able_stand"
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 02, 2013, 01:24:11 am
I'm guessing something about unit wounds changed? I just tried another script that is supposed to fix ability to stand lost
Code: [Select]
repairhim = lambda { |u|
    # dirty
    if u.body.wounds.count > 0 then
      u.body.wounds = []
      puts "supermedic: cleared all wounds."
    end
    if u.status2.able_stand < 2 then
      u.status2.able_stand = 2
      puts "supermedic: repaired lost stand ability."
    end
    if u.status2.able_stand_impair < 2 then
      u.status2.able_stand_impair = 2
      puts "supermedic: repaired impaired stand ability."
    end
    # maybe dirty
    if u.job.current_job.job_type == :Rest then
      u.job.current_job.job_type = :CleanSelf
      puts "supermedic: released from 'Rest' job."
    end
}

if him = df.unit_find then
  repairhim[him]
end
but right away it throws an error on "able_stand"

able_stand was renamed to limbs_stand_max and able_stand_impair was renamed to limbs_stand_count
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 02, 2013, 02:25:00 am

able_stand was renamed to limbs_stand_max and able_stand_impair was renamed to limbs_stand_count

Thanks. Is there somewhere I can see a list of these values?
Cheers, I can confirm this script fixes lost ability to stand
Code: [Select]
repairhim = lambda { |u|
    # dirty
    if u.body.wounds.count > 0 then
      u.body.wounds = []
      puts "supermedic: cleared all wounds."
    end
    if u.status2.limbs_stand_max < 2 then
      u.status2.limbs_stand_max = 2
      puts "supermedic: repaired lost stand ability."
    end
    if u.status2.limbs_stand_count < 2 then
      u.status2.limbs_stand_count = 2
      puts "supermedic: repaired impaired stand ability."
    end
    # maybe dirty
    if u.job.current_job.job_type == :Rest then
      u.job.current_job.job_type = :CleanSelf
      puts "supermedic: released from 'Rest' job."
    end
}

if him = df.unit_find then
  repairhim[him]
end
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on June 02, 2013, 03:46:01 am
Does the DFusion empregnate script make eggs fertile?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 02, 2013, 03:58:37 am
Does the DFusion empregnate script make eggs fertile?
Nope.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on June 02, 2013, 04:13:45 am
What about applying a transformation into the male caste on some random creature, even if it resets after a tick? Will the eggs fertilize then?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 03, 2013, 12:26:45 am
In trying to solve the "Babies and children don't grow" bug ( http://www.bay12forums.com/smf/index.php?topic=126558.0 ), I found that unit.flags3.unk1 ( https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L95 ) may be involved. The flag is set to false in most of the population, but it is set to true in the rare few children who are growing normally. The flag is also set to true in dwarves who are over 100 years old, and I don't understand why.

...
If you can figure out more about these fields, it can be updated and made even better ;)
...
See my post above - the fields appear to be volume, contact area, and length/height.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on June 03, 2013, 02:30:59 am
Have you tried setting the flag yourself and seeing if it had any effect on growth?  Possibly set it to true and wait until a critter's birthday to see if it causes their size to be recalculated?

I must admit I'm at a loss on precisely what the definition of the flag could mean.  It might have something to do with age checking, such as whether the thing needs to have events like growing into a peasant or dying of old age checked on its next birthday?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 03, 2013, 08:59:04 am
Have you tried setting the flag yourself and seeing if it had any effect on growth?  Possibly set it to true and wait until a critter's birthday to see if it causes their size to be recalculated?

I must admit I'm at a loss on precisely what the definition of the flag could mean.  It might have something to do with age checking, such as whether the thing needs to have events like growing into a peasant or dying of old age checked on its next birthday?

If I change the flag, the game changes it back a few ticks later without changing the creature size.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 04, 2013, 03:36:55 am

able_stand was renamed to limbs_stand_max and able_stand_impair was renamed to limbs_stand_count

Thanks. Is there somewhere I can see a list of these values?
Cheers, I can confirm this script fixes lost ability to stand
Code: [Select]
repairhim = lambda { |u|
    # dirty
    if u.body.wounds.count > 0 then
      u.body.wounds = []
      puts "supermedic: cleared all wounds."
    end
    if u.status2.limbs_stand_max < 2 then
      u.status2.limbs_stand_max = 2
      puts "supermedic: repaired lost stand ability."
    end
    if u.status2.limbs_stand_count < 2 then
      u.status2.limbs_stand_count = 2
      puts "supermedic: repaired impaired stand ability."
    end
    # maybe dirty
    if u.job.current_job.job_type == :Rest then
      u.job.current_job.job_type = :CleanSelf
      puts "supermedic: released from 'Rest' job."
    end
}

if him = df.unit_find then
  repairhim[him]
end

Hmm strangeness. I've applied this to two dwarves, one a military guy one a migrant who showed up with an inexplicable broken back.

The migrant is fine. But the military dwarf loses the ability to stand every time I load the game.
His description says he sustained major wounds recently, but his wound screen is empty, nothing missing, and his health screen shows no injuries.

Any idea why he'd keep having this lost ability to stand on load?

When i run the script on him though, it does something weird. It fixes the lost ability to stand but then throws a
Code: [Select]
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]# supermedic
supermedic: repaired impaired stand ability.
E: NoMethodError: undefined method `job_type' for nil:NilClass
 ./hack/scripts/supermedic.rb:16
 ./hack/scripts/supermedic.rb:23:in `[]'
 ./hack/scripts/supermedic.rb:23
 (eval):1:in `load'
 (eval):1
 (eval):1:in `catch'
 (eval):1
[DFHack]#

When i ran it on the migrant I didn't get that kind of error.
Title: Re: DFHack 0.34.11 r3
Post by: Njals on June 04, 2013, 01:53:22 pm
Hi! I need to read grass density values for some tiles as 'probe' plugin does (specifically what this line https://github.com/peterix/dfhack/blob/master/plugins/probe.cpp#L349 does). Is it possible to do the same thing via lua (ruby?)

I'd be grateful for help of at least for some helpful documentation on lua/C++ mapping (I haven't found any but existent scripts examples).
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 04, 2013, 01:55:43 pm
https://github.com/peterix/dfhack/blob/master/Lua%20API.rst
Title: Re: DFHack 0.34.11 r3
Post by: Njals on June 04, 2013, 03:15:19 pm
https://github.com/peterix/dfhack/blob/master/Lua%20API.rst
Well, I've found this one but it's of little help. Could you please tell how to get current absolute cursor coordinates, at least? The manual you referenced has nothing on this topic (or it's just very obscured).

EDIT:
Ok, finally found a missing part: https://github.com/peterix/df-structures Now the cursor thing became clear:
Code: [Select]
df.global.cursor
You probably should put a link to it somewhere in the Lua API docs, though.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 05, 2013, 04:38:18 am
remind me to wake up tomorrow and make this more coherent:

i'm in a bit of a bind because I just remembered that Fortbent still uses separate creatures for all of the citizens (when they get a COMBATHARDNESS of 100) and I haven't tested that far yet but Sparking shows me that that probably means that they'll be "too injured" to work but they can still be ordered around militarily. The problem is that I first included DFHack in Fortbent for friendship for this situation but friendship is no longer in fortbent but fortbent relies on the latest version of DFHack for other things and I for the life of me can't figure out friendship so...
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 05, 2013, 04:46:02 am


Thanks. Is there somewhere I can see a list of these values?
Cheers, I can confirm this script fixes lost ability to stand
Code: [Select]
repairhim = lambda { |u|
    # dirty
    if u.body.wounds.count > 0 then
      u.body.wounds = []
      puts "supermedic: cleared all wounds."
    end
    if u.status2.limbs_stand_max < 2 then
      u.status2.limbs_stand_max = 2
      puts "supermedic: repaired lost stand ability."
    end
    if u.status2.limbs_stand_count < 2 then
      u.status2.limbs_stand_count = 2
      puts "supermedic: repaired impaired stand ability."
    end
    # maybe dirty
    if u.job.current_job.job_type == :Rest then
      u.job.current_job.job_type = :CleanSelf
      puts "supermedic: released from 'Rest' job."
    end
}

if him = df.unit_find then
  repairhim[him]
end

Hmm strangeness. I've applied this to two dwarves, one a military guy one a migrant who showed up with an inexplicable broken back.

The migrant is fine. But the military dwarf loses the ability to stand every time I load the game.
His description says he sustained major wounds recently, but his wound screen is empty, nothing missing, and his health screen shows no injuries.

Any idea why he'd keep having this lost ability to stand on load?


Another follow-up on this. Despite showing no wounds, no missing limbs and nothing listed in the health screen, after some time, both dwarves seem to revert to ability to stand lost. Their descriptions don't indicate any kind of injury or missing limb that would cause this. How can I dump the full details on a dwarf to really see into the nitty gritty and what might be causing this?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 05, 2013, 04:48:31 am
remind me to wake up tomorrow and make this more coherent:

i'm in a bit of a bind because I just remembered that Fortbent still uses separate creatures for all of the citizens (when they get a COMBATHARDNESS of 100) and I haven't tested that far yet but Sparking shows me that that probably means that they'll be "too injured" to work but they can still be ordered around militarily. The problem is that I first included DFHack in Fortbent for friendship for this situation but friendship is no longer in fortbent but fortbent relies on the latest version of DFHack for other things and I for the life of me can't figure out friendship so...
It's quite easy to use friendship, but only on windows and only from lua (due to me not getting around to make gui and allow reconfiguration - now it needs a full df restart to change what species are in the friendship list). This should work (use it in save specific script file - "raw/init.lua" - for best effect):
Code: [Select]
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","ELF","GOBLIN"}
same for embark
Code: [Select]
plug=require"plugins.dfusion.embark"
plug.Embark:install{{"DWARF",0},{"ELF",0},{"GOBLIN",1},{"DWARF",1},{"DWARF",1},{"DWARF",1},{"GOBLIN",1}}

EDIT: just noticed that there is a bug that ignores the first entry in Friendship, so to workaround:
Code: [Select]
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","ELF","GOBLIN","DWARF"}
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on June 05, 2013, 05:08:21 am
Hmm has anyone here ask for something off ball yet? Like setting up a sport in fort mode which causes people from other cities to visit to watch? so far we could set up wrestling matches but the sport of getting 2 people to fight each other is easy, getting a horde of goblins to rush in for PPV to see "Cold Boulder Steel Anvil" face off "The Cackling" in a Slade in a Shade match is tricky.
Title: Re: DFHack 0.34.11 r3
Post by: Hommit on June 06, 2013, 03:10:28 am
Any chance to someone updating digvx code, so it don't place SO many stairs (sometimes up to like 80% of tiles on one level!)?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 06, 2013, 03:11:41 am
It places stairs wherever there's a vein of similar material on an adjacent z-level; I'd say it makes perfect sense to do it that way. It seems more of a personal issue.
Title: Re: DFHack 0.34.11 r3
Post by: Askot Bokbondeler on June 06, 2013, 07:28:49 am
i don't use stairs, i'd prefer if it would place ramps. it wouldn't always work, but that's what overseers are for. how would i go about changing it?
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on June 06, 2013, 08:19:03 am
First step, set up a very efficient hospital for all of the upcoming mining injuries...

 :P
Title: Re: DFHack 0.34.11 r3
Post by: peterix on June 06, 2013, 10:02:19 am
i don't use stairs, i'd prefer if it would place ramps. it wouldn't always work, but that's what overseers are for. how would i go about changing it?

The code for that is here:
https://github.com/peterix/dfhack/blob/master/plugins/dig.cpp#L987

Currently, it spreads up and down, setting the designations appropriately. If you wanted to do ramps, you'd have to do channels. A tile where the algorithm would spread down would be designated for channeling, a tile that would make it go up would NOT be designated. Everything else would be designated for normal digging. Nothing would change about the actual algorithm, just a few more conditions and different designations.
Title: Re: DFHack 0.34.11 r3
Post by: cdombroski on June 06, 2013, 11:28:59 am
I've duplicated the upcoming restrictliquid and restrictice commands as lua scripts (thanks to rampaging-poet for the original code!). I imagine it's not as fast as the original C++ code, but it gets the job done for me.

Here they are for anyone else who's impatient like me:
Code: (restrictliquid.lua) [Select]
-- Restrict visible tiles with liquid
max_x,max_y,max_z = dfhack.maps.getTileSize()
for x=0, max_x-1 do
for y=0, max_y-1 do
for z=0, max_z-1 do
des = dfhack.maps.getTileFlags(x,y,z)
if des ~= nil and des['hidden'] == false and des['flow_size'] ~= 0 then
des['traffic'] = df.tile_traffic['Restricted']
end
end
end
end

Code: (restrictice.lua) [Select]
-- Restrict tiles over visible ice walls
max_x,max_y,max_z = dfhack.maps.getTileSize()
for x=0, max_x-1 do
for y=0, max_y-1 do
for z=1, max_z-1 do
des = dfhack.maps.getTileFlags(x,y,z)
des_below = dfhack.maps.getTileFlags(x,y,z-1)
type_below = dfhack.maps.getTileType(x,y,z-1)
if des_below ~= nil and des_below['hidden'] == false and type_below == df.tiletype['FrozenWall'] then
des['traffic'] = df.tile_traffic['Restricted']
end
end
end
end
Title: Re: DFHack 0.34.11 r3
Post by: eclipse412 on June 06, 2013, 08:04:16 pm
How can I use this to fill in a hole with clay? I dug a hole to get ride of water then thought I could use this to fill it in. Any Help?
Thanks,
E
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on June 06, 2013, 08:10:30 pm
Use tiletypes to transform the clay floor tiles into clay wall tiles.

"filter shape floor" and "paint shape wall" should be enough for settings. It'll transform any floor tile under the loo[k]-cursor into a plain undug wall of the same material.
Title: Re: DFHack 0.34.11 r3
Post by: Askot Bokbondeler on June 06, 2013, 08:11:35 pm
thanks!
Title: Re: DFHack 0.34.11 r3
Post by: eclipse412 on June 06, 2013, 08:51:20 pm
What about open space?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 06, 2013, 10:53:18 pm
unit.appearance.unk_4c8  is the effective body appearance modifier (percent), default is 100.  This effective body modifier is the result of combining the body size modifiers in unit.appearance.body_modifiers[] .  I haven't looked at enough creatures that use more than 2 modifiers to see if the integer division happens for each modifier or is applied later.  With body_modifiers 99 and 106, unk_4c8 = 104 = 99 * 106 / 100.

Using unk_4c8, my estimated body size calculation is now spot on for units that spawn full grown.

*edit: found a unit with modifiers 95,104,107, and unk_4c8 = 105

100 * 95/100 * 104/100 = 98.80 => 98 * 107 / 100 = 104.86 => 104 != 105

100 * (95 * 104 * 107) / 100^3 = 105.7160 => 105 == 105 so it looks like the loss of precision happens last rather than for each modifier
Title: Re: DFHack 0.34.11 r3
Post by: Billy Jack on June 07, 2013, 02:00:41 am
https://github.com/expwnent/dfhack/blob/f92e859f499105abfbb40d008189bc36e88323f5/Readme.rst#mod-interaction

I have (finally) written the documentation for the NEXT version of autoSyndrome/syndromeTrigger. The rules are slightly different from the way they are now, but they make more sense this way and should only require minimal changes. The main changes: boiling temperature is now ignored, you need to have a \AUTO_SYNDROME tag, and instead of \WORKER_ONLY, there's \ALLOW_NONWORKER_TARGETS, which does the opposite of what \WORKER_ONLY did (it makes more sense for worker only to be the default).

The short version: autoSyndrome allows you to instantly attach syndromes to units with custom building reactions. syndromeTrigger lets you trigger commands or do true transformations whenever a unit becomes afflicted with a syndrome, regardless of the cause of the syndrome. It should work whether it's from "natural causes", an interaction, autoSyndrome, and hopefully even for itemsyndrome.

edit: also, both autoSyndrome and syndromeTrigger are disabled by default to help FPS for those who don't need it. It is recommended that if you want to use them you add the following to your dfhack.init file:

Code: [Select]
autoSyndrome enable
syndromeTrigger enable
While I'm not a pro on reading C++ code, it looks to me like the default of affecting the worker only will still result in other creatures possibly being affected.
https://github.com/expwnent/dfhack/blob/master/plugins/autoSyndrome.cpp

At line 382, the Boolean test on workeronly continues on in the For loop.  Shouldn't it exit the loop?  At the end of the For loop, a valid target is attempted to be found, with the worker being ignored.

I was trying to figure out why a baby was being affected when the mother tries to run the reaction.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 07, 2013, 08:54:18 am
Each syndrome is treated separately. You can have multiple syndromes per rock, or multiple rocks per reaction.

edit: "continue" means "skip the rest of this iteration of the loop".
Title: Re: DFHack 0.34.11 r3
Post by: Ranalcus on June 07, 2013, 04:15:23 pm
Sorry to bother you guys.
But i have used th exportmaps command, and I don't know WHERE it was exported or what is the name of those map files. I Have a working Isoworld (after FEW problems) but I don't know how to use it, it is probably so simple that they even don't write it in readme...

;___;
Help
Title: Re: DFHack 0.34.11 r3
Post by: ORCACommander on June 07, 2013, 05:17:01 pm
well wrong place to ask for help with iso world but i have also used that script. it puts it out to where pictures always go, the df home directory.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 07, 2013, 08:39:06 pm
Sorry to bother you guys.
But i have used the exportmaps command, and I don't know WHERE it was exported or what is the name of those map files. I Have a working Isoworld (after FEW problems) but I don't know how to use it, it is probably so simple that they even don't write it in readme...

;___;
Help

I suppose that is some useful stuff to know that isn't quite as clear as it could be so I have updated the dffd description for exportmaps. 
Title: Re: DFHack 0.34.11 r3
Post by: Ranalcus on June 07, 2013, 11:21:55 pm
You area a SAINT person Dwarf!
Let the Armok bless you with his knowledge.
Even if I would be thanking you for a century, it still would be not enough to prise you.

EDIT:
When I upload the files extracted by DFhack into isoworld it CRASHes horribly.
Is there anyway to contact with the creator of that program? By Chat? IRC?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 08, 2013, 04:54:59 pm
In an effort to figure out how to calculate the thickens body size, I have deciphered much about the unknowns in the body plan structure and am trying to put together a function for calculating the thickens body size.  However I run into a block where I can't determine in code if a layer's tissue has [THICKENS_ON_ENERGY_STORAGE] and/or [THICKENS_ON_STRENGTH].  I suppose I could get around this if I ignore the edge case of a tissue that has both since there are no vanilla tissues that do, but I would prefer to do it right just in case a mod uses the edge case.  Therefore, my question is, is it possible to read the binary form of the tissues "userdata" structure in raws.creatures.all[].tissues[] ? 
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 08, 2013, 07:34:36 pm
If unit.body.unk494 has an offset of 0x494 in the unit data, and therefore unit.body.blood_count has an offset of 0x490 because it is an int32, what is the offset to the members of unit.body.physical_attr_tissues? I am still trying to wrap my head around the compound, array, vector, and pointer differences.

See this for reference: https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L551
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 08, 2013, 07:59:56 pm
If unit.body.unk494 has an offset of 0x494 in the unit data, and therefore unit.body.blood_count has an offset of 0x490 because it is an int32, what is the offset to the members of unit.body.physical_attr_tissues? I am still trying to wrap my head around the compound, array, vector, and pointer differences.

See this for reference: https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L551

I think that physical_attr_tissues would start at 0x474

6 int32 from physical_attr_tissues, 1 int32 (blood_max), 1 int32 (blood_count) = 8 int32 = 32 bytes = 0x020
0x494 - 0x020 = 0x474

It has been a while since I learned about c/c++ and haven't used it much so I could be wrong about that.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on June 08, 2013, 08:45:26 pm
I got 0x474 too.  Each int 32 is 4 bytes, each pointer (for 32-bit memory addresses, which all inside DF will be) is 4 bytes and each STL pointer is 12 bytes (3 pointers grouped together, if memory serves).  Arrays can be viewed a few different ways, but for the static-arrays in the documentation just multiply the count by the size of its data type.  So an array of 6 int32s is 24 bytes.  For a dynamic array that only stored a pointer to the first element, it would just be like any other pointer, but I don't think that comes up anywhere in the DF structures since Toady uses STL vectors in place of them.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 08, 2013, 10:15:08 pm
I guess I am ready to post my finding from investigating the body plan structure:

Spoiler: Wall of text (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 09, 2013, 12:51:50 am
unit.appearance.unk_4c8  is the effective body appearance modifier (percent), default is 100.  This effective body modifier is the result of combining the body size modifiers in unit.appearance.body_modifiers[] .
...

unit.flags3.unk1=false causes unk_4c8 to be "calibrated/calculated" and sets itself to true when complete.

The part of the game that makes changes to unit.body.physical_attr_tissues draws on info from the race's creature_raw, specifically 0x128 and 0x12c. Here are links to the creature_raw part that I am talking about, but I don't know what info is being targeted because the offsets aren't labelled in df.creature-raws.xml.
https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L339
https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L954

The part of the game that makes changes to unit.body.physical_attr_tissues also draws on some sort of time number (I know this only because 403200 appears in there), the effective body appearance modifier unk_4c8, and unit.counters2.stored_fat. It also appears to have some kind of default size and blood count of 7000 to initialize variables.

EDIT: I think it also looks at the body_plan info that Kurik found, at the unit.body.body_plan offsets 0xa0, 0x94, 0x98, and 0x9c, whatever those are.
Title: Re: DFHack 0.34.11 r3
Post by: ag on June 09, 2013, 02:04:49 am
You cannot assume that "unk494" means it starts at 0x494 - that's just a name. For one, it is different between linux and windows. The address is just a convenient way to initially assign a name that doesn't conflict with anything else, rather than manually counting what number is next when using the unk1,unk2,unk3... etc pattern.

For actual offsets see the csv files: https://github.com/angavrilov/df-structures/tree/master/windows (https://github.com/angavrilov/df-structures/tree/master/windows)
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 09, 2013, 02:16:13 am
unit.appearance.unk_4c8  is the effective body appearance modifier (percent), default is 100.  This effective body modifier is the result of combining the body size modifiers in unit.appearance.body_modifiers[] .
...

unit.flags3.unk1=false causes unk_4c8 to be "calibrated/calculated" and sets itself to true when complete.

The part of the game that makes changes to unit.body.physical_attr_tissues draws on info from the race's creature_raw, specifically 0x128 and 0x12c. Here are links to the creature_raw part that I am talking about, but I don't know what info is being targeted because the offsets aren't labelled in df.creature-raws.xml.
https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L339
https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L954

The part of the game that makes changes to unit.body.physical_attr_tissues also draws on some sort of time number (I know this only because 403200 appears in there), the effective body appearance modifier unk_4c8, and unit.counters2.stored_fat. It also appears to have some kind of default size and blood count of 7000 to initialize variables.

EDIT: I think it also looks at the body_plan info that Kurik found, at the unit.body.body_plan offsets 0xa0, 0x94, 0x98, and 0x9c, whatever those are.

Interesting.  403200 is one year.  7000 as an init is probably related to humans, I think I remember some place saying that humans were used as a base line.  At the moment, my thickens size calculation is using body_plan.unk8 (body relative size without embedded and/or internal) which I think is at offset 0x40, store_fat, STRENGTH.value, body_part.relsize, body_part.unk4 and unk5 in the absence of accessing the tissue data, and the body size.  I calculate the body size (physical_attr_tissues[1]) with the creature raws .caste.body_size_1 and body_size_2, and the unit.appearnce.unk_4c8.  My thickens calc is coming along.  I have it giving a valid result for thickens on strength, and almost have it right for thickens on energy.  I seem to be missing a ratio.

body plan 0x94 should refer to anon_1 ; 0x98, 0x9c, and 0xa0 should refer to the materials.mat_type vector.
I think that creature_raw 0x128, 0x12c, and 0x130 is the caste vector (type caste_raw).


You cannot assume that "unk494" means it starts at 0x494 - that's just a name. For one, it is different between linux and windows. The address is just a convenient way to initially assign a name that doesn't conflict with anything else, rather than manually counting what number is next when using the unk1,unk2,unk3... etc pattern.

For actual offsets see the csv files: https://github.com/angavrilov/df-structures/tree/master/windows (https://github.com/angavrilov/df-structures/tree/master/windows)

I suppose my offset interpretations might not line up then, struck em out (if anyone cares, i am using the windows version).
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 10, 2013, 12:03:14 am
Did more testing with some liposuction and force-feeding by altering unit.counters2.stored_fat between 1000 and 1000000. Also tried altering the (actual) strength attribute value.

Turns out that creatures with unit.flags3.unk1=false (old or young) also happen to be immune to size (physical_attr_tissues[0]) changes from alteration to muscle or fat. They can also walk around with an incorrect hacked unit.appearance.unk_4c8 and it doesn't change or matter.

Creatures with unit.flags3.unk1=true, which happen to grow properly, will change size within a few ticks, and their unit.appearance.unk_4c8 will recalculate to a correct value.

However, the flag is NOT the cause of the problem but rather another symptom. The evidence indicates that the size calculation function is being bypassed completely for some creatures, regardless of if they are growing or not. If the bug was fixed, all your old lazy corpulent dwarves would suddenly gain a few belt notches and move slower due to their increased size.

On another topic, the game appears to use unit.body.body_plan.unk15c and unit.body.body_plan.unk15d to determine if a creature has ANY fat or muscle in its body - it checks if the numbers are greater than zero.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 10, 2013, 04:20:11 am
I have a question, or more of an idea:

A way to make only a specific mat digable by a specific item. Example:

ITEM_SHOVEL only digs inorganics with [REACTION_CLASS:SHOVEL]
ITEM_PICK only digs inorganic with [REACTION_CLASS:SHOVEL] and [REACTION_CLASS:PICK]
ITEM_DRILL only digs inorganics with [REACTION_CLASS:SHOVEL] and [REACTION_CLASS:PICK] and [REACTION_CLASS:DRILL]

This would make mining a lot more interesting, with cheap shovels (wood), expensive picks (metal), and custom made drills (ore/slade). Also nice for other races, Kobolds only get shovels, can only dig soil...

How feasable is this?
Title: Re: DFHack 0.34.11 r3
Post by: foop on June 10, 2013, 05:06:54 am
Does workflow understand making clay bricks yet?  About halfway through this thread, back in June 2012, someone tracked the problem down (http://www.bay12forums.com/smf/index.php?topic=91166.1685) to workflow not knowing how to handle the FIRED_MAT mask on the input to the reaction. 

Is this still the case or is there now some clever way of including brick making into workflow?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 10, 2013, 07:37:45 am
I have a question, or more of an idea:

A way to make only a specific mat digable by a specific item. Example:

ITEM_SHOVEL only digs inorganics with [REACTION_CLASS:SHOVEL]
ITEM_PICK only digs inorganic with [REACTION_CLASS:SHOVEL] and [REACTION_CLASS:PICK]
ITEM_DRILL only digs inorganics with [REACTION_CLASS:SHOVEL] and [REACTION_CLASS:PICK] and [REACTION_CLASS:DRILL]

This would make mining a lot more interesting, with cheap shovels (wood), expensive picks (metal), and custom made drills (ore/slade). Also nice for other races, Kobolds only get shovels, can only dig soil...

How feasable is this?
Hardish: you could cancel active dig jobs if worker does not have correct item (and issue a message). That would be annoying as mining under lava to some extent. Also because there is limited way to select who does what you will have problems with mining equipment. That said there is already a system that detects new jobs, although it is not accessible through lua so i can't help you there.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 10, 2013, 09:24:14 am
Thanks warmist. I still hope for some sort of solution. I want to merge all my playable races into one world-gen, but the kobolds can only dig soil. I did this by adding UNDIGGABLE to the stone-template when playing as kobolds. But you need a new worldgen to remove it, so I cant play kobolds, retire the camp, then play dwarves...

I would even be ok with removing digging in its entirety from one race, if possible.

Another idea: Can a screwpump by copied, just without the need for water underneath it? Essentially a pump-workshop that just spawns the water/magma on one end. It would be so much better then the current system for water/magma spawning.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 10, 2013, 10:24:24 am
The problem with changing diggability is you'd have to regularly override the in-game job assigner thing, cancelling and assigning jobs yourself in code. I don't know exactly how the existing algorithm works so anything I wrote might assign dig jobs unfairly often or unfairly rarely.

I guess a "liquid factory" could be done. It'd be a moderate pain to make it "pressurize" in the same way that screw pumps do, but it'd certainly be doable.

edit: It would be easier to modify the time it takes to dig based on the pick used. You could just set the time to dig to be ridiculously high for inappropriately weak picks, and leave it up to the player to organize who digs where with what.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 10, 2013, 10:41:08 am
Quote
edit: It would be easier to modify the time it takes to dig based on the pick used. You could just set the time to dig to be ridiculously high for inappropriately weak picks, and leave it up to the player to organize who digs where with what.

That sounds useful :) How high is high? Ingame ticks? That would be more then enough.

Shovel: Soil_template: 10 ticks. Stone_template: 999999 ticks.
Pick: Soil_template: 10 ticks. Stone_template: 20 ticks.

Done. That is more or less what I asked for. ^^

The pumps dont necessarily need to pressurize things, magma is not pressurized anyway. The reason I asked about it is the liquid generation. If people want to pressurize something, they can just build a regular pump right next to it. :)
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 10, 2013, 11:06:25 am
I haven't tried it, but there might be a problem with dwarves not cancelling the job until they're starving to death if it's an absurdly long dig job. Something to keep in mind.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 10, 2013, 11:22:41 am
Thats fine. I would only use it on kobolds. Their own fault for trying to mine rock using a wooden shovel.
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on June 10, 2013, 02:51:38 pm
So, whichever Kobold comes up with the job assignment is doomed.  The RNG, she is a cruel mistress.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 10, 2013, 03:38:08 pm
removing the dig designation should end the job, freeing whomever glued their shovel to the wall
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 10, 2013, 09:25:36 pm
Did more testing with some liposuction and force-feeding by altering unit.counters2.stored_fat between 1000 and 1000000. Also tried altering the (actual) strength attribute value.

Turns out that creatures with unit.flags3.unk1=false (old or young) also happen to be immune to size (physical_attr_tissues[0]) changes from alteration to muscle or fat. They can also walk around with an incorrect hacked unit.appearance.unk_4c8 and it doesn't change or matter.

Creatures with unit.flags3.unk1=true, which happen to grow properly, will change size within a few ticks, and their unit.appearance.unk_4c8 will recalculate to a correct value.

However, the flag is NOT the cause of the problem but rather another symptom. The evidence indicates that the size calculation function is being bypassed completely for some creatures, regardless of if they are growing or not. If the bug was fixed, all your old lazy corpulent dwarves would suddenly gain a few belt notches and move slower due to their increased size.

On another topic, the game appears to use unit.body.body_plan.unk15c and unit.body.body_plan.unk15d to determine if a creature has ANY fat or muscle in its body - it checks if the numbers are greater than zero.

It appears that dwarves who were not born at your fort (old dwarves) who have unit.flags3.unk1=true and have size calculated correctly, also have unit.relations.birth_time==-1 (It says "1st of granite" when you view their birth day).

If I change a non-growing dwarf's birth_time to -1, it cures them of the bug and allows size to be properly calculated. WTF!?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 10, 2013, 09:32:38 pm
If I change a non-growing dwarf's birth_time to -1, it cures them of the bug and allows size to be properly calculated. WTF!?

Someone needs to make a plugin or script or something which can apply this automatically.  Unless it has side effects worse than non-growing units?  (also - does it work on animals?)
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 11, 2013, 12:32:47 am
I have made a small sample confirmation of the -1 birth time, but then through a process found that a multiple of 10 also works.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 11, 2013, 12:51:05 am
Code: (fixgrowthbug.lua) [Select]
--Fixes the body size bug.

local function fixAllCreaturesOfSizeBug()
    for _,unit in ipairs(df.global.world.units.active) do
        r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10) --Kurik Amudnil's code; if it's not clear, it sets a creature's birth_time to the nearest multiple of 10 of the previous one.
        if r > 0 then
            unit.relations.birth_time = unit.relations.birth_time - r
        end
    end
end

args = {...}

for k,arg in ipairs(args) do
    if v == "enable" or v == "Enable" then enable = true end
    if v == "disable" or v == "Disable" then enable = false end
    if v == "force" or v == "Force" then force = true end
end

if enable then
    automateTheFix = function()
        fixAllCreaturesOfSizeBug()
        dfhack.timeout(1,"months",automateTheFix)
    end
    automateTheFix()
else
    automateTheFix = function() end
end

if force then fixAllCreaturesOfSizeBug()

Here's something that will (hopefully) automate the fix that I whipped up real quick.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 11, 2013, 12:57:59 am
It appears that dwarves who were not born at your fort (old dwarves) who have unit.flags3.unk1=true and have size calculated correctly, also have unit.relations.birth_time==-1 (It says "1st of granite" when you view their birth day).

If I change a non-growing dwarf's birth_time to -1, it cures them of the bug and allows size to be properly calculated. WTF!?

Fascinating. Very well done. Have you found a causational link with unit.flags3.unk1? Or is it just with birth_time? Does setting birth_time cause the game to set any other weird flags that might be related?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 11, 2013, 01:55:54 am
This is my attempt in ruby


However, yours looks shorter but instead of unit.relations.birth_time = -1,  I would want to use
Code: [Select]
    for _,unit in ipairs(df.global.world.units.active) do
        r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10)
        if r > 0 then
            unit.relations.birth_time = unit.relations.birth_time - r
        end
    end
so that the unit doesn't gain months and days of age.  Also of note, is that the historical figure and hidden identities have their own birth time which might get confusing somewhere or somehow if they are far different.

Edit:
...
Fascinating. Very well done. Have you found a causational link with unit.flags3.unk1? Or is it just with birth_time? Does setting birth_time cause the game to set any other weird flags that might be related?

Setting the birth_time to -1 or a multiple of 10 does cause unit.flags3.unk1 to become true.  I am not sure if it happens the next tick or a few more but it did so for me.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on June 11, 2013, 04:28:25 am
You can use the modulo operator to simplify that.

r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10)
same as
r = unit.relations.birth_time % 10

It's the same syntax in ruby and lua.

Edit: Also, well done! :)  Although I am going to miss my exploity fast bird growth.
Title: Re: DFHack 0.34.11 r3
Post by: ag on June 11, 2013, 07:21:09 am
Looking at the code, it seems it's basically doing something like this for some reason:

Code: [Select]
if (cur_year_tick % 10 == 0 && (cur_year_tick - birth_time) % 1200 == 0) { update stuff }
Also added various fields mentioned recently: https://github.com/angavrilov/df-structures/commits/master (https://github.com/angavrilov/df-structures/commits/master)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 11, 2013, 09:21:28 am
...
...
Fascinating. Very well done. Have you found a causational link with unit.flags3.unk1? Or is it just with birth_time? Does setting birth_time cause the game to set any other weird flags that might be related?

Setting the birth_time to -1 or a multiple of 10 does cause unit.flags3.unk1 to become true.  I am not sure if it happens the next tick or a few more but it did so for me.

unit.flags3.unk1 is an after-effect of having your size calculated properly. It can be used to find creatures that need to be fixed.
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on June 11, 2013, 11:38:23 am
how do you spawn poisons of a specific creature and turn them in to gases using createitem . tell me all please
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 11, 2013, 11:39:55 am
You can use the modulo operator to simplify that.

r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10)
same as
r = unit.relations.birth_time % 10

It's the same syntax in ruby and lua.

Edit: Also, well done! :)  Although I am going to miss my exploity fast bird growth.

lua's and ruby's modulus doesn't work right with -1 for what I was trying to do
lua: -1 % 10 == 9
ruby: -1 % 10 == 11 9

what is needed here:
-1 % 10 == -1

Edit: not sure where my 11 came from
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 11, 2013, 11:54:26 am
ruby: -1 % 10 == 11

Wait, what?

I Googled this, and apparently Ruby should return 9 in this case...
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 11, 2013, 12:30:37 pm
ruby: -1 % 10 == 11

Wait, what?

I Googled this, and apparently Ruby should return 9 in this case...

Hmm, just tested that again, not sure where my 11 came from.  In any case, I need it to return -1 for -1%10 so that it doesn't change -1 to -10.  Also, when r == -1, we could drop the if statement which would set all cases of birth_time == -1 to 0 which should also work unless -1 has some special significance somewhere.
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on June 11, 2013, 12:42:41 pm
What is the unit of measure in this birth date?  Will this mod10 function change everybody's birthday to only once every ten days?  Or is it hours?  Millifortnights?  (Must convert all of these to the fff system of measures for a mod one day)
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 11, 2013, 01:53:45 pm
What is the unit of measure in this birth date?  Will this mod10 function change everybody's birthday to only once every ten days?  Or is it hours?  Millifortnights?  (Must convert all of these to the fff system of measures for a mod one day)

Well, apparently a day is 1200 ticks, so one tick is slightly more than a minute.  This function will round everyone's birthday to the nearest 12 minutes.
Title: Re: DFHack 0.34.11 r3
Post by: 0x517A5D on June 11, 2013, 02:51:18 pm

lua's and ruby's modulus doesn't work right with -1 for what I was trying to do
lua: -1 % 10 == 9
ruby: -1 % 10 == 9

They're doing it right, by the mathematical definition of modulus.

Conceptually, the result of a modulus operation will be in the set of integers between 0 (inclusive) and the divisor (exclusive).

0 <= result < divisor

or

0 <= result <= (divisor-1)

You expected a result of -1, but that's not between 0 and 9, so it is not a legal result.

Quote
what is needed here:
-1 % 10 == -1

Add a special case.

if (unit.relations.birth_time < 0) then result = -1
else result = (unit.relations.birth_time % 10)

or

result = (unit.relations.birth_time < 0) ? -1 : (unit.relations.birth_time % 10)
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 11, 2013, 06:25:07 pm
I've been directed here from Moltenchannels. Do we actually have a fix that will cause all creatures to grow up to their proper sizes now? Will it cause dwarves to grow up properly, or not? How do I go about applying those changes in DFhack (using Mac OSX 10.6)? Do I have to apply the fix every time some dwarf gets born, or every year, or what?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 11, 2013, 06:52:28 pm
Just a few posts before you, I posted this post (http://www.bay12forums.com/smf/index.php?topic=91166.msg4310810#msg4310810) which contains the fix. Just type "(whatever you name the file) enable" to have it automatically fix the bug for every unit on the map every month or "(name) force" to do it immediately for all units on the map.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 11, 2013, 06:56:59 pm
Just a few posts before you, I posted this post (http://www.bay12forums.com/smf/index.php?topic=91166.msg4310810#msg4310810) which contains the fix. Just type "(whatever you name the file) enable" to have it automatically fix the bug for every unit on the map every month or "(name) force" to do it immediately for all units on the map.

Alright. So that goes straight to a file, which I then execute? Do I need to execute the file every time I load a save, or do I just need to execute it once per save?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 11, 2013, 06:58:09 pm
Just after some advice here:  if I'm going to put this fix in my LNP+, I assume that I need to put it in a specific folder, with a .lua extension?  (I'm guessing hack/scripts)

@Putnam - I'd propose a standard name, so that it can be added to the .init without issues about different names.  How about "fixgrowthbug.lua"?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 11, 2013, 07:00:59 pm
Actually, I've got one better. Since I think you're running a succession game right now, you'll want to put it into the save. Save this file as "init.lua" in the save's raw folder (NOT the objects folder, but the top-level raw folder):

Code: (init.lua) [Select]
--Fixes the body size bug.

local function fixAllCreaturesOfSizeBug()
    for _,unit in ipairs(df.global.world.units.active) do
        r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10) --Kurik Amudnil's code; if it's not clear, it sets a creature's birth_time to the nearest multiple of 10 of the previous one.
        if r > 0 then
            unit.relations.birth_time = unit.relations.birth_time - r
        end
    end
end

function automateTheFix()
    fixAllCreaturesOfSizeBug()
    dfhack.timeout(1,"months",automateTheFix) --will this work as it is?
end

automateTheFix()

fixgrowthbug.lua would work as the standard name for the non-init version.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 11, 2013, 07:12:34 pm
Actually, I've got one better. Since I think you're running a succession game right now, you'll want to put it into the save. Save this file as "init.lua" in the save's raw folder (NOT the objects folder, but the top-level raw folder):

Code: (init.lua) [Select]
--Fixes the body size bug.

local function fixAllCreaturesOfSizeBug()
    for _,unit in ipairs(df.global.world.units.active) do
        r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10) --Kurik Amudnil's code; if it's not clear, it sets a creature's birth_time to the nearest multiple of 10 of the previous one.
        if r > 0 then
            unit.relations.birth_time = unit.relations.birth_time - r
        end
    end
end

function automateTheFix()
    fixAllCreaturesOfSizeBug()
    dfhack.timeout(1,"months",automateTheFix) --will this work as it is?
end

automateTheFix()

fixgrowthbug.lua would work as the standard name for the non-init version.

OK. I've added the .lua file to the raw folder. Is that all that's needed? This will need to run in a DFhack'd version, right? (unless Toady fixes the bug in the coming release)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 11, 2013, 07:15:39 pm
Is the file called init.lua?

If it is, that should be all you need. If it comes up with an error, post it.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 11, 2013, 07:16:29 pm
Can I get some quick confirmation before uploading a new description:  this will work if I put it in hack/scripts called "fixgrowthbug.lua", and add "fixgrowthbug enable" to dfhack.init?

Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 11, 2013, 07:19:53 pm
No. Sorry, just realized that my earlier code is shit and won't actually work as intended. Use the init.lua version.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 11, 2013, 07:24:30 pm
OK, I'll assume that if I switch the contents of that file the rest will work then :-)
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 11, 2013, 07:25:58 pm
[double post, sorry]
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 11, 2013, 07:27:10 pm
Switch?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 11, 2013, 07:28:52 pm
Use the code you've called 'init.lua' as a file called "fixgrowthbug.lua" in hack/scripts, with a dfhack.init entry "fixgrowthbug enable" (is that unecessary now?)
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on June 11, 2013, 07:30:04 pm
how do I create a specific poison with the dfhack createitem command?
Title: DFHack 0.34.11 r3
Post by: catvanbrian on June 11, 2013, 07:32:16 pm
how do I create a specific poison using dfhack createitem command
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 11, 2013, 07:37:00 pm
Use the code you've called 'init.lua' as a file called "fixgrowthbug.lua" in hack/scripts, with a dfhack.init entry "fixgrowthbug enable" (is that unecessary now?)

Save the code called "init.lua" into a file called "init.lua" in the raw folder and all of the individual save folders' raw folder.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 11, 2013, 07:41:04 pm
Well, that seems anticlimatic!  Thanks, done, will upload new LNP release now. 
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 11, 2013, 08:38:57 pm
I loaded up the save with the init.lua file in the raws. I don't get any readout on load in the DFHack terminal. Is this OK?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 11, 2013, 08:40:02 pm
Is it in raw, NOT raw/objects?
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 11, 2013, 08:44:26 pm
Is it in raw, NOT raw/objects?

It is in raw. It is one of the four files or folders in the folder of the save, and the only one that is a file and not a folder. I was thinking DFhack would say some file was loaded or function was executed.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 11, 2013, 09:12:52 pm
Ah, then it's working. Hehe. I keep forgetting to include notifications...
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 11, 2013, 09:24:31 pm
Ah, then it's working. Hehe. I keep forgetting to include notifications...

How do you do notifications?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 12, 2013, 01:29:23 am
...
Add a special case.

if (unit.relations.birth_time < 0) then result = -1
else result = (unit.relations.birth_time % 10)

or

result = (unit.relations.birth_time < 0) ? -1 : (unit.relations.birth_time % 10)

I have an update for my ruby version using a change to the if statement as suggested by 0x517A5D to make the code easier to understand by removing the ambiguity over the debatable interpretations over how modulus should function with negative numbers.

I gave it a usage help string and configurable repeat time (default of once a month).  It notifies when it makes a fix.  I wrote the help string with the intention of saving the file in hack/scripts/fix/growthbug.rb


If we have a better name for it, I am open to that.  I thought it would be best to put the script in the fix directory.  I would consider using the suggested name fixgrowthbug except I don't want to conflict with the lua version.
Title: Re: DFHack 0.34.11 r3
Post by: Urist McFumbler on June 12, 2013, 01:39:18 am
Greetings.

I am trying to figure out how to automate the "superdwarf add" command instead of using press a bound key 144 times.

Would really appreciate if anyone of the scripting gurus could give me a sample on how to go about it.

Secondly, I am trying to figure out how to construct a steam engine. What do I need to do? Insert a new workshop with the token or just modify any existing workshop?

Thanks.

Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 12, 2013, 01:40:35 am
fastdwarf

steam workshop: just copy the given one is what I would do
Title: Re: DFHack 0.34.11 r3
Post by: Urist McFumbler on June 12, 2013, 01:45:41 am
fastdwarf

steam workshop: just copy the given one is what I would do

Dear Putnam,

I am already using fastdwarf but I want to shorten the "on break" times which only the superdwarf command can adjust.

:facepalm: Next time I will look through every dang folder before asking a stupid question.

Thanks with a redface.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 12, 2013, 01:47:35 am
oh then siren
Title: Re: DFHack 0.34.11 r3
Post by: Urist McFumbler on June 12, 2013, 01:51:53 am
oh then siren

Thanks
Title: Re: DFHack 0.34.11 r3
Post by: Goran on June 12, 2013, 03:11:34 am
Would it be possible to do a script which would turn constructions into rock? Games with a lot of constructed buildings get sluggish, and I expect they would work better if they had a few thousand stone blocks that were used to build the dwarven city be turned into natural rock formation and the items deleted. Just a thought, I have no idea how this would work out or if it would affect pathing, temperature, indoor, outdoor and stuff. But it would be a neat way to clean up the fort.
Title: Re: DFHack 0.34.11 r3
Post by: FengYun on June 12, 2013, 04:04:03 am
I'm sorry, but do I just add 'fix/growthbug enable' to dfhack.init? I didn't quite get what days/months are for.

EDIT: After placing the script to the fix folder, of course.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 12, 2013, 06:58:35 am
I seem to recall there was a script to add a foreign unit to your fort, like say a caravan guard (dwarven)... I've tried googling, but can't seem to find where I found that script. I've got a stray dwarven caravan guard hanging out, caravan is long gone, so I figured i"d just add him to the fort maybe it'd fix him.
Title: Re: DFHack 0.34.11 r3
Post by: FengYun on June 12, 2013, 07:03:29 am
It's 'makeown'. You can read about this in .../Dwarf Fortress/hack/Readme.html
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 12, 2013, 07:10:22 am
It's 'makeown'. You can read about this in .../Dwarf Fortress/hack/Readme.html
are there restrictions on these units?
I grabbed a dwarf..I can see him.. and see him in dwarf therapist.. definitely mine. But when I tried to add him to my speardwarf squad, I can't find the name with searching. And when I tried to add him via dwarf therapist, it sort of showed him in the squad, but in the military screen he wasn't there.

When I hover over her in game and go to preferences there is no squad list like the other dwarves in my fort have.
Title: Re: DFHack 0.34.11 r3
Post by: FengYun on June 12, 2013, 09:20:59 am
Yes, there are restrictions.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 12, 2013, 10:20:39 am
Would it be possible to do a script which would turn constructions into rock? Games with a lot of constructed buildings get sluggish, and I expect they would work better if they had a few thousand stone blocks that were used to build the dwarven city be turned into natural rock formation and the items deleted. Just a thought, I have no idea how this would work out or if it would affect pathing, temperature, indoor, outdoor and stuff. But it would be a neat way to clean up the fort.

If this works on smooth constructed walls, it would allow multiplying rare stone.  Not sure whether that matters.  Also, it probably could only work on constructions made of rock materials.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 12, 2013, 07:54:22 pm
I'm back. I haven't had any trouble back in moltenchannels, and I'm still using that code. Is there something I can use to get the actual sizes of dwarves?
Title: Re: DFHack 0.34.11 r3
Post by: Hommit on June 13, 2013, 01:21:20 am
Is there any way to fix loyalty cascade?
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on June 13, 2013, 01:48:42 am
Is there any way to fix loyalty cascade?
Well there's a script called fix/loyaltycascade.  I've never used it, but it's name is suggestive.
Title: Re: DFHack 0.34.11 r3
Post by: ag on June 13, 2013, 01:52:10 am
If this works on smooth constructed walls, it would allow multiplying rare stone.  Not sure whether that matters.  Also, it probably could only work on constructions made of rock materials.

There may be a way to at least delete the actual items used in the constructions, because Quietust found that worldgen constructions use a special flag that makes the game create the item on deconstruction, instead of creating all the items beforehand like with normal ones. Thus, deleting the items while simultaneously setting the flags shouldn't affect the resulting gameplay behavior.

And yes, turning constructions into map tiles can only work with rock, because they would have to be turned into mineral veins in order to preserve the material.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 13, 2013, 04:21:01 am
Would it be possible to do a script which would turn constructions into rock? Games with a lot of constructed buildings get sluggish, and I expect they would work better if they had a few thousand stone blocks that were used to build the dwarven city be turned into natural rock formation and the items deleted. Just a thought, I have no idea how this would work out or if it would affect pathing, temperature, indoor, outdoor and stuff. But it would be a neat way to clean up the fort.

If this works on smooth constructed walls, it would allow multiplying rare stone.  Not sure whether that matters.  Also, it probably could only work on constructions made of rock materials.

Digging a tile as a 1/4 probability of giving you a stone. A stone can be turned into 4 blocks. 4 blocks can make 4 walls. You can do a random walk with the number of resources you have, but you can't reliably use this to gain resources.

On the other hand, gems and adamantine always drop stones, so just making it so you can't reconstruct gem tiles or adamantine tiles would prevent cheating.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 13, 2013, 04:48:01 am
Would it be possible to do a script which would turn constructions into rock? Games with a lot of constructed buildings get sluggish, and I expect they would work better if they had a few thousand stone blocks that were used to build the dwarven city be turned into natural rock formation and the items deleted. Just a thought, I have no idea how this would work out or if it would affect pathing, temperature, indoor, outdoor and stuff. But it would be a neat way to clean up the fort.

If this works on smooth constructed walls, it would allow multiplying rare stone.  Not sure whether that matters.  Also, it probably could only work on constructions made of rock materials.

Digging a tile as a 1/4 probability of giving you a stone. A stone can be turned into 4 blocks. 4 blocks can make 4 walls. You can do a random walk with the number of resources you have, but you can't reliably use this to gain resources.

On the other hand, gems and adamantine always drop stones, so just making it so you can't reconstruct gem tiles or adamantine tiles would prevent cheating.

All small clusters always drop stones.  I forget whether there are any small cluster stones in vanilla, but there definitely are in Masterwork.  The script should ignore blocks made of any small cluster material (as well as adamantine and non-stone materials).  Reconstructing adamantine or small cluster tiles with uncut stone would be fine, since you'd only get back what you put in.

Although, that feature could be used to turn all of your floors to adamantine for extremely valuable rooms... not that room value is in short supply very often.  Constructed walls also do something screwy with the floor, but it's more localized (that is, the resulting floor material has to be native to the layer).
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on June 13, 2013, 04:59:48 am
All small clusters always drop stones. I forget whether there are any small cluster stones in vanilla, but there definitely are in Masterwork.

No, they don't. Only stones with IS_GEM tag have a 100% droprate. There's like twenty minor minerals that only occur in small, <9 tile clusters. Graphite and brimstone and hornblende and chromite and borax and rutile and orpiment and realgar and and and and and.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 13, 2013, 05:19:01 am
All small clusters always drop stones. I forget whether there are any small cluster stones in vanilla, but there definitely are in Masterwork.

No, they don't. Only stones with IS_GEM tag have a 100% droprate. There's like twenty minor minerals that only occur in small, <9 tile clusters. Graphite and brimstone and hornblende and chromite and borax and rutile and orpiment and realgar and and and and and.

Hmm... Wolframite in Masterwork Mod has a 100% droprate, but I don't see any [IS_GEM] tag in the raws.  There is a [SPECIAL] tag, if that matters.

This is it:

Code: [Select]
[INORGANIC:WOLFRAMITE]
[USE_MATERIAL_TEMPLATE:STONE_TEMPLATE]
[STATE_NAME_ADJ:ALL_SOLID:wolframite][DISPLAY_COLOR:7:0:1][TILE:138]
[ENVIRONMENT_SPEC:GRANITE:CLUSTER_SMALL:75]
[ENVIRONMENT:IGNEOUS_ALL:CLUSTER_SMALL:75]
[ENVIRONMENT:METAMORPHIC:CLUSTER_SMALL:100]
[SOLID_DENSITY:2307]
[IS_STONE]
[MELTING_POINT:12457][MAX_EDGE:10000]
[MATERIAL_VALUE:15]
[REACTION_CLASS:WOLFRAM]
[SPECIAL]

...and that stuff has a 100% droprate.

EDIT: From the wiki:

Quote
When the wall-part is removed from a stone tile, there is a 25% chance that a single stone (also known as a boulder) will be left behind. The same applies to most ores. Any minerals that are found in small clusters have a 100% chance of leaving a stone or rough gem behind (and so does raw adamantine).

Not entirely sure whether "minerals" includes junk like hornblende or not, but it apparently includes wolframite (which isn't smeltable - it uses a custom reaction to get the bars instead), and for it to be based on whether the stone is economic or not would be rather strange.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 13, 2013, 05:38:19 am
Yes, there are restrictions.

Is there anyway to further mod these made-owned dwarves to make them behave like a normal dwarf?
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on June 13, 2013, 05:56:58 am
Hmm... Wolframite in Masterwork Mod has a 100% droprate, but I don't see any [IS_GEM] tag in the raws.  There is a [SPECIAL] tag, if that matters.

Oops, that's right. Adamantine (DEEP_SPECIAL) and gems both have a 100% droprate. The cluster shape or size still has no effect, though.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 13, 2013, 11:25:27 am
Hmm... Wolframite in Masterwork Mod has a 100% droprate, but I don't see any [IS_GEM] tag in the raws.  There is a [SPECIAL] tag, if that matters.

Oops, that's right. Adamantine (DEEP_SPECIAL) and gems both have a 100% droprate. The cluster shape or size still has no effect, though.

Uh... this is just [SPECIAL], not [DEEP_SPECIAL].

You're claiming the wiki (http://dwarffortresswiki.org/index.php/DF2012:Mining#Mineral_production_.28profit.21.29) is wrong (and none of the usual sources of wiki wrongness seem to apply).  I think you're going to have to provide something much stronger than your word on the matter.  Really, only tests with screenshots could overcome that hurdle.
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on June 13, 2013, 11:40:29 am
...huh. I just tested it out myself in an old fort of mine (with red tourmalines and saltpeter) and what do you know, I was wrong. Maximum saltpeter droprate from like three separate deposits, just like the tourmalines.

I could've sworn up and down that non-gem small deposit stuff like hornblende acted just like ordinary stone. I'll go wipe this egg from my face.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 13, 2013, 07:04:12 pm
Hmm... Wolframite in Masterwork Mod has a 100% droprate, but I don't see any [IS_GEM] tag in the raws.  There is a [SPECIAL] tag, if that matters.

Oops, that's right. Adamantine (DEEP_SPECIAL) and gems both have a 100% droprate. The cluster shape or size still has no effect, though.

Uh... this is just [SPECIAL], not [DEEP_SPECIAL].

You're claiming the wiki (http://dwarffortresswiki.org/index.php/DF2012:Mining#Mineral_production_.28profit.21.29) is wrong (and none of the usual sources of wiki wrongness seem to apply).  I think you're going to have to provide something much stronger than your word on the matter.  Really, only tests with screenshots could overcome that hurdle.
Technically, DEEP_SPECIAL implies SPECIAL (i.e. setting the former is the same as setting both), so it's possible that it's actually the latter which forces 100% drop rate.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 13, 2013, 07:26:32 pm
Though we've established that it's actually CLUSTER_SMALL and CLUSTER_ONE that cause the 100% drop rate, and that [SPECIAL] may have nothing to do with it at all ([DEEP_SPECIAL] probably does, though)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 13, 2013, 08:00:42 pm
Is there any way in DFHack to write a script that can take 2+ cursor inputs from the user? I want to do something where the user has to select two creatures, and then the script performs a certain operation regarding those two creatures.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on June 13, 2013, 08:08:37 pm
Is there any way in DFHack to write a script that can take 2+ cursor inputs from the user? I want to do something where the user has to select two creatures, and then the script performs a certain operation regarding those two creatures.
there's a way to set it up where dfhack will wait for an imput via "getline" and you can realign the cursor to another unit.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 13, 2013, 08:26:34 pm
Though we've established that it's actually CLUSTER_SMALL and CLUSTER_ONE that cause the 100% drop rate, and that [SPECIAL] may have nothing to do with it at all ([DEEP_SPECIAL] probably does, though)
I've just located the code, and it looks to work something like this:
1. If it's a small cluster or single-tile inclusion, it always drops a stone
2. If it's a vein, it has a 1/3 chance to drop a stone
3. If it's a large cluster, it has a 1/4 chance to drop a stone
4. If it's not part of a mineral inclusion (e.g. layer stone or feature stone), it has a 1/4 chance to drop a stone
5. If it's made of a DEEP_SPECIAL or DEEP_SURFACE material (in case your DEEP_SURFACE material is diggable), then it becomes a 100% chance to drop a stone.
6. If it's made of a SOIL material, then it becomes a 0% chance to drop a stone.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 13, 2013, 09:14:58 pm
Is there any way in DFHack to write a script that can take 2+ cursor inputs from the user? I want to do something where the user has to select two creatures, and then the script performs a certain operation regarding those two creatures.
there's a way to set it up where dfhack will wait for an imput via "getline" and you can realign the cursor to another unit.

I get an error about an "attempt to call global 'getline' (a nil value)" and something about main chunk tail calls.

Looking at sample script here: http://www.bay12forums.com/smf/index.php?topic=93317.msg3625175#msg3625175
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 13, 2013, 09:25:14 pm
dfhack.getline()?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 13, 2013, 10:03:00 pm
dfhack.getline()?

Now I get an error about an "attempt to call field 'getline' (a nil value)".

EDIT:
An online lua reference suggests io.read(). This initially appears to work, but the script causes df to become unresponsive and frozen until you provide input, so I can't move the cursor.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 14, 2013, 01:48:33 am
dfhack.getline()?

Now I get an error about an "attempt to call field 'getline' (a nil value)".

EDIT:
An online lua reference suggests io.read(). This initially appears to work, but the script causes df to become unresponsive and frozen until you provide input, so I can't move the cursor.

That is wrong way to do anyway. I was thinking about making a series of overlays for e.g. unit selection (including multiple, from list, by some filter), item selection, generic cursor, etc...
They would be like gui.dialogs. this https://github.com/warmist/OpusArcania/blob/master/buildings.lua actually uses an overlay to show mana in world and has movable cursor.  movie how it looks  (http://mkv25.net/dfma/movie-2518-morethingsadded)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 14, 2013, 02:06:20 am
I am going to get around the multiple input problem for now by using two scripts.

Script 1 will print the id or other unique identifer of the targeted unit. You use this on both units.

Script 2 will prompt twice for user text input, and you enter the numbers that you can see above. The script can then find the two units. It's clumsy, but it will work for my experiments.
Title: Re: DFHack 0.34.11 r3
Post by: ag on June 14, 2013, 02:18:04 am
An online lua reference suggests io.read(). This initially appears to work, but the script causes df to become unresponsive and frozen until you provide input, so I can't move the cursor.

Read the dfhack lua api documentation, instead of random online references: https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#native-utilities (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#native-utilities)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 14, 2013, 09:06:19 am
An online lua reference suggests io.read(). This initially appears to work, but the script causes df to become unresponsive and frozen until you provide input, so I can't move the cursor.

Read the dfhack lua api documentation, instead of random online references: https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#native-utilities (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#native-utilities)

Thanks, the script is now working as I intended. You can now change cursor targets while it is waiting for input:

Code: [Select]
print("Target first unit")
test=dfhack.lineedit("")
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

print("Target second unit")
test=dfhack.lineedit("")
unit2=dfhack.gui.getSelectedUnit()
if unit2==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

print(unit.id, unit2.id)
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 14, 2013, 01:07:08 pm
Is there any indication of how often the game goes through the list of items on the map? Because this is related to FPS drop, is there a way to change how often the game checks and reduce it to "when necessary" or "every week"? This kind of hack might help increase framerates.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 14, 2013, 02:03:42 pm
It depends on what you mean by "go through the list of items on the map" - there's checks for updating temperature, increasing item age (and applying stuff like rot and possibly also fire damage), generating hauling jobs, and other various operations, and those are all done on completely separate intervals (and I believe some have the same interval but different offsets). Changing those isn't as simple as you might think.

Even if they could be changed, how exactly would you define "when necessary"?

If you really want to reduce FPS drop related to large item counts, then just destroy the extra items so the game doesn't have to deal with them - we already have "autodump" to do that with garbage, and (as angavrilov mentioned in a post earlier) it should also be possible to 'free up' the items used by constructions.

[edit] I've just written a new plugin (which will be called "cleanconst") which gets rid of construction materials and marks them to be recreated on disassembly.
Title: Re: DFHack 0.34.11 r3
Post by: UberFuber on June 14, 2013, 02:23:22 pm
It depends on what you mean by "go through the list of items on the map" - there's checks for updating temperature, increasing item age (and applying stuff like rot and possibly also fire damage), generating hauling jobs, and other various operations, and those are all done on completely separate intervals (and I believe some have the same interval but different offsets). Changing those isn't as simple as you might think.

Even if they could be changed, how exactly would you define "when necessary"?

If you really want to reduce FPS drop related to large item counts, then just destroy the extra items so the game doesn't have to deal with them - we already have "autodump" to do that with garbage, and (as angavrilov mentioned in a post earlier) it should also be possible to 'free up' the items used by constructions.
DFHack also have the temperature tweak, which means it takes less time (hence less processing power) for items to reach equilibrium temperature.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 14, 2013, 11:39:52 pm
Turns out that swapping souls between two creatures actually works. This only results in a skill/preference/personality trait swap. Alliances, happiness, names, thoughts, relationships, and profession are stored seperately (I know we already knew that). One could argue that you want the creature's deity to be tied to the soul, even if it makes sense to track the parents of the body. Also, the soul has a gender, so after a swap the creature's description may have "He" used to describe physical attributes and "She" used to describe preferences/mental.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 15, 2013, 12:58:52 am
Turns out that swapping souls between two creatures actually works. This only results in a skill/preference/personality trait swap. Alliances, happiness, names, thoughts, relationships, and profession are stored seperately (I know we already knew that). One could argue that you want the creature's deity to be tied to the soul, even if it makes sense to track the parents of the body. Also, the soul has a gender, so after a swap the creature's description may have "He" used to describe physical attributes and "She" used to describe preferences/mental.
Also you can stack souls into one body. Though it does not do much.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 15, 2013, 01:00:09 am
That's an understatement. It does nothing, as far as I can tell.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 15, 2013, 01:12:47 am
That's an understatement. It does nothing, as far as I can tell.
Well you still hold the souls. They could be used as a resource. Just don't forget which is yours and if you use up the last one, then too bad for you...
Title: Re: DFHack 0.34.11 r3
Post by: Sergarr on June 15, 2013, 05:17:23 am
Turns out that swapping souls between two creatures actually works. This only results in a skill/preference/personality trait swap. Alliances, happiness, names, thoughts, relationships, and profession are stored seperately (I know we already knew that). One could argue that you want the creature's deity to be tied to the soul, even if it makes sense to track the parents of the body. Also, the soul has a gender, so after a swap the creature's description may have "He" used to describe physical attributes and "She" used to describe preferences/mental.

Does that affect marriages?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 15, 2013, 10:13:55 am
Turns out that swapping souls between two creatures actually works. This only results in a skill/preference/personality trait swap. Alliances, happiness, names, thoughts, relationships, and profession are stored seperately (I know we already knew that). One could argue that you want the creature's deity to be tied to the soul, even if it makes sense to track the parents of the body. Also, the soul has a gender, so after a swap the creature's description may have "He" used to describe physical attributes and "She" used to describe preferences/mental.

Does that affect marriages?

Nope. Those are stored as a relationship. A married dwarf now has the soul of a dog, with no skills or personality, but the marriage wasn't changed between the dwarf's body and the spouse. The dog is now flashing because it has a legendary skill.

Deleting a dwarf's soul entirely causes the description page to say "Text generation failed: " , and removes all skills/mental attributes/personality, but doesn't otherwise appear to cause the game to crash.
Title: Re: DFHack 0.34.11 r3
Post by: Askot Bokbondeler on June 15, 2013, 10:35:37 am
stuff starting to creep me out. you sure you guys should be playing with that?
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 15, 2013, 01:02:55 pm
I recently put someone soul back in his body (he was floating around as a ghost, and his body was standing around soulless).  Here's a script that's basically the steps I took to do it:

Code: [Select]
body = dfhack.gui.getSelectedUnit()
histfig = df.historical_figure.find(body.hist_figure_id2)
ghost = df.unit.find(histfig.unit_id)

body.name.first_name = ghost.name.first_name
body.name.nickname = ghost.name.nickname
for a,b in pairs(ghost.name.words) do
body.name.words[a] = b
end
for a,b in pairs(ghost.name.parts_of_speech) do
body.name.parts_of_speech[a] = b
end
body.name.language = ghost.name.language
body.name.unknown = ghost.name.unknown
body.name.has_name = ghost.name.has_name

body.status.current_soul = ghost.status.current_soul
body.status.souls:insert("#", body.status.current_soul)
body.hist_figure_id = ghost.hist_figure_id
body.relations.birth_year = ghost.relations.birth_year
body.relations.birth_time = ghost.relations.birth_time
body.relations.old_year = ghost.relations.old_year
body.relations.old_time = ghost.relations.old_time
body.relations.last_attacker_id = ghost.relations.last_attacker_id
body.flags1.important_historical_figure = ghost.flags1.important_historical_figure
body.flags2.important_historical_figure = ghost.flags2.important_historical_figure

ghost.status.current_soul = nil
ghost.status.souls = {}
ghost.hist_figure_id = -1
ghost.flags1.important_historical_figure = false
ghost.flags2.important_historical_figure = false
ghost.relations.ghost_info = nil
ghost.corpse_parts = {}
ghost.flags1.dead = true

histfig.unit_id = body.id
histfig.flags.ghost = false
histfig.flags[15] = false

I also did some extra stuff to restore his outpost liaison position (which he had lost at death), and he promptly left unhappy.  All well and good... now I don't have that stupid nameless peasant and foreign ghost wandering around my fortress. :P He was never my dwarf anyway, just an unfortunate diplomat.

This situation arose in the first place from a dwarf being killed, animated as an undead, killed again, then properly resurrected.  The upshot of this is that there's a lot of stuff that's lost at animation, not just the soul.  I didn't even catch everything - just the stuff that happened to be different for this particular dwarf.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 15, 2013, 01:11:13 pm
stuff starting to creep me out. you sure you guys should be playing with that?

Dwarf Fortress is all about doing what you shouldn't.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on June 15, 2013, 01:16:34 pm
If only we could change the error to say "Unknown and unknowable." Then we could leave something very creepy for adventurers to find...
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on June 15, 2013, 01:23:30 pm
If only we could change the error to say "Unknown and unknowable." Then we could leave something very creepy for adventurers to find...

You could!

Well, only with the DF localization string patching utility (that Masterwork is currently using to alter existing job titles and such), but it should be possible. I checked one of the string dumps and it's right there, in the open.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 15, 2013, 02:11:17 pm
I'm sorry, but do I just add 'fix/growthbug enable' to dfhack.init? I didn't quite get what days/months are for.

EDIT: After placing the script to the fix folder, of course.

Sorry for the slow reply, my Internet was down for a few days.

yes, 'fix/growthbug enable' in dfhack.init will work.  That defaults to one month of game time between checks for new units to fix.  If you feel like that is too long, you can give it some number of weeks 'fix/growthbug enable 2w', or some number of days 'fix/growthbug enable 5d', to have it check more often. Or if you want it to check less often 'fix/growthbug enable 3m' would have it check once per season or every 3 months.

I'm back. I haven't had any trouble back in moltenchannels, and I'm still using that code. Is there something I can use to get the actual sizes of dwarves?

you can use my unit-info-viewer (link in sig), it displays actual size and other things.  However, with a growth fix now available, I need to updated it to drop the calculated expectation.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 15, 2013, 07:27:47 pm
Anyone have any ideas about how to "fix" a dwarf you've used "makeown" to get? Makeown seems to create a dwarf who is "missing" something. I wonder if there is someway to copy stuff from an existing fort dwarf into a dwarf you've acquired via make-own to turn them into a dwarf you can use for everything.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 15, 2013, 07:51:48 pm
Anyone have any ideas about how to "fix" a dwarf you've used "makeown" to get? Makeown seems to create a dwarf who is "missing" something. I wonder if there is someway to copy stuff from an existing fort dwarf into a dwarf you've acquired via make-own to turn them into a dwarf you can use for everything.

What are the indicators that something is missing?
Title: Re: DFHack 0.34.11 r3
Post by: danaris on June 15, 2013, 08:05:18 pm
Anyone have any ideas about how to "fix" a dwarf you've used "makeown" to get? Makeown seems to create a dwarf who is "missing" something. I wonder if there is someway to copy stuff from an existing fort dwarf into a dwarf you've acquired via make-own to turn them into a dwarf you can use for everything.

What are the indicators that something is missing?

IIRC, dwarves snagged through makeown are not histfigs, and thus cannot be put in armies or have a few other things happen to them.
Title: Re: DFHack 0.34.11 r2
Post by: Kurik Amudnil on June 15, 2013, 09:46:11 pm
Anyone have any ideas about how to "fix" a dwarf you've used "makeown" to get? Makeown seems to create a dwarf who is "missing" something. I wonder if there is someway to copy stuff from an existing fort dwarf into a dwarf you've acquired via make-own to turn them into a dwarf you can use for everything.

What are the indicators that something is missing?

IIRC, dwarves snagged through makeown are not histfigs, and thus cannot be put in armies or have a few other things happen to them.

This post from a while back had something to say about that:

Question about makeown:

I used it on a dwarven caravan guard, but he's not listed as a citizen or member of anything (no blue text in his description). I can force him into a squad using DT and he'll follow station orders, but he won't go and train or put on a uniform, or in fact any clothes at all. He was wearing them at one point, but then dropped everything when I forced him into a squad. Removing him from the squad via DT doesn't make him wear anything either.

Is there any way of making him a full member of the fortress, or does makeown only work for making civilians?
We were trying to make this work over in the ☼Masterwork Succession Fortress: Exultationhexxed☼ (http://www.bay12forums.com/smf/index.php?topic=124444.0) game, because migration never started beyond the hardcoded waves. 

Here's my current attempt to supplement tweak makeown by creating a new historical figure record. It's still clearly incomplete.

Code: [Select]
function find_entity(id)
  for ii = 0,#df.global.world.entities.all - 1 do
    if df.global.world.entities.all[ii].id == id then
      return ii
    end
  end
  return -1
end

function create_hist_fig(unit)
  if unit.flags1.important_historical_figure == true then
    print("Already a historical figure.")
    return
  end
 
  new_fig_id = df.global.hist_figure_next_id

  new_hist_fig = df.historical_figure:new()
  new_hist_fig.profession = unit.profession
  new_hist_fig.race = unit.race
  new_hist_fig.caste = unit.caste
  new_hist_fig.sex = unit.sex
  new_hist_fig.appeared_year = unit.relations.birth_year
  new_hist_fig.born_year = unit.relations.birth_year
  new_hist_fig.born_seconds = unit.relations.birth_time
  new_hist_fig.curse_year = unit.relations.curse_year
  new_hist_fig.curse_seconds = unit.relations.curse_time
  new_hist_fig.anon_1 = unit.relations.anon_2
  new_hist_fig.anon_2 = unit.relations.anon_3
  new_hist_fig.old_year = unit.relations.old_year
  new_hist_fig.old_seconds = unit.relations.old_time
  new_hist_fig.died_year = -1
  new_hist_fig.died_seconds = 1
  new_hist_fig.name:assign(unit.name)
  new_hist_fig.civ_id = unit.civ_id
  new_hist_fig.population_id  = unit.population_id
  new_hist_fig.breed_id = -1
  new_hist_fig.unit_id = unit.id
  new_hist_fig.id = new_fig_id
 
  civ_link = df.histfig_entity_link_memberst:new()
  civ_link.entity_id = df.global.ui.civ_id
  civ_link.link_strength =  100
 
  fort_link = df.histfig_entity_link_memberst:new()
  fort_link.entity_id = df.global.ui.group_id
  fort_link.link_strength =  100
 
  new_hist_fig.entity_links:insert('#', civ_link)
  new_hist_fig.entity_links:insert('#', fort_link)
 
  df.global.world.history.figures:insert('#', new_hist_fig)
  df.global.hist_figure_next_id = df.global.hist_figure_next_id + 1
 
  unit.flags1.important_historical_figure = true
  unit.flags2.important_historical_figure = true
  unit.hist_figure_id = new_fig_id
  unit.hist_figure_id2 = new_fig_id
 
  newhist_loc = df.global.world.history.figures[#df.global.world.history.figures - 1]
 
  df.global.ui.main.fortress_entity.histfig_ids:insert('#', new_fig_id)
  df.global.ui.main.fortress_entity.hist_figures:insert('#', newhist_loc)
 
  civ_index = find_entity(df.global.ui.main.fortress_entity.entity_links[0].target)
  df.global.world.entities.all[civ_index].histfig_ids:insert('#', new_fig_id)
  df.global.world.entities.all[civ_index].hist_figures:insert('#', newhist_loc)
end

unit = dfhack.gui.getSelectedUnit()
create_hist_fig(unit)
The guards, when converted, will:
- show up in Dwarf Therapist (because their histfig's are listed for the fortress entity)
- can set and will obey labor preferences
- claim bedrooms
- have strange moods
- join squads (not lead them)
- equip uniforms and weapons as soldiers
- go to training
- obey squad orders to attack, move, etc.

The game doesn't seem to break, and in particular, it will keep creating more historical entities without complaint. (Thanks, Ag!)

The biggest problem is noble assignments and squad leadership. They show up in the list to be made a noble, but once you exit the window, the position remains unfilled.

I think that's an improvement over just tweak makeown, but doesn't do everything necessary to truly add the dwarf to the fortress.
Title: Re: DFHack 0.34.11 r3
Post by: Hommit on June 16, 2013, 01:54:55 am
Is it possible to make workflow forge steel armor until i have exactly 10 masterwork ones? Can someone give me an asample? thx

edit: i think i got it, but... it seems that workflow manages free items, on top of that in use. any way to disable it after production is done?

edit2:
workflow count ITEM_ARMOR:ITEM_ARMOR_MAIL_SHIRT//INORGANIC:STEEL/LOCAL,MASTERWORK 10 0
Cannot find item type: ITEM_ARMOR:ITEM_ARMOR_MAIL_SHIRT
whats wrong?
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 16, 2013, 03:08:48 am
Kurik, thanks. That looks like a script I can just run, I don't have to hunt down the unit I used the command on?

Also..how do I know to make it a .rb or .lua script? Does it matter?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 16, 2013, 07:49:22 am
Kurik, thanks. That looks like a script I can just run, I don't have to hunt down the unit I used the command on?

Also..how do I know to make it a .rb or .lua script? Does it matter?
It absolutely does matter - in this case, it must be a .lua script.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 16, 2013, 08:37:10 am
Kurik, thanks. That looks like a script I can just run, I don't have to hunt down the unit I used the command on?

Also..how do I know to make it a .rb or .lua script? Does it matter?
It absolutely does matter - in this case, it must be a .lua script.

Is there a way to tell from the code which one I should make? I often find code pasted in a message somewhere with no mention as to whether it should be an rb or a lua script (luckily I chose lua and this script ran fine)
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 16, 2013, 12:49:44 pm
Kurik, thanks. That looks like a script I can just run, I don't have to hunt down the unit I used the command on?

Also..how do I know to make it a .rb or .lua script? Does it matter?
It absolutely does matter - in this case, it must be a .lua script.

Is there a way to tell from the code which one I should make? I often find code pasted in a message somewhere with no mention as to whether it should be an rb or a lua script (luckily I chose lua and this script ran fine)

Well, looking through the ruby and lua scripts in my copy of DFHack, ruby scripts have the word "def" dotted around, while lua scripts use "function".  You can also check the comments - comments in lua start with "--", while comments in ruby start with "#".
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 16, 2013, 11:11:30 pm
It depends on what you mean by "go through the list of items on the map" - there's checks for updating temperature, increasing item age (and applying stuff like rot and possibly also fire damage), generating hauling jobs, and other various operations, and those are all done on completely separate intervals (and I believe some have the same interval but different offsets). Changing those isn't as simple as you might think.

Even if they could be changed, how exactly would you define "when necessary"?

If you really want to reduce FPS drop related to large item counts, then just destroy the extra items so the game doesn't have to deal with them - we already have "autodump" to do that with garbage, and (as angavrilov mentioned in a post earlier) it should also be possible to 'free up' the items used by constructions.

[edit] I've just written a new plugin (which will be called "cleanconst") which gets rid of construction materials and marks them to be recreated on disassembly.

By go through all the items on the map, I mean run a search through every single one for something or to edit something.

"When necessary" is defined as:
-When you look through the items with "look" or on the stocks screen (maybe).
-When a dwarf or other creature gets a job that requires an item.
-When you want to build something.
-After a certain interval, to calculate age and rotting and so on.

The "hack" to reduce the search interval is related to the last one.

When creatures look for items to carry out jobs, the check needs to be done but these events are not frequent enough to cause massive FPS decay on the scale that we are seeing.

The idea is to ensure the check for ageing and decay is only carried out every few ticks, i.e. once per day or once per week depending on how much you have in the game. The interval set depends on personal preferences and the state of FPS for the user. While the interval should be user-defined, but I am OK with increasing the length of time to say, 10x what it is now just to start out with. I know this will change the way the game behaves, but it will be a good compromise to keep the game playable.

If we have to keep the item count as low as it needs to be now, we keep ending up with trouble playing forts longer than ten years. If we even get to ten years, or five years, that is.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 17, 2013, 02:05:40 pm
Kurik, thanks. That looks like a script I can just run, I don't have to hunt down the unit I used the command on?

Also..how do I know to make it a .rb or .lua script? Does it matter?

that script does use getSelectedUnit so you will have to select the unit in one of its supported methods.  I haven't played around with makeown myself so I don't know how feasible it would be to make the script look for any incomplete citizens with which to add historical figure data. 

A thought off the top of my head about why these units can't be placed into a noble position might have to do with a lack of recorded events such as arriving at the fort, birth, or some such.  I might look into that later if no one else does.
Title: Re: DFHack 0.34.11 r3
Post by: sonerohi on June 17, 2013, 02:27:49 pm
Sorry if I'm missing something frustratingly obvious, but I am having issues with the hack to fix fortress born critters growing. First off, I have to be honest and say I'm not comfortable or competent with lua. Whenever I try to run lua files, I get that windows prompt to select the program to open it with. Is there something I'm needing to get? Or is this something that someone could just put up as a download for those of us who are not quite so savvy?
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 17, 2013, 03:03:41 pm
Sorry if I'm missing something frustratingly obvious, but I am having issues with the hack to fix fortress born critters growing. First off, I have to be honest and say I'm not comfortable or competent with lua. Whenever I try to run lua files, I get that windows prompt to select the program to open it with. Is there something I'm needing to get? Or is this something that someone could just put up as a download for those of us who are not quite so savvy?

Just type "lua" in the DFHack window, then paste this part of the script in:

Code: [Select]
    for _,unit in ipairs(df.global.world.units.active) do
        r = unit.relations.birth_time - 10 * math.modf(unit.relations.birth_time / 10) --Kurik Amudnil's code; if it's not clear, it sets a creature's birth_time to the nearest multiple of 10 of the previous one.
        if r > 0 then
            unit.relations.birth_time = unit.relations.birth_time - r
        end
    end

That'll fix every creature currently on the map.

Then type "quit" to get out of lua mode and back to where you type DFHack commands.
Title: Re: DFHack 0.34.11 r3
Post by: sonerohi on June 17, 2013, 03:40:50 pm
And then apply that every immigrant wave and birth?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 17, 2013, 03:47:53 pm
A few pages back there was a script that runs that every so often.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 17, 2013, 04:26:23 pm
And then apply that every immigrant wave and birth?

Personally, I'm satisfied with just running it once shortly after setting up a military, to guarantee that my military is the right size.  If you're continually butchering animals raised in the fortress, then that might not work so well.

To fix it permanently, you'll need to put the aforementioned script in the hack/scripts directory, then put the command to enable the script ("growthbug enable", I think) in your dfhack.init file (probably at the end).
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 17, 2013, 06:19:04 pm
The .lua script Putnam wrote should go in your raw folder at the top level, and will silently run the fix every month.

For anything but succession games, use Kurik's ruby script - it goes in the usual hack/scripts/fix spot, and add 'fix/growthbug enable' to dfhack.init.  It'll run at a configurable interval (defaults to monthly) and pop up a notification of what it fixed each time.

I've included this one in the LNP in my sig. 
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 17, 2013, 10:58:43 pm
Kurik, thanks. That looks like a script I can just run, I don't have to hunt down the unit I used the command on?

Also..how do I know to make it a .rb or .lua script? Does it matter?

that script does use getSelectedUnit so you will have to select the unit in one of its supported methods.  I haven't played around with makeown myself so I don't know how feasible it would be to make the script look for any incomplete citizens with which to add historical figure data. 

A thought off the top of my head about why these units can't be placed into a noble position might have to do with a lack of recorded events such as arriving at the fort, birth, or some such.  I might look into that later if no one else does.

The events are probably unimportant, but for completeness we could add a history_event_add_hf_entity_linkst and a history_event_change_hf_statest. 

To get the noble positions working I found that the unit needs a nemesis entry.
Spoiler: fixmakeown.lua (click to show/hide)

changes:still missing and perhaps not needed:script to add nemesis to units that have already had historical figures added with the previous version of the fixmakeown or fixhistfig script:
Spoiler: fixnemesis.lua (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 18, 2013, 01:12:30 am
you are a scholar and a gentleman.
Title: Re: DFHack 0.34.11 r3
Post by: Button on June 18, 2013, 05:01:16 am
Hey memory editing types,

I found a bug(?) with [SHELL] having different physical properties in play (http://www.bay12forums.com/smf/index.php?topic=127386.0) from the ones defined in the raws. The properties I investigated were attack properties, but I'm pretty sure, anecdotally, that shell is also weaker for defense than its raws would indicate. Can one of y'all who knows how to navigate the whole "investigating memory while the game is running" thing check out what's going on?
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on June 18, 2013, 07:18:30 am
I wrote this to autoresume suspended building constructions.
Makes cracking aquifers 500% less annoying.
Spoiler (click to show/hide)
My question is, can I make DF exit the 'q' menu when the script starts running?  That would make it work smoother.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 18, 2013, 07:46:12 am
My question is, can I make DF exit the 'q' menu when the script starts running?  That would make it work smoother.

i think this would do that:
Code: [Select]
dfhack.screen.dismiss(dfhack.gui.getCurViewscreen())
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on June 18, 2013, 08:02:55 am
i think this would do that:
Code: [Select]
dfhack.screen.dismiss(dfhack.gui.getCurViewscreen())
Thanks, but that closes DF entirely.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 18, 2013, 09:35:13 am
There is already a ruby autounsuspend script released with dfhack r3.  Turn it on 'autounsuspend enable' when working on the aquifer, turn it off 'autounsuspend disable' when done.

as for exiting q screen from script, I think you would need something like.

Code: (lua) [Select]
gui = require 'gui'
gui.simulateInput(dfhack.gui.getCurViewscreen(), 'LEAVESCREEN')

EDIT: identify code as lua code
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on June 18, 2013, 02:24:16 pm
Thanks, that did it.
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on June 18, 2013, 07:01:18 pm
(question for adventure mode dfhack) how do you catch and tame a animal?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 18, 2013, 08:06:50 pm
Hey memory editing types,

I found a bug(?) with [SHELL] having different physical properties in play (http://www.bay12forums.com/smf/index.php?topic=127386.0) from the ones defined in the raws. The properties I investigated were attack properties, but I'm pretty sure, anecdotally, that shell is also weaker for defense than its raws would indicate. Can one of y'all who knows how to navigate the whole "investigating memory while the game is running" thing check out what's going on?

No need, there is no bug: http://www.bay12forums.com/smf/index.php?topic=127386.msg4331393#msg4331393
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 19, 2013, 12:31:52 am
Discovered the meanings of some more unknown vectors. These may be relevant to the healing script that crossmr was trying to write: http://www.bay12forums.com/smf/index.php?topic=91166.msg4297004#msg4297004 , in particular the body component severed and status flags.

See https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L738
body_layer_328 is a 0-100 value indexed by nonsolid layer id. Initially 100 for all liquid, gas, etc. body part layers, it can be drained to 0 as the creatures lose material. I'd call it "percent fluid remaining". Used in fire men and iron men, among others.
body_layer_338 is normally 0 for each body part layer, but is 1 if the body part layer is severed (i.e. you can break away a layer without destroying the entire body part). It is also 2 if the body part layer is leaking (i.e. iron men), and 3 if the body part layer has completely leaked away (1+2=3).
body_layer_348 is the contact area of wounds on the body part layer. It seems to heal instantly to 0 outside of combat.
body_layer_358 is 100x the surface percentage of cuts/fractures on the body part layer. If you stab a dwarf with a contact area 50 weapon in a body part that has a calculated contact area of 80, the surface percentage of the wound is 63, so the corresponding value in body_layer_358 is 6300.
body_layer_368 is 100x the surface percentage of dents on the body part layer. It seems to heal instantly to 0 outside of combat.
body_layer_378 is 100x the surface percentage of "effects" on the body part layer (such as bruises, burns, frostbite, melting, freezing, necrosis, and blistering).

These are related to some of the wound data found here: https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L1084

Also see this lua script that I wrote to explore the data:
Code: [Select]
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

--printall(unit.body.components)
local lpart=""
local lname=""
local lid=""

for k,v in pairs(unit.body.components.body_layer_328) do
if true then
lid=unit.body.body_plan.nonsolid_layers[k]
lpart=unit.body.body_plan.layer_part[lid]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==lid then
lname=y.layer_name
end
end
print("FLUID LEFT",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_338) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("SEVER/LEAK",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_348) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("CONTACT AREA",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_358) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("SURF % DAMAGE",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_368) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("SURF % DENT",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_378) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("SURF % EFFECT",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_part_status) do
for kk,vv in pairs(v) do
if vv==true then
print("STATUS FLAG",kk,unit.body.body_plan.body_parts[k].name_singular[0].value)
end
end
end
Use it on creatures that are fighting in the arena and have wounds.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 19, 2013, 02:00:47 am
(question for adventure mode dfhack) how do you catch and tame a animal?
Good question. That is almost uncharted territory. Generally i think you need to cage trap an animal, then having food use taming. I forget if i removed or left taming in.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 19, 2013, 03:06:56 am
Discovered the meanings of some more unknown vectors. These may be relevant to the healing script that crossmr was trying to write: http://www.bay12forums.com/smf/index.php?topic=91166.msg4297004#msg4297004 , in particular the body component severed and status flags.

See https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L738
body_layer_328 is a 0-100 value indexed by nonsolid layer id. Initially 100 for all liquid, gas, etc. body part layers, it can be drained to 0 as the creatures lose material. I'd call it "percent fluid remaining". Used in fire men and iron men, among others.
body_layer_338 is normally 0 for each body part layer, but is 1 if the body part layer is severed (i.e. you can break away a layer without destroying the entire body part). It is also 2 if the body part layer is leaking (i.e. iron men), and 3 if the body part layer has completely leaked away (1+2=3).
body_layer_348 is the contact area of wounds on the body part layer. It seems to heal instantly to 0 outside of combat.
body_layer_358 is 100x the surface percentage of cuts/fractures on the body part layer. If you stab a dwarf with a contact area 50 weapon in a body part that has a calculated contact area of 80, the surface percentage of the wound is 63, so the corresponding value in body_layer_358 is 6300.
body_layer_368 is 100x the surface percentage of dents on the body part layer. It seems to heal instantly to 0 outside of combat.
body_layer_378 is 100x the surface percentage of "effects" on the body part layer (such as bruises, burns, frostbite, melting, freezing, necrosis, and blistering).

These are related to some of the wound data found here: https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L1084

Also see this lua script that I wrote to explore the data:
Code: [Select]
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

--printall(unit.body.components)
local lpart=""
local lname=""
local lid=""

for k,v in pairs(unit.body.components.body_layer_328) do
if true then
lid=unit.body.body_plan.nonsolid_layers[k]
lpart=unit.body.body_plan.layer_part[lid]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==lid then
lname=y.layer_name
end
end
print("FLUID LEFT",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_338) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("SEVER/LEAK",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_348) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("CONTACT AREA",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_358) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("SURF % DAMAGE",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_368) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("SURF % DENT",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_layer_378) do
if v ~= 0 then
lpart=unit.body.body_plan.layer_part[k]
lname=" "
for x,y in pairs(unit.body.body_plan.body_parts[lpart].layers) do
if y.layer_id==k then
lname=y.layer_name
end
end
print("SURF % EFFECT",lname,v,unit.body.body_plan.body_parts[lpart].name_singular[0].value)
end
end

for k,v in pairs(unit.body.components.body_part_status) do
for kk,vv in pairs(v) do
if vv==true then
print("STATUS FLAG",kk,unit.body.body_plan.body_parts[k].name_singular[0].value)
end
end
end
Use it on creatures that are fighting in the arena and have wounds.

I wasn't trying to write, just trying to fix up, I've done some programming, but haven't had the time to get into the scripting language here yet. What I am wondering is about nerve damage. I think my legendary hammerdwarf and that immigrant that showed up all wrecked, had nerve damage. I had another dwarf with regular injuries, who lost the ability to stand, I fixed him up and he's good. But the hammerdwarf and migrant just won't take. You fix them, they're good for a little while, but after a short time they lose the ability to stand again. I seem to recall that he hammerdwarf had a sensory nerve or something shot. it doesn't show up anymore. Is there anyway I can dump his body status beyond what is shown in the wound/health screen? Somewhat to check those sensory nerves to see if there is something wrong with them?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 19, 2013, 04:17:15 am
Could somebody please bring me up-to-date with the current custom scripts?

I know of warmists startdwarf.rb, the growthfix, exportlegendsmaps, urist-da-vincis control of embark/tradegoods (even though I had no time at all to play around with it) and expwnents digging invaders. (again, no time so far)

Anything I missed that might be benefitial to the usual player, that might be useful in the Masterwork pack?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 19, 2013, 04:30:50 am
Could somebody please bring me up-to-date with the current custom scripts?

I know of warmists startdwarf.rb, the growthfix, exportlegendsmaps, urist-da-vincis control of embark/tradegoods (even though I had no time at all to play around with it) and expwnents digging invaders. (again, no time so far)

Anything I missed that might be benefitial to the usual player, that might be useful in the Masterwork pack?
None of the scripts are mine actually ;)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 19, 2013, 05:39:08 am
I only meant the startdwarf, the link I found mentioned it was yours. Is it jjyg ? I never seen that name before.

Try DFHack (http://www.bay12forums.com/smf/index.php?topic=91166.0) and this tiny script (http://www.bay12forums.com/smf/index.php?topic=91166.msg4244960#msg4244960).  (Thank you, Warmist.)

This is how I found it. It does work nicely. :)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 19, 2013, 07:36:30 am
I only meant the startdwarf, the link I found mentioned it was yours. Is it jjyg ? I never seen that name before.

Try DFHack (http://www.bay12forums.com/smf/index.php?topic=91166.0) and this tiny script (http://www.bay12forums.com/smf/index.php?topic=91166.msg4244960#msg4244960).  (Thank you, Warmist.)

This is how I found it. It does work nicely. :)
Yes it's jjyg in github or jj`` in #dfhack afaik
Title: Re: DFHack 0.34.11 r3
Post by: fricy on June 19, 2013, 09:05:21 am
Quote
New Power Meter plugin
    When activated, implements a pressure plate modification that detects power in gear
    boxes built on the four adjacent N/S/W/E tiles. The gui/power-meter script implements
    the necessary build configuration UI.

I just found this. Am I right to assume that this works as a simple power-to-signal converter? If it's a yes, then a BIG THANK YOU for whoever made this.

So, is it possible to modify other parameters of pressure plates with Dfhack? I ran into a limitation: (http://www.bay12forums.com/smf/index.php?topic=127362.0) the sensitivity of p.plates built on minecart tracks is 50 urists. Can it be modified to 10 urists?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 19, 2013, 09:24:14 am
...
Use it on creatures that are fighting in the arena and have wounds.

I wasn't trying to write, just trying to fix up, I've done some programming, but haven't had the time to get into the scripting language here yet. What I am wondering is about nerve damage. I think my legendary hammerdwarf and that immigrant that showed up all wrecked, had nerve damage. I had another dwarf with regular injuries, who lost the ability to stand, I fixed him up and he's good. But the hammerdwarf and migrant just won't take. You fix them, they're good for a little while, but after a short time they lose the ability to stand again. I seem to recall that he hammerdwarf had a sensory nerve or something shot. it doesn't show up anymore. Is there anyway I can dump his body status beyond what is shown in the wound/health screen? Somewhat to check those sensory nerves to see if there is something wrong with them?

See here: https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L709

This lua script will detect if any body parts of the creature have status flags set, including motor/sensory nerves severed.
Code: [Select]
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

for k,v in pairs(unit.body.components.body_part_status) do
for kk,vv in pairs(v) do
if vv==true then
print("STATUS FLAG",kk,unit.body.body_plan.body_parts[k].name_singular[0].value)
end
end
end

You can also use this:
Code: [Select]
for k,v in pairs(unit.body.components.body_part_status) do
v.motor_nerve_severed=false
v.sensory_nerve_severed=false
end
or similar ruby code to repair all nerve damage stored at this location.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 19, 2013, 10:01:54 am
...
Use it on creatures that are fighting in the arena and have wounds.

I wasn't trying to write, just trying to fix up, I've done some programming, but haven't had the time to get into the scripting language here yet. What I am wondering is about nerve damage. I think my legendary hammerdwarf and that immigrant that showed up all wrecked, had nerve damage. I had another dwarf with regular injuries, who lost the ability to stand, I fixed him up and he's good. But the hammerdwarf and migrant just won't take. You fix them, they're good for a little while, but after a short time they lose the ability to stand again. I seem to recall that he hammerdwarf had a sensory nerve or something shot. it doesn't show up anymore. Is there anyway I can dump his body status beyond what is shown in the wound/health screen? Somewhat to check those sensory nerves to see if there is something wrong with them?

See here: https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L709

This lua script will detect if any body parts of the creature have status flags set, including motor/sensory nerves severed.
Code: [Select]
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

for k,v in pairs(unit.body.components.body_part_status) do
for kk,vv in pairs(v) do
if vv==true then
print("STATUS FLAG",kk,unit.body.body_plan.body_parts[k].name_singular[0].value)
end
end
end

You can also use this:
Code: [Select]
for k,v in pairs(unit.body.components.body_part_status) do
v.motor_nerve_severed=false
v.sensory_nerve_severed=false
end
or similar ruby code to repair all nerve damage stored at this location.

ah-ha. Okay. According to that, He has organ loss and organ damage to his lower spine. That would explain it. Anyway to restore that organ?

Tracked down that migrant, and he has the same thing.

Title: Re: DFHack 0.34.11 r3
Post by: VerdantSF on June 19, 2013, 12:12:53 pm
Nvm, found the answer!
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 19, 2013, 02:07:53 pm
Could somebody please bring me up-to-date with the current custom scripts?

I know of warmists startdwarf.rb, the growthfix, exportlegendsmaps, urist-da-vincis control of embark/tradegoods (even though I had no time at all to play around with it) and expwnents digging invaders. (again, no time so far)

Anything I missed that might be benefitial to the usual player, that might be useful in the Masterwork pack?

There is also unit-info-viewer for age, grazing, shearing products, milking products, and body size.  I think I need to add egg layer in the next update.

EDIT:  updated to add egg laying info, remove body size calc because it isn't needed anymore, and a few other little things.  Also forgot to mention that unit-info-viewer is also useful for providing a unit context to other selected unit scripts/mods/plugins such as the set nickname or set custom profession because unit-info-viewer gets the selected unit from more places than dfhack.gui.getSelectedUnit() currently supports.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 19, 2013, 09:08:16 pm
...
You can also use this:
Code: [Select]
for k,v in pairs(unit.body.components.body_part_status) do
v.motor_nerve_severed=false
v.sensory_nerve_severed=false
end
or similar ruby code to repair all nerve damage stored at this location.

ah-ha. Okay. According to that, He has organ loss and organ damage to his lower spine. That would explain it. Anyway to restore that organ?

Tracked down that migrant, and he has the same thing.

Maybe this?:
Code: [Select]
for k,v in pairs(unit.body.components.body_part_status) do
v.organ_loss=false
v.organ_damage=false
end

The organ_loss is probably the cause, it is the cyan color where the organ has lost function, in this case sending nervous signals.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 19, 2013, 09:35:07 pm
Is there any list of flags that can be set when making plugins? I'm interested in being able to put cleaning jobs on tiles.

Also is there anyway to stop large unit lists from reducing migration wave size? This is beginning to affect the Moltenchannels succession game - it basically means the fortress won't be getting any massive migrant wave !!FUN!! any longer.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 19, 2013, 10:17:16 pm
Is there any list of flags that can be set when making plugins? I'm interested in being able to put cleaning jobs on tiles.

Also is there anyway to stop large unit lists from reducing migration wave size? This is beginning to affect the Moltenchannels succession game - it basically means the fortress won't be getting any massive migrant wave !!FUN!! any longer.

scripts/fix/dead-units.lua
Removes "uninteresting" dead units from the active units.  I hear that  migrants stop coming when this list gets over 3000 or something like that.  Some have said that it is more aggressive than they would like in what it considers uninteresting, but I think this is what you are looking for.

scripts/fix/population-cap.lua
Quote from: From the file
-- Communicates current population to mountainhomes to avoid cap overshooting.

-- The reason for population cap problems is that the population value it
-- is compared against comes from the last dwarven caravan that successfully
-- left for mountainhomes. This script instantly updates it.
-- Note that a migration wave can still overshoot the limit by 1-2 dwarves because
-- of the last migrant bringing his family. Likewise, king arrival ignores cap.

As for designating cleaning jobs, that is something I have been trying to do the past couple of days too.  I have created cleaning jobs which nobody will be assigned to, and created "stagnant water" items with the hope that with no_auto_clean == false would auto make a clean job but doesn't.  I have also tried creating the ice boulder which when melted becomes stagnant water and hence the auto clean job, but the created boulder when melted did not do so.  My next attempt will involve associating the created clean jobs with a building to see if that will get them to assign somebody.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 19, 2013, 11:02:04 pm
I meant a plugin that would clean up the reduction in immigration without clearing the "dead units" list.

Have you tried to designate a cleaning job like a mining job, so it will be performed on a specific tile and wait for an available dwarf with cleaning enabled to assign the task to?
Title: Re: DFHack 0.34.11 r3
Post by: 0x517A5D on June 19, 2013, 11:37:59 pm
I meant a plugin that would clean up the reduction in immigration without clearing the "dead units" list.

I think that would require digging into DF's code, instead of just the data structures.  You'd have to find and disable the actual test(s) that check for the limit, and then apply a patch to force the test to always take the branch that allows immigrants.
Title: I have no idea how to code
Post by: mithosaurion on June 19, 2013, 11:38:31 pm
Hello all, I was wondering if anyone would know how to code a dfusion lua command to make a selected unit twice as strong as a dragon.
I need it for reasons.
Also try to make the advice idiot proof, I have messed up adding commands before.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 19, 2013, 11:56:36 pm
First "twice as strong as a dragon" would have to be defined.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 20, 2013, 12:12:39 am
...
Have you tried to designate a cleaning job like a mining job, so it will be performed on a specific tile and wait for an available dwarf with cleaning enabled to assign the task to?

I hadn't thought to look up how those designations work in memory.  Looking at them now, there isn't one for clean, but maybe one of the ones for liquid will get the created liquid object to spawn the clean job.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 20, 2013, 02:15:11 am
...
Have you tried to designate a cleaning job like a mining job, so it will be performed on a specific tile and wait for an available dwarf with cleaning enabled to assign the task to?

I hadn't thought to look up how those designations work in memory.  Looking at them now, there isn't one for clean, but maybe one of the ones for liquid will get the created liquid object to spawn the clean job.

Someone made a digging invaders hack that forced the "dig" or "dig channel" or "dig staircase" job upon a certain invader unit. That job shows up in the jobs list, too. You can probably do the same with cleaning.

There isn't a designation for "clean", but we're talking about the dispatching of the job to the jobs list through DFHack. If there were a designation, we wouldn't have that much trouble with cleaning stuff up. #Townbrush #Any other fortress with colossal contamination.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 20, 2013, 03:04:05 am


Maybe this?:
Code: [Select]
for k,v in pairs(unit.body.components.body_part_status) do
v.organ_loss=false
v.organ_damage=false
end

The organ_loss is probably the cause, it is the cyan color where the organ has lost function, in this case sending nervous signals.
I tried creating a script with that, but it doesn't seem to work..it just blows up with an EOF error. I made this an rb file as you indicated.

Code: [Select]
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return

for k,v in pairs(unit.body.components.body_part_status) do
    v.organ_loss=false
    v.organ_damage=false
end

Code: [Select]
E: SyntaxError: (eval):2:in `load': ./hack/scripts/organfix.rb:9: syntax error,
unexpected $end, expecting kEND
 (eval):2
 (eval):2
 (eval):2:in `catch'

Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 20, 2013, 03:08:30 am
That's because you saved lua into an .rb file.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 20, 2013, 03:27:29 am


Maybe this?:
Code: [Select]
for k,v in pairs(unit.body.components.body_part_status) do
v.organ_loss=false
v.organ_damage=false
end

The organ_loss is probably the cause, it is the cyan color where the organ has lost function, in this case sending nervous signals.
I tried creating a script with that, but it doesn't seem to work..it just blows up with an EOF error. I made this an rb file as you indicated.

Code: [Select]
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return

for k,v in pairs(unit.body.components.body_part_status) do
    v.organ_loss=false
    v.organ_damage=false
end

Code: [Select]
E: SyntaxError: (eval):2:in `load': ./hack/scripts/organfix.rb:9: syntax error,
unexpected $end, expecting kEND
 (eval):2
 (eval):2
 (eval):2:in `catch'

Looks like lua to me, though I'm not very familiar with ruby.  If it's lua, you're gonna need an "end" on the line after the "return".  Since that seems to be what the error is saying too, I suppose ruby and lua are pretty much equivalent for this purpose...
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 20, 2013, 03:31:07 am
No, not at all. Ruby has different syntax in a lot of ways and that's pretty obviously lua. Let me fix that for you (commenting what's fixed):

Code: [Select]
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return nil --need to return something, I'm pretty sure
end --end is needed for if then in lua

for k,v in ipairs(unit.body.components.body_part_status) do --note ipairs instead of pairs
    v.organ_loss=false
    v.organ_damage=false
end
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 20, 2013, 03:36:41 am
--note ipairs instead of pairs

Why?  "pairs" and "ipairs" seem to do the same thing if you don't care what the key is.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 20, 2013, 03:38:41 am
No, not at all. Ruby has different syntax in a lot of ways and that's pretty obviously lua. Let me fix that for you (commenting what's fixed):

Code: [Select]
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return nil --need to return something, I'm pretty sure
end --end is needed for if then in lua

for k,v in ipairs(unit.body.components.body_part_status) do --note ipairs instead of pairs
    v.organ_loss=false
    v.organ_damage=false
end

Thanks. the finer points are still all new to me here. He had mentioned using it as "ruby code" so I saved it as an RB file.

After running this, then rerunning body check the spine damage isn't listed anymore. I ran the supermedic script I have to fix the "ability to stand lost" tag and we'll see if it stays gone now.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 20, 2013, 04:45:22 am
Okay, well that didn't work.
As before he stayed fine for awhile, then as an ambush arrived, I sent him and some other squads out to slaugther them, and noticed him blinking. He didn't get injured, but doing bodycheck again, it notes his lower spine is missing and damaged.

do we need to somehow insert a new lower spine, rather than simply flipping the flag that says it's missing?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 20, 2013, 09:12:47 am
...
Thanks. the finer points are still all new to me here. He had mentioned using it as "ruby code" so I saved it as an RB file.

After running this, then rerunning body check the spine damage isn't listed anymore. I ran the supermedic script I have to fix the "ability to stand lost" tag and we'll see if it stays gone now.

http://www.bay12forums.com/smf/index.php?topic=91166.msg4332668#msg4332668

Technically, I wrote "You can also use this:{code}{/code} or similar ruby code to repair all nerve damage stored at this location." after previously stating in the same post for some other code "This lua script will detect if any body parts of the creature have status flags set, including motor/sensory nerves severed".

I only mentioned ruby because crossmr's original supermedic script was in ruby ( http://www.bay12forums.com/smf/index.php?topic=91166.msg4297004#msg4297004 ) and I thought that he wrote it (could write it).
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 20, 2013, 10:00:32 am
...
Thanks. the finer points are still all new to me here. He had mentioned using it as "ruby code" so I saved it as an RB file.

After running this, then rerunning body check the spine damage isn't listed anymore. I ran the supermedic script I have to fix the "ability to stand lost" tag and we'll see if it stays gone now.

http://www.bay12forums.com/smf/index.php?topic=91166.msg4332668#msg4332668

Technically, I wrote "You can also use this:{code}{/code} or similar ruby code to repair all nerve damage stored at this location." after previously stating in the same post for some other code "This lua script will detect if any body parts of the creature have status flags set, including motor/sensory nerves severed".

I only mentioned ruby because crossmr's original supermedic script was in ruby ( http://www.bay12forums.com/smf/index.php?topic=91166.msg4297004#msg4297004 ) and I thought that he wrote it (could write it).

Nope. I found it somewhere.. i think github. But unfortunately that code didn't fix them. The missing organs disappeared again.. are there any scripts out there that actually work on restoring organs?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 20, 2013, 01:53:18 pm
I meant a plugin that would clean up the reduction in immigration without clearing the "dead units" list.

modifying fix/dead-units.lua to be less aggressive (target only slaughtered units that were not former pets) I came up with this.  I don't think anyone would miss slaughtered units from the dead list.

Code: (clear-slaughtered-units.lua) [Select]
-- Remove slaughtered dead units from the unit list.

local units = df.global.world.units.active
local count = 0

for i=#units-1,0,-1 do
    local unit = units[i]
    local flags1 = unit.flags1
    local flags2 = unit.flags2
    if flags1.dead and flags2.slaughter and flags2.killed and not unit.name.has_name then
        count = count + 1
        units:erase(i)
    end
end

print('Units removed from active: '..count)
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 20, 2013, 04:58:58 pm
I meant a plugin that would clean up the reduction in immigration without clearing the "dead units" list.

modifying fix/dead-units.lua to be less aggressive (target only slaughtered units that were not former pets) I came up with this.  I don't think anyone would miss slaughtered units from the dead list.

Code: (clear-slaughtered-units.lua) [Select]
-- Remove slaughtered dead units from the unit list.

local units = df.global.world.units.active
local count = 0

for i=#units-1,0,-1 do
    local unit = units[i]
    local flags1 = unit.flags1
    local flags2 = unit.flags2
    if flags1.dead and flags2.slaughter and flags2.killed and not unit.name.has_name then
        count = count + 1
        units:erase(i)
    end
end

print('Units removed from active: '..count)

The real deal is the number of dead invaders, I think. In the end that's going to pile up to more than the number of slaughtered units. However, I will copy over the save and run the script. See what happens.

I think what we need is a hack for the number of immigrants who arrive. Alternatively if someone knows how to locate the code dealing with immigration and patching the bad stuff out, maybe (so it never actually checks the total number of units, just the number of citizens and whether you're over the population cap at that).

The trouble starts at a total list of 1,000 citizens, pets, other, and dead, when the migration wave size goes down to 10. The wave size is reduced by 1 at intervals, until at 3,000 total units you don't get any more migrants.

EDIT: hang on, is it possible to make the dead units plugin unload the uninteresting dead units list to a file and then reload it at the end (or when you feel like tabulating the carnage in your fortress)?
Title: Re: DFHack 0.34.11 r3
Post by: gchristopher on June 20, 2013, 05:42:02 pm
Kurik, thanks. That looks like a script I can just run, I don't have to hunt down the unit I used the command on?

Also..how do I know to make it a .rb or .lua script? Does it matter?

that script does use getSelectedUnit so you will have to select the unit in one of its supported methods.  I haven't played around with makeown myself so I don't know how feasible it would be to make the script look for any incomplete citizens with which to add historical figure data. 

A thought off the top of my head about why these units can't be placed into a noble position might have to do with a lack of recorded events such as arriving at the fort, birth, or some such.  I might look into that later if no one else does.

The events are probably unimportant, but for completeness we could add a history_event_add_hf_entity_linkst and a history_event_change_hf_statest. 

To get the noble positions working I found that the unit needs a nemesis entry.
Spoiler: fixmakeown.lua (click to show/hide)

changes:
  • new_hist_fig.appeared_year = df.global.cur_year.  Probably irrelevant but this field is usually the year they arrived or created not birth year.
  • new_hist_fig.died_seconds = -1. Also likely to be irrelevant, but = 1 was probably a typo.
  • create and insert nemesis entries.
  • searches for all relevant units instead of only the currently selected unit
still missing and perhaps not needed:
  • history_event_add_hf_entity_linkst and history_event_change_hf_statest events.
  • historical_figure.info, historical_figure.info.skills, historical_figure.info.unk_14.
script to add nemesis to units that have already had historical figures added with the previous version of the fixmakeown or fixhistfig script:
Spoiler: fixnemesis.lua (click to show/hide)
Whoa, that's great Kurik! Thanks for the fix!
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 20, 2013, 05:51:34 pm
... unfortunately that code didn't fix them. The missing organs disappeared again.. are there any scripts out there that actually work on restoring organs?

I tried to merge the various heal scripts floating around and tested it by trying to resurrect units in one of my test worlds.  I found that setting the body_part_status wouldn't stick unless I also reset the body.components.body_layer_*** values that Urist posted about.  However, setting those with a for ipairs/pairs loop wouldn't stick either but would stick with for idx=0,length,1 do unit.body.components.body_layer_***[idx] = 0.  Getting the body_layer_*** vectors to stick, the body_part_status would then stick (with either type of loop).  Resurrecting a unit is not completely tested but appears to work at the moment.

Spoiler: fullheal.lua (click to show/hide)
EDIT: please be sure to make a backup before testing (especially when testing the resurrection part)


EDIT: hang on, is it possible to make the dead units plugin unload the uninteresting dead units list to a file and then reload it at the end (or when you feel like tabulating the carnage in your fortress)?

That sounds plausable as I think the units still exist in units.all.  Would need to double check that.  If they do still exist in units.all then writing a file listing the unit.id of units removed from the active list would allow reading back those ids to reinsert them into active.



Whoa, that's great Kurik! Thanks for the fix!

Your welcome!
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 20, 2013, 06:50:29 pm
How do you check whether the unit still exists in units.all?
Title: Re: DFHack 0.34.11 r3
Post by: mithosaurion on June 20, 2013, 06:50:38 pm
First "twice as strong as a dragon" would have to be defined.
How about a command to give a targeted creature 1000000 strength?
I would prefer it be something that can be inserted into dfusion tools... since I kinda know how to do that (and I have no idea how to run a separate lua file with dfusion).
Someone on this board helped me with a tool to modify skills.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 20, 2013, 07:21:14 pm
... unfortunately that code didn't fix them. The missing organs disappeared again.. are there any scripts out there that actually work on restoring organs?

I tried to merge the various heal scripts floating around and tested it by trying to resurrect units in one of my test worlds.  I found that setting the body_part_status wouldn't stick unless I also reset the body.components.body_layer_*** values that Urist posted about.  However, setting those with a for ipairs/pairs loop wouldn't stick either but would stick with for idx=0,length,1 do unit.body.components.body_layer_***[idx] = 0.  Getting the body_layer_*** vectors to stick, the body_part_status would then stick (with either type of loop).  Resurrecting a unit is not completely tested but appears to work at the moment.

Spoiler: fullheal.lua (click to show/hide)
EDIT: please be sure to make a backup before testing (especially when testing the resurrection part)

Okay, well so far so good. Not a lot of time to test right now, but after work I'll run it for a bit and see if it sticks.
I ran the squad around a little and he didn't break right away. I never noticed how long it took to reset before.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 20, 2013, 08:50:13 pm
How do you check whether the unit still exists in units.all?

I wrote the unit.id to file when removing from active, the used df.unit.find(unit.id) which gets a unit by id from units.all to see if it returned a unit or nil.  When I tested that, the unit still existed in units.all .

So.. what I have so far is:

add this to the save's init.lua to save the save games path to a persistent entry:
Code: (dwarf fortress/save/regionX/raw/init.lua) [Select]
dfhack.persistent.save({key='SAVE_PATH',value=SAVE_PATH})
modified fix/dead-units (original unit selection criteria):
Code: (fix/clear-dead-units.lua) [Select]
-- Remove uninteresting dead units from the unit list. Use option 'restore' to put them back (if saved)

local restore = false
for _,arg in pairs({...}) do
    if arg == "restore" then restore = true end
end

local units = df.global.world.units.active
local count = 0
local SAVE_PATH = dfhack.persistent.get('SAVE_PATH')
local SAVE_FILE, file, unit, flags1, flags2, remove
if SAVE_PATH then
SAVE_FILE = SAVE_PATH.value .. '/cleared-dead-units.txt'
end

if restore then
if SAVE_FILE then
file = assert(io.open(SAVE_FILE, "r"))
for line in file:lines() do
unit = df.unit.find(tonumber(line))
units:insert('#',unit)
count = count + 1
end
file:close()
else
dfhack.printerr("Error, can't resore cleared dead units without save path from init.lua")
end
else
if SAVE_FILE then
file = assert(io.open(SAVE_FILE, "a"))
end
local dwarf_race = df.global.ui.race_id
local dwarf_civ = df.global.ui.civ_id
for i=#units-1,0,-1 do
unit = units[i]
flags1 = unit.flags1
flags2 = unit.flags2
if flags1.dead and unit.race ~= dwarf_race then
remove = false
if flags2.slaughter then
remove = true
elseif not unit.name.has_name then
remove = true
elseif unit.civ_id ~= dwarf_civ and
not (flags1.merchant or flags1.diplomat) then
remove = true
end
if remove then
count = count + 1
file:write(tostring(units[i].id), NEWLINE)
units:erase(i)
end
end
end
file:close()
print('Units removed from active (Saved): '..count)
end

It needs better error checking and I am not sure what happens if you try to restore more than once since it currently doesn't remove saved ids from the save file when restoring.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 20, 2013, 09:19:37 pm
How do you check whether the unit still exists in units.all?

I wrote the unit.id to file when removing from active, the used df.unit.find(unit.id) which gets a unit by id from units.all to see if it returned a unit or nil.  When I tested that, the unit still existed in units.all .

So.. what I have so far is:

add this to the save's init.lua to save the save games path to a persistent entry:
Code: (dwarf fortress/save/regionX/raw/init.lua) [Select]
dfhack.persistent.save({key='SAVE_PATH',value=SAVE_PATH})
modified fix/dead-units (original unit selection criteria):
Code: (fix/clear-dead-units.lua) [Select]
-- Remove uninteresting dead units from the unit list. Use option 'restore' to put them back (if saved)

local restore = false
for _,arg in pairs({...}) do
    if arg == "restore" then restore = true end
end

local units = df.global.world.units.active
local count = 0
local SAVE_PATH = dfhack.persistent.get('SAVE_PATH')
local SAVE_FILE, file, unit, flags1, flags2, remove
if SAVE_PATH then
SAVE_FILE = SAVE_PATH.value .. '/cleared-dead-units.txt'
end

if restore then
if SAVE_FILE then
file = assert(io.open(SAVE_FILE, "r"))
for line in file:lines() do
unit = df.unit.find(tonumber(line))
units:insert('#',unit)
count = count + 1
end
file:close()
else
dfhack.printerr("Error, can't resore cleared dead units without save path from init.lua")
end
else
if SAVE_FILE then
file = assert(io.open(SAVE_FILE, "a"))
end
local dwarf_race = df.global.ui.race_id
local dwarf_civ = df.global.ui.civ_id
for i=#units-1,0,-1 do
unit = units[i]
flags1 = unit.flags1
flags2 = unit.flags2
if flags1.dead and unit.race ~= dwarf_race then
remove = false
if flags2.slaughter then
remove = true
elseif not unit.name.has_name then
remove = true
elseif unit.civ_id ~= dwarf_civ and
not (flags1.merchant or flags1.diplomat) then
remove = true
end
if remove then
count = count + 1
file:write(tostring(units[i].id), NEWLINE)
units:erase(i)
end
end
end
file:close()
print('Units removed from active (Saved): '..count)
end

It needs better error checking and I am not sure what happens if you try to restore more than once since it currently doesn't remove saved ids from the save file when restoring.

I think that's fine. I'm going to apply it to the Moltenchannels save, so we can finally get more huge migration waves. I hope.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on June 20, 2013, 11:23:50 pm
How would I make a Tigerperson that we got off the elven caravan into a proper citizen? We need her bonedoctoring skills!
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 21, 2013, 12:36:30 am
updated clear-dead-units.lua .  I think this is essentially complete as it now clears the saved list when restoring and resaves missing ids if the unit is not found (shouldn't happen) and only restores one copy of duplicate ids in the save file (also shouldn't happen under normal circumstances), doesn't allow clearing the list without the save file, and it should be less likely to fail and lose the saved list. If for some weird reason a unit still exists in the active list and has a saved id from this script (I don't see why it would happen without user editing the list) a duplicate will still be added as duplicates are only detected in the saved list rather than in the active units list.  The save list is appended so future clears add to the saved list. 

The only thing I can things that is missing from making this script complete are: ensuring fortress mode, and clearing the saved list if the fort is lost or abandoned so that the next fort doesn't inherit a saved list of invalid unit ids.  Not that the invalid ids will hurt anything but can lead to duplicate units entries when that id becomes used again by the new fort and is then restored from the saved list.

add this to the save's init.lua to save the save games path to a persistent entry:
CODE

fix/clear-dead-units.lua using fix/dead-units original unit selection criteria, saving removed active unit ids to the save dir:
Code: (fix/clear-dead-units.lua) [Select]
-- Remove uninteresting dead units from the unit list. Use option 'restore' to put them back
local utils = require('utils')

local restore = false
for _,arg in pairs({...}) do
    if arg == "restore" then restore = true end
end

local SAVE_FILE = 'data/save/' .. df.global.world.cur_savegame.save_dir .. '/cleared-dead-units.txt'

if restore then
file = assert(io.open(SAVE_FILE, "r"))
local units = df.global.world.units
local count = 0
local ids = {}
for n in file:lines() do
ids[n] = tonumber(n) -- prevent duplicates, not an array
end
file:close()
file = io.open(SAVE_FILE, "w") -- empty file, re-add failures
for _,id in pairs(ids) do
local unit = utils.binsearch(units.all,id,'id')
if unit then
units.active:insert('#',unit)
count = count + 1
else
file:write(id,NEWLINE)
end
id = table.remove(ids,#ids) -- pop laste element
end
file:close()
print('Restored dead units to active from saved list: '..count)
else
file = assert(io.open(SAVE_FILE, "a"))
local dwarf_race = df.global.ui.race_id
local dwarf_civ = df.global.ui.civ_id
local units = df.global.world.units.active
local count = 0
for i=#units-1,0,-1 do
local unit = units[i]
local flags1 = unit.flags1
local flags2 = unit.flags2
if flags1.dead and unit.race ~= dwarf_race then
local remove = false
if flags2.slaughter then
remove = true
elseif not unit.name.has_name then
remove = true
elseif unit.civ_id ~= dwarf_civ and
not (flags1.merchant or flags1.diplomat) then
remove = true
end
if remove then
count = count + 1
file:write(units[i].id, NEWLINE)
units:erase(i)
end
end
end
file:close()
print('Removed dead units from active to saved list: '..count)
end


EDIT:  applied suggestion from expwnent to use df.global.world.cur_savegame.save_dir so that init.lua is no longer needed.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 21, 2013, 01:06:33 am
Instead of all that, consider using

Code: [Select]
df.global.world.cur_savegame.save_dir
to get at the save directory.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 21, 2013, 02:37:46 am
How would I make a Tigerperson that we got off the elven caravan into a proper citizen? We need her bonedoctoring skills!
From what I read, you'd need to change their race to dwarf.
you can tweak makeown them, but the game still treats them like a pet.
So you can't see them in dwarf therapist and stuff like that.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on June 21, 2013, 02:44:18 am
Well, at the very least I just need this tigerperson to hang out in the dining hall and actually talk to the dwarves (evidenced by raising social skills) for the purposes of the succession game.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 21, 2013, 09:44:31 pm
I'm now playing Moltenchannels with your script. There are now only 811 units in the list between citizens, pets/livestock, others, and dead/missing.

If I save the game without restoring the dead units, will I still be able to restore them?

Problem I've noticed: Lots of dwarf corpses are showing. These are the un-named beings that siege your fortress when the undead come. Is it possible to get rid of those as well?

It may help if we have a binary patch to fix this problem once and for all. However, at this rate unless we get 189 more named dead or dead dwarves, citizens, traders, or other livestock and pets, we will be OK.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 22, 2013, 03:16:30 am
I'm now playing Moltenchannels with your script. There are now only 811 units in the list between citizens, pets/livestock, others, and dead/missing.

If I save the game without restoring the dead units, will I still be able to restore them?

Problem I've noticed: Lots of dwarf corpses are showing. These are the un-named beings that siege your fortress when the undead come. Is it possible to get rid of those as well?

It may help if we have a binary patch to fix this problem once and for all. However, at this rate unless we get 189 more named dead or dead dwarves, citizens, traders, or other livestock and pets, we will be OK.

My tests worked with saving, quitting, loading and restoring the list.  As long as a list was successfully created it should work fine.

for the undead.. could try doing something like this:
Quote
      if flags1.dead and unit.race ~= dwarf_race then
         local remove = false
         if flags2.slaughter then
            remove = true
         elseif unit.enemy.undead then
            remove = true
         elseif not unit.name.has_name then
            remove = true
         ...

Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 22, 2013, 03:31:39 am
... unfortunately that code didn't fix them. The missing organs disappeared again.. are there any scripts out there that actually work on restoring organs?

I tried to merge the various heal scripts floating around and tested it by trying to resurrect units in one of my test worlds.  I found that setting the body_part_status wouldn't stick unless I also reset the body.components.body_layer_*** values that Urist posted about.  However, setting those with a for ipairs/pairs loop wouldn't stick either but would stick with for idx=0,length,1 do unit.body.components.body_layer_***[idx] = 0.  Getting the body_layer_*** vectors to stick, the body_part_status would then stick (with either type of loop).  Resurrecting a unit is not completely tested but appears to work at the moment.

Spoiler: fullheal.lua (click to show/hide)
EDIT: please be sure to make a backup before testing (especially when testing the resurrection part)

Okay, well so far so good. Not a lot of time to test right now, but after work I'll run it for a bit and see if it sticks.
I ran the squad around a little and he didn't break right away. I never noticed how long it took to reset before.

Just to report back, this seems to have done the trick. Spine is replaced, and after extensive play, and many dead goblins it hasn't reappeared.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 22, 2013, 03:45:14 am
...

Okay, well so far so good. Not a lot of time to test right now, but after work I'll run it for a bit and see if it sticks.
I ran the squad around a little and he didn't break right away. I never noticed how long it took to reset before.

Just to report back, this seems to have done the trick. Spine is replaced, and after extensive play, and many dead goblins it hasn't reappeared.

Awesome!
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on June 22, 2013, 07:18:55 am
I'm now playing Moltenchannels with your script. There are now only 811 units in the list between citizens, pets/livestock, others, and dead/missing.

If I save the game without restoring the dead units, will I still be able to restore them?

Problem I've noticed: Lots of dwarf corpses are showing. These are the un-named beings that siege your fortress when the undead come. Is it possible to get rid of those as well?

It may help if we have a binary patch to fix this problem once and for all. However, at this rate unless we get 189 more named dead or dead dwarves, citizens, traders, or other livestock and pets, we will be OK.

My tests worked with saving, quitting, loading and restoring the list.  As long as a list was successfully created it should work fine.

for the undead.. could try doing something like this:
Quote
      if flags1.dead and unit.race ~= dwarf_race then
         local remove = false
         if flags2.slaughter then
            remove = true
         elseif unit.enemy.undead then
            remove = true
         elseif not unit.name.has_name then
            remove = true
         ...


Thanks! Is there a way to stop dwarf corpses from the undead legions being placed in tombs?

How do you create binary patches? I've seen these have been used to fix the hospital overstocking. Is it possible to use binary patches to fix dwarves not getting married if the difference in age is more than 10 years, or the immigration slowing down after enough units arrive or walk into cage traps?

EDIT: THANK THE LORD! The dead units list is no longer dominated by previously undead dwarf corpses and arms. Now we can have 361 more dead citizens and pets, and live pets and merchants and citizens before stuff goes wrong. We can also get the carnage list on demand.
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on June 22, 2013, 07:37:06 am
How do you create binary patches? I've seen these have been used to fix the hospital overstocking.

You just use a hex editor and adjust certain values according to the instructions that Quietust or some other codelord posted somewhere like the bug tracker. I personally use the Notepad++ plugin.
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on June 22, 2013, 08:53:28 am
That's not so much a binpatch as using a hex editor to get your hands dirty yourself.  Both do the same thing in the end, but a pre-packaged binpatch keeps you from fat fingering your own edits.

CREATING said binpatch is another question.  There are a couple of ways to make one, and I suppose depends on what method of applying the patch will be used.  As always, be careful of error checking, garbage collection and edge cases whenever possible.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on June 22, 2013, 12:34:57 pm
Is it possible to
A) change the flags of an off-site unit, if their ID is known

and

B) kill them, making the game think they were killed by someone in particular
Title: Re: DFHack 0.34.11 r3
Post by: sonerohi on June 22, 2013, 03:54:38 pm
So, I am back with more questions. To save myself a little time and frustration, I made a text document called dfhack.init in my main dwarf fortress folder. The text for it is the following
Spoiler (click to show/hide)

It applies the armory fix on start up, but nothing else. I'm guessing I did not do it right, but I'll be honest about not understanding what is wrong. If someone could show me an example that would fix the binpatches, and one for the tweaks then I can apply the changes across the rest. Also, not sure if I did growthbug right. It is called growthbug.lua in my scripts folder, and is just a text document containing Putnams code. And when I say text documents, by the way, I mean they open with notepad and have the .txt ending.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 22, 2013, 04:00:01 pm
Put them all on different lines
Title: Re: DFHack 0.34.11 r3
Post by: sonerohi on June 22, 2013, 04:24:40 pm
Seriously that is all? Daaaaaang. Thank you very much for the help and for your code.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 22, 2013, 04:31:23 pm
The growthbug should be in init.lua in the raw folder, btw; better would be to use Kurik Amudnil's ruby code and have it in your dfhack.init
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 22, 2013, 05:15:02 pm
Is it possible to
A) change the flags of an off-site unit, if their ID is known

and

B) kill them, making the game think they were killed by someone in particular

possibly, but its complicated.  The unit would have to be found in units.all.  change their unit.flags1.dead to true, choose a cause of death, create a death_info, giving the unit the death_info.id.  If unit is a historical figure then the historical figure would need to be updated with time of death, and create a histrory_event_hist_figure_diedst.  The history event could probably be ignored but then engravers wouldn't be able to make artwork related to the event.  There might also be other considerations too (weapon used?) but that is a rough outline.

EDIT:  if the unit doesn't exist in units.all then they can only die by way of historical figure and history event.  If not a historical figure, then no way to kill them. However, the slayer may have someplace to record the deed.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 22, 2013, 05:31:34 pm
As well as my earlier findings here: http://www.bay12forums.com/smf/index.php?topic=91166.msg4332174#msg4332174 , I have another submission to the df structures:

unk14 in body_part_layer_raw is the nonsolid layer id

See https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L389 and https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L594 for reference.

EDIT:
https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L732
flag 18 in body_part_status, which is seen on smashed ribs for some reason, appears on severed body parts only at the location of the break. So if you cut off someone's lower arm, the lower arm has the flag set, but not the hand or fingers. If you cut off someone's nose, the nose gets the flag, so it doesn't depend on there being children to the severed body part. I think of it as the "stump" flag.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on June 23, 2013, 04:34:20 am
Apparently AutoSyndrome does not take into account percentage chance of reagents. If I make multiple 1% products with autosyndrome, the first one will work 100% of times no matter what.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 23, 2013, 06:45:08 am
Can you move the randomness to an lua script? With 100% probability, run a script which does stuff with probability 1 or whatever.
Title: Re: DFHack 0.34.11 r3
Post by: Deon on June 23, 2013, 09:34:05 am
It would be amazing if it read the product chance from the product raws.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 23, 2013, 03:28:02 pm
It would be amazing if it read the product chance from the product raws.

Or check what was actually created by the reaction (so add syndromes only if the stone was actually created).
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on June 23, 2013, 03:40:18 pm
Is it possible to
A) change the flags of an off-site unit, if their ID is known

and

B) kill them, making the game think they were killed by someone in particular

possibly, but its complicated.  The unit would have to be found in units.all.  change their unit.flags1.dead to true, choose a cause of death, create a death_info, giving the unit the death_info.id.  If unit is a historical figure then the historical figure would need to be updated with time of death, and create a histrory_event_hist_figure_diedst.  The history event could probably be ignored but then engravers wouldn't be able to make artwork related to the event.  There might also be other considerations too (weapon used?) but that is a rough outline.

EDIT:  if the unit doesn't exist in units.all then they can only die by way of historical figure and history event.  If not a historical figure, then no way to kill them. However, the slayer may have someplace to record the deed.
Not to worry, this is for a bugged adventure game, the target in question being an absent megabeast.
Title: Re: DFHack 0.34.11 r3
Post by: BoogieMan on June 23, 2013, 03:54:45 pm
I updated to the new version of DFHack and now dfusion doesn't have the dwarf count editor on embark function. Is it elsewhere? How can I get it back without backing up a version?
Title: Re: DFHack 0.34.11 r3
Post by: Toxicshadow on June 23, 2013, 06:49:32 pm
Is there a command to force a job to get done?  By this I mean, the nearest(?) dwarf that can do the job, quits his current to do whatever the forced task was.  I'm looking for this because my dwarves seem to lack the ability to build walls. Rather, they just want to idle, despite every one of them having the skill to build the wall.  It's a very large pain in the ass, when you go 6 years without one damn wall-section built.
Title: Re: DFHack 0.34.11 r3
Post by: danaris on June 23, 2013, 07:46:02 pm
Is there a command to force a job to get done?  By this I mean, the nearest(?) dwarf that can do the job, quits his current to do whatever the forced task was.  I'm looking for this because my dwarves seem to lack the ability to build walls. Rather, they just want to idle, despite every one of them having the skill to build the wall.  It's a very large pain in the ass, when you go 6 years without one damn wall-section built.

If there is even one dwarf with the appropriate labour enabled (usually Masonry), who does not have another higher-priority job (which Idle is not, though On Break and Party can be), and your wall isn't getting built, then IIRC, 99 times out of 100, that means that either your materials are (for one reason or another) unusable, or the site is inaccessible.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 23, 2013, 07:49:15 pm
Is there a command to force a job to get done?  By this I mean, the nearest(?) dwarf that can do the job, quits his current to do whatever the forced task was.  I'm looking for this because my dwarves seem to lack the ability to build walls. Rather, they just want to idle, despite every one of them having the skill to build the wall.  It's a very large pain in the ass, when you go 6 years without one damn wall-section built.

There's a command that causes all jobs to be assigned (if possible) when you pause.
Title: Re: DFHack 0.34.11 r3
Post by: Toxicshadow on June 23, 2013, 08:10:42 pm
Is there a command to force a job to get done?  By this I mean, the nearest(?) dwarf that can do the job, quits his current to do whatever the forced task was.  I'm looking for this because my dwarves seem to lack the ability to build walls. Rather, they just want to idle, despite every one of them having the skill to build the wall.  It's a very large pain in the ass, when you go 6 years without one damn wall-section built.

If there is even one dwarf with the appropriate labour enabled (usually Masonry), who does not have another higher-priority job (which Idle is not, though On Break and Party can be), and your wall isn't getting built, then IIRC, 99 times out of 100, that means that either your materials are (for one reason or another) unusable, or the site is inaccessible.
Yeah, I was trying to build a wall in a tile that was diagonally adjacent to the closest accessible tile (I assumed it would work the same as routing), which was my problem.  I had to make straight paths to get them built.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 24, 2013, 03:13:31 am
Is there a way to magically carry out designations?  I ask because I recently finished quickfort plans for the mines on Moria (http://www.bay12forums.com/smf/index.php?topic=127599), and I'd love to have a look in Overseer and other visualisers, but there's no way my laptop could actually handle digging it out - designating while paused is one thing, but it's a 12x7 embark and fps death would arrive too fast.  It would also be useful in other situations, but that's not why I'm asking - one example that springs to mind is map alterations like an enormous canyon or a workaround for the channelling AI-fail. 
Title: Re: DFHack 0.34.11 r3
Post by: Hommit on June 24, 2013, 09:07:42 am
Not that i know of. But there is atleast this partial way: increase embark points, dwarf number to whatever u like, get pick for each and lots of food, then designate and "fastdwarf 1 1". go watch tv or something :)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 24, 2013, 11:01:51 am
I updated to the new version of DFHack and now dfusion doesn't have the dwarf count editor on embark function. Is it elsewhere? How can I get it back without backing up a version?
https://raw.github.com/warmist/dfhack/master/scripts/startdwarf.rb
put this into hack/scripts/startdwarf.rb
and then run startdwarf <number>
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 24, 2013, 12:26:03 pm
Is there a command to force a job to get done?  By this I mean, the nearest(?) dwarf that can do the job, quits his current to do whatever the forced task was.  I'm looking for this because my dwarves seem to lack the ability to build walls. Rather, they just want to idle, despite every one of them having the skill to build the wall.  It's a very large pain in the ass, when you go 6 years without one damn wall-section built.

There's a command that causes all jobs to be assigned (if possible) when you pause.

workNow
Title: Re: DFHack 0.34.11 r3
Post by: cdombroski on June 24, 2013, 07:39:36 pm
Is there a way to magically carry out designations?  I ask because I recently finished quickfort plans for the mines on Moria (http://www.bay12forums.com/smf/index.php?topic=127599), and I'd love to have a look in Overseer and other visualisers, but there's no way my laptop could actually handle digging it out - designating while paused is one thing, but it's a 12x7 embark and fps death would arrive too fast.  It would also be useful in other situations, but that's not why I'm asking - one example that springs to mind is map alterations like an enormous canyon or a workaround for the channelling AI-fail.

I think tiletypes can do it as long as you're only talking about one action. There's a designated filter; pair that with painting floor shapes should give you what you want assuming you just want regular digging (disclaimer: I've never tried to use this filter). If you want additional actions, I guess you could separate the steps into different phases in quickfort and do them one at a time with the appropriate paint option in between each designation.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 24, 2013, 08:39:28 pm
Is there a way to magically carry out designations?  I ask because I recently finished quickfort plans for the mines on Moria (http://www.bay12forums.com/smf/index.php?topic=127599), and I'd love to have a look in Overseer and other visualisers, but there's no way my laptop could actually handle digging it out - designating while paused is one thing, but it's a 12x7 embark and fps death would arrive too fast.  It would also be useful in other situations, but that's not why I'm asking - one example that springs to mind is map alterations like an enormous canyon or a workaround for the channelling AI-fail.

It took a bit longer than I thought, but you can try this (after a good backup of course)

Spoiler: magic-shovel.lua (click to show/hide)

It uses some trimmed and modified code ported from tiletypes.  It isn't perfect so there may be issues with continuing to play a game after using it.  Issues will most likely be related to reveal, light from being opened to the sky, and plants when their tile gets channeled.

EDIT:  Found out that it isn't working for simple dig ...
EDIT2: Fixed part of the problem ...
EDIT3: Ahh, found the last problem.  it should now dig.
EDIT4: performance improvement, only check each tile for designations if has block.flags.designated set .. and fix a refactoring bug I made when fixing the plain dig
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on June 25, 2013, 05:43:16 am
Hi, I could not find a complete doc on the ruby bindings so I have a couple of newbie questions.

a) As I am looking at tweak makeown, I see that it goes in a loop through the targeted unit's inventory to unforbid and manipulate values. Is there such a way to select an unit's inventory with Ruby?

b) Can raws be accessed? I want to select an creature raw, through an unit or its name ID, to know the natural skills that were defined.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 25, 2013, 03:52:27 pm
1. Yeah, assigning a variable to unit.inventory should do the trick
2. Yeah, but I'm not entirely sure how it's done through Ruby.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 25, 2013, 05:06:33 pm
I think it would be something like this
Code: (ruby unit inventory) [Select]
unit.inventory.each do |invitem|
    invitem.item.flags.forbid = false
    puts invitem.item.id
end

hack/ruby/ruby-autogen.rb     contains type definitions.
hack/ruby/item.rb  unit.rb  building.rb  etc. contain some additional functions like unit_find or item_find which do about the same thing as dfhack.gui.getSelectedUnit and dfhack.gui.getSelectedItem in lua.  Many of the ruby definitions have a _tg function (for objects with an item id: .item_tg() ) which will search their id in their respective vectors (such as finding an item in items.all or a unit in units.all).  The only real difference in how to access fields in ruby vs lua is that lua usings df.global.etc and ruby uses df.etc

creatures/caste raws are at (lua): df.global.world.raws.creatures.all[ unit.race ].caste[ unit.caste ]

creatures/caste raws are at (ruby): df.world.raws.creatures.all[ unit.race ].caste[ unit.caste ]
    or unit.race_tg  and unit.race_tg.caste[unit.caste]

as a side note, I recently ported 'tweak makeown' to a  lua include for a minor mod to hire caravan guards (http://www.bay12forums.com/smf/index.php?topic=127720.0).  I did change the item ownership claiming such that armor and weapons would remain forbidden so they wouldn't get dropped, but the rest of the own-able clothes would be claimed and owned.  I also changed the actual make_own function to call the function to add historical figure and nemesis data if the unit is of the same race as the fort.

Edit: if 'tweak makeown' gets changed to expose a lua api then my makeown include would probably go away or get moved to hack/lua/plugins/tweak.lua
Title: Re: DFHack 0.34.11 r3
Post by: meowmix on June 25, 2013, 09:12:07 pm
does anyone know if there is a dfhack script that instantly ages baby and children dwarves into adult dwarves?
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on June 26, 2013, 01:03:15 am
1. Yeah, assigning a variable to unit.inventory should do the trick
2. Yeah, but I'm not entirely sure how it's done through Ruby.

Thank you, that should be enough to finish a script or two.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 26, 2013, 02:51:23 am
as a side note, I recently ported 'tweak makeown' to a lua include ...  I did change the item ownership claiming such that armor and weapons would remain forbidden so they wouldn't get dropped, but the rest of the own-able clothes would be claimed and owned.  I also changed the actual make_own function to call the function to add historical figure and nemesis data if the unit is of the same race as the fort.

Edit: if 'tweak makeown' gets changed to expose a lua api then my makeown include would probably go away or get moved to hack/lua/plugins/tweak.lua

I am wondering if I should go ahead and name this include file hack/lua/plugins/tweak.lua  and perhaps get hooked up on github to try to contribute a lua api update to the tweak plugin.  Is there anything specific to the dfhack project I ought to know if I do?  Is there a best practice that I should follow when writing stuff that ought to be used as an include instead of a stand alone script like this makeown.lua and fov.lua (field of view, 2d circular shadow cast)?

edit:  answered some of my own questions about writing contributions by re-reading the OP
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on June 26, 2013, 06:05:32 pm
one question for dfhack tiletypes how do you make a floor out of grass and I mean like the grass outside and inside a cavern, how do you do that?
Title: Re: DFHack 0.34.11 r3
Post by: cdombroski on June 26, 2013, 06:32:23 pm
one question for dfhack tiletypes how do you make a floor out of grass and I mean like the grass outside and inside a cavern, how do you do that?

Should be either grass_light or grass_dark material (dry and dead are also available)
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on June 26, 2013, 06:47:45 pm
one question. how do you make grass floors with tiletypes?
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on June 26, 2013, 06:49:25 pm
one question. how do you make grass floors with tiletypes?
h wait I all ready typed that sorry it's because my pc is slow
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on June 26, 2013, 07:34:39 pm
I has a problem.

Birds in df.global.world.units.active that are slaughtered stay in the list.  Which is the opposite of what I expected.  Seeing how they can't get any less active.

Do dead birds ever leave the list? 
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 26, 2013, 08:44:04 pm
I has a problem.

Birds in df.global.world.units.active that are slaughtered stay in the list.  Which is the opposite of what I expected.  Seeing how they can't get any less active.

Do dead birds ever leave the list?

so far as I know all dead units, slaughtered or otherwise remain in active.  I posted a modifed version of hack/scripts/fix/dead-units.lua that would remove only slaughtered units here (http://www.bay12forums.com/smf/index.php?topic=91166.msg4335510#msg4335510) and posted another version to be more aggressive but save the unit ids so that those units could return the units.active later here (http://www.bay12forums.com/smf/index.php?topic=91166.msg4336893#msg4336893).  I probably ought to upload the latter one to dffd.



one question for dfhack tiletypes how do you make a floor out of grass and I mean like the grass outside and inside a cavern, how do you do that?

Should be either grass_light or grass_dark material (dry and dead are also available)

paint shape floor     (floor)
paint material grass_dark     (for dark grass)
paint material grass_dead     (for dead greass)
paint material grass_dry      (for dry grass)
paint material grass_light     (for light grass)
paint variant var_1     (  right  '  )
paint variant var_2     (  ,  )
paint variant var_3     (  left  '  )
paint variant var_4     (  .  )
paint variant any      (or leave variant out and it should pick the first variant for you as needed)


note, this will only make the tile look like grass.  the block also needs an appropriate block_event that contains the amount of the specific grass type per tile in order to actually have grass.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 26, 2013, 11:09:11 pm
[edit] I've just written a new plugin (which will be called "cleanconst") which gets rid of construction materials and marks them to be recreated on disassembly.

I've ported this to lua.

Code: [Select]
local cleaned_total = 0

for _,item in ipairs(df.global.world.items.all) do
-- only process items marked as "in construction"
if item.flags.construction then
local pos = item.pos
local cons = df.construction.find(pos)
-- if the construction is already labeled as "no build item", then leave it alone
if not cons then
dfhack.printerr("Item at "..pos.x..","..pos.y..","..pos.z.." marked as construction but no construction is present!")
elseif not cons.flags.no_build_item then
-- only destroy the item if the construction claims to be made of the exact same thing
if item.getType(item) == cons.item_type and
item.getSubtype(item) == cons.item_subtype and
item.getMaterial(item) == cons.mat_type and
item.getMaterialIndex(item) == cons.mat_index then

item.flags.garbage_collect = 1
cons.flags.no_build_item = 1
cleaned_total = cleaned_total + 1
end
end
end
end

dfhack.println("Done. "..cleaned_total.." construction items cleaned up.\n");

Could someone confirm that mat_index in lua is the same as matgloss in C++?  It's the closest thing I could find, but since it doesn't have the same name, I'm not completely sure.

Installation instructions: Put the above code in a file named "cleanconst.lua" in your "hack/scripts" directory.  Type "cleanconst" in the dfhack window to run it.

Anyway, when I actually ran this, it didn't have any noticeable effect on my 6 FPS.  YMMV.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 26, 2013, 11:33:12 pm
it looks to me that the cpp matgloss is the mat_type mat_index pair.

so I think that this might be more of what you are looking for:
Code: [Select]
item.mat_type == cons.mat_type and
item.mat_index == cons.mat_index then

or something to do with dfhack.matinfo.decode(type,index) (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#material-info-lookup)

 
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 27, 2013, 12:52:00 am
it looks to me that the cpp matgloss is the mat_type mat_index pair.

so I think that this might be more of what you are looking for:
Code: [Select]
item.mat_type == cons.mat_type and
item.mat_index == cons.mat_index then

or something to do with dfhack.matinfo.decode(type,index) (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#material-info-lookup)

I changed:

Code: [Select]
item->getMaterial() != cons->material ||
item->getMatgloss() != cons->matgloss)

To:

Code: [Select]
item.getMaterial(item) == cons.mat_type and
item.getMaterialIndex(item) == cons.mat_index then

If "matgloss" is the mat_type mat_index pair, then I'm left with the question of what "material" is (I assumed it was mat_type).
Title: Re: DFHack 0.34.11 r3
Post by: azrael300 on June 27, 2013, 01:49:10 am
is it possible to use df hack to spawn a vampire? like spawn a vampire hedgehog pet? i want to be a vampire in adventure mode.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 27, 2013, 02:00:09 am
is it possible to use df hack to spawn a vampire? like spawn a vampire hedgehog pet? i want to be a vampire in adventure mode.

It could be done in Lua, though it would be fairly complicated.  I don't think there's an existing DFHack plugin that makes it easy.  Modding something readily available (such as chicken meat) to turn you into a vampire when you eat it would probably be easier.
Title: Re: DFHack 0.34.11 r3
Post by: azrael300 on June 27, 2013, 02:01:03 am
is it possible to use df hack to spawn a vampire? like spawn a vampire hedgehog pet? i want to be a vampire in adventure mode.

nevermind, i already found a way...

(http://i1152.photobucket.com/albums/p489/azrael300/gottalovedfhackandmasterwork.png?t=1372316418)
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 27, 2013, 02:02:30 am

given the original
Code: [Select]
if (item->getType() != cons->item_type ||
            item->getSubtype() != cons->item_subtype ||
            item->getMaterial() != cons->mat_type ||
            item->getMaterialIndex() != cons->mat_index)
            continue;

I get this translation (basicly the same as what you have, but using the : tail call )
Code: [Select]
if item:getType() == cons.item_type and
            item:getSubtype() == cons.item_subtype and
            item:getMaterial() == cons.mat_type and
            item:getMaterialIndex() == cons.mat_index  then
    -- destroy item, mark construction as "no build item"
end


the getMaterial vmethod returns the item mat_type, but according to the df.item.xml, getActualMaterial returns actual material never race, so by inference getMaterial might return a race for a creature mat.  I didn't see any matgloss value being used.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 27, 2013, 02:21:50 am

given the original
Code: [Select]
if (item->getType() != cons->item_type ||
            item->getSubtype() != cons->item_subtype ||
            item->getMaterial() != cons->mat_type ||
            item->getMaterialIndex() != cons->mat_index)
            continue;

I get this translation (basicly the same as what you have, but using the : tail call )
Code: [Select]
if item:getType() == cons.item_type and
            item:getSubtype() == cons.item_subtype and
            item:getMaterial() == cons.mat_type and
            item:getMaterialIndex() == cons.mat_index  then
    -- destroy item, mark construction as "no build item"
end


the getMaterial vmethod returns the item mat_type, but according to the df.item.xml, getActualMaterial returns actual material never race, so by inference getMaterial might return a race for a creature mat.  I didn't see any matgloss value being used.

Where did you get that original?  I got mine from quietust's branch of DFHack:

https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp (https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp)
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 27, 2013, 03:10:30 am
Where did you get that original?  I got mine from quietust's branch of DFHack:

https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp (https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp)

from https://github.com/quietust/dfhack/blob/master/plugins/cleanconst.cpp (https://github.com/quietust/dfhack/blob/master/plugins/cleanconst.cpp)



In other news, I have managed to create cleaning jobs and assign them to workers in two ways.

One way is by spawning stagnant water.  Issues:  Will be deleted at the beginning of each season (I am not sure if it will take other contaminants with it),  might disappear if hit by a rain drop, might freeze or evaporate according to environment.

The other way is by hooking a custom reaction and using the worker who completes the reaction and a burrow created for assigning cleaning designations to get a location.  Issues:  cannot use cleaning labor on custom reaction, unit will take time related to skill level, (i guess they take their time at the janitors closet, grumbling about having to do janitorial work), and can't detect if the unit cancels the job en-route to the destination tile (cancel due to hunger, sleep, thirst, danger), and the unit does not seem to gain skill by performing the reaction unless I put it in the hook code (haven't tested experience gain extensively).

Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on June 27, 2013, 05:48:06 am
Where did you get that original?  I got mine from quietust's branch of DFHack:

https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp (https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp)

from https://github.com/quietust/dfhack/blob/master/plugins/cleanconst.cpp (https://github.com/quietust/dfhack/blob/master/plugins/cleanconst.cpp)

Okay, that looks like a more recent version.  I'm guessing matgloss is simply outdated, then.
Title: Re: DFHack 0.34.11 r3
Post by: crossmr on June 27, 2013, 05:52:38 am
Would it be possible to create a script that hides all body parts (corpses skull/teeth/hair/bones/etc) that are on non-cavern tiles? After I wipe out a siege, I send the dwarves to clean up then go through and hide the leftover body parts.
For ambushes not a big deal, for sieges, kind of annoying and time consuming, especially with axe and sword dwarves, but when my hammerdwarf smashes someone in the mouth it just becomes difficult. 20 teeth usually go spraying all over the landscape, and it seems to be happening with increased frequency.

Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 27, 2013, 07:43:54 am
Where did you get that original?  I got mine from quietust's branch of DFHack:

https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp (https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp)

Take a closer look at that URL - that's dfhack-23a, a special fork of DFHack that's designed to work with the old 2D version of DF (namely, version 0.23.130.23a).

The version of cleanconst.cpp in there is actually non-functional because constructions didn't exist in that version (and it's excluded from compilation) - it's only there because dfhack-23a merges all commits from dfhack-40d (for version 0.28.181.40d, which itself merges commits from the current version of DFHack), where material info is referred to as material/matgloss (rather than mat_type/mat_index as it came to be called in 0.31 and later). And in case you're wondering, the cleanconst command does work in 40d - I successfully ran it on Flarechannel, but it didn't have any noticeable effect on framerate.
Title: Re: DFHack 0.34.11 r3
Post by: PintOfBass on June 27, 2013, 08:12:35 am
I looked and was unable to find a settings file.  I would like to turn off mousequery track so I don't have to do it every time I load the game.  Thanks in advance.

PoB
Title: Re: DFHack 0.34.11 r3
Post by: Dragoon209 on June 27, 2013, 12:49:09 pm
Hello,

I'm having trouble with the Keybindings not triggering their command when loaded from dfhack.init.  I've ensured that the keybinding commands are typed correctly, and have ensured (by running keybinding with no arguments) that I am on the correct screen to use it.

Spoiler: dfhack.init (click to show/hide)


The commands I am trying to use are Quicksave (keybinding add Ctrl-Alt-S@dwarfmode/Default quicksave) and Alternate Stock Screen (keybinding add Shift-Ctrl-Z@dwarfmode/Default "stocks show")

The commands will run if I copy and paste them from the init into the DFHack command window, keybinding list Ctrl-Alt-S shows
Code: [Select]
[DFHack]# keybinding list Ctrl-Alt-S
  @dwarfmode/Default: quicksave
[DFHack]#



the command is bound to the key combination, and keybinding shows:
Code: [Select]
[DFHack]# keybinding
Usage:
  keybinding list <key>
  keybinding clear <key>[@context]...
  keybinding set <key>[@context] "cmdline" "cmdline"...
  keybinding add <key>[@context] "cmdline" "cmdline"...
Later adds, and earlier items within one command have priority.
Supported keys: [Ctrl-][Alt-][Shift-](A-Z, or F1-F9, or Enter).
Context may be used to limit the scope of the binding, by
requiring the current context to have a certain prefix.
Current UI context is: dwarfmode/Default
[DFHack]#

What is going on here?  Any suggestions?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 27, 2013, 02:13:15 pm
@Dragoon209
It is my understanding that windows doesn't like honering hotkeys that use Ctrl-Z or Shift-Z or hotkeys that use Ctrl-Alt.  If you are not using windows.. I don't know.


Title: Re: DFHack 0.34.11 r3
Post by: Dragoon209 on June 27, 2013, 02:20:06 pm
@Dragoon209
It is my understanding that windows doesn't like honering hotkeys that use Ctrl-Z or Shift-Z or hotkeys that use Ctrl-Alt.  If you are not using windows.. I don't know.

I AM using Windows, that could be a thing.... I'll try changing them and report back.

Thanks!

EDIT:

  This DID fix my problem.  I changed the bindings to Alt-Z and Alt-S, and both worked.  Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on June 27, 2013, 02:29:37 pm
I looked and was unable to find a settings file.  I would like to turn off mousequery track so I don't have to do it every time I load the game.  Thanks in advance.

PoB

The mouse plugin thread (http://www.bay12forums.com/smf/index.php?topic=125618.0) is the home of talking about mousequery and its options.  dwarf fortress/dfhack.init is used to change the default options.  you might be looking for something like this:
Code: (add to dfhack.init) [Select]
mousequery track disable
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on June 27, 2013, 06:56:42 pm
Is there a way of getting DFHack to run invisibly in the background, with no console window? This would allow people to use the patch features of DFHack without the cheat features being available. Sometimes it's hard for me to resist the urge to fiddle around instead of doing things 'properly'.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 27, 2013, 08:07:06 pm
Is there a way of getting DFHack to run invisibly in the background, with no console window? This would allow people to use the patch features of DFHack without the cheat features being available. Sometimes it's hard for me to resist the urge to fiddle around instead of doing things 'properly'.
On Linux, running DF with [PRINT_MODE:TEXT] will prevent DFHack from being able to use the console (because it can't just create a new one), but on Windows there's currently no way to do that.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 28, 2013, 12:19:10 am
I did ask about the possibilities of a water/magma-pump, a workshop that works like a screwpump, with the output of liquid, but without an input. Essentially a workshop that spawns either water or magma in a reaction.

I just wanted to ask if anyone did any work on it. :)
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on June 28, 2013, 01:32:02 am
Is there a way of getting DFHack to run invisibly in the background, with no console window? This would allow people to use the patch features of DFHack without the cheat features being available. Sometimes it's hard for me to resist the urge to fiddle around instead of doing things 'properly'.

You could modify the source of dfhack and recompile.
https://github.com/peterix/dfhack/blob/master/library/Core.cpp
Starting at line 922 is the code that initializes the console.
Probably not what you wanted. :) 
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 28, 2013, 01:41:01 am
As well as my earlier findings here: http://www.bay12forums.com/smf/index.php?topic=91166.msg4332174#msg4332174 and http://www.bay12forums.com/smf/index.php?topic=91166.msg4341092#msg4341092 , I have yet another submission to the df structures:

wound_damage_flags2
unk1 (0x2 or the second flag) is enabled when the wound contact area is equal to or greater than the contact area of the body part (regardless of depth of penetration). I'd name the flag "Entire Surface".
See https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L1069

unit_wound
unk_40 is userdata:12026B28 (or something else) when syndrome_id has contents, such as a creature created with a syndrome in the arena (animated corpse). I don't know what that means, but it looks like an address.
See https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L1152

unit.counters2.unk_59c is the undead hitpoints, counting upwards from 0.
See https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L684
The animated corpse collapses when the undead hitpoints exceed body_size_info area_cur (formerly physical_attr_tissues[2])
See https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L755

What is also awesome about the undead hitpoints is that it appears to provide an objective means of comparing weapons/attacks - a herd of bunnies proved the relationship between the area_cur and unk_59c by increasing unk_59c by 1 per hit on a large animated corpse. A bronze colossus punch added thousands to unk_59c and instantly collapsed the animated corpse. Dwarf punches cause less hitpoint damage than a warhammer etc.
Title: Re: DFHack 0.34.11 r3
Post by: Kebra on June 28, 2013, 09:35:06 am
Im having a bit of a problem understanding tiletypes

If i wanted to change a floor to be fertile soil. How would i go about it?

I have tried painting with dark_grass and making it wet. But as soon as a dwarf walks over it, it immediately turns into sand (the previous floor type)

Also, can you paint "air" into fx. a crystal glass block?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 28, 2013, 09:48:47 am
I did ask about the possibilities of a water/magma-pump, a workshop that works like a screwpump, with the output of liquid, but without an input. Essentially a workshop that spawns either water or magma in a reaction.

I just wanted to ask if anyone did any work on it. :)

Oh, and before I forget it:
1. Portal1 and Portal2 building for manually transfering workers between the two.
2. Renaming of pets. Like the current system for workshops, just for pets. Please, I always wanted to give warpets a fitting name. :)
Title: Re: DFHack 0.34.11 r3
Post by: Rose on June 28, 2013, 10:11:58 am
Im having a bit of a problem understanding tiletypes

If i wanted to change a floor to be fertile soil. How would i go about it?

I have tried painting with dark_grass and making it wet. But as soon as a dwarf walks over it, it immediately turns into sand (the previous floor type)

Also, can you paint "air" into fx. a crystal glass block?
grass is more complicated than just a tiletype. there's also grass structures that describe what grass is growing and how much. Dealing with this is beyond the scope of tiletypes.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on June 28, 2013, 10:13:30 am
Im having a bit of a problem understanding tiletypes

If i wanted to change a floor to be fertile soil. How would i go about it?

I have tried painting with dark_grass and making it wet. But as soon as a dwarf walks over it, it immediately turns into sand (the previous floor type)

Also, can you paint "air" into fx. a crystal glass block?

I believe the material you want is SOIL?  It's been a while since I've tried that, but to remove annoyances like rocks that prevent plopping a farm down, I'd paint an area with SOIL material and WALL shape.  Then change the shape to FLOOR and paint it with SOIL again.  There's probably a simpler way, but something like that worked.

The discussion on grass has me doubting it, but I seem to recall this would make the grass eventually grow in those tiles.  It might just be a biome thing where the grass data structures were already in place though.
Title: Re: DFHack 0.34.11 r3
Post by: cdombroski on June 28, 2013, 10:18:43 am
Isn't sand already fertile soil (at least as DF understands it)?

I don't quite understand the last question. You can paint air but it's mostly useful with shapes EMPTY and RAMP_TOP.
Title: Re: DFHack 0.34.11 r3
Post by: Kebra on June 28, 2013, 11:05:35 am
Isn't sand already fertile soil (at least as DF understands it)?

I don't quite understand the last question. You can paint air but it's mostly useful with shapes EMPTY and RAMP_TOP.

What i meant was to paint glass blocks in the air (replace air/empty space with glass blocks).

As for fertility in sand, i get a "yellow" warning that the ground isn't fertile when building farms over surface sand.

Quote
I believe the material you want is SOIL?  It's been a while since I've tried that, but to remove annoyances like rocks that prevent plopping a farm down, I'd paint an area with SOIL material and WALL shape.  Then change the shape to FLOOR and paint it with SOIL again.  There's probably a simpler way, but something like that worked.

The discussion on grass has me doubting it, but I seem to recall this would make the grass eventually grow in those tiles.  It might just be a biome thing where the grass data structures were already in place though.
Can you give me an example setup of tiletypes where you got that to work?
Title: Re: DFHack 0.34.11 r3
Post by: cdombroski on June 28, 2013, 01:19:50 pm
Isn't sand already fertile soil (at least as DF understands it)?

I don't quite understand the last question. You can paint air but it's mostly useful with shapes EMPTY and RAMP_TOP.

What i meant was to paint glass blocks in the air (replace air/empty space with glass blocks).

As for fertility in sand, i get a "yellow" warning that the ground isn't fertile when building farms over surface sand.

You can replace air with walls, however I don't think there's a way to specifically paint glass. Your main choices for walls are soil, stone and mineral and they'll all take an appropriate material from the surrounding area.

The warning on placing above ground farm plots is a well known bug as mention on the farming (http://dwarffortresswiki.org/index.php/Farming) page.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on June 28, 2013, 02:55:04 pm
Probably not what you wanted. :)
I was hoping for something you could put in the init file, yes. But this is a way of doing it, at least.
Title: Re: DFHack 0.34.11 r3
Post by: Matoro on June 29, 2013, 06:48:13 am
I just can't figure out how to use DFusion commands like friendship, mirgants and embark expander. How do they work?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on June 29, 2013, 08:33:53 am
I just can't figure out how to use DFusion commands like friendship, mirgants and embark expander. How do they work?
by typing in the number not the word corresponding to the option
it doesn't help that dfusion kinda gutted out friendship,migrant, and embark expander...

in scripting news I just finished ironing out the spawn unit script warmist made now it can spawn any unit how many times you want and doesn't horribly turn all your dwarves tame and make sharks rulers, costing you the trust of a coder.

here's a fort friendly version so that you don't have to set an adventurer in your fort to spawn units (http://pastebin.com/Xfe6DUpn)
here's one for adventure mode one (http://pastebin.com/8sPdNzng)

this won't work right away if you don't have genesis so you need to edit the "Barbarian Class" with any race you want.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 29, 2013, 02:27:00 pm
I just can't figure out how to use DFusion commands like friendship, mirgants and embark expander. How do they work?
by typing in the number not the word corresponding to the option
it doesn't help that dfusion kinda gutted out friendship,migrant, and embark expander...

in scripting news I just finished ironing out the spawn unit script warmist made now it can spawn any unit how many times you want and doesn't horribly turn all your dwarves tame and make sharks rulers, costing you the trust of a coder.

here's a fort friendly version so that you don't have to set an adventurer in your fort to spawn units (http://pastebin.com/Xfe6DUpn)
here's one for adventure mode one (http://pastebin.com/8sPdNzng)

this won't work right away if you don't have genesis so you need to edit the "Barbarian Class" with any race you want.

SHIET

EDIT: Does autosyndrome work with adventure mode reactions?
Title: Re: DFHack 0.34.11 r3
Post by: theit8514 on July 01, 2013, 12:16:57 am
EDIT: DOH, I made a variable mistake :D Ignore this. I've updated the code to the complete 100% working (including preferred improvement types and counting # of improvements over 1), incase anyone else needs a value calculator :) Time to start working on the other item types. Yay.

I've been working on calculating out trader item values (to make improvements to how tradeassist works). So far, I've gotten pretty close (for weapons, that is :D ). Some items that are improved have the correct value (#3). Others are way off (#4). I am wondering if any dfhack veterans have any suggestions.

Spoiler (click to show/hide)

I have absolutely no idea why ITEM_WEAPON_WHIP_THROWING is so off. It's size is 100 in the raws (a 3 multi), and the material multi is the same as the raws. The calculation is correct for other items (or close enough that I can count the remainder as "trader variation").

Spoiler (click to show/hide)

The code, for anyone interested:
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 01, 2013, 06:48:23 pm
changed some todo stuff:

Code: [Select]
function CreateUnit(race_id,caste_id) --This is from Rumrusher/Warmist's spawnunit script: http://www.bay12forums.com/smf/index.php?topic=91166.msg4359680
    local race=df.creature_raw.find(race_id)
    if race==nil then error("Invalid race_id") end
    local caste=getCaste(race_id,caste_id)
    local miscStuff = caste.misc
    local unit=df.unit:new()
    unit.race=race_id
    unit.caste=caste_id
        unit.id=(df.global.unit_next_id)
        df.global.unit_next_id = df.global.unit_next_id + 1
    local body=unit.body
   
    body.body_plan=caste.body_info
    local body_part_count=#body.body_plan.body_parts
    local layer_count=#body.body_plan.layer_part
    --components
    local creatureAge = math.random(miscStuff.child_age,miscStuff.maxage_min/2)
    unit.relations.birth_year=df.global.cur_year-creatureAge
    --unit.relations.birth_time=??
    unit.relations.old_year=unit.relations.birth_year+(math.random(miscStuff.maxage_min,miscStuff.maxage_max))
    --unit.relations.old_time=?? --TODO add normal age
    local cp=body.components
    cp.body_part_status:resize(body_part_count)
    cp.numbered_masks:resize(#body.body_plan.numbered_masks)
    for num,v in ipairs(body.body_plan.numbered_masks) do
        cp.numbered_masks[num]=v
    end
   
    cp.body_layer_338:resize(layer_count)
    cp.body_layer_348:resize(layer_count)
    cp.body_layer_358:resize(layer_count)
    cp.body_layer_368:resize(layer_count)
    cp.body_layer_378:resize(layer_count)
    --maybe physical_attr
    body.blood_max=miscStuff.adult_size
    body.blood_count=miscStuff.adult_size
    body.unk_494=0
    unit.status2.body_part_temperature:resize(body_part_count)
    for k,v in pairs(unit.status2.body_part_temperature) do
        unit.status2.body_part_temperature[k]={new=true,whole=(caste.homeotherm~=60001) and caste.homeotherm or 10067,fraction=0}
       
    end
    --------------------
    local stuff=unit.enemy
    stuff.body_part_878:resize(body_part_count) -- all = 3
    stuff.body_part_888:resize(body_part_count) -- all = 3
    stuff.body_part_relsize:resize(body_part_count)
 
    --TODO add correct sizes.
   
    stuff.were_race=race_id
    stuff.were_caste=caste_id
    stuff.normal_race=race_id
    stuff.normal_caste=caste_id
    stuff.body_part_8a8:resize(body_part_count) -- all = 1
    stuff.body_part_base_ins:resize(body_part_count)
    stuff.body_part_clothing_ins:resize(body_part_count)
    stuff.body_part_8d8:resize(body_part_count)
    unit.recuperation.healing_rate:resize(layer_count)
    --appearance
   
    local app=unit.appearance
    app.body_modifiers:resize(#caste.body_appearance_modifiers) --3
    app.bp_modifiers:resize(#caste.bp_appearance.modifier_idx) --0
    --app.unk_4c8:resize(33)--33
        app.tissue_style:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_civ_id:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_id:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_type:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_length:resize(#caste.bp_appearance.style_layer_idx)
    app.genes.appearance:resize(#caste.body_appearance_modifiers+#caste.bp_appearance.modifiers) --3
    app.genes.colors:resize(#caste.color_modifiers*2) --???
    app.colors:resize(#caste.color_modifiers)--3
    -- maybe add a soul?
    df.global.world.units.all:insert("#",unit)
    --df.global.world.units.bad:insert("#",unit)
    df.global.world.units.active:insert("#",unit)
    return unit
end

function PlaceUnit(trgunit,filter)
u = selectCreature(filter)
u.relations.group_leader_id=trgunit.id
local u_nem=dfhack.units.getNemesis(u)
local t_nem=dfhack.units.getNemesis(trgunit)
if u_nem then
        u_nem.group_leader_id=t_nem.id
end
if t_nem and u_nem then
        t_nem.companions:insert(#t_nem.companions,u_nem.id)
end
u.civ_id=df.global.ui.civ_id
--u.civ_id=(df.global.world.units.active[0].civ_id) --be sure to use adventure swap on a local dwarf so they be connected to the right civ
--u.pos:assign(df.global.world.units.active[0].pos)
u.pos:assign(xyz2pos(pos2xyz(df.global.cursor)))
u.name.first_name="Summoned monster of " .. target.name.first_name
u.name.has_name=true
end
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on July 01, 2013, 08:59:33 pm
changed some todo stuff:

Code: [Select]
function CreateUnit(race_id,caste_id) --This is from Rumrusher/Warmist's spawnunit script: http://www.bay12forums.com/smf/index.php?topic=91166.msg4359680
    local race=df.creature_raw.find(race_id)
    if race==nil then error("Invalid race_id") end
    local caste=getCaste(race_id,caste_id)
    local miscStuff = caste.misc
    local unit=df.unit:new()
    unit.race=race_id
    unit.caste=caste_id
        unit.id=(df.global.unit_next_id)
        df.global.unit_next_id = df.global.unit_next_id + 1
    local body=unit.body
   
    body.body_plan=caste.body_info
    local body_part_count=#body.body_plan.body_parts
    local layer_count=#body.body_plan.layer_part
    --components
    local creatureAge = math.random(miscStuff.child_age,miscStuff.maxage_min/2)
    unit.relations.birth_year=df.global.cur_year-creatureAge
    --unit.relations.birth_time=??
    unit.relations.old_year=unit.relations.birth_year+(math.random(miscStuff.maxage_min,miscStuff.maxage_max))
    --unit.relations.old_time=?? --TODO add normal age
    local cp=body.components
    cp.body_part_status:resize(body_part_count)
    cp.numbered_masks:resize(#body.body_plan.numbered_masks)
    for num,v in ipairs(body.body_plan.numbered_masks) do
        cp.numbered_masks[num]=v
    end
   
    cp.body_layer_338:resize(layer_count)
    cp.body_layer_348:resize(layer_count)
    cp.body_layer_358:resize(layer_count)
    cp.body_layer_368:resize(layer_count)
    cp.body_layer_378:resize(layer_count)
    --maybe physical_attr
    body.blood_max=miscStuff.adult_size
    body.blood_count=miscStuff.adult_size
    body.unk_494=0
    unit.status2.body_part_temperature:resize(body_part_count)
    for k,v in pairs(unit.status2.body_part_temperature) do
        unit.status2.body_part_temperature[k]={new=true,whole=(caste.homeotherm~=60001) and caste.homeotherm or 10067,fraction=0}
       
    end
    --------------------
    local stuff=unit.enemy
    stuff.body_part_878:resize(body_part_count) -- all = 3
    stuff.body_part_888:resize(body_part_count) -- all = 3
    stuff.body_part_relsize:resize(body_part_count)
 
    --TODO add correct sizes.
   
    stuff.were_race=race_id
    stuff.were_caste=caste_id
    stuff.normal_race=race_id
    stuff.normal_caste=caste_id
    stuff.body_part_8a8:resize(body_part_count) -- all = 1
    stuff.body_part_base_ins:resize(body_part_count)
    stuff.body_part_clothing_ins:resize(body_part_count)
    stuff.body_part_8d8:resize(body_part_count)
    unit.recuperation.healing_rate:resize(layer_count)
    --appearance
   
    local app=unit.appearance
    app.body_modifiers:resize(#caste.body_appearance_modifiers) --3
    app.bp_modifiers:resize(#caste.bp_appearance.modifier_idx) --0
    --app.unk_4c8:resize(33)--33
        app.tissue_style:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_civ_id:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_id:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_style_type:resize(#caste.bp_appearance.style_layer_idx)
        app.tissue_length:resize(#caste.bp_appearance.style_layer_idx)
    app.genes.appearance:resize(#caste.body_appearance_modifiers+#caste.bp_appearance.modifiers) --3
    app.genes.colors:resize(#caste.color_modifiers*2) --???
    app.colors:resize(#caste.color_modifiers)--3
    -- maybe add a soul?
    df.global.world.units.all:insert("#",unit)
    --df.global.world.units.bad:insert("#",unit)
    df.global.world.units.active:insert("#",unit)
    return unit
end

function PlaceUnit(trgunit,filter)
u = selectCreature(filter)
u.relations.group_leader_id=trgunit.id
local u_nem=dfhack.units.getNemesis(u)
local t_nem=dfhack.units.getNemesis(trgunit)
if u_nem then
        u_nem.group_leader_id=t_nem.id
end
if t_nem and u_nem then
        t_nem.companions:insert(#t_nem.companions,u_nem.id)
end
u.civ_id=df.global.ui.civ_id
--u.civ_id=(df.global.world.units.active[0].civ_id) --be sure to use adventure swap on a local dwarf so they be connected to the right civ
--u.pos:assign(df.global.world.units.active[0].pos)
u.pos:assign(xyz2pos(pos2xyz(df.global.cursor)))
u.name.first_name="Summoned monster of " .. target.name.first_name
u.name.has_name=true
end

 pretty sure warmist corrected the sizes and what not in his version (https://gist.github.com/warmist/4296504), mine is an earlier version of his script modified to work with little crashing so it would be safe to throw in all that randomize/state changing stuff.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 01, 2013, 09:03:55 pm
Yeah, on my end it's crashing without fail.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on July 02, 2013, 12:12:56 pm
which one? my version, your version, warmist version? or all three?
because to explain it to others my version is a modified old version that was tested in genesis,
warmist is kinda unstable.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on July 02, 2013, 01:05:05 pm
which one? my version, your version, warmist version? or all three?
because to explain it to others my version is a modified old version that was tested in genesis,
warmist is kinda unstable.
warmist is uber stable :)

But my version is for next dfhack release. so ;P
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 02, 2013, 10:12:53 pm
Then I'll have more reason to wait ;V

I tried both mine and yours, Rumrusher, but Warmist I didn't, hehe.
Title: Re: DFHack 0.34.11 r3
Post by: skyte100 on July 02, 2013, 10:46:58 pm
I wanted to take an adventurer and start a fort with just him as a challenge. Anyone know a way to change it from adventure mode to fortress mode with it being stable? Methods I tried result in crashes.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on July 03, 2013, 12:43:40 am
I wanted to take an adventurer and start a fort with just him as a challenge. Anyone know a way to change it from adventure mode to fortress mode with it being stable? Methods I tried result in crashes.
https://gist.github.com/warmist/4198190 this to switch from adv-mode to fort mode. But it needs a site in that location. To create a site you can use dfusion->2.) adventurer tools->4.) create a site at current location.

After using first script, save n exit, and reload. It should work somewhat more uncrashy then other methods.
Title: Re: DFHack 0.34.11 r3
Post by: skyte100 on July 03, 2013, 11:49:14 am
I wanted to take an adventurer and start a fort with just him as a challenge. Anyone know a way to change it from adventure mode to fortress mode with it being stable? Methods I tried result in crashes.
https://gist.github.com/warmist/4198190 this to switch from adv-mode to fort mode. But it needs a site in that location. To create a site you can use dfusion->2.) adventurer tools->4.) create a site at current location.

After using first script, save n exit, and reload. It should work somewhat more uncrashy then other methods.
Thanks! Methods I tried were:
1. Changing from adventure straight to fortress. Result was locked keys, inability to move map, area in adventuers line of sight went dark and area to his far left was fully visible. Doesnt function at all.
 1.1. Changing it to fortress mode while in the adventurers screen and using "tweak makeown" then saving resulted in instant crashes if the game doesnt pause on load. It then crashes when unpausing or trying to access certain screens.
2. Changing from adventure to arena, manually removing control of adventurer, then switching to fort mode and adding the adventurer to to the fort via "tweak makeown". Result is semi functioning with immediate pausing with the ability to change labors but several labors missing. Unpausing results in immediate unleashing of hell followed by crash. Also had a fully revealed map due to arena. It was also unable to save thanks to the use of arena mode.
 2.1. Changing it instead to fortress mode, using reveal, changing it to arena, removing control, back to fort, and unreveal resulted in only hell being visible other than the surface. It then crashes.

Also gonna go ahead and report here that the advfort thing that lets you do jobs had a bit of a hiccup. I manually slept in a built underground base. Waking up reloaded the site with all changes I had made reverted and me moved above ground and the inability to move in the same square as the logs from cut trees.

Edit: I tried it and it seems more stable but accessing the z > Animals screen crashes it. Also gonna send you some screen shots of issues I found.
Title: Re: DFHack 0.34.11 r3
Post by: Button on July 05, 2013, 01:36:59 pm
What's the name of the script that checks if eggs are fertilized? I've googled around for it but I must be blanking on the right keywords.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 05, 2013, 01:53:25 pm
What's the name of the script that checks if eggs are fertilized? I've googled around for it but I must be blanking on the right keywords.

I know that a while back there was some discussion about what will allow an egg to hatch, which if I interpreted it correctly summarizes to if the egg layer is on the nest and has a valid pregnancy timer/ptr/mystry when the egg gets to 3 months old, it should hatch.  I find that there is something missing from that because resetting the age and pregnancy timer on ages that failed to hatch doesn't fix them.  I would also be interested in a script that gets it right (knows if they are going to hatch or not).

I did find that item_eggst.anon_4 is the unit.id of the egg layer.  item_eggst.unk_cc is a copy of the egg layer's unit.animal.population (world_population_ref) or in other words, the unit.animal.population structure the hatchlings will receive.  And I think item_eggst.anon_3 is the unit.training_level that the hatchlings will receive (based on the egg layer's training level)

Edit: added another egg field
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on July 05, 2013, 02:35:42 pm
Edit: I tried it and it seems more stable but accessing the z > Animals screen crashes it. Also gonna send you some screen shots of issues I found.
updated that fixes animal screen:
https://gist.github.com/warmist/4198190
if you want to fix already existing fort that has this, type this into dfhack console:
Code: [Select]
:lua df.global.ui.main.fortress_entity.training_knowledge={new=true}

ps: about usability: all this is not for general consumption. It hacks df quite bad and is a miracle that it works. That is why it's not included in main dfhack package and i don't encourage using it for general population. Some thing could be improved (everybody is welcome to fork my gist) but I'm not sure about the value of this. Main limitations and problems:
Title: Re: DFHack 0.34.11 r3
Post by: BoogieMan on July 06, 2013, 04:14:35 pm
I have a two quick questions.. I downloaded dfhack-0.34.11-r3-Windows.zip.

The scripts in the Hack/scripts/fix.. Are they run automatically? I can't seem to run them by name like the others. And sadly if they are auto run, they don't seem to be helping my FPS as I had hoped.

Also, I see some things like "fast-heat" in the readme, but can see no evidence of their existence in the files anywhere?

Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 06, 2013, 04:36:43 pm
I have a two quick questions.. I downloaded dfhack-0.34.11-r3-Windows.zip.

The scripts in the Hack/scripts/fix.. Are they run automatically? I can't seem to run them by name like the others. And sadly if they are auto run, they don't seem to be helping my FPS as I had hoped.

Also, I see some things like "fast-heat" in the readme, but can see no evidence of their existence in the files anywhere?

Run automatically: no, unless started from dfhack.init

Because they are in the fix sub-directory they need to called with fix/scriptname

fast heat is part of the tweak plugin and is usually run with "tweak fast-heat 500" in dfhack.init

if you don't have dfhack.init (in the dwarf fortress directory), copy or rename dfhack.init-example
Title: Re: DFHack 0.34.11 r3
Post by: zenos14 on July 06, 2013, 05:56:17 pm
I'm trying to use tiletypes to make a small underground river in my fortress and I'm trying to use aquifers as a end/beginning for the river but the tiletypes aqua command doesn't seem to do anything other than make the stone damp. Is there anyway to create aquifers with tiletypes?
I tried looking but couldn't find much at all about tiletypes
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on July 06, 2013, 07:02:34 pm
I'm trying to use tiletypes to make a small underground river in my fortress and I'm trying to use aquifers as a end/beginning for the river but the tiletypes aqua command doesn't seem to do anything other than make the stone damp. Is there anyway to create aquifers with tiletypes?
I tried looking but couldn't find much at all about tiletypes

Well, with liquids, you can make a water source.  You might even be able to put the water source inside the aquifer stone you created with tiletypes.
Title: Re: DFHack 0.34.11 r3
Post by: zenos14 on July 06, 2013, 07:44:03 pm
I'm trying to use tiletypes to make a small underground river in my fortress and I'm trying to use aquifers as a end/beginning for the river but the tiletypes aqua command doesn't seem to do anything other than make the stone damp. Is there anyway to create aquifers with tiletypes?
I tried looking but couldn't find much at all about tiletypes

Well, with liquids, you can make a water source.  You might even be able to put the water source inside the aquifer stone you created with tiletypes.

Will the water source absorb water like an aquifer?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 06, 2013, 08:18:09 pm
Running this code:

Code: [Select]
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","DWARF","HUMAN","ELF","GOBLIN"}

Gets me this error:

Code: [Select]
C:\DFTerm\Hack\hack\lua\plugins\dfusion.lua:146: loadObjectFile: C++ exception:
Error opening file!
stack traceback:
        [C]: in function 'loadObjectFile'
        C:\DFTerm\Hack\hack\lua\plugins\dfusion.lua:146: in function 'load'
        C:\DFTerm\Hack\hack\lua\plugins\dfusion.lua:125: in function 'fun'
        C:\DFTerm\Hack\hack\lua\class.lua:98: in function 'invoke_after_rec'
        C:\DFTerm\Hack\hack\lua\class.lua:94: in function 'invoke_after_rec'
        C:\DFTerm\Hack\hack\lua\class.lua:129: in function 'FriendshipRainbow'
        C:\DFTerm\Hack\hack\lua\plugins\dfusion\friendship.lua:120: in main chun
k
        [C]: in function 'require'
        C:\DFTerm\Hack\hack\scripts/friendship.lua:1: in main chunk
        (...tail calls...)
[/color]
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on July 07, 2013, 12:40:42 am
Running this code:

Code: [Select]
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","DWARF","HUMAN","ELF","GOBLIN"}

Gets me this error:

Code: [Select]
C:\DFTerm\Hack\hack\lua\plugins\dfusion.lua:146: loadObjectFile: C++ exception:
Error opening file!
stack traceback:
        [C]: in function 'loadObjectFile'
        C:\DFTerm\Hack\hack\lua\plugins\dfusion.lua:146: in function 'load'
        C:\DFTerm\Hack\hack\lua\plugins\dfusion.lua:125: in function 'fun'
        C:\DFTerm\Hack\hack\lua\class.lua:98: in function 'invoke_after_rec'
        C:\DFTerm\Hack\hack\lua\class.lua:94: in function 'invoke_after_rec'
        C:\DFTerm\Hack\hack\lua\class.lua:129: in function 'FriendshipRainbow'
        C:\DFTerm\Hack\hack\lua\plugins\dfusion\friendship.lua:120: in main chun
k
        [C]: in function 'require'
        C:\DFTerm\Hack\hack\scripts/friendship.lua:1: in main chunk
        (...tail calls...)
[/color]
check if there is a file hack\lua\plugins\dfusion\friendship.o
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on July 07, 2013, 01:07:27 am
I'm trying to use tiletypes to make a small underground river in my fortress and I'm trying to use aquifers as a end/beginning for the river but the tiletypes aqua command doesn't seem to do anything other than make the stone damp. Is there anyway to create aquifers with tiletypes?
I tried looking but couldn't find much at all about tiletypes

Well, with liquids, you can make a water source.  You might even be able to put the water source inside the aquifer stone you created with tiletypes.

Will the water source absorb water like an aquifer?

Normally, no, but I suggest checking; it could be different when an aquifer stone is present.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 07, 2013, 01:26:59 am
Running this code:

Code: [Select]
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","DWARF","HUMAN","ELF","GOBLIN"}

Gets me this error:

Code: [Select]
C:\DFTerm\Hack\hack\lua\plugins\dfusion.lua:146: loadObjectFile: C++ exception:
Error opening file!
stack traceback:
        [C]: in function 'loadObjectFile'
        C:\DFTerm\Hack\hack\lua\plugins\dfusion.lua:146: in function 'load'
        C:\DFTerm\Hack\hack\lua\plugins\dfusion.lua:125: in function 'fun'
        C:\DFTerm\Hack\hack\lua\class.lua:98: in function 'invoke_after_rec'
        C:\DFTerm\Hack\hack\lua\class.lua:94: in function 'invoke_after_rec'
        C:\DFTerm\Hack\hack\lua\class.lua:129: in function 'FriendshipRainbow'
        C:\DFTerm\Hack\hack\lua\plugins\dfusion\friendship.lua:120: in main chun
k
        [C]: in function 'require'
        C:\DFTerm\Hack\hack\scripts/friendship.lua:1: in main chunk
        (...tail calls...)
[/color]
check if there is a file hack\lua\plugins\dfusion\friendship.o

I can tell you right now there isn't.
Title: Re: DFHack 0.34.11 r3
Post by: zenos14 on July 07, 2013, 02:58:21 am
I'm trying to use tiletypes to make a small underground river in my fortress and I'm trying to use aquifers as a end/beginning for the river but the tiletypes aqua command doesn't seem to do anything other than make the stone damp. Is there anyway to create aquifers with tiletypes?
I tried looking but couldn't find much at all about tiletypes

Well, with liquids, you can make a water source.  You might even be able to put the water source inside the aquifer stone you created with tiletypes.

Will the water source absorb water like an aquifer?

Normally, no, but I suggest checking; it could be different when an aquifer stone is present.

It doesn't work, oh well time to make a plan b
Title: Re: DFHack 0.34.11 r3
Post by: fricy on July 08, 2013, 09:37:04 am
Quick question, maybe someone can point me in the right direction:

There's a watch-minecarts lua script in the "scripts/devel/" folder. I tested it with dfhack r3 with the LNP pack, it works. But when I try to run it in Masterwork DF (same dfhack version) I get the following error message: http://imgbox.com/adqrJB4w

My testing forts were made in MW, so it would be nice if I could run it without building a new one in vanilla. Any idea how to make it work?

EDIT: Another problem I ran into:
I managed to edit the script to output into a .csv file, now I'm trying to macro it with a step command, so I can advance the time with one tick, run the script, repeat.
Code: [Select]
minecart_watcher
D_ONESTEP
End of group
CUSTOM_SHIFT_W
End of group
End of macro


Dfhack properly catches the input when recording, but won't run the script upon playback. I guess it means dfhack is not compatible with macro commands. Any way around it?
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on July 08, 2013, 06:22:01 pm
Where did you get that original?  I got mine from quietust's branch of DFHack:

https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp (https://github.com/quietust/dfhack-23a/blob/master/plugins/cleanconst.cpp)

Take a closer look at that URL - that's dfhack-23a, a special fork of DFHack that's designed to work with the old 2D version of DF (namely, version 0.23.130.23a).

The version of cleanconst.cpp in there is actually non-functional because constructions didn't exist in that version (and it's excluded from compilation) - it's only there because dfhack-23a merges all commits from dfhack-40d (for version 0.28.181.40d, which itself merges commits from the current version of DFHack), where material info is referred to as material/matgloss (rather than mat_type/mat_index as it came to be called in 0.31 and later). And in case you're wondering, the cleanconst command does work in 40d - I successfully ran it on Flarechannel, but it didn't have any noticeable effect on framerate.

I suspect there is something other than item count that reduces the framerate. When a large amounts of the map get dug out (it usually does in older fortresses), the framerate falls significantly. In fact, this may be the bigger contributor, rather than items.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on July 08, 2013, 06:26:09 pm
Large open areas equals more path-finding calculations.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on July 08, 2013, 06:31:15 pm
Large open areas equals more path-finding calculations.

I mean that even when they are sealed off and uninhabited, so no pathfinding can be happening there, the FPS is reduced.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on July 08, 2013, 07:58:25 pm
Temperature calculations, especially with moving air?  Also, if there are items sealed off but not forbidden, they can cause the area that is accessible to be searched more often.
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on July 08, 2013, 08:25:43 pm
Also the growth of moss on soil tiles. Really honeycombing the shit out of the clay and sand could really kick a fort in the shins, I think.
Title: Re: DFHack 0.34.11 r3
Post by: TheCoolSideofthePIllow on July 09, 2013, 02:19:14 am
Is there a plugin that will allow me to thaw my embark site? Even though I am in a temperate area, the site is frozen all year long, which sucks because I got like 5 rivers all converging in these cliffs and it would make a dope waterfall if the damn things would thaw in the spring/summer.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on July 09, 2013, 02:34:02 am
Is there a plugin that will allow me to thaw my embark site? Even though I am in a temperate area, the site is frozen all year long, which sucks because I got like 5 rivers all converging in these cliffs and it would make a dope waterfall if the damn things would thaw in the spring/summer.

Dig under it and use "liquids" to put magma under it.
Maybe you could use "tiletypes" to do the digging too.

Speaking of Terraria, why can't I carry magma in a bucket?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on July 09, 2013, 02:39:21 pm
Is there a plugin that will allow me to thaw my embark site? Even though I am in a temperate area, the site is frozen all year long, which sucks because I got like 5 rivers all converging in these cliffs and it would make a dope waterfall if the damn things would thaw in the spring/summer.

Dig under it and use "liquids" to put magma under it.
Maybe you could use "tiletypes" to do the digging too.

Speaking of Terraria, why can't I carry magma in a bucket?
well you mean in adventure mode or in fort mode? because you could scoop up magma into a bucket though the heat of magma will burn you, and the bucket.
Title: Re: DFHack 0.34.11 r3
Post by: TheCoolSideofthePIllow on July 10, 2013, 10:46:58 pm
Fort mode... But I'd like to have the whole embark site just thaw like normal during the warmer months. I've never seen a site listed as "temperate" be frozen all year round, and the snow is ugly.
Title: Re: DFHack 0.34.11 r3
Post by: Grax on July 10, 2013, 11:30:15 pm
well you mean in adventure mode or in fort mode? because you could scoop up magma into a bucket though the heat of magma will burn you, and the bucket.

But there's nether-caps. ;-)
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on July 11, 2013, 05:54:29 am
Congratulations on your bucket-shaped block of basalt.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on July 11, 2013, 09:57:10 am
Large open areas equals more path-finding calculations.

I mean that even when they are sealed off and uninhabited, so no pathfinding can be happening there, the FPS is reduced.

When the game calculates connected components, it needs to do stuff for sealed off areas. That's not the same as pathfinding but it's related.

edit: what about open space, as opposed to lots of floor tiles? Does open space slow things down similarly?
Title: Re: DFHack 0.34.11 r3
Post by: BoogieMan on July 11, 2013, 02:48:12 pm
I updated to the new version of DFHack and now dfusion doesn't have the dwarf count editor on embark function. Is it elsewhere? How can I get it back without backing up a version?
https://raw.github.com/warmist/dfhack/master/scripts/startdwarf.rb
put this into hack/scripts/startdwarf.rb
and then run startdwarf <number>

Thanks for the reply. I placed that file where you said, and when I run it by either typing simply startdwarf, startdwarf 15, startdwarf <15> I get red text saying syntax error, unexpected '<' and a bunch of other stuff.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 11, 2013, 04:17:31 pm
"A bunch of other stuff" doesn't help.

1. Right click the top of the command line.
2. Highlight "edit".
3. Click mark.
4. Use the mouse to highlight the error.
5. Press enter to copy.
6. Paste it here.
Title: Re: DFHack 0.34.11 r3
Post by: BoogieMan on July 11, 2013, 05:03:52 pm
"A bunch of other stuff" doesn't help

1. Right click the top of the command line.
2. Highlight "edit".
3. Click mark.
4. Use the mouse to highlight the error.
5. Press enter to copy.
6. Paste it here.

I assumed I was doing something very simple in the wrong way, not using the correct syntax or something and didn't know how to copy from the cmd window so decided that typing the entire error message might have been a waste of time. But now that I know how to copy from there, that's easy. Thanks. Here it is:

I put it in Dwarf Fortress 0.34.11\hack\scripts


E: SyntaxError: (eval):1:in `load': ./hack/scripts/startdwarf.rb:4: syntax error
, unexpected '<'
<!DOCTYPE html>
 ^
./hack/scripts/startdwarf.rb:5: syntax error, unexpected '<'
<html>
 ^
./hack/scripts/startdwarf.rb:7: syntax error, unexpected '<'
    <meta charset='utf-8'>
     ^
./hack/scripts/startdwarf.rb:8: syntax error, unexpected '<'
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
     ^
./hack/scripts/startdwarf.rb:8: syntax error, unexpected tIDENTIFIER, expecting
$end
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
                                              ^
 (eval):1
 (eval):1
 (eval):1:in `catch'
 (eval):1
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 11, 2013, 05:19:07 pm
uhh

Just use this:

Code: [Select]
# patch start dwarf count

nr = $script_args[0].to_i

raise 'too low' if nr < 7

addr = df.get_global_address('start_dwarf_count')
df.memory_patch(addr, [nr].pack('L'))

None of that other stuff.
Title: Re: DFHack 0.34.11 r3
Post by: BoogieMan on July 11, 2013, 05:47:47 pm
uhh

Just use this:

Code: [Select]
# patch start dwarf count

nr = $script_args[0].to_i

raise 'too low' if nr < 7

addr = df.get_global_address('start_dwarf_count')
df.memory_patch(addr, [nr].pack('L'))

None of that other stuff.

Oh. I went to https://github.com/warmist/dfhack/tree/master/scripts and downloaded the .rb itself, didn't create my own with just that text. When I view it on the website it shows just that text, but when I saved it to my desktop, it added a TON of crap to the file. WTF?
Title: Re: DFHack 0.34.11 r3
Post by: falconne on July 11, 2013, 10:01:23 pm
Oh. I went to https://github.com/warmist/dfhack/tree/master/scripts and downloaded the .rb itself, didn't create my own with just that text. When I view it on the website it shows just that text, but when I saved it to my desktop, it added a TON of crap to the file. WTF?

You saved the web page, not the file displayed in the page. If you click the button labelled "Raw" you'll get a file that you can save.
Title: Re: DFHack 0.34.11 r3
Post by: BoogieMan on July 12, 2013, 02:22:34 pm
Oh. I went to https://github.com/warmist/dfhack/tree/master/scripts and downloaded the .rb itself, didn't create my own with just that text. When I view it on the website it shows just that text, but when I saved it to my desktop, it added a TON of crap to the file. WTF?

You saved the web page, not the file displayed in the page. If you click the button labelled "Raw" you'll get a file that you can save.

ROFL. What a noob move. Thanks! I thought save link as in Firefox was like save target as in IE. Apparently not.
Title: Re: DFHack 0.34.11 r3
Post by: AMTiger on July 13, 2013, 07:07:42 am
Hi, How do you add new scripts to DFHack?
 Ive tried everything I can think of and nothing seems to do anything but break it, and searching brings up too much irrelevant information to find anything through.

 Just dropping the .rb files in the scripts folder [the only place they are in other mods DFHacks], doesnt seem to do anything at all.
Title: Re: DFHack 0.34.11 r3
Post by: Brilliand on July 13, 2013, 02:01:39 pm
Hi, How do you add new scripts to DFHack?
 Ive tried everything I can think of and nothing seems to do anything but break it, and searching brings up too much irrelevant information to find anything through.

 Just dropping the .rb files in the scripts folder [the only place they are in other mods DFHacks], doesnt seem to do anything at all.

Putting the file in the scripts folder is the main thing, but you also have to activate the script somehow, either by typing its name on the dfhack prompt or by adding its name to your dfhack.init file.
Title: Re: DFHack 0.34.11 r3
Post by: AMTiger on July 13, 2013, 07:36:34 pm
Hi, How do you add new scripts to DFHack?
 Ive tried everything I can think of and nothing seems to do anything but break it, and searching brings up too much irrelevant information to find anything through.

 Just dropping the .rb files in the scripts folder [the only place they are in other mods DFHacks], doesnt seem to do anything at all.

Putting the file in the scripts folder is the main thing, but you also have to activate the script somehow, either by typing its name on the dfhack prompt or by adding its name to your dfhack.init file.

 Thanks!
 SO what do you put into dfhack to add it to the prompt?
 Just dropping it into the scripts folder then typing its name [as works in the packaged-with-a-mod-DFHack it's copied from[Downloaded copy script tested too]] causes the red 'is not a recognized command'
 The script command gives a read 'error loading script' and load a 'no such plugin' and etc. Ive tried everything in the ls that seems event remotely relevant and I cant work out what im missing to get DFHack to acknowledge it.
Title: Re: DFHack 0.34.11 r3
Post by: skyte100 on July 13, 2013, 10:16:17 pm
Anyone know a script that will force relationships between dwarves? The one I found http://www.bay12forums.com/smf/index.php?topic=100964.msg3997955#msg3997955 just tells me that it cant find the dwarves even with the correct ids.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on July 14, 2013, 01:00:58 pm
I wrote that script for an older version of DFHack I think.  I don't have the current version, so it's possible that something has changed that would prevent it from working.  What error is it generating exactly?

I should probably also update the script to allow you to pick targets through the GUI instead of the roundabout method of finding their IDs first.  I remember seeing a code snippet earlier in the thread (by Urist DaVinci I think?) that allowed selecting multiple targets.
Title: Re: DFHack 0.34.11 r3
Post by: skyte100 on July 14, 2013, 04:42:01 pm
I wrote that script for an older version of DFHack I think.  I don't have the current version, so it's possible that something has changed that would prevent it from working.  What error is it generating exactly?

I should probably also update the script to allow you to pick targets through the GUI instead of the roundabout method of finding their IDs first.  I remember seeing a code snippet earlier in the thread (by Urist DaVinci I think?) that allowed selecting multiple targets.
No error. Just says it cant find the first unit regardless of which goes first.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on July 14, 2013, 05:47:16 pm
Is there something to add animals to the 'give medical treatment' list? Some bastard goblin fired at a cat and instead took out the Achilles tendon of one of my jabberers fifty tiles away.
Title: Re: DFHack 0.34.11 r3
Post by: Matoro on July 15, 2013, 01:17:12 pm
Quote
Okay, "dfhack.gui.getSelectedUnit().mood=df.mood_type.Berserk" will send the selected unit into a berserk rage, which apparently is not the same thing as being CRAZED.

If you actually want the dwarf to act like an invader, then you could enable "flags1.marauder", "flags1.invades" and "flags1.invader_origin", but by itself that will cause a loyalty cascade.  Setting the dwarf's "civ_id" to something else might fix that, but I haven't tested it.

I managed to make dwarf berserk through this, but I couldn't change a dwarf to invader. I tried to type "dfhack.gui.getSelectedUnit().flags1.marauder" to lua panel etc, DFHack just wrote ">>". I think I should type something there, too, but I have no idea what. The dwarf is selected through (v)iew, just like when making a dwarf go berserk. Any ideas why this doesen't work?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 15, 2013, 02:27:41 pm
the lua statement is unfinished.  It looks like you are trying to assign true like this:
Code: (lua) [Select]
dfhack.gui.getSelectedUnit().flags1.marauder = true
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on July 15, 2013, 06:10:01 pm
On top of that, you may have to change the dwarf's civilization ID.  I don't think they'll attack unless you do that.  I was able to make a member of my fort an invader once in .31.25 by doing something like that in Runesmith, and I would expect the process to be the same in .34.11 with DFHack.



Oh, and related to the relationship script having problems in the current version of DFHack: I haven't had a chance to update my DFHack install to take a look at it.  I would say a property must have been renamed, but if it doesn't produce any errors and only complains about not finding the unit I don't know what the problem would be.
Title: Re: DFHack 0.34.11 r3
Post by: Mohreb el Yasim on July 16, 2013, 04:34:42 pm
i got the latest DFHack and i would like to ask if scripts like falconne's (http://dffd.wimbli.com/file.php?id=7248) and age/size bugfix are in the package or we need to add them?
>also if i activeate a plugin (workflow for example) do i need to reactivate every time i play or is there a way to make it par default?
>in the readme there are activity management examples but i do not see how to set zone command on automated execution (for keeping animal population in a pasture for example with auto butcher and auto nestbox together it should work well but i do not see a way to automatize)
Title: Re: DFHack 0.34.11 r3
Post by: AMTiger on July 17, 2013, 01:43:01 am
 Is it possible to have a script that makes a dwarf into a vampire?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 17, 2013, 02:44:30 pm
i got the latest DFHack and i would like to ask if scripts like falconne's (http://dffd.wimbli.com/file.php?id=7248) and age/size bugfix are in the package or we need to add them?
I believe some of falconne's plugins are included, but there have been several updates to them since the latest dfhack release so I would recommend getting the updated versions.  The growth/size bugfix is also newer than the last release. You can get my version of the growth/size bugfix from this post (http://www.bay12forums.com/smf/index.php?topic=91166.msg4313566#msg4313566) or from my github (https://raw.github.com/KurikAmudnil/dfhack/master/scripts/fix/growthbug.rb).  I also have a compiled plugin version that I haven't released yet, if you or others are interested I will post it.


>also if i activeate a plugin (workflow for example) do i need to reactivate every time i play or is there a way to make it par default?
I believe workflow is enabled per fort (or maybe per world), it will stay active for that fort/world after you start using it.  Other plugins should be enabled or disabled by way of the dfhack.init so that they don't need to be reactivated each time.


>in the readme there are activity management examples but i do not see how to set zone command on automated execution (for keeping animal population in a pasture for example with auto butcher and auto nestbox together it should work well but i do not see a way to automatize)
I have not yet used these myself to any great degree.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on July 17, 2013, 03:15:11 pm
Is it possible to have a script that makes a dwarf into a vampire?
yes, it's also possible to fix necromancers who don't get the undead immunity.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on July 19, 2013, 02:37:34 am
Cross-post from plugins suggestions, since I think this would be really quick: 

Would anyone be up for whipping up a script like soundsense-season, to add information to the gamelog on load that can identify the world?  I'm thinking of something like "Loaded RegionX, [dwarfname] [translatedname]".   

There's a nice little utility called Story Maker (http://www.bay12forums.com/smf/index.php?topic=128570.0) which could take advantage of something like this in the next version, but it would also be nice for flavor and tracking activity across different forts manually.  It would also potentially allow someone to build a plugin that lets DF show gamelog info from previous sessions, which could be nice for people who play in short bursts. 
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on July 19, 2013, 06:58:15 am
Cross-post from plugins suggestions, since I think this would be really quick: 

Would anyone be up for whipping up a script like soundsense-season, to add information to the gamelog on load that can identify the world?  I'm thinking of something like "Loaded RegionX, [dwarfname] [translatedname]".   

There's a nice little utility called Story Maker (http://www.bay12forums.com/smf/index.php?topic=128570.0) which could take advantage of something like this in the next version, but it would also be nice for flavor and tracking activity across different forts manually.  It would also potentially allow someone to build a plugin that lets DF show gamelog info from previous sessions, which could be nice for people who play in short bursts.
we have the ability to hijack the announcement tab and add anything you want...or well warmist does.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on July 20, 2013, 05:30:19 am
we have the ability to hijack the announcement tab and add anything you want...or well warmist does.

Well, yeah - I can tell that from looking at soundsense-season. 

I just need someone to actually do it - I have no idea what variables to plug in, or I could probably just modify a copy of  soundsense-season to do it.  (I lie, even with that I still have no idea about lua or scripting at all, so some help would be lovely.)
Title: Re: DFHack 0.34.11 r3
Post by: Makbeth on July 20, 2013, 02:01:25 pm
I am attempting to produce a surface geology map by reading the highest non-soil rock layers from df.global.world.world_data.  Quietust has helpfully suggested getting the region index from region_map(x)(y), but I've hit a wall here.  I cannot figure out how to use the coordinates here.  Parentheses do not work, and every reference I can find to reading 2D data from Lua writes it as
Code: [Select]
printall(data[x][y])This doesn't work either. 

I have had limited success using
Code: [Select]
printall(region_map[x])which has 129 valid values for x.  From the temperature and elevation data I can read from it, these are the northernmost region tiles from west to east.  That's great, but I'd really like to know how to adjust the y values. 
Code: [Select]
printall(region_map[x][y]) does not work, nor do any of the permutations I've tried, such as
Code: [Select]
printall(region_map[x,y])
printall(region_map[x],[y])
printall(region_map[[x][y]])
and so on.

I'm fairly new to Lua, though I've had some experience in Python, and my attempts to find descriptions of the correct syntax all point to
Code: [Select]
printall(region_map[x][y])which doesn't work.  Could anyone point me in the right direction please?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 20, 2013, 02:07:16 pm
Code: [Select]
I am attempting to produce a surface geology map by reading the highest non-soil rock layers from df.global.world.world_data.
Quietust has helpfully suggested getting the region index from region_map(x)(y), but I've hit a wall here.
I cannot figure out how to use the coordinates here.
Parentheses do not work, and every reference I can find to reading 2D data from Lua writes it as "printall(data[x][y])".  This doesn't work either. 

I have had limited success using printall(region_map[x]), which has 129 valid values for x.
From the temperature and elevation data I can read from it, these are the northernmost region tiles from west to east.
That's great, but I'd really like to know how to adjust the y values.
printall(region_map[x][y]) does not work, nor do any of the permutations I've tried, such as printall(region_map[x,y]), printall(region_map[x],[y]), printall(region_map[[x][y]]), and so on.

I'm fairly new to Lua, though I've had some experience in Python, and my attempts to find descriptions of the correct syntax all point to printall(region_map[x][y]), which doesn't work.  Could anyone point me in the right direction please?

Use code tags, otherwise you get this

But yeah, it should be
Code: [Select]
printall(region_map[x][y]) If you're getting an error, post it. Try this code out:

Code: [Select]
for k,region_map_x in ipairs(region_map) do
    for kk,region_map_y in ipairs(region_map_x) do
        printall(region_map_y)
    end
end

Depending on what you're trying to do, that should work.
Title: Re: DFHack 0.34.11 r3
Post by: Makbeth on July 20, 2013, 02:24:48 pm
First, I create the variable region_map

Code: [Select]
[lua]# region_map=df.global.world.world_data.region_map


I test out the first value; seems to be a freezing ocean.  The ice cap is in the northern part of this world.

Code: [Select]
[lua]# printall(region_map[0])
unk_0                    = 146750001
sites                    = <vector<world_site*>: 0x1e9890fc>
flags                    = <BitArray<>: 0x1e98910c>
elevation                = 50
wetness                  = 88
vegetation               = 0
temperature              = -27
evilness                 = 58
hilliness                = 91
unk_2c                   = 91
savagery                 = 18
unk_30                   = 3
unk_32                   = 0
unk_34                   = 0
unk_36                   = 0
unk_38                   = 0
unk_3a                   = 4400
saltiness                = 100
unk_3e                   = <coord: 0x1e989132>
unk_44                   = <coord: 0x1e989138>
unk_4a                   = <coord: 0x1e98913e>
region_id                = 0
landmass_id              = -1
geo_index                = 166



The 27th tile from the west edge on the north edge of the map is a terrifying volcanic island. Checking x=26 gives us:

Code: [Select]
[lua]# printall(region_map[26])
unk_0                    = 140500002
sites                    = <vector<world_site*>: 0x206cf094>
flags                    = <BitArray<>: 0x206cf0a4>
elevation                = 102
wetness                  = 100
vegetation               = 8
temperature              = -29
evilness                 = 93
hilliness                = 68
unk_2c                   = 100
savagery                 = 92
unk_30                   = 3
unk_32                   = 0
unk_34                   = 0
unk_36                   = 0
unk_38                   = 0
unk_3a                   = 5000
saltiness                = 66
unk_3e                   = <coord: 0x206cf0ca>
unk_44                   = <coord: 0x206cf0d0>
unk_4a                   = <coord: 0x206cf0d6>
region_id                = 1
landmass_id              = 0
geo_index                = 268




So that basically confirms that it's reading the top row.  Good so far, but when I try to read tiles off rows other than the top:

Code: [Select]
[lua]# printall(region_map[26][26])
(interactive):1: Cannot read field world_data.T_region_map.26: not found.
stack traceback:
        [C]: in function '__index'
        (interactive):1: in main chunk
        [C]: in function 'safecall'
        ....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:267: in func
tion <....34.11] [V13]\Dwarf Fortress 0.34.11\hack\lua\dfhack.lua:193>

Not sure what's going on there.

Another thing that concerns me is that these are region tiles, not local tiles.  The entire tile is reported as being a volcanic island, even though the northwest corner is frozen ocean on the local map.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 20, 2013, 02:28:37 pm
Well, there is no [26][26] or even [26][0] for that matter. You'd see 0, 1, 2, 3 etc. if those existed, but those aren't there. There are probably rows that aren't the top if you just... kinda... make the number bigger.
Title: Re: DFHack 0.34.11 r3
Post by: Makbeth on July 20, 2013, 02:32:53 pm
That was one of the things I tried earlier; the index values stop at 128; trying to print region_map[129] gives a blank result.

Trying to print region_map[600] crashed DF.  Started thinking maybe it was related to the cursor position on the embark map, so I moved to the mid latitudes, started over with redefining region_map, and got the exact same results for region_map[26].

Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 21, 2013, 03:18:48 am
I know this seems an odd question, but is there a way to pass arguments and view the DFHack console through a network?
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on July 21, 2013, 03:46:55 am
I know this seems an odd question, but is there a way to pass arguments and view the DFHack console through a network?
Remote shell, Ssh or telnet, and dfhack-run.exe.

Title: Re: DFHack 0.34.11 r3
Post by: Rose on July 21, 2013, 04:10:08 am
DFHack-run works fine for connecting to the DFHack console, however, it does not have the ability to connect over a network, and this is intentional, as a security feature. If you want that ability, you need to modify the source to allow connections to and from other computers.
Title: Re: DFHack 0.34.11 r3
Post by: Hommit on July 21, 2013, 03:08:19 pm
DFHack-run works fine for connecting to the DFHack console, however, it does not have the ability to connect over a network, and this is intentional, as a security feature. If you want that ability, you need to modify the source to allow connections to and from other computers.
connect to cmd/bash/whatever shell and dfhack-run through that?
Title: Re: DFHack 0.34.11 r3
Post by: Makbeth on July 22, 2013, 01:09:36 am
Hi Japa, I have a question for you.

What is the deal with df.global.world.world_data.region_map?  Is it an array of region tiles or local tiles?  Is it an array at all?  It doesn't seem to respond to printall in the same way as a normal array, but it does list different entries if you use a printall command with indices from 0 to 128.

Is there a way, using dfhack, to read all 2064x2064 local tiles (for a medium world) for their topmost rock layers, or do you actually have to visit them like in isoworld?  How big a deal would it be to try to set up something like isoworld to show a surface geology map if that's the case?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 22, 2013, 01:14:02 am
No, it responds to printall in the exact way it does with a normal table. It's just that it seems you're expecting it to be a set of tables in its tables, which it isn't.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on July 22, 2013, 01:30:13 am
Why are you asking me? I have no idea about anything lua related.
Title: Re: DFHack 0.34.11 r3
Post by: Makbeth on July 22, 2013, 01:35:06 am
I guess the problem is I don't understand how tables work in Lua then.  Thanks for the quick replies.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on July 22, 2013, 10:11:55 am
df.global.world.world_data.region_map is a special structure - it's a 2-dimensional array which is sized according to the dimensions of your world (e.g. between 17x17 and 257x257), and DFHack/Lua doesn't properly know how to treat it as a 2D array, so you'll need to use _displace() to index into it (e.g. "df.global.world.world_data.region_map:_displace(x).value:_displace(y)").

Alternatively, you can let DFHack do the work for you and use the function "dfhack.maps.getRegionBiome(x,y)".
Title: Re: DFHack 0.34.11 r3
Post by: acetech09 on July 22, 2013, 12:17:03 pm
Is stonesense operational on OSX? Every time I try to launch it, it crashes DF. I'm not sure if it's a known issue.
Title: Re: DFHack 0.34.11 r3
Post by: vjek on July 22, 2013, 12:27:21 pm
df.global.world.world_data.region_map is a special structure - it's a 2-dimensional array which is sized according to the dimensions of your world (e.g. between 17x17 and 257x257), and DFHack/Lua doesn't properly know how to treat it as a 2D array, so you'll need to use _displace() to index into it (e.g. "df.global.world.world_data.region_map:_displace(x).value:_displace(y)").

Alternatively, you can let DFHack do the work for you and use the function "dfhack.maps.getRegionBiome(x,y)".
Further to this, would it be possible to recursively prospect each region to get a worldwide list of stones, to make a holistic Finder?
Title: Re: DFHack 0.34.11 r3
Post by: fricy on July 22, 2013, 01:01:30 pm
Is stonesense operational on OSX? Every time I try to launch it, it crashes DF. I'm not sure if it's a known issue.

Try this:

http://dffd.wimbli.com/file.php?id=7850
Title: Re: DFHack 0.34.11 r3
Post by: lastofthelight on July 23, 2013, 06:20:05 pm


Query. I've been playing with it, but I can't seem to get it to work.

How do I use createitem to:

1. Create gold ore?

2. Create clear glass blocks?

I think if I could see how to do these, the function of it would become much clearer for me. I've had some partial successes, but they certainly have not worked out as I intended, heh.

Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on July 24, 2013, 12:51:59 am
Code: [Select]
BOULDER INORGANIC:GOLD
it works like reactions but you remove the ITEM. so if it's ITEMTOOLS then you use TOOLS in the code. also loads of spaces
Title: Re: DFHack 0.34.11 r3
Post by: Meph on July 24, 2013, 03:55:50 am
Hey everyone, I stumbled upon a little problem. I am sure there is a simple solution for it, I just dont know it yet. I have this nice script that Urist da Vinci wrote, its actually two scripts. The first one shows the access of a civ to a specific material, this example show all wood types. The second one removes all items, crafts, barrels and so forth, of a specific wood.

wood.lua => Shows the tree_id of accessable wood.
Code: [Select]
local my_entity=df.historical_entity.find(df.global.ui.civ_id)

for k,v in pairs(my_entity.resources.organic.wood.mat_type) do
sText=dfhack.matinfo.decode(v,my_entity.resources.organic.wood.mat_index[k])
print(sText)

if (sText==nil) then
--print("nil")
else
--print("OK")
print(sText.plant.id)
end
end


nosporewood.lua => Removes access to sporewood from your civ. No more sporewood at embark or from traders.
Code: [Select]
removes all SPORE_TREE wood from all civs:

local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" "
local k=0
local v=1

for x,y in pairs(df.global.world.entities.all) do
my_entity=y

k=0
while k < #my_entity.resources.organic.wood.mat_index do
v=my_entity.resources.organic.wood.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.organic.wood.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.crafts.mat_index do
v=my_entity.resources.misc_mat.crafts.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.crafts.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.barrels.mat_index do
v=my_entity.resources.misc_mat.barrels.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.barrels.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.wood2.mat_index do
v=my_entity.resources.misc_mat.wood2.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.wood2.mat_index[k])
if (sText==nil) then
--LIQUID wood2
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.cages.mat_index do
v=my_entity.resources.misc_mat.cages.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.cages.mat_index[k])
if (sText==nil) then
--LIQUID cages
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end
end

The problem that arises is that the user must run it manually. I can add "nosporewood" to the dfhack.init, but it does not work. The script, just like embark everywhere or startdwarf, has to be run at the embark screen, on the map before you press 'e' and get to your embark selection. The quesion I have is: Can this be automated? Are there any lines that can be added so that the script is run every time the embark screen is opened?

And if yes, would a small pop-up/ui be possible? It would be nice if a player would start DF, go to the embark selection, and a little pop-up shows with "With how many citizens would you like to embark? (min-7)" and the player could add a number, press enter, and thats it. Just to make the startdwarf script a bit more accessable.

Background info, for those who care: Evaporating wood can be done, and can affect woodcutter with syndromes. But you cant use it on the surface or in the caverns, because these wood types are stable in worldgen, so caravans will bring wagons, barrels and items made of those materials. They then instantly boil away, affecting the trader with the syndrome. If I remove these with a script from the traders, I can make syndrome-bearing trees... good with positive effects, evil with negative effects.. a firestarting-tree for deserts, poisonous gas-clouds from giant underground mushrooms, and so forth.

Which leads to question number 3: The script only removes it from your home-civ, if I am not wrong. Which means that allies, like elves, would still bring these evaporating wood types. I would need a variant of this script that targets all civs. I assume its just changing the my_entity. with something else, but I dont know lua. One for creatures/pets would be even more helpful. It would be a lot easier to assign specific domestic pets to specific races, which is a major point in MasterworkDF, because of the multiple playable races. It even leads to some bugs, because I have to remove and add several creatures, depending on which race you play.

I also found this script while reading through custom ones that have been posted:
Code: [Select]
MEDIC.RB. Mark unit as requiring a medic.

# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end

As far as I understand it you look at a dwarf with 'k', then run the script, and the job-priority for diagnosis and rescue go up. So if an injured dwarf is lying, ignored, on a battlefield, or the chief medical dwarf is for some reason not diagnosing a patient in the hospital, then this script will help?

To sum it up:
#1: Can a script be automatically run once the embark screen/map opens?
#2: Can this script open a small pop-up that accepts a number as entry, for the startdwarf.rb script?
#3: Could someone please be so kind (if #1 has a yes as answer), to change the script to target all civs, instead of just the players civ?
#4: Can the above-shown scripts be altered to show/erase available creatures/pets?
#5: Does anyone have experience with the medic.rb script and could give a short readme for it?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 24, 2013, 04:10:38 am
1. Yes, with init.lua. For nosporewood, you have to remove the first line; then, the rest of the file goes into init.lua, which goes at the top folder of the raws folder.
2. Yes, but I (or someone else) will have to write that my/his/herself.
3. nosporewood already does. Also, Da Vinci: you could just have for k,my_entity in ipairs instead of for x,y and having y be set to my_entity.
4. Yeah
5. Medic.rb is so simple, I don't even KNOW ruby and I can read it.

Step 1: select dwarf with k or v menu (not related to for k,v in lua, btw).
Step 2: run "medic".
Step 3: that's it. You're done.

You could very easily just make it a hotkey.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on July 24, 2013, 04:18:15 am
Thanks Putnam.

1. Where can I find the init.lua? I can frankenstein those together with what you told me, but I cant find an init.lua in my hack folders.
2. I will ask falconne about the pop-up, he seems to be the most experienced person when it comes to UIs, judging from workflow/dwarfmonitor.
3. Awesome.
4. Again, awesome. I'll ask DaVinci if he can do this.
5. Yes, I know how to use it. But does it work? I assume the flag is already set to true, so why should this script shorten the time a dwarf gets rescued/diagnosed?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 24, 2013, 04:31:39 am
For nosporewood, you have to remove the first line; then, the rest of the file goes into init.lua, which goes at the top folder of the raws folder.

You need to make it.

5. The flag is being set to true for creatures who have issues with being, say, legless but not being given a crutch due to bugs.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on July 24, 2013, 04:53:38 am
Ah, ok. I thought that there should have been a init.lua that hooks into something. I will have a go at it, see if I can get it to work. At least the automated start.

Edit: Cant get it to work. Top folder of the raws folder? That would be the DwarfFortress folder, next to the .exe.

init.lua looks like this:
Code: [Select]
--local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" "
local k=0
local v=1

for x,y in pairs(df.global.world.entities.all) do
my_entity=y

k=0
while k < #my_entity.resources.organic.wood.mat_index do
v=my_entity.resources.organic.wood.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.organic.wood.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.crafts.mat_index do
v=my_entity.resources.misc_mat.crafts.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.crafts.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.barrels.mat_index do
v=my_entity.resources.misc_mat.barrels.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.barrels.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.wood2.mat_index do
v=my_entity.resources.misc_mat.wood2.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.wood2.mat_index[k])
if (sText==nil) then
--LIQUID wood2
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.cages.mat_index do
v=my_entity.resources.misc_mat.cages.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.cages.mat_index[k])
if (sText==nil) then
--LIQUID cages
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end


end

Anything I have to add to the dfhack.init?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 24, 2013, 06:48:08 pm
#1 something like this can be run from dfhack.init and listen for the embark screen
Spoiler: embark_listener.lua (click to show/hide)
Listening for the embark profile select/modify screen might be useful for adjusting the embark points according to the number of extra dwarfs given by startdwarf (number of dwarfs over 7 might be easier to detect)


#2 a problem with the popup question for startdwarf is trying to run startdwarf (a ruby script) from a lua script, or translating startdwarf to lua.  Also, if you get to the embark profile screen, it is too late to ask about startdwarf. Running startdwarf at the site selector seems to be fine.

#3 I think that filtering the trade goods probably ought to happen at the site selector also. 

#5 I haven't noticed any improved response times for marking a unit for recovery/diagnosis as the dwarf in question usually has those flags already set to true.  I have thought about trying to force the unit to have a resting state/job but haven't tested that yet.
Title: Re: DFHack 0.34.11 r3
Post by: Somanarga on July 24, 2013, 07:53:40 pm
hey guys, i have a bit of a situation and im hoping you guys can help me.

my map is permanently revealed. ive tried unrevealing, but it gives me error "there is nothing to revert!". i try revforget "there is nothing to forget!"

i can reveal/unreveal and it gives me the proper prompts, but nothing changes on the map, unless i do reveal hell, which shows hell, then i can unreveal and it blocks hell off again. doesnt change the already revealed spots though.

is there a way to fix this? or am i screwed?
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on July 24, 2013, 08:13:42 pm
Try 'revflood'
Title: Re: DFHack 0.34.11 r3
Post by: Somanarga on July 24, 2013, 08:16:58 pm
Try 'revflood'

"point the cursor at some empty space you want unhidden"

everything is already unhidden so it wont hid it D:
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on July 24, 2013, 08:24:46 pm
Kurik (or anyone) - I'm trying to write a script based on soundsense-season that writes which region was loaded to the gamelog, so that it's possible to distinguish between fort logs when playing more than one at a time - important for eg DF Story Maker and /or manual parsing. 

If I'm right, all I need is the proper variable names to get the region number, dwarf name, and translated name.  If I've stuffed up somewhere else, what's gone wrong?

Code: [Select]
-- On map load writes information about the loaded region to gamelog.txt

local function write_gamelog(msg)
    local log = io.open('gamelog.txt', 'a')
    log:write(msg.."\n")
    log:close()
end

if args[1] == 'disable' then
    dfhack.onStateChange[_ENV] = nil
else
    dfhack.onStateChange[_ENV] = function(op)
        if op == SC_WORLD_LOADED then
            write_gamelog('Loaded Region'[X]', '[dwarfname]', '[translatedname]'.')
        end
    end
end

Title: Re: DFHack 0.34.11 r3
Post by: Meph on July 24, 2013, 09:18:22 pm
@Kurik Amudnil: Thanks, that sounds like it would solve most things I did ask for. The script you posted is an example? And "site selector" is what I did mean when I said "embark screen before embark selection" I didnt knew there was a specific name for it. I dont know how much work all of this would be... a pop-up for startdwarf, maybe one for embark points like you suggested, (is there even a script for this?) and running the script that deletes access to specific materials/pets from civs.

That would be amazing, I could do fancy trees, even fancier pets, fix a bug with the embark profiles (DF deletes the pet entries for other races, so if I play Dwarf it deletes orc/kobold pets, and when I then play orc/kobolds the pets I selected for the embark profiles are gone), allow easier handling of embark dwarves and points, and I can give more specific pets to invaders and traders. No more endless lists, or random warbeasts that invaders shouldnt have. Makes balancing so much better, and lore-wise as well. Steampunk horses as mounts for the automatons, with steampunk spiders as warbeasts... Goblins ride war boars, bring trolls... Orcs ride Warghs and bring Ogres... yeah. :)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on July 24, 2013, 10:04:09 pm
I'll look into the recent request. In the meantime, I'd refer people to the link in my sig for the "liquid barrel and blood barrel remover" http://www.bay12forums.com/smf/index.php?topic=91166.msg4246062#msg4246062 .

Note that I say:
Quote
If used before embark (at the screen where you choose your site location), it prevents you from being able to embark with barrels of blood, considerably shortening the extracts list.
But I meant that the script can be used anytime after embark to prevent future human caravans from bringing blood barrels etc. - it only makes embarking with milk easier if you use it at the site selector.

You only want to remove explosive trees at the site selector because there is a nonzero chance that your embark wagon will be very FUN if you don't!
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 24, 2013, 10:40:09 pm
Ah, ok. I thought that there should have been a init.lua that hooks into something. I will have a go at it, see if I can get it to work. At least the automated start.

Edit: Cant get it to work. Top folder of the raws folder? That would be the DwarfFortress folder, next to the .exe.

init.lua looks like this:
Code: [Select]
--local my_entity=df.historical_entity.find(df.global.ui.civ_id)
local sText=" "
local k=0
local v=1

for x,y in pairs(df.global.world.entities.all) do
my_entity=y

k=0
while k < #my_entity.resources.organic.wood.mat_index do
v=my_entity.resources.organic.wood.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.organic.wood.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.organic.wood.mat_type:erase(k)
my_entity.resources.organic.wood.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.crafts.mat_index do
v=my_entity.resources.misc_mat.crafts.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.crafts.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.crafts.mat_type:erase(k)
my_entity.resources.misc_mat.crafts.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.barrels.mat_index do
v=my_entity.resources.misc_mat.barrels.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.barrels.mat_index[k])
if (sText==nil) then
--LIQUID barrels
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.barrels.mat_type:erase(k)
my_entity.resources.misc_mat.barrels.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.wood2.mat_index do
v=my_entity.resources.misc_mat.wood2.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.wood2.mat_index[k])
if (sText==nil) then
--LIQUID wood2
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.wood2.mat_type:erase(k)
my_entity.resources.misc_mat.wood2.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end

k=0
while k < #my_entity.resources.misc_mat.cages.mat_index do
v=my_entity.resources.misc_mat.cages.mat_type[k]
sText=dfhack.matinfo.decode(v,my_entity.resources.misc_mat.cages.mat_index[k])
if (sText==nil) then
--LIQUID cages
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
else
if(sText.material.id=="WOOD") then
if(sText.plant.id=="SPORE_TREE") then
my_entity.resources.misc_mat.cages.mat_type:erase(k)
my_entity.resources.misc_mat.cages.mat_index:erase(k)
k=k-1
end
end
end
k=k+1
end


end

Anything I have to add to the dfhack.init?

The top of the raws folder is the raws folder, right above objects, which is one of the two folders in the raws folder.

Dwarf Fortress/raw is where you put it.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 25, 2013, 12:06:16 am
....

something like this?
Code: (lua) [Select]
-- On map load writes information about the loaded region to gamelog.txt

local function write_gamelog(msg)
    local log = io.open('gamelog.txt', 'a')
    log:write(msg.."\n")
    log:close()
end

local args = {...}
if args[1] == 'disable' then
    dfhack.onStateChange[_ENV] = nil
else
    dfhack.onStateChange[_ENV] = function(op)
        if op == SC_WORLD_LOADED then
            local site = df.world_site.find(df.global.ui.site_id)
            local fort_ent = df.global.ui.main.fortress_entity
            local civ_ent = df.historical_entity.find(df.global.ui.civ_id)
            -- site positions
            -- site  .pos.x  .pos.y
            -- site  .rgn_min_x  .rgn_min_y  .rgn_max_x  .rgn_max.y
            -- site  .global_min_x  .global_min_y  .global_max_x  .global_max_y
            --site.name
            --fort_ent.name
            --civ_ent.name
           
            write_gamelog('Loaded Region ('..site.pos.x..','..site.pos.y..'), '..dfhack.TranslateName(site.name)..' ('..dfhack.TranslateName(site.name, true)..')'..NEWLINE..
                          '    colonized by the group '..dfhack.TranslateName(fort_ent.name)..' ('..dfhack.TranslateName(fort_ent.name,true)..
                              ') of the civilization '..dfhack.TranslateName(civ_ent.name)..' ('..dfhack.TranslateName(civ_ent.name,true)..').'..NEWLINE)
        end
    end
end

might want to use SC_MAP_LOADED instead of world but it seems to be working with world so it might be irrelevant.

** added local to the 3 variables I set
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on July 25, 2013, 12:40:06 am
Brilliant, thanks so much. 

My brief findings so far:  SC_WORLD_LOADED puts this before the announcement for soundsense-season, which is better for parsing so I've left it like that.  I've called the script "log-region.lua" in my LNP (up as soon as it uploads...), and it triggers with just the name "log-region" in dfhack.init

Now off to let the_gazelle know that this is available, so DF Story Maker can take advantage of it and do history per-fort...
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 25, 2013, 02:53:23 am
@PeridexisErrant

I forgot to declare those 3 variables local, not that important here but they should be declared local.  Reformat the text as needed.  I am not sure which of the various position variables would be the most relevant or useful.  I think site.pos is the map block and according to comments in the world_site.xml, the rgn_min_x etc are embark blocks within the map block, and the global_min_x etc are the same embark blocks but in global coords rather than local to the map block.

This also should be tested with the different game modes to make sure it behaves.



@Meph
yes, that is an example script.  When we have example scripts for the other stuff it can be updated to plug that in.

I was also thinking about looking into making a compiled c++ plugin to intercept the (e)mbark button to export a lua event so that the script stuff could be done before the embark profiles come up but after a site and civ are chosen.  I am not yet sure how well that would work but it is a thought.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on July 25, 2013, 03:47:16 am
@Kurik Amudnil

I've updated it for the next version, again many thanks.  From my quick calculations, the site.pos bit returns the region tile from the world map that your fort is within, which is potentially pretty useful for finding a fort given that you can't embark across the edges, or even just scrolling to embark there on a copy of someone's save.  Only thing I can think of to add is if it's possible to append the number to region (eg region2), and maybe reshuffle the first line to scan a little better? (I've put in '..#..' as a placeholder for whatever that variable should be called...

Code: [Select]
write_gamelog('Loaded Region'..#..', '..dfhack.TranslateName(site.name)..' ('..dfhack.TranslateName(site.name, true)..'), at coordinates ('..site.pos.x..','..site.pos.y..')'..NEWLINE..
This would give
Quote
Loaded Region2, Datangikut (Irondabbled), at coordinates (11,12)
    colonized by the group Sarvesh Kudust (The Furnace of Princes) of the civilization Alath Teskom (The Bolt of Jails).
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on July 25, 2013, 04:49:09 am
<...> if it's possible to append the number to region (eg region2) <...>
Actually it can be any string if you rename your region folder. It can be got from df.global.(?world.?).cur_savegame.save_dir
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 25, 2013, 01:00:30 pm
yes, what warmist said

Code: [Select]
write_gamelog('Loaded '..df.global.world.cur_savegame.save_dir..', '..
Title: Re: DFHack 0.34.11 r3
Post by: Mohreb el Yasim on July 25, 2013, 05:41:49 pm
i think i found an error in prospect command:
it says:

[DFHack]# prospect
Could not find magma sea.


when i am in the before embark screen.
the particularity of this world is that there is no magma sea (but i do not see the need of a magma see for the command can give me the layer types.)
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on July 25, 2013, 07:47:45 pm
Kurik, Warmist, thanks again.  The script I'm going to call final (if nothing else comes up) is: 

Code: (log-region.lua) [Select]
-- On map load writes information about the loaded region to gamelog.txt

local function write_gamelog(msg)
    local log = io.open('gamelog.txt', 'a')
    log:write(msg.."\n")
    log:close()
end

local args = {...}
if args[1] == 'disable' then
    dfhack.onStateChange[_ENV] = nil
else
    dfhack.onStateChange[_ENV] = function(op)
        if op == SC_WORLD_LOADED then
            local site = df.world_site.find(df.global.ui.site_id)
            local fort_ent = df.global.ui.main.fortress_entity
            local civ_ent = df.historical_entity.find(df.global.ui.civ_id)
            -- site positions
            -- site  .pos.x  .pos.y
            -- site  .rgn_min_x  .rgn_min_y  .rgn_max_x  .rgn_max.y
            -- site  .global_min_x  .global_min_y  .global_max_x  .global_max_y
            --site.name
            --fort_ent.name
            --civ_ent.name
           
            write_gamelog('Loaded '..df.global.world.cur_savegame.save_dir..', '..dfhack.TranslateName(site.name)..' ('..dfhack.TranslateName(site.name, true)..'), at coordinates ('..site.pos.x..','..site.pos.y..')'..NEWLINE..
                          '    colonized by the group '..dfhack.TranslateName(fort_ent.name)..' ('..dfhack.TranslateName(fort_ent.name,true)..
                              ') of the civilization '..dfhack.TranslateName(civ_ent.name)..' ('..dfhack.TranslateName(civ_ent.name,true)..').'..NEWLINE)
        end
    end
end

And is activated by putting "log-region" as it's own line in dfhack.init
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on July 26, 2013, 12:22:41 am
This script displays all the creatures that are stored in entity.resources.animals for all entities in the world. I recommend generating a pocket world to use the script on for the first time, because normal worlds seem to have thousands of entities.

Note that adding or erasing creatures from this list won't change the meat, blood, milk, leather, etc. that civs bring. It will only affect the live creatures that they bring.

You can do silly stuff like make elves pull caravan wagons without having to change the elf creature tokens by editing the appropriate lists.

Code: [Select]
print("Type y to print ",#df.global.world.entities.all," entity creature lists")
test=dfhack.lineedit("")
if test=="y" or test=="Y" then

for x,my_entity in pairs(df.global.world.entities.all) do
anmlz=my_entity.resources.animals

print(" ")
print("******************************************************************************")
print("entity:",my_entity.entity_raw.code, df.global.world.raws.creatures.all[my_entity.race].creature_id)
if my_entity==df.historical_entity.find(df.global.ui.civ_id) then
print("Player's Civilization")
end
print(" ")

for k,v in pairs(anmlz.pet_races) do
critter=df.global.world.raws.creatures.all[v]
print("PET",k, critter.creature_id, critter.caste[anmlz.pet_castes[k]].caste_id)
end

for k,v in pairs(anmlz.wagon_races) do
critter=df.global.world.raws.creatures.all[v]
print("WAGON",k, critter.creature_id, critter.caste[anmlz.wagon_castes[k]].caste_id)
end

for k,v in pairs(anmlz.pack_animal_races) do
critter=df.global.world.raws.creatures.all[v]
print("PACK_ANIMAL",k, critter.creature_id, critter.caste[anmlz.pack_animal_castes[k]].caste_id)
end

for k,v in pairs(anmlz.wagon_puller_races) do
critter=df.global.world.raws.creatures.all[v]
print("WAGON_PULLER",k, critter.creature_id, critter.caste[anmlz.wagon_puller_castes[k]].caste_id)
end

for k,v in pairs(anmlz.mount_races) do
critter=df.global.world.raws.creatures.all[v]
print("MOUNT",k, critter.creature_id, critter.caste[anmlz.mount_castes[k]].caste_id)
end

for k,v in pairs(anmlz.minion_races) do
critter=df.global.world.raws.creatures.all[v]
print("MINION",k, critter.creature_id, critter.caste[anmlz.minion_castes[k]].caste_id)
end

for k,v in pairs(anmlz.exotic_pet_races) do
critter=df.global.world.raws.creatures.all[v]
print("EXOTIC_PET",k, critter.creature_id, critter.caste[anmlz.exotic_pet_castes[k]].caste_id)
end

--test=dfhack.lineedit("continue...")
end

end

print(" ")
print("done!")
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 26, 2013, 01:24:31 am
Does anyone know how exactly deities are linked to specific entities (Urist Stylesuitor is a deity of The Glad Helms....)?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on July 26, 2013, 01:28:37 am
As well as my earlier findings here:
http://www.bay12forums.com/smf/index.php?topic=91166.msg4332174#msg4332174
http://www.bay12forums.com/smf/index.php?topic=91166.msg4341092#msg4341092
http://www.bay12forums.com/smf/index.php?topic=91166.msg4356227#msg4356227
I have yet another submission to the df structures:

https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L1025
wound_damage_flags1
Spoiler (click to show/hide)

https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L1012
wound_effect_type
Spoiler (click to show/hide)

https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L709
body_part_status
Spoiler (click to show/hide)

https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L940
unit_inventory_item mode Unk7 is used to identify a bitten part held in a mouth:
You bite Dwarf 2 in the fourth toe, right foot, tearing apart the fat!
You latch on firmly!
You shake Dwarf 2 around by the fourth toe, right foot and the severed part sails off in an arc!
The fourth toe, right foot is ripped away and remains in Your grip!
You let the Dwarf 2's fourth toe, right foot drop away as You attack.

https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L659
This curse integer, default 100, is the luck percentage.
200 means that your luck-affected skill rolls are multiplied by 2.
50 means that your skill rolls are divided by 2.
Valid values are from 0 (cursed by a mummy) to 10000 (100x or {1% becomes 100%} auto-success). Yes, you can use a syndrome to bless people with random bursts of awesome.

Also just for interest:
IMPACT material properties are used in blunt damage calculation
SHEAR is used with edged damage
TENSILE is used with shaking a creature after a bite latched
COMPRESSIVE is used with pinching/gouging
BENDING is used with joint locks
TORSION may also be used with joint locks (verify)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 26, 2013, 01:45:48 am
Oh, and btw, there's a bit of a bug in some stuff: there's both a general improvement anon_1 and an itemimprovement_pagesst.anon_1, which causes issues in lua.

EDIT: Grr. Also, how are secrets associated with particular books and slabs?
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 26, 2013, 02:41:11 am
Does anyone know how exactly deities are linked to specific entities (Urist Stylesuitor is a deity of The Glad Helms....)?

from civ_ent.unknown1b.worship ? as a reverse list of histfig ids to dieties?

where civ_ent is a civilization entry in df.global.world.enities.all or = df.historical_entity.find(df.global.ui.civ_id)

It looks to me to pick the first entity that includes the deity's historical figure id in that list.  I added the id to the group entity with no change, then removed the id from the civ entity and the "is a deity of" message changed to the group.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 26, 2013, 02:44:02 am
unknown1b? That sure explains why I couldn't find it.

EDIT: Friggin' vectors. fig.info.sphere is of type vector<int16_t>, which I can't seem to make a new of in lua.
Title: Re: DFHack 0.34.11 r3
Post by: Askot Bokbondeler on July 26, 2013, 07:47:34 am
Try 'revflood'

"point the cursor at some empty space you want unhidden"

everything is already unhidden so it wont hid it D:
point somewhere you want unhidden, it will hide everything that can't be pathed from there, so if you point to a cavern it will hide the surface and any cavern that isn't connected, etc.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on July 26, 2013, 10:47:02 am
unknown1b? That sure explains why I couldn't find it.

EDIT: Friggin' vectors. fig.info.sphere is of type vector<int16_t>, which I can't seem to make a new of in lua.
usually thing={new=true} works
Title: Re: DFHack 0.34.11 r3
Post by: milo christiansen on July 26, 2013, 12:17:43 pm
Is there a way to remove vanilla buildings? I did a forum search but could not find anything conclusive.
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on July 26, 2013, 01:27:13 pm
Is there a way to remove vanilla buildings? I did a forum search but could not find anything conclusive.

Nope. The most I've heard that it'd potentially possibly might be viable, but I might be mixing that with something else.
Title: Re: DFHack 0.34.11 r3
Post by: milo christiansen on July 26, 2013, 01:56:51 pm
Drat. I guess there will just be a bunch of useless buildings in the list then.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 26, 2013, 03:19:38 pm
unknown1b? That sure explains why I couldn't find it.

EDIT: Friggin' vectors. fig.info.sphere is of type vector<int16_t>, which I can't seem to make a new of in lua.
usually thing={new=true} works

Yep.
Title: Re: DFHack 0.34.11 r3
Post by: silentdeth on July 26, 2013, 11:14:15 pm
Ran into a CTD bug with the tweak plugin.

Save: http://dffd.wimbli.com/file.php?id=7859 (http://dffd.wimbli.com/file.php?id=7859)

With the tweak plugin load the game will crash within a couple of seconds of loading and unpausing. Unload the tweak plugin and it wont crash. 
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on July 27, 2013, 08:00:44 am
So that marry script how do you get it to work?
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on July 27, 2013, 01:50:08 pm
I still haven't had a chance to check it in the newest version of DFHack.  The way it worked is that you're supposed to run the command and give it two arguments: the unit id of the two targets.  That worked in the previous version at least, though it was a bit clunky because you had to find the unit ids yourself which could be a pain.  Supposedly in the current version it claims that it can't find the dwarves even if you put in the right ids.

I would like to improve it so you could use DF's interface to pick the targets, but just don't have the time to figure it out right now.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on July 27, 2013, 03:10:32 pm
...
I would like to improve it so you could use DF's interface to pick the targets, but just don't have the time to figure it out right now.

Try this lua script:
Code: [Select]
print("Target first unit and press enter")
test=dfhack.lineedit("")

unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

print("Target second unit and press enter")
test=dfhack.lineedit("")

unit2=dfhack.gui.getSelectedUnit()
if unit2==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

print(unit.id, unit2.id)

--your code goes here
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on July 27, 2013, 03:32:45 pm
<...>
I would like to improve it so you could use DF's interface to pick the targets, but just don't have the time to figure it out right now.
I would like to do that too. Imho it needs a selector module that would allow easy way to select various things (both with list for quick select and manual pointer select) ranging from select a tile (with some limitations what tiles are acceptable) to items (incl items in inventories), units, rooms, entities, etc...
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on July 27, 2013, 05:53:03 pm
some research: unit.idle_area_unk_a0 is somehow related to type of idle area: 25 for starting wagon, 28 for no valid area (roam map?) and 26 for meeting area.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on July 27, 2013, 09:32:41 pm
...code...

Awesome, thanks.  I thought I'd seen you post code like that earlier in the thread but was too lazy to go find it.  :)

Here are redone versions of the marry and divorce scripts that use the interface to pick targets.  I just tested them both in my version of DFHack and they work fine.  I think that perhaps using this will help alleviate whatever was wrong in the newer version of DFHack.

Code: (divorce.lua) [Select]
-- Divorces a creature from its spouse and / or lover.  Run this per creature in a relationship.

function divorce (victim)

local historic_victim

for key, value in pairs(df.global.world.units.all) do
-- The arguments are strings, but the structs contain numbers
if value.id == unit_id then
victim = value
end
end

if df.isnull(victim) then
print('The unit was not found.')
return
end

if victim.relations.spouse_id == -1 and victim.relations.lover_id == -1 then
print('Warning: the unit has no lover or spouse, nothing to do.')
return
end

print("Divorcing " .. victim.name.nickname)

for key, value in pairs(df.global.world.history.figures) do
if value.id == victim.hist_figure_id then
historic_victim = value
end
end

if df.isnull(historic_victim) then
print('The historical figure for the unit was not found.')
return
end

local link_count = #historic_victim.histfig_links

-- Remove the spouse hf link, if it exists
for key, value in pairs(historic_victim.histfig_links) do
if df.histfig_hf_link_spousest:is_instance(value) then
if key ~= link_count -1 then
-- Moves the spouse entry to the end of the list, then resizes the list to size - 1, erasing it
historic_victim.histfig_links[key] = historic_victim.histfig_links[link_count - 1]
end

historic_victim.histfig_links:resize(link_count - 1)
link_count = link_count - 1
value:delete()

break
end
end

-- Remove the lover hf link, if it exists
for key, value in pairs(historic_victim.histfig_links) do
if df.histfig_hf_link_loverst:is_instance(value) then
if key ~= link_count -1 then
-- Moves the lover entry to the end of the list, then resizes the list to size - 1, erasing it
historic_victim.histfig_links[key] = historic_victim.histfig_links[link_count - 1]
end

historic_victim.histfig_links:resize(link_count - 1)
link_count = link_count - 1
value:delete()

break
end
end

victim.relations.spouse_id = -1
victim.relations.lover_id = -1
end

unit = dfhack.gui.getSelectedUnit()
if (unit == nil) then
print('You must place the cursor over the target.')
return
end

dfhack.with_suspend(divorce, unit)

Code: (marry.lua) [Select]
-- Marries two specified creatures.  Take care when using this on creatures that are already married!

function marry (victim1, victim2)

local historic_victim1
local historic_victim2

if df.isnull(victim1) then
print('The first unit was not found.')
return
end
if df.isnull(victim2) then
print('The second unit was not found.')
return
end

if victim1.relations.spouse_id ~= -1 then
print('Warning: the first unit is already married.  Their marriage will be replaced.')
end
if victim2.relations.spouse_id ~= -1 then
print('Warning: the second unit is already married.  Their marriage will be replaced.')
end

print("Marrying " .. victim1.name.nickname .. " and " .. victim2.name.nickname)

for key, value in pairs(df.global.world.history.figures) do
if value.id == victim1.hist_figure_id then
historic_victim1 = value
end
if value.id == victim2.hist_figure_id then
historic_victim2 = value
end
end

if df.isnull(historic_victim1) then
print('The historical figure for the first unit was not found.')
return
end
if df.isnull(historic_victim2) then
print('The historical figure for the second unit was not found.')
return
end

local new_link1 = df.histfig_hf_link_spousest:new()
local new_link2 = df.histfig_hf_link_spousest:new()

-- Not documented, but this is the historical figure id
new_link1.anon_1 = victim2.hist_figure_id
new_link1.link_strength = 100

new_link2.anon_1 = victim1.hist_figure_id
new_link2.link_strength = 100

local link_count1 = #historic_victim1.histfig_links
local link_count2 = #historic_victim2.histfig_links

historic_victim1.histfig_links:resize(link_count1 + 1)
historic_victim1.histfig_links[link_count1] = new_link1
historic_victim2.histfig_links:resize(link_count2 + 1)
historic_victim2.histfig_links[link_count2] = new_link2

victim1.relations.spouse_id = victim2.id
victim2.relations.spouse_id = victim1.id
end

unit_1 = dfhack.gui.getSelectedUnit()
if unit_1 == nil then
print ("You must place the cursor over the first target.")
return
end

print("Target second unit and press enter")
test = dfhack.lineedit("")

unit_2 = dfhack.gui.getSelectedUnit()
if unit_2 == nil then
print ("You must place the cursor over the second target.")
return
end

dfhack.with_suspend(marry, unit_1, unit_2)

They still do the unnecessary with_suspend thing and I never added in the code to add historical event entries for marriage and divorce, but that never mattered to me.
Title: Re: DFHack 0.34.11 r3
Post by: Grax on July 27, 2013, 10:35:49 pm
Hey, clever lua guys, would somebody of you be so kind and release a newer version with all those beautiful additions?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on July 28, 2013, 12:11:12 am
I encountered a little problem with the feature script. I want to run it with autosyndrome whenever the player spawns magma with magical means in a reaction. This way they can build magma furnaces without the need to dig down. I can already spawn magma (although my screw-pump like liquid-spawner idea still stands) and I can run the script manually. But it shows some odd behaviour.

When I type "feature list" it shows the map features. These differ from map to map. Each feature has a number, and a name. The script claims that you can run it by either.

"Feature show 8" and "Feature show magma_pool" should both enable the magma-pool in my test map. But only "feature show 8" works, while "feature show magma_pool" reveal the first feature in the list, a cave. Here a screenshot as proof:
(http://i.imgur.com/Cak6QgQ.png)

The problem I have is that the numbers are different on each map. I can only have the reaction do one keyword, it is not smart enough to run "feature list" and then pick the correct number for magma-pool. I wanted to run "feature show magma_pool", but it does not work, as I said above. Anyone knows any solution to this?

EDIT: Oh, and another random thought: Is it possible to make a creature simply disappear? Just gone, no corpse, no ghosts, no negative thoughts for friends and family... I saw a threat about "migrants leaving the fort" in the suggestion board. Maybe that can be done with dfhack as is. :)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on July 28, 2013, 02:33:12 pm
EDIT: Oh, and another random thought: Is it possible to make a creature simply disappear? Just gone, no corpse, no ghosts, no negative thoughts for friends and family... I saw a threat about "migrants leaving the fort" in the suggestion board. Maybe that can be done with dfhack as is. :)
try unit.flags2.cleanup_1=true . There is also 2 and 3 and unit.flags3.cleanup_4 but i'm not sure how different they are.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on July 29, 2013, 06:23:19 am
"Feature show 8" and "Feature show magma_pool" should both enable the magma-pool in my test map. But only "feature show 8" works, while "feature show magma_pool" reveal the first feature in the list, a cave.
That's because it only accepts a number, so if you try to enter a string it'll interpret it as zero.

If you want to show/hide features programatically, then look at how the feature command works and then duplicate (and augment) its functionality in a Lua script - iterate across the list of features, find one of the appropriate type, then show/hide it accordingly. The 'feature' command is really only meant to be used interactively.

There's also the issue that not every map has a magma pool (most will only have the magma sea itself), so it's possible that your reaction won't have any effect at all.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on July 29, 2013, 11:35:01 am
"Feature show 8" and "Feature show magma_pool" should both enable the magma-pool in my test map. But only "feature show 8" works, while "feature show magma_pool" reveal the first feature in the list, a cave.
That's because it only accepts a number, so if you try to enter a string it'll interpret it as zero.

If you want to show/hide features programatically, then look at how the feature command works and then duplicate (and augment) its functionality in a Lua script - iterate across the list of features, find one of the appropriate type, then show/hide it accordingly. The 'feature' command is really only meant to be used interactively.

There's also the issue that not every map has a magma pool (most will only have the magma sea itself), so it's possible that your reaction won't have any effect at all.
Discovering the magma-sea is fine as well. I just want to enable the magma furnaces, thats all. I am also somewhat illiterate when it comes to code, I have never written any scripts besides VisualBasics and Html. C++ is somewhat beyond me. Thats why I come here and ask ;)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 29, 2013, 02:16:08 pm
I was totally code-illiterate when I semi-wrote force and mostly code illiterate when I wrote itemsyndrome ;)
Title: Re: DFHack 0.34.11 r3
Post by: sirdodger on July 29, 2013, 07:40:04 pm
I'm having two issues with DFHack (v0.34.11) under Windows, and I was wondering if anyone came across them or had a solution.  The first is that hotkeys sometimes fail.  The simple Ctrl-V digv binding works some of the time, and not others.  I haven't been able to repro the problem consistently, but sometimes switching out of the game, prodding the DFHack console, and switching back in will fix it.

The second is that the coloring of the military screen (tweak military-color-assigned) does not work for me.  Coloring elsewhere seems to work fine, and tweak military-stable-assigned works fine on that screen.

I'll post more if I can narrow down either of the issues.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 29, 2013, 07:56:13 pm
1. When you alt-tab out, the alt key gets a bit "stuck" in the input phase. Press alt again when you go back into the game.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on July 30, 2013, 01:11:40 am
probably not related to your problem, but windows also doesn't like letting dfhack use Ctrl-Alt hotkeys nor Ctrl and/or Shift Z.  Hotkeys can also be blocked by other utilities/programs such as quickfort
Title: Re: DFHack 0.34.11 r3
Post by: sirdodger on July 30, 2013, 01:42:45 am
1. When you alt-tab out, the alt key gets a bit "stuck" in the input phase. Press alt again when you go back into the game.

Nailed it, thanks!


probably not related to your problem, but windows also doesn't like letting dfhack use Ctrl-Alt hotkeys nor Ctrl and/or Shift Z.  Hotkeys can also be blocked by other utilities/programs such as quickfort

I noticed that when I was fiddling with hotkeys during setup, but that was less astonishing than having simple hotkeys (like Ctrl-V) sporadically work.
Title: Re: DFHack 0.34.11 r3
Post by: silentdeth on July 31, 2013, 01:16:02 pm
I'm adding a LUA API to the feature plugin (assuming nothing is beyond my abilities), most so I can create a LUA script for the masterwork mod that enables magma workshops. Being that I am a lazy bastard I wasn't planning on do much more than just what I need to get that functioning. Is there anything request, or something that anyone feels should be included? I'm learning LUA as I go, so I am not entirely sure of what all the possibilities are. The currently planned functions are feature_list_type, feature_list_name, isDiscovered(int) [can you overload functions in LUA? can I have isDiscovered(string type) too?], setDiscovered(int) [or maybe show(int) to keep it in line with the feature plugin].

Once I am finished what is the process of submitting it to be included in the next dfhack release? I've never contributed to a github project before, mostly I just download them and fiddle with them on my own.

EDIT: is there a way to find a list of all the feature types? I don't know where it gets the names and such for these? Magic I'm pretty sure.

EDIT2: Thanks Putnam that is useful.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on July 31, 2013, 01:21:43 pm
You can't overload functions, but you can have one function handle both strings and integers, sort of:

Code: [Select]
function typeHandleExample(argument)
    if tonumber(argument) then
        print("Argument is a number.")
    else
        print("Argument is not a number.")
    end
end

If you, say, run "typeHandleExample(5)", you'll get "Argument is a number". If you run "typeHandleExample("foo")", you'll get "Argument is not a number".
Title: Re: DFHack 0.34.11 r3
Post by: silentdeth on July 31, 2013, 04:44:15 pm
I'm doing something wrong and I can't figure out what. I have:
Spoiler (click to show/hide)

And I keep getting the error:
Spoiler (click to show/hide)

So something is wrong with how I am trying to use the Lua::SetField things, but I cannot for the life of me see what the problem could be. Help :(
Title: Re: DFHack 0.34.11 r3
Post by: Ccna on August 01, 2013, 12:14:23 am
I have been getting this in my stderr file:

Spoiler (click to show/hide)

after getting an error message that says:

Spoiler (click to show/hide)

upon starting dwarf fortress. Does anyone know the solution? thanks in advance.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on August 01, 2013, 12:26:13 am
If you, say, run "typeHandleExample(5)", you'll get "Argument is a number". If you run "typeHandleExample("foo")", you'll get "Argument is not a number".
Also you can overload to other types with "type(value)=='string' " or "type(value)=='table' ". This is efficient because string equality comparison is O(1) in lua.
I'm doing something wrong and I can't figure out what. I have:
Spoiler (click to show/hide)

And I keep getting the error:
Spoiler (click to show/hide)

So something is wrong with how I am trying to use the Lua::SetField things, but I cannot for the life of me see what the problem could be. Help :(
As the second spoiler points it's a linking error. In cmake file add "LINK_LIBRARIES LUA" like here: https://github.com/warmist/dfhack/blob/master/plugins/CMakeLists.txt#L115 (https://github.com/warmist/dfhack/blob/master/plugins/CMakeLists.txt#L115) to link with lua lib.
On the other hand smallish things like this are better done in lua, because it's more trouble to compile, link, export and manage c++ plugins. C++ is reserved for high-performance (e.g. accessing all map by tiles) or imposible to do in lua (vmethod interposing). The rest can use lua (or ruby afaik) and all data structures are accesible in it. This could be lua code:
Code: [Select]
local utils = require("utils") --for call_with_string

function getFeature(name)
    for index,value in ipairs(df.global.world.cur_savegame.map_features) do
if utils.call_with_string(value,"getName")==name then
return value
end
end
end
-- call with string wraps function with temporary string to put value in
-- in a similar way:
function featureList()
local ret={}
for index,value in ipairs(df.global.world.cur_savegame.map_features) do
local featureType=value:getType()
table.insert(ret,{name=utils.call_with_string(value,"getName"), type=df.feature_type[featureType]})
end 
return ret
end
As for submitting your code to dfhack: either fork all of dfhack and then issue pull request in github (i think there was a way without forking...) or ask in irc (#dfhack in freenode, see first post) for peterix to merge in.

@ccna: looks like your install is corrupted somehow. Try reinstalling.
Title: Re: DFHack 0.34.11 r3
Post by: silentdeth on August 01, 2013, 12:49:48 am
Ah, I did not think you could access those data structures from lua. This makes things so much easier. Thanks, tons and tons.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 01, 2013, 12:54:47 am
Ah, I did not think you could access those data structures from lua. This makes things so much easier. Thanks, tons and tons.

I can't really think of any you can't, except some odd arrays.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on August 01, 2013, 02:03:18 am
Ah, I did not think you could access those data structures from lua. This makes things so much easier. Thanks, tons and tons.

I can't really think of any you can't, except some odd arrays.
Actually everything that is accessible from c++ is also accessible from lua because the same code that generates c++ structures also generates lua structs.
Title: Re: DFHack 0.34.11 r3
Post by: silentdeth on August 01, 2013, 06:59:47 am
Tired of working on it. Finished it, some of things are probably not the best way of doing it, but it works. And it should be similar enough to the feature plugin that no one will be overly confused.

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Ccna on August 01, 2013, 03:46:35 pm
reinstalling still gives me the error :(
if it helps, this is my stdout file:

Spoiler (click to show/hide)

im on windows, and removing STD.dll allows me to play the normal game as far as I can tell.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on August 02, 2013, 04:22:09 pm
using lua, can I grab the max attainable stat for a dwarf (which is x2 of starting value).  Splinterz uses it in his Dwarf Therapist (when you hover the mouse cursor over a dwarf's attribute, you'll see the max possible as such current/max).

Anyways, I noticed vjek's Armoks_blessing script doesnt affect max value, and I was hoping to modify it...

Does AG have a data objects list for the data structure's he's done, to my understanding, that's how all this lua scripting is done.  Is there an easy way to load up these data objects in some ide, so I can see them all?
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on August 02, 2013, 04:33:29 pm
Yeah, the max is stored as part of the attribute.  For physical attributes I think it's unit.body.physical_attrs.STRENGTH.max for example.  For mental attributes it's unit.status.current_soul.mental_attrs.WHATEVER.max instead I think.  Can't check at the moment since I'm at work.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on August 02, 2013, 04:38:01 pm
thx, that really helps, I found this (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#c-function-wrappers) but didn't have max in there, it would be nice if all these objects were browse-able somewhere as some sort of library.

do you know if max is a read only value or can it be manipulated?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 02, 2013, 05:01:43 pm
thx, that really helps, I found this (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#c-function-wrappers) but didn't have max in there, it would be nice if all these objects were browse-able somewhere as some sort of library.

do you know if max is a read only value or can it be manipulated?

It's max_value, and it can be.

Also, the objects are browsable here. (https://github.com/peterix/df-structures) You can also use interactive lua console in DFHack with printall to look through stuff. The specific xml you want is here. (https://github.com/peterix/df-structures/blob/master/df.units.xml)
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on August 02, 2013, 06:12:49 pm
thx, that really helps, I found this (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#c-function-wrappers) but didn't have max in there, it would be nice if all these objects were browse-able somewhere as some sort of library.

do you know if max is a read only value or can it be manipulated?

It's max_value, and it can be.

Also, the objects are browsable here. (https://github.com/peterix/df-structures) You can also use interactive lua console in DFHack with printall to look through stuff. The specific xml you want is here. (https://github.com/peterix/df-structures/blob/master/df.units.xml)

took me a while to figure out printall
http://www.bay12forums.com/smf/index.php?topic=91166.msg3470560#msg3470560

wait... no, not exactly sure how to use it, I get a unrecognized command using printall
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on August 02, 2013, 07:23:10 pm
lua printall and its dfhack synonym ~ (I prefer using ~ because it also works on simple values whereas printall only works on structs/lists
Code: [Select]
[DFHack]# lua
Type quit to exit interactive lua interpreter.
[lua]# unit=dfhack.gui.getSelectedUnit()
[lua]# printall(unit.body.physical_attrs.STRENGTH)
value                    = 1064
max_value                = 2190
improve_counter          = 0
unused_counter           = 0
soft_demotion            = 93
rust_counter             = 2
demotion_counter         = 0
[lua]#
[lua]# ~unit.body.physical_attrs.STRENGTH
<unit_attribute: 0x1810f70c>
value                    = 1064
max_value                = 2190
improve_counter          = 0
unused_counter           = 0
soft_demotion            = 93
rust_counter             = 2
demotion_counter         = 0
[lua]#
[lua]# printall(unit.body.physical_attrs.STRENGTH.max_value)
[lua]# ~unit.body.physical_attrs.STRENGTH.max_value
2190

personally, I like to use these keybindings in dfhack.init to run the gm_editor when I am working on scripts
Code: (dfhack.init) [Select]
#  display gm_editor
keybinding add Alt-E gui/gm-editor
keybinding add Ctrl-E "gui/gm-editor dialog"
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 02, 2013, 09:48:51 pm
thx, that really helps, I found this (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#c-function-wrappers) but didn't have max in there, it would be nice if all these objects were browse-able somewhere as some sort of library.

do you know if max is a read only value or can it be manipulated?

It's max_value, and it can be.

Also, the objects are browsable here. (https://github.com/peterix/df-structures) You can also use interactive lua console in DFHack with printall to look through stuff. The specific xml you want is here. (https://github.com/peterix/df-structures/blob/master/df.units.xml)

took me a while to figure out printall
http://www.bay12forums.com/smf/index.php?topic=91166.msg3470560#msg3470560

wait... no, not exactly sure how to use it, I get a unrecognized command using printall

You have to type "lua" first.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on August 03, 2013, 06:52:22 am
warmist gave me this tidbit

gui/gm-editor df.global.world.raws.creatures.all[466].caste[0].attributes
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on August 03, 2013, 08:20:54 am
warmist gave me this tidbit

gui/gm-editor df.global.world.raws.creatures.all[466].caste[0].attributes
or a more generic:
for all stuff in df:
gui/gm-editor df.global
when having unit selected in gui:
gui/gm-editor
for adventurer:
gui/gm-editor df.global.world.units.active[0]
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on August 03, 2013, 11:11:59 am
or
Code: [Select]
Gui/gm-editor Dfhack.gui.getCurViewscreen() if you want to poke at menus like effecting your stats from the beginning.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on August 04, 2013, 06:09:36 am
that gui really helps, I can pretty much answer all my own questions as to what data structures can be manipulated in lua
Title: Re: DFHack 0.34.11 r3
Post by: mrDLS on August 04, 2013, 06:43:59 am
Dear peoples,

I remember seeing somewhere that there was a command to hide the annoying "dwarf cancels job" announcements in dfhack, but I can't remember what is was or where to find it. Could someone please help me and tell me what it is?

Thanks in advance.
Title: Re: DFHack 0.34.11 r3
Post by: silentdeth on August 04, 2013, 08:39:43 pm
Would anyone else find it useful if there was an auto-melt option for stockpiles, similar to the auto-trade option? Any obvious issues preventing it from being done?
Title: Re: DFHack 0.34.11 r3
Post by: HavingPhun on August 04, 2013, 08:43:45 pm
I am guessing this is a no. But, would it be possible to make a dfhack script that would allow you to turn a dwarf into a vampire by putting the k cursor over them and running said script?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 04, 2013, 08:47:38 pm
I am guessing this is a no. But, would it be possible to make a dfhack script that would allow you to turn a dwarf into a vampire by putting the k cursor over them and running said script?

Yes.
Title: Re: DFHack 0.34.11 r3
Post by: HavingPhun on August 04, 2013, 08:50:47 pm
I am guessing this is a no. But, would it be possible to make a dfhack script that would allow you to turn a dwarf into a vampire by putting the k cursor over them and running said script?

Yes.
Alright. Hmmm.. And uh, how would I do that? If thats not asking too much.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on August 05, 2013, 02:11:38 am
Is there a correct way to set nicknames with DFHack?  I'm pretty sure this is a problem with tools like Dwarf Therapist, so I'm guessing it's a similar mechanism at fault, but nicknames that I set using the Lua interface disappear randomly.

Do you have to set it on more than the unit itself?  Also on the historical figure perhaps?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 05, 2013, 02:17:58 am
Is there a correct way to set nicknames with DFHack?  I'm pretty sure this is a problem with tools like Dwarf Therapist, so I'm guessing it's a similar mechanism at fault, but nicknames that I set using the Lua interface disappear randomly.

Do you have to set it on more than the unit itself?  Also on the historical figure perhaps?

Unit, historical figure and soul.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on August 05, 2013, 02:27:37 am
Alright, thanks, I'll try that out.  May need to write a quick Lua script to handle it rather than doing it through the interactive interface then.

Nicknaming invaders sucks.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 05, 2013, 02:44:28 am
Nicknaming can just be done with dfhack.units.setNickname(unit,nick)
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on August 05, 2013, 02:49:42 am
Well, that certainly simplifies matters.  I know I must be doing a lot the hard way with Lua when there are built in functions for some of this stuff.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on August 05, 2013, 10:44:47 am
I wonder if the WIP fake id script allows you to get away with murder... just a little. Killing peasants under a new identity ruins the chances of fooling every one else once you switch up again. I guess this is due to how the new identity works. oh and the new identity only works in a new site not the same site you commit the murder.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on August 05, 2013, 01:09:28 pm
Kurik, Warmist, thanks again.  The script I'm going to call final (if nothing else comes up) is: 

Spoiler: log-region.lua (click to show/hide)

And is activated by putting "log-region" as it's own line in dfhack.init

It has occured to me that you may find the world name useful too
Code: (lua) [Select]
worldname = df.global.world.world_data.name
dfhack.TranslateName(worldname)
dfhack.TranslateName(worldname ,true)
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on August 05, 2013, 04:28:28 pm
1. What's an easy way to tell if the game screen is on the embark screen?
  -- solved, did a search for embark screen and found an answer in this thread.

2. How can I find the value of a dwarf's migrant wave?

3. Is there a way to modify an artifact so it's sellable?

4. Where can I modify embark points (i.e. in dfhack)
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on August 05, 2013, 06:41:59 pm
OK, log-region updated – thanks again. 

Spoiler: new edition (click to show/hide)

Outputs: 
Quote
*** STARTING NEW GAME ***
** Loading Fortress **
Loaded region2, Boldoltar (The Cyclopean Land) at coordinates (139,155)
 Loaded the fortress Sazirust (Bridgebreach), colonized by the group Idithmestthos (The Systemic Citadel) of the civilization Endok Limar (The Attic of Wealths).
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on August 05, 2013, 11:08:22 pm
I also found this script while reading through custom ones that have been posted:
Code: [Select]
MEDIC.RB. Mark unit as requiring a medic.

# Mark a unit as requiring a medic
selected = df.unit_find()

if selected == nil
   puts "You must select a dwarf first"
else
   puts "Marking '#{selected.name}' as needing a medic"
   selected.health.flags.rq_diagnosis = true
   selected.health.flags.needs_healthcare = true

   # This is normally set if dwarf can't walk,
   selected.health.flags.needs_recovery = true
end

As far as I understand it you look at a dwarf with 'k', then run the script, and the job-priority for diagnosis and rescue go up. So if an injured dwarf is lying, ignored, on a battlefield, or the chief medical dwarf is for some reason not diagnosing a patient in the hospital, then this script will help?

To sum it up:
#1: Can a script be automatically run once the embark screen/map opens?
#2: Can this script open a small pop-up that accepts a number as entry, for the startdwarf.rb script?
#3: Could someone please be so kind (if #1 has a yes as answer), to change the script to target all civs, instead of just the players civ?
#4: Can the above-shown scripts be altered to show/erase available creatures/pets?
#5: Does anyone have experience with the medic.rb script and could give a short readme for it?

I think that script just adds a job, I don't believe it actually increases the job's priority... although that would be a great thing...
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 08, 2013, 11:40:08 am
I just had a completely random idea, but please tell me this is possible: Weather Rain/Snow/Clear controls the weather. Weather Interactions control which material is rained, or appears as cloud of mist/fog.

Can this be combined? Can a plugin/script call a specific weather interaction, or simulate one by making it rain blood... or sludge... or beer... sulfur...?

In short: Can the custom weather interactions be started by a script, disregarding which biome they usually appear in? That would be awesome.
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on August 08, 2013, 04:11:36 pm
how do you create a creature in arena mode ( that can be aseesed with mode set
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 08, 2013, 04:14:51 pm
Aseesed?
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on August 08, 2013, 04:22:51 pm
Aseesed?
*arena mode *entered
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 08, 2013, 04:25:48 pm
Oh, accessed.
Title: Re: DFHack 0.34.11 r3
Post by: Suds Zimmerman on August 08, 2013, 11:23:23 pm
Is it possible to remove reactions from workshops at the individual workshop level (i.e. bone polishing workshop 1 stripped of all reactions whilst all others can still be operated normally.) Failing that, is it possible to spawn and despawn workshops? Preferably whilst keeping their preferences intact. (Storing and loading them, perhaps?) For clarity's sake, I'm talking about custom workshops only.
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on August 09, 2013, 09:29:12 am
Hi, I would like to give a skill to a creature that does not have it.

If the creature has learnt it (at least dabbling), I can access it all right with unit.status.current_soul.skills[skill].

But if the creature never had the skill, it is not there. Judging from the bindings I need to create this structure (https://github.com/peterix/df-structures/blob/master/df.units.xml#L1418) here and inject it to the above vector but I could not figure how.

Is it possible to create an instance of this structure? I tried unit.unit_skill.new() without success (unit_skill undefined).

here's an example of what I am trying to do from the fixMakeown lua script :
new_nemesis = df.nemesis_record:new()
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on August 09, 2013, 09:58:59 am
Is there an array that holds the fortress jobs. does the order affect the priority
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 09, 2013, 10:03:03 am
Boltgun, here is the make_legendary.lua script. It can add skills to any dwarf, so the solution you are looking for is probably in the code. Hope it helps.

Code: [Select]
-- This script will modify skills, or a single skill, of a unit
-- usage is:  target a unit in DF, and execute this script in dfhack
-- via ' lua /path/to/script skillname '
-- the skill will be increased to 20 (Legendary +5)
-- arguments 'list', 'classes' and 'all' added
-- by vjek, version 3, 20130123, for DF(hack) 34.11 r2
-- Praise Armok!

function make_legendary(skillname)
local skillnamenoun,skillnum
unit=dfhack.gui.getSelectedUnit()

if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

if (df.job_skill[skillname]) then
skillnamenoun = df.job_skill.attrs[df.job_skill[skillname]].caption_noun
else
print ("The skill name provided is not in the list.")
return
end

if skillnamenoun ~= nil then
utils = require 'utils'
skillnum = df.job_skill[skillname]
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillnum, rating = 20 }, 'id')
print (unit.name.first_name.." is now a Legendary "..skillnamenoun)
else
print ("Empty skill name noun, bailing out!")
return
end
end

function PrintSkillList()
local i
for i=0, 115 do
print("'"..df.job_skill.attrs[i].caption.."' "..df.job_skill[i].." Type: "..df.job_skill_class[df.job_skill.attrs[i].type])

end
print ("Provide the UPPER CASE argument, for example: PROCESSPLANTS rather than Threshing")
end

function BreathOfArmok()
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end
local i
utils = require 'utils'
for i=0, 115 do
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = i, rating = 20 }, 'id')
end
print ("The breath of Armok has engulfed "..unit.name.first_name)
end

function LegendaryByClass(skilltype)
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

utils = require 'utils'
local i
local skillclass
for i=0, 115 do
skillclass = df.job_skill_class[df.job_skill.attrs[i].type]
if skilltype == skillclass then
print ("Skill "..df.job_skill.attrs[i].caption.." is type: "..skillclass.." and is now Legendary for "..unit.name.first_name)
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = i, rating = 20 }, 'id')
end
end
end

function PrintSkillClassList()
local i
for i=0, 8 do
print(df.job_skill_class[i])
end
print ("Provide one of these arguments, and all skills of that type will be made Legendary")
print ("For example: Medical will make all medical skills legendary")
end

--main script operation starts here
----
local opt = ...
local skillname

if opt then
if opt=="list" then
PrintSkillList()
return
end
if opt=="classes" then
PrintSkillClassList()
return
end
if opt=="all" then
BreathOfArmok()
return
end
if opt=="Normal" or opt=="Medical" or opt=="Personal" or opt=="Social" or opt=="Cultural" or opt=="MilitaryWeapon" or opt=="MilitaryAttack" or opt=="MilitaryDefense" or opt=="MilitaryMisc" then
LegendaryByClass(opt)
return
end
skillname = opt
else
print ("No skillname supplied.  Pass argument 'list' to see a list, 'classes' to show skill classes, or use 'all' if you want it all!")
return
end

make_legendary(skillname)

And:
Quote
I just had a completely random idea, but please tell me this is possible: Weather Rain/Snow/Clear controls the weather. Weather Interactions control which material is rained, or appears as cloud of mist/fog.

Can this be combined? Can a plugin/script call a specific weather interaction, or simulate one by making it rain blood... or sludge... or beer... sulfur...?

In short: Can the custom weather interactions be started by a script, disregarding which biome they usually appear in? That would be awesome.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 09, 2013, 10:04:31 am
Hi, I would like to give a skill to a creature that does not have it.

If the creature has learnt it (at least dabbling), I can access it all right with unit.status.current_soul.skills[skill].

But if the creature never had the skill, it is not there. Judging from the bindings I need to create this structure (https://github.com/peterix/df-structures/blob/master/df.units.xml#L1418) here and inject it to the above vector but I could not figure how.

Is it possible to create an instance of this structure? I tried unit.unit_skill.new() without success (unit_skill undefined).

here's an example of what I am trying to do from the fixMakeown lua script :
new_nemesis = df.nemesis_record:new()

It's df.unit_skill:new().
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on August 09, 2013, 12:48:18 pm
It's df.unit_skill:new().

Thank you. This did not work in ruby so I guess I will stick to Luanda.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on August 09, 2013, 09:01:19 pm
Is there an array that holds the fortress jobs. does the order affect the priority

df.global.world.job_list

It's a doubly linked list you can traverse like this

job = df.global.world.job_list
while job do
  print(job.item.id)  -- or whatever
  job = job.next
end

job.prev lets you go backwards.

All jobs seem to be LIFO.  Maybe someone else has done more testing on this.  New jobs are added to the end of the list.  You could try to relink a job to the end to see if it gets done faster.

Under trivia, wall construction jobs are added top to bottom, left to right.  So a 2x2 wall constructed will be built in the order. 
Code: [Select]
42
31
The reverse of the jobs creation order.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on August 09, 2013, 09:46:55 pm
df.global.world.job_list

It's a doubly linked list you can traverse like this

job = df.global.world.job_list
while job do
  print(job.item.id)  -- or whatever
  job = job.next
end

job.prev lets you go backwards.

All jobs seem to be LIFO.  Maybe someone else has done more testing on this.  New jobs are added to the end of the list.  You could try to relink a job to the end to see if it gets done faster.

A while back I wanted to create a job priority plugin, so the first thing I tried was rearranging the jobs in that list to put the high priority ones at the end. That didn't work... the way the job assignment seemed to work was that when a dwarf finished their current job, they next look for the (spatially) closest available job they can do. I only did a limited test though; I might have missed something.
Title: Re: DFHack 0.34.11 r3
Post by: Suds Zimmerman on August 10, 2013, 11:53:28 am
Is it possible to remove reactions from workshops at the individual workshop level (i.e. bone polishing workshop 1 stripped of all reactions whilst all others can still be operated normally.) Failing that, is it possible to spawn and despawn workshops? Preferably whilst keeping their preferences intact. (Storing and loading them, perhaps?) For clarity's sake, I'm talking about custom workshops only.

Does nobody know whether this is possible?
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on August 10, 2013, 02:52:51 pm
You could forbid the building's material to disable the building.

b = getSelectedBuilding()
b.contained_items[0].item.flags.forbid = true
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 11, 2013, 01:03:43 am
Another idea, which came to me from hiding/unhiding magma-workshops.

Can a flag be toggled for the visibility of workshops in the menu, without any magma? For example "hide workshop kitchen" would result in the kitchen disappearing in the menu. Even if the workshop and reactions themselves are still there, maybe this helps total conversions to get rid of vanilla workshops.

I could also use it for my research system. Scientific discovery has been made, a workshop is now available, and is then shown in the workshop menu. So people would start out with a short list of buildings, and it gets longer and longer the more the research.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 11, 2013, 01:13:57 am
There aren't any flags, but I'm sure there's code that can be run that will remove said option from a menu whenever the menu comes up.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 12, 2013, 01:08:55 am
Hi :)

I have this code, which makes a dwarf under the cursor legendary in a selected skill.

Code: [Select]
-- This script will modify skills, or a single skill, of a unit
-- usage is:  target a unit in DF, and execute this script in dfhack
-- via ' lua /path/to/script skillname '
-- the skill will be increased to 20 (Legendary +5)
-- arguments 'list', 'classes' and 'all' added
-- by vjek, version 3, 20130123, for DF(hack) 34.11 r2
-- Praise Armok!

function make_legendary(skillname)
local skillnamenoun,skillnum
unit=dfhack.gui.getSelectedUnit()

if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

if (df.job_skill[skillname]) then
skillnamenoun = df.job_skill.attrs[df.job_skill[skillname]].caption_noun
else
print ("The skill name provided is not in the list.")
return
end

if skillnamenoun ~= nil then
utils = require 'utils'
skillnum = df.job_skill[skillname]
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillnum, rating = 20 }, 'id')
print (unit.name.first_name.." is now a Legendary "..skillnamenoun)
else
print ("Empty skill name noun, bailing out!")
return
end
end

function PrintSkillList()
local i
for i=0, 115 do
print("'"..df.job_skill.attrs[i].caption.."' "..df.job_skill[i].." Type: "..df.job_skill_class[df.job_skill.attrs[i].type])

end
print ("Provide the UPPER CASE argument, for example: PROCESSPLANTS rather than Threshing")
end

function BreathOfArmok()
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end
local i
utils = require 'utils'
for i=0, 115 do
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = i, rating = 20 }, 'id')
end
print ("The breath of Armok has engulfed "..unit.name.first_name)
end

function LegendaryByClass(skilltype)
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting with extreme prejudice.")
return
end

utils = require 'utils'
local i
local skillclass
for i=0, 115 do
skillclass = df.job_skill_class[df.job_skill.attrs[i].type]
if skilltype == skillclass then
print ("Skill "..df.job_skill.attrs[i].caption.." is type: "..skillclass.." and is now Legendary for "..unit.name.first_name)
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = i, rating = 20 }, 'id')
end
end
end

function PrintSkillClassList()
local i
for i=0, 8 do
print(df.job_skill_class[i])
end
print ("Provide one of these arguments, and all skills of that type will be made Legendary")
print ("For example: Medical will make all medical skills legendary")
end

--main script operation starts here
----
local opt = ...
local skillname

if opt then
if opt=="list" then
PrintSkillList()
return
end
if opt=="classes" then
PrintSkillClassList()
return
end
if opt=="all" then
BreathOfArmok()
return
end
if opt=="Normal" or opt=="Medical" or opt=="Personal" or opt=="Social" or opt=="Cultural" or opt=="MilitaryWeapon" or opt=="MilitaryAttack" or opt=="MilitaryDefense" or opt=="MilitaryMisc" then
LegendaryByClass(opt)
return
end
skillname = opt
else
print ("No skillname supplied.  Pass argument 'list' to see a list, 'classes' to show skill classes, or use 'all' if you want it all!")
return
end

make_legendary(skillname)

I want to run it with autosyndrome, but it says that no unit is selected, because there is no cursor... autosyndrome targets the worker, but somehow the two scripts dont interact well. Now I dont want to instantly make dwarves legendary, but I'd like this script to add 1 skill point to an existing skill. 1 level... and to a pet in the workshop.

Autosyndrome allows me to target a pet in a workshop with [SYN_CLASS:\COMMAND][SYN_CLASS:\LOCATION][SYN_CLASS:\ALLOW_MULTIPLE_TARGETS][SYN_CLASS:\REACTION_INDEX], and adds a syndrome to the target. Can anyone think of an idea how to make it target the pet with the above script, and change it from legendary to +1 skill?

I would like my animal-trainers to actually train the animals skills, improve dodging, fighting, biting and all that, one reaction = one skill point. That way you can make legendary guard animals. :)

This would be really really cool, I hope someone likes the idea enough to have a go at it.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 12, 2013, 01:58:38 am
Here, try this:

Code: [Select]
-- This script will modify skills, or a single skill, of a unit
-- usage is:  target a unit in DF, and execute this script in dfhack
-- via ' lua /path/to/script skillname '
-- the skill will be increased to 20 (Legendary +5)
-- arguments 'list', 'classes' and 'all' added
-- by vjek, version 3, 20130123, for DF(hack) 34.11 r2
-- Praise Armok!

function make_legendary(skillname,unit)
local skillnamenoun,skillnum

if unit==nil then
print ("No unit selected!  Aborting with extreme prejudice.")
return
end

if (df.job_skill[skillname]) then
skillnamenoun = df.job_skill.attrs[df.job_skill[skillname]].caption_noun
else
print ("The skill name provided is not in the list.")
return
end

if skillnamenoun ~= nil then
utils = require 'utils'
skillnum = df.job_skill[skillname]
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillnum, rating = rating or 1 }, 'id')
print (unit.name.first_name.." is now a Level ".. rating .." ".. skillnamenoun)
else
print ("Empty skill name noun, bailing out!")
return
end
end

--main script operation starts here
----
local opt = {...}
local skillname

local unit      = df.global.world.units.all[opt[1]] --I HAVE NO IDEA IF THIS WILL WORK
      skillname = opt[2]
 
if not opt[1] or not opt[2] then
print("Your syntax is wrong. To be exact...")
if not opt[1] then
print("You forgot to declare a unit!")
end
if not opt[2] then
print("You forgot to say what skill you wanted!")
end
end
make_legendary(skillname,unit)

Syntax:

First argument is the unit
Second is the skill

I have included in the form of comments any trepidation in my decisions
Title: Re: DFHack 0.34.11 r3
Post by: 0cu on August 12, 2013, 04:41:59 am
What do the commands autodump-destroy actually do?

I have lots of items laying around in my river because of the suicide merchants jumping down the waterfall. Can I destroy those items with DFhack? It's a lot and really starts to hurt my FPS.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on August 12, 2013, 09:47:47 am
What do the commands autodump-destroy actually do?

I have lots of items laying around in my river because of the suicide merchants jumping down the waterfall. Can I destroy those items with DFhack? It's a lot and really starts to hurt my FPS.

I don't know how to explain it better than https://github.com/peterix/dfhack/blob/master/Readme.rst
But here goes.

d-b-d mass dump the stuff you want to get rid of.  Then "autodump destroy" in the console will delete all the items.  It's equivalent to setting a garbage zone under an atom smasher.  With less labor.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on August 12, 2013, 02:25:44 pm
Has DFhack found anything related to how the game gives units items when it spawns them? I was wondering if it might be possible to hack it so males stop spawning in dresses.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on August 12, 2013, 03:29:02 pm
You have something against dresses, punk?
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on August 12, 2013, 03:36:45 pm
It does kind of kill the tension when you get ambushed by bandits sporting beards and shaven heads and they're all wearing skirts.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on August 12, 2013, 04:48:51 pm
Spoiler: Is that so? (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on August 12, 2013, 05:12:42 pm
Skirts and dresses, not kilts. And depending on the mod, bras.
Title: Re: DFHack 0.34.11 r3
Post by: moondowner on August 13, 2013, 02:38:09 pm
I seem to misunderstand some basics about how to use DFHack on linux  :( When I run dfhack script in terminal, it starts Dwarf Fortress and the terminal output is captured not by DFHack, but by DF itself (same as if I would launch ./df). It wouldn't let me enter any commands, obviously. 'pgrep dfhack' says dfhack is running, though. What am I doing wrong?
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on August 13, 2013, 09:47:45 pm
I seem to misunderstand some basics about how to use DFHack on linux  :( When I run dfhack script in terminal, it starts Dwarf Fortress and the terminal output is captured not by DFHack, but by DF itself (same as if I would launch ./df). It wouldn't let me enter any commands, obviously. 'pgrep dfhack' says dfhack is running, though. What am I doing wrong?
Are you running [PRINTMODE:TEXT] ?
Title: Re: DFHack 0.34.11 r3
Post by: moondowner on August 14, 2013, 02:07:07 am
Are you running [PRINTMODE:TEXT] ?
No. I think I didn't make myself clear - the game itself launches in a separate window, but the terminal is still occupied by it. Here's the screenshot
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on August 14, 2013, 05:19:51 am
No. I think I didn't make myself clear - the game itself launches in a separate window, but the terminal is still occupied by it.

It looks normal to me. You should have a command prompt in the terminal after dfhack as finished initializing where you can enter commands. The game is on a separate window.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on August 14, 2013, 05:57:51 am
I don't think it looks right, he should be seeing a DFHack prompt by then.

I seem to misunderstand some basics about how to use DFHack on linux  :( When I run dfhack script in terminal, it starts Dwarf Fortress and the terminal output is captured not by DFHack, but by DF itself (same as if I would launch ./df). It wouldn't let me enter any commands, obviously. 'pgrep dfhack' says dfhack is running, though. What am I doing wrong?

What distro are you running and how did you install df + dfhack?

What happens if you run this from the DF directory:
Code: [Select]
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./stonesense/deplibs":"./hack"
setarch i386 -R env LD_PRELOAD=./hack/libdfhack.so ./libs/Dwarf_Fortress
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 15, 2013, 02:14:29 am
More importantly see if there is an stderr.log file and what's in it.
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 16, 2013, 09:28:25 am
As well as my earlier findings here:
http://www.bay12forums.com/smf/index.php?topic=91166.msg4332174#msg4332174
http://www.bay12forums.com/smf/index.php?topic=91166.msg4341092#msg4341092
http://www.bay12forums.com/smf/index.php?topic=91166.msg4356227#msg4356227
I have yet another submission to the df structures:

Added:

http://github.com/angavrilov/df-structures/commit/f51c7d9ceab971222dfc87ac62546a414dbc6886 (http://github.com/angavrilov/df-structures/commit/f51c7d9ceab971222dfc87ac62546a414dbc6886)
Title: Re: DFHack 0.34.11 r3
Post by: moondowner on August 16, 2013, 11:12:26 am
What distro are you running and how did you install df + dfhack?
Debian Wheezy, 64bit.
I had to fix some 32/64bit library issues, but I've forgotten the details by now. As for DFHack, I just unpacked the archive to df directory, as the readme said.

What happens if you run this from the DF directory:
Code: [Select]
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./stonesense/deplibs":"./hack"
setarch i386 -R env LD_PRELOAD=./hack/libdfhack.so ./libs/Dwarf_Fortress
Makes no difference. DF starts, console is stuck on "Resetting textures".

More importantly see if there is an stderr.log file and what's in it.
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 16, 2013, 01:16:44 pm
Unable to retrieve version information.
File: /proc/self/exe
MD5: 01645e9ac27f1f5c0eb7c77e1c9c57b8

That MD5 hash of your executable does not match any of the known DF versions, so DFHack shuts down. Did you apply any patches to the game? If so, you need to add its hash to hack/symbols.xml in the section for the appropriate version.
Title: Re: DFHack 0.34.11 r3
Post by: moondowner on August 16, 2013, 01:44:39 pm
That MD5 hash of your executable does not match any of the known DF versions, so DFHack shuts down. Did you apply any patches to the game? If so, you need to add its hash to hack/symbols.xml in the section for the appropriate version.
Thanks, it worked! :) Now I get DFHack console alright.
I did edit /libs/Dwarf_Fortress to get rid of "Not found: /data/art/mouse.png" problem.
Title: Re: DFHack 0.34.11 r3
Post by: Kiloku on August 17, 2013, 02:48:46 pm
Since training-ammo and fix-armory seem not to be precisely this, is there any plugin around that will allow my marksdwarves to pick up ammo from bins and wheelbarrows? They tend to ignore the containers and prefer to stay ammo-less.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 17, 2013, 10:50:58 pm
Store ammo in a stockpile with 0 allowed containers.

EDIT: I got crashes related to add-splatter.plug.dll. If I remove this file the game does not crash, its a CTD on embark sometimes. Several people reported it, and the linux/mac version couldnt run with their version of the add-splatter at all.

Does anyone know anything about it? The plugin has been in use for the mod for a long time, but I never connected it to crashes before. I also did not change any items or coverings that I use the plugin for, so I am naturally quite surprised that its a problem all of a sudden.
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 18, 2013, 01:39:17 am
Got a save file and reliable reproduction instructions?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 18, 2013, 07:05:34 am
I do have half a dozen saves, crashes are reproduced no matter what I do. But I just uploaded a new version of the mod, I will wait and see if the problem solved itself. If it persists, I will come back with a few saves and as much info as I can gather.

EDIT: Oh, and does anyone have an idea how to trigger this script with autosyndrome? If I trigger it, it cannot find the unit... Its supposed to add +1skill to a creature pastured on a workshop. The script should work fine, and the trigger with autosyndrome works as well, but the script does not recognize a valid target. Its probably just a few lines of code that must be changed.

Code: [Select]
-- This script will modify skills, or a single skill, of a unit
-- usage is:  target a unit in DF, and execute this script in dfhack
-- via ' lua /path/to/script skillname '
-- the skill will be increased to 20 (Legendary +5)
-- arguments 'list', 'classes' and 'all' added
-- by vjek, version 3, 20130123, for DF(hack) 34.11 r2
-- Praise Armok!

function make_legendary(skillname,unit)
local skillnamenoun,skillnum

if unit==nil then
print ("No unit selected!  Aborting with extreme prejudice.")
return
end

if (df.job_skill[skillname]) then
skillnamenoun = df.job_skill.attrs[df.job_skill[skillname]].caption_noun
else
print ("The skill name provided is not in the list.")
return
end

if skillnamenoun ~= nil then
utils = require 'utils'
skillnum = df.job_skill[skillname]
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = skillnum, rating = rating or 1 }, 'id')
print (unit.name.first_name.." is now a Level ".. rating .." ".. skillnamenoun)
else
print ("Empty skill name noun, bailing out!")
return
end
end

--main script operation starts here
----
local opt = {...}
local skillname

local unit      = df.global.world.units.all[opt[1]] --I HAVE NO IDEA IF THIS WILL WORK
      skillname = opt[2]
 
if not opt[1] or not opt[2] then
print("Your syntax is wrong. To be exact...")
if not opt[1] then
print("You forgot to declare a unit!")
end
if not opt[2] then
print("You forgot to say what skill you wanted!")
end
end
make_legendary(skillname,unit)
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on August 19, 2013, 05:54:32 pm
I wonder if my game got glitched or something because in using the DFhack, I saw there were a few kobolds standing around for a while for whatever reason and I used slayrace on them because I thought they were broken somehow and then it showed some goblins around, but I can't find them.

I first used slayrace on the osprey men and then axolotl men, but no idea if that broke something. When I did slay race on them, they appeared in the same area.

Edit: They dissapeared on their own somehow.....

Edit2: nm, they're just hiding REALLY well.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on August 21, 2013, 10:49:05 am
Using the workflow plugin to make rock pots.  And I use the job manager to make bone armor at a different craft shop(s) near the butchers.  So I fill the rock crafts shop with jobs and suspend them.

I was wondering, anyone figured out another way to keep the manager from assigning jobs to a shop?  I don't like all the red on the jobs screen.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 21, 2013, 05:08:36 pm
Download save that crashes with add-spatter. (http://dffd.wimbli.com/file.php?id=7923)

For ag: I mentioned how several people reported problems with crashes and the Masterwork Mod. I got 6-7 reports about crashes that happens instantly upon embark. You select your team of dwarves, hit 'e', and get a CTD. Deleting the add-spatter.plug.dll in the hack/plugins folder always solved this crash. Above is an example save. Maybe you, or anyone else with greater knowledge of the .dll plugins, can find a reason for this.

Here is the report I got about the above crash:
Spoiler (click to show/hide)

I include the add-spatter.plug.dll since V.2c and use it for the Toxicologist's Laboratory, the Rune Weaponry and the Rune Armory. The mod is now on V.3f, which is ~10 updates. I never had any crashes with add-spatter, and I did not change any raws that use this plugin. I did add more reactions for Kobold Mode, but those are not active when playing as dwarves, and the crashes happen in Dwarf Mode.

Thats about all the info I can think of. Good luck and thanks for any help that can be given.
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 22, 2013, 02:27:08 am
I include the add-spatter.plug.dll since V.2c and use it for the Toxicologist's Laboratory, the Rune Weaponry and the Rune Armory. The mod is now on V.3f, which is ~10 updates. I never had any crashes with add-spatter, and I did not change any raws that use this plugin. I did add more reactions for Kobold Mode, but those are not active when playing as dwarves, and the crashes happen in Dwarf Mode.

Found a buffer overrun bug caused by ADD_SPATTER reactions which have any non-improvement outputs. Until this is fixed in the dll itself, you can work around by avoiding such things. The crash happens when enumerating reactions on world load, so active/inactive is irrelevant.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 22, 2013, 02:54:26 am
So any reaction that has SPATTER_ADD in its ID that has no [IMPROVEMENT:800:object:COVERED:GET_MATERIAL_FROM_REAGENT:extract:NONE] does cause this crash?

Is [REACTION:KOBOLD_SPATTER_ADD_BOLTS_SHADOW] ok as ID? I just realized that I made new versions for the kobolds and changed that name, but the readme states "Reaction name must start with 'SPATTER_ADD_':".  I have 253 reactions that start with SPATTER_ADD, but another 21 have this KOBOLD_SPATTER_ADD.

AHA: I also found some Orc Reaction with the same problem. REACTION:RUNES_ADD_WEAPON_MITHRIL_ORC. 6 reactions.
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 22, 2013, 03:23:25 am
When I debugged it, it crashed on SPATTER_ADD_WEAPON_BITTER because of the KNOWLEDGE_STONE non-improvement products.

The bug is a simple error in loop bounds. If the reaction has only IMPROVEMENT outputs, there is no difference:

http://github.com/angavrilov/dfhack/commit/70a2ab91417281a39df2d26ab2ca2d654e4b58ff (http://github.com/angavrilov/dfhack/commit/70a2ab91417281a39df2d26ab2ca2d654e4b58ff)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 22, 2013, 03:41:22 am
Ah... I understand. The reaction might only create improvements, nothing else.

That actually causes a balancing problem ingame. Since improvements are not new items and give no XP, the PoisonWorker skill and the Runesmith skill gain no XP from applying runes or poisons. The Knowledge Stone is a boiling inorganic that I just add to have a XP gain with the reaction. If I remove it, the skills will never rise.

But THANK YOU !!!! YEAH :) One crash fixed.

EDIT: For ag: Falconne thought you might be able to find something about this one too. Its a crash that happened with the tweak plugin. Falconnes self-build tweak plugin fixes it, but he does not know why. I plan to use his version for the next release, but he thinks you might be able to see the actual reason why it crashed.

The report about the crash can be found here. (http://www.bay12forums.com/smf/index.php?topic=91166.msg4438141#msg4438141) If you need more info, please leave falconne a message, he knows more about it then I do.

I cant state how much I appreciate this help. I was completely lost looking at my mod, thinking: Mh. Might have to redo ~200 hours of work.
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 22, 2013, 09:37:59 am
The report about the crash can be found here. (http://www.bay12forums.com/smf/index.php?topic=91166.msg4438141#msg4438141) If you need more info, please leave falconne a message, he knows more about it then I do.

That save crashes because there are hives with uncollected products, but no bees. It confuses the hive code and makes it access an uninitialized pointer. For me the crash happens even with no dfhack loaded at all. The question therefore is how the hives got into this state.

One clue here might be the fact that the bee items in two of the other hives have a huge amount of wear on them, but I have no idea what it might signify. When I tried to put data breakpoints on the wear counters, they didn't trigger, so at least in my setup there seems to be no ongoing wear.

To fix the save you need to fake-collect products in the two hives with products but no bees. To do that, find the hives, select each of the uncollected products (with blue B next to them) in 't' mode and execute in the console:

Code: [Select]
[DFHack]# :lua dfhack.gui.getSelectedItem().flags.in_building = false
This should remove the blue B, and thus avoid the subsequent crash.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 22, 2013, 10:08:35 am
Are you a wizard?

How in hell can you know this stuff, modders have such a hard time finding a crash, and you are like: Yep, thats because of A and it will do B to the code, you can do C to fix it. Is it hard for you to find this info? Because my line of thought at this moment is: Oh, there is someone that can identify and fix crashes. Lets flood him will all the reports and all the saves and do a housecleaning of the mod. Of course that makes no sense if it's too much work for you... I'd like to help, but I dont even know how you know what you know. ;)

Btw, falconnes tweak-plugin also fixes that crash, so I'll include it as well in the next release, if I can get my hands on it.

EDIT: Silly question coming up: Would [PRODUCT:0:1:BOULDER:NONE:INORGANIC:ANNOUNCEMENT_RUNEAMMO] crash a add-spatter reaction? It is a product in the reaction, but there is no actual product created. I assume that it would still crash. I only ask because I use this to trigger custom announcements, like "A stack of ammo has been inscribed with a rune."
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 22, 2013, 12:03:24 pm
Well, determining that it was something to do with hives was about 15 min I guess; understanding how the hives work (including some new fields (http://github.com/angavrilov/df-structures/commit/250dc7f827a09dc6a84ff76c94b3053b06947be3) for data structures) and what's wrong with them - about 2 hours I'd say.

Anything that's not IMPROVEMENT will make it crash - the problem is that the plugin makes a list of only improvement products, and then indexes it with the number of all outputs.



Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 22, 2013, 02:06:08 pm
Oh, wow, then thank you even more. I already made a set of raws without any products for the spatter_add reactions and rebalanced some mod features to fit. The hive-bug is probably neglectable, because falconnes tweak-plugin fixes it. I'll add it to the dfhack-init and have it run on every loadup. So if someone does have this weird crash, simply restarting DF should fix it.

Why a hive-product, which are usually tools, can degrade.. no idea. I added several modded hive-animals (cochineal, banespiders, silkmoths), but they still use tools with an inorganic mat.

I think I'll just release the crash-fixes I have now and see if any other issues pop up. Might be that its only these two things, who knows.
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 22, 2013, 02:40:07 pm
Oh, wow, then thank you even more. I already made a set of raws without any products for the spatter_add reactions and rebalanced some mod features to fit. The hive-bug is probably neglectable, because falconnes tweak-plugin fixes it. I'll add it to the dfhack-init and have it run on every loadup. So if someone does have this weird crash, simply restarting DF should fix it.

Why a hive-product, which are usually tools, can degrade.. no idea. I added several modded hive-animals (cochineal, banespiders, silkmoths), but they still use tools with an inorganic mat.

Well, since I made most of the stuff in tweak, I had to make sure it isn't some bug messing up something so that an unrelated thing crashes later ;) About the falconne tweak, what are the changes in it? Since the crash is caused by using an uninitialized value, the effect depends on what random value was in that address before, and thus completely unrelated things can seem to affect it.

It's not tools that are worn in those hives, it's the bees themselves, i.e. the actual vermin item listed under small live animals or something in stocks. I can't think of anything that could cause that really, other than maybe some temperature damage from too cold or hot, or maybe some actual bug. The original owner of that save may be in a better position to guess.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 22, 2013, 03:22:45 pm
If a vermin is inside a workshop, nothing can affect it. Just like liquids. At least thats my understanding. I honestly dont know what might have caused this peculiar crash.

I also cant say anything about falconnes tweak plugin, since I only got a compiled .dll. I will let you know after I talked to him, or you write him. Would probably be better, because I dont know C++ so my information would just be copy+paste of whatever he will tell me. ;)

Anyway, thanks for the spatter-add fix, and maybe, just maybe, I will come back to you with another crashed save, if any reproducable crashes will be reported with my next mod update. Curious to see if you can epically pinpoint those as well, if you find the time. :P
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on August 22, 2013, 03:31:14 pm
No, no, no.  The mis-behaving honey bee hives were a result of Mallophora fautrix infestation.  They must have this predatory insect in the raws.

Bug Spray.

Regen.

It's the only solution.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on August 22, 2013, 09:23:18 pm
The hive-bug is probably neglectable, because falconnes tweak-plugin fixes it.

No, based on what ag found, it's actually a coincidence that the crash didn't happen when I tried it in my build environment. If there's an uninitialised pointer, the data it contains will be random... when I used my build it just so happened that the random data made the crash not occur. But that's very situational... on a different day you will see different results.

So using the tweak plugin from my build won't help, as it has nothing to do with the plugin, so just ignore it. If the hives get to that state often then you'll have to figure out why that's happening. Maybe the original player did something unusual?

It might be worth figuring out a Lua script that can detect this hive state. Then you can run it on future bugged saves you get sent, to see if this is a one off occurrence or not.
Title: Re: DFHack 0.34.11 r3
Post by: Kougarkat on August 22, 2013, 09:53:16 pm
Might well also be related to the spatter-add bug.  Buffer overflows can cause some weird memory corruption. And then that state is what crashes later.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 22, 2013, 11:33:19 pm
So I'd need a script that runs in the background, monitors if this state happens in any hive, then runs: [DFHack]# :lua dfhack.gui.getSelectedItem().flags.in_building = false automatically, while knowing in which hive it should target. Yeah... that sounds totally like something I can write; he said sarcastically. ^^

What happens if the hive is simply deconstructed? So someone has a crash, reports it, and I say: Load the save, raze your hives. Would that help?

I also have no idea if this is some sort of freak occurence, or a problem with any of the new hive-creatures that are in the mod. I'd let it go for now, and wait and see. I wouldnt want several people trying to fix something that might not happen again.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 23, 2013, 12:17:35 am
Code: [Select]
function buildingIsHive(building)
if not string.find(tostring(building),"hivest") then return false else return true end
end

function itemIsHive(item)
for k,v in ipairs(item.subtype.tool_use) do
if v==12 then return true end
end
return false
end

function buildingHasProductButNoBees(building)
local buildingHasProduct = false
local buildingHasNoBees = true
for k,v in ipairs(building.contained_items) do
if string.find(v.item,"verminst") then return false end
if string.find(v.item,"toolst") and not itemIsHive(v.item) then buildingHasProduct = true end
end
if buildingHasProduct then return true else return false end --already checked if bees; if bees, then false anyway.
end

function getShortestHiveProductTime()
local shortestHiveProductTime = 2^128 --get a larger number than that for your time, eh?
for _,creature in ipairs(df.global.world.raws.creatures.all) do
for k,length in ipairs(creature.hive_product_1) do
shortestHiveProductTime=(length<shortestHiveProductTime) and length or shortestHiveProductTime --neat but incomprehensible lua trick
end
end
return shortestHiveProductTime
end

function checkForBuggyHives()
for k,building in ipairs(df.global.world.buildings.all) do
if buildingIsHive(building) and buildingHasProductButNoBees(building) then
for _,v in building.contained_items do
local item = v.item
if string.find(v.item,"toolst") and itemIsHive(v.item) then item.flags.in_building=false end
end
end
end
end

function fixHiveCrashRepeater()
checkForBuggyHives()
dfhack.timeout(shortestHiveProductTime-1,'ticks',fixHiveCrashRepeater) --if someone makes a hive that goes every 1 tick i would be so mad
end

dfhack.onStateChange.fixHiveCrash = function(code) --Many thanks to Warmist for pointing this out to me!
    shortestHiveProductTime=getShortestHiveProductTime()
if code==SC_WORLD_LOADED then
dfhack.timeout(1,'ticks',fixHiveCrashRepeater)
end
end

dfhack.onStateChange.fixHiveCrash()

Here's your fix, I think.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 23, 2013, 12:50:25 am
Putnam, thanks :) I can test this script on the crashing save I have, see what happens. I am curious what falconne/ag will say about it.

Once I am at it: I get these sometimes in the dfhack commmand window:

Soundesense-season cant find the correct season. I assume it is because I replaced the string dump for "has arrived on the calender" and "is upon you" with different wording, like "is upon you. Active Civs: Humans, Cave-Civs, Warlocks." I guess I can just alter the wording in the .lua to fit the new strings?
Quote
...DF v3f\Dwarf Fortress\hack\scripts/soundsense-season.lua:23: attempt to conca
tenate field '?' (a nil value)
stack traceback:
        ...DF v3f\Dwarf Fortress\hack\scripts/soundsense-season.lua:23: in funct
ion <...DF v3f\Dwarf Fortress\hack\scripts/soundsense-season.lua:21>

This is from some products in custom workshops. I dont know which script gives this errorlog, so I never quite figure out what to do about it. I just ignored it. Anyone knows the script name?
Quote
This script requires a workshop job selected in the 'q' mode
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 23, 2013, 12:54:43 am
I just edited the script so that it checks the shortest hive product time after it loads a world. It probably won't work otherwise.

Newest version:

Code: [Select]
function buildingIsHive(building)
    if not string.find(tostring(building),"hivest") then return false else return true end
end

function itemIsHive(item)
    for k,v in ipairs(item.subtype.tool_use) do
        if v==12 then return true end
    end
    return false
end

function buildingHasProductButNoBees(building)
    local buildingHasProduct = false
    local buildingHasNoBees = true
    for k,v in ipairs(building.contained_items) do
        if string.find(v.item,"verminst") then return false end
        if string.find(v.item,"toolst") and not itemIsHive(v.item) then buildingHasProduct = true end
    end
    if buildingHasProduct then return true else return false end --already checked if bees; if bees, then false anyway.
end

function getShortestHiveProductTime()
    local shortestHiveProductTime = 2^128 --get a larger number than that for your time, eh?
    for _,creature in ipairs(df.global.world.raws.creatures.all) do
        for k,length in ipairs(creature.hive_product_1) do
            shortestHiveProductTime=(length<shortestHiveProductTime) and length or shortestHiveProductTime --neat but incomprehensible lua trick
        end
    end
    return shortestHiveProductTime
end

function checkForBuggyHives()
    for k,building in ipairs(df.global.world.buildings.all) do
        if buildingIsHive(building) and buildingHasProductButNoBees(building) then
            for _,v in building.contained_items do
                local item = v.item
                if string.find(v.item,"toolst") and itemIsHive(v.item) then item.flags.in_building=false end
            end
        end
    end
end

function fixHiveCrashRepeater()
    checkForBuggyHives()
    dfhack.timeout(shortestHiveProductTime-1,'ticks',fixHiveCrashRepeater) --if someone makes a hive that goes every 1 tick i would be so mad
end

dfhack.onStateChange.fixHiveCrash = function(code) --Many thanks to Warmist for pointing this out to me!
    shortestHiveProductTime=getShortestHiveProductTime()
    if code==SC_WORLD_LOADED then
        dfhack.timeout(1,'ticks',fixHiveCrashRepeater)
    end
end

dfhack.onStateChange.fixHiveCrash()
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 23, 2013, 01:14:17 am
This is more like it:

Code: [Select]
function process_hive(hive)
    for i,iinfo in ipairs(hive.contained_items) do
        if df.item_verminst:is_instance(iinfo.item) then
            return
        end
    end

    local found = false

    for i,iinfo in ipairs(hive.contained_items) do
        if iinfo.use_mode == 0 and iinfo.item.flags.in_building then
            found = true
            iinfo.item.flags.in_building = false
        end
    end

    if found then
        print('Fixed a broken hive at ('..hive.x1..','..hive.y1..','..hive.z..')')
    end
end

for i,hive in ipairs(df.global.world.buildings.other.HIVE) do
    process_hive(hive)
end

Also, I think you can't possibly time any repeating check to always catch the condition before a crash can happen unless you make it run every frame, because every hive has its own independent timers for creation of products and job creation (the crashing bit).
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 23, 2013, 01:17:21 am
So I'll include the script, name it "crashfix_hive.lua", and let people know that this option exists, if they should have that problem again. And I'll try both scripts on that save. :)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 23, 2013, 01:21:34 am
(i would go with ag's because he's totally right about that repeating thing)
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 23, 2013, 01:32:06 am
The best way to fix this crash is by a C++ tweak, because it can be made to run its code exactly when the function that crashes is called, and not at any other time. Plus, the check itself will incur almost no overhead.

Btw, note that you are supposed to use is_instance to check the type of objects, instead of comparing strings ;)
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on August 23, 2013, 02:58:16 pm
In case you need a reaction randomly triggering a siege, here's a script :
https://gist.github.com/Devduweb/6323075

It requires the force event script. Depending of the given probabilities, will pick a civilization to lay siege on you.
You need to edit the 'entities' array first to fit your mod, currently there is all the vanilla civs, dwarves being commented out to prevent tragedies.

This ignores all triggers and such, and will create ambushes if the selected civilization do that.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on August 24, 2013, 04:09:06 pm
Is it possibly to add and remove creature classes with DFHack? Syndrome classes just aren't cutting it for what I want to do.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 24, 2013, 04:10:44 pm
No, not really. Creature classes are stored in the creature raw, not in the unit.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 25, 2013, 04:27:24 am
Roses, tell me what you try to do, maybe I can come up with something.
Title: Re: DFHack 0.34.11 r3
Post by: Grewon on August 25, 2013, 08:56:28 am
I modified warmist's syndrome script from here (https://gist.github.com/warmist/4061959) so that it searches for the vampire syndrome id by checking the syndrome's displayed name(in this case vampire), and then infects the selected unit with the vampire syndrome, effectively making him a vampire. It also seems to work with necromancers.
Code: [Select]
function assignSyndrome(target,syn_id)
    if target==nil then
        qerror("Not a valid target")
    end
    local ns=df.unit_syndrome:new()
    local trg_syn=df.syndrome.find(syn_id)
    ns.type=trg_syn.id
    --ns.year=
    --ns.year_time=
    ns.ticks=1
    ns.unk1=1
    for k,v in ipairs(trg_syn.ce) do
        local sympt=df.unit_syndrome.T_symptoms:new()
        sympt.ticks=1
        sympt.flags=2
        ns.symptoms:insert("#",sympt)
    end
    target.syndromes.active:insert("#",ns)
end
function makeVampire(unit)
for i=0,#df.global.world.raws.syndromes.all-1 do
for j=0,#df.global.world.raws.syndromes.all[i].ce-1 do
for k,v in pairs(df.global.world.raws.syndromes.all[i].ce[j]) do
if k=="name" then
if v=="vampire" then --this can be changed to necromancer
print("Found vampire syndrome id:"..i)
assignSyndrome(unit,i)
print("Infected unit with vampire syndrome.")
return
end
end
end
end
end
end
local unit=dfhack.gui.getSelectedUnit()
makeVampire(unit)


P.S. this simple cure script removes all syndromes in case you want to undo the effects of the first script, or even if you want to cure genuinely infected units.
Code: [Select]
local unit=dfhack.gui.getSelectedUnit()
while #unit.syndromes.active > 0 do
unit.syndromes.active:erase(0)
end
while #unit.body.wounds > 0 do
unit.body.wounds:erase(0)
end
unit.body.wound_next_id=1
Title: Re: DFHack 0.34.11 r3
Post by: Roses on August 25, 2013, 10:48:45 pm
Roses, tell me what you try to do, maybe I can come up with something.

I want to make hybrid classes, so you have to get to say rank 2 warrior and rank 2 priest to become a rank 1 paladin. I can't think of a way to do this with syndrome classes and such because interactions only have IT_CANNOT_HAVE_SYNDROME_CLASS and syndromes allowed/iimmune tags are for creature classes. I suppose I could make separate castes for each rank and each rank combination, but I think that might become overwhelming.

What I would like the most is to not have to use transformations at all, honestly, but CE_DISPLAY_NAME is fixed once it is assigned and there is no way to change skill learn rates with syndromes. That way I could have castes that are more or less suited for different tasks, but let the player choose how they want to play.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 26, 2013, 03:35:15 am
Like you said, castes would allow more functionality, but are more difficult to set up.

What you can do is give all dwarves as self-targeted interaction, to be repeated every 5000 ticks or so that adds the SYN_CLASS:NO_PALADIN_W and NO_PALADIN_P (and all other hybrid-classes you want). Then, when the dwarf gets the warrior rank2, he gets an interaction that blocks NO_PALADIN_W. Priest Rank2 blocks NO_PALADIN_P. You can do this using cannot-have-syn-class. The Warrior2 interaction is selftargeted, has no end, and adds SYN_CLASS:BLOCK_NO_PALADIN_W, and the Priest2 interaction is selftargeted, has no end, and adds SYN_CLASS:BLOCK_NO_PALADIN_P. The paladin_w and paladin_p of course have CANNOT_HAVE_SYN_CLASS:BLOCK_NO_PALADIN_W/P.

Step1: Dwarf gets syn-classes that blocks Paladin Transformation.
Step2: Warrior and Priests get interactions that block the blocking interaction.
Step3: The dwarf is now a valid target for Paladin Transformation.
Step4: Profit.
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 26, 2013, 08:11:12 am
I made a C++ tweak for that beehive issue:

http://github.com/angavrilov/dfhack/commit/b885123d4ea8ebe95536774a4798ddef3c67a6b1 (http://github.com/angavrilov/dfhack/commit/b885123d4ea8ebe95536774a4798ddef3c67a6b1)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 26, 2013, 08:42:29 am
Nice. :) I guess its better then the crashfix you posted earlier, because the crashfix must be run after someone knows that the problem exists, but this tweak will prevent the crash from happening in the first place? Do I have to compile it myself?  Its probably just me, but I couldnt find a download button. ^^

I also got this save send to me: http://dffd.wimbli.com/file.php?id=7931 (http://dffd.wimbli.com/file.php?id=7931). The crashfix you posted does not fix it, and its not spatter-add, so if you have more time to spend on crashes, feel free to have a look. I can replicate the crash, but have no idea what might be the cause, as most of the time with crashes.  :-\
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 26, 2013, 09:42:50 am
The tweak is the same thing as the fix, only coded in C++ and set up to run every time the crashed code is about to be called. Falconne can probably build it for you ;)

How do you make that save crash?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 26, 2013, 10:31:11 am
You dont have to do anything but wait. It takes a few minutes, but my netbook is slow. If you keep it at 150FPS (if your machine can handle that) it shouldnt take long.

Ok, thanks. I have the crashfix included in the current download, I'll see that I can get a compiled C++ version in the next update. :)
Title: Re: DFHack 0.34.11 r3
Post by: Roses on August 26, 2013, 10:50:04 am
Yeah, that was the only other thing I could think of. Maybe I will just wait on hybrid classes until more functionality is added to the interactions and syndromes. With 24 non-hybrid classes that should be good enough for now. I wish CE_DISPLAY_NAME and CE_DISPLAY_TILE were more functional
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 26, 2013, 10:55:23 am
Can you get the display tile to work on civ-members at all? I only got either no effect, or a flickering tile.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on August 26, 2013, 11:04:20 am
Can you get the display tile to work on civ-members at all? I only got either no effect, or a flickering tile.

I never got it to work, I think creature graphics overrides it maybe?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 26, 2013, 11:13:47 am
Same here. The sprites overwrite the display_tile, but the flash_tile works. the problem is that the flask_tile frequency does not accept a 0. I wanted to to 0 for the default tile and 99999 for the flash tile... but even then it flickers every tick. But it displays the alternative tile.

I also found a way with nobles, because you can make as many profession sprites as you like... but you have tons of nobles then. ^^
Title: Re: DFHack 0.34.11 r3
Post by: fricy on August 27, 2013, 03:47:08 am
Question: The spatter_add plugin is loaded when dfhack finds the string SPATTER_ADD_ in the raws. Correct? Any other strings that activate the plugin?
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 27, 2013, 05:22:04 am
You dont have to do anything but wait. It takes a few minutes, but my netbook is slow. If you keep it at 150FPS (if your machine can handle that) it shouldnt take long.

I ran it a couple of times. What seems to happen is that almost immediately a siege comes, and eventually everybody (or almost everybody) dies.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 27, 2013, 07:51:42 am
Mh... I can try to run the save again and give you more info. Sorry if I wasted your time with it. Maybe I can reproduce the crash again and quicksave a few seconds before it.

EDIT: Could someone please add a timer into this? its the slayrace.rb script, which has the command "slayrace creature-name magma", which drops magma on top of creatures. It would be really useful if that magma-flow would stop after a certain amount of ingame ticks (or even RL seconds). I want to make a magma-spawning creature with it. It works, but the creature never stops to spawn it. ^^

Code: [Select]
# slay all creatures of a given race

# race = name of the race to eradicate, use 'him' to target only the selected creature
# use 'undead' to target all undeads
race = $script_args[0]

# if the 2nd parameter is 'magma', magma rain for the targets instead of instant death
magma = ($script_args[1] == 'magma')

checkunit = lambda { |u|
(u.body.blood_count != 0 or u.body.blood_max == 0) and
not u.flags1.dead and
not u.flags1.caged and not u.flags1.chained and
#not u.flags1.hidden_in_ambush and
not df.map_designation_at(u).hidden
}

slayit = lambda { |u|
if not magma
# just make them drop dead
u.body.blood_count = 0
# some races dont mind having no blood, ensure they are still taken care of.
u.animal.vanish_countdown = 2
else
# it's getting hot around here
# !!WARNING!! do not call on a magma-safe creature
ouh = df.onupdate_register("slayrace ensure #{u.id}", 1) {
if u.flags1.dead
df.onupdate_unregister(ouh)
else
x, y, z = u.pos.x, u.pos.y, u.pos.z
z += 1 while tile = df.map_tile_at(x, y, z+1) and
tile.shape_passableflow and tile.shape_passablelow
df.map_tile_at(x, y, z).spawn_magma(7)
end
}
end
}

all_races = Hash.new(0)

df.world.units.active.map { |u|
if checkunit[u]
if (u.enemy.undead or
    (u.curse.add_tags1.OPPOSED_TO_LIFE and not
     u.curse.rem_tags1.OPPOSED_TO_LIFE))
all_races['Undead'] += 1
else
all_races[u.race_tg.creature_id] += 1
end
end
}

case race
when nil
all_races.sort_by { |race, cnt| [cnt, race] }.each{ |race, cnt| puts " #{race} #{cnt}" }

when 'him'
if him = df.unit_find
slayit[him]
else
puts "Select a target ingame"
end

when /^undead/i
count = 0
df.world.units.active.each { |u|
if (u.enemy.undead or
    (u.curse.add_tags1.OPPOSED_TO_LIFE and not
     u.curse.rem_tags1.OPPOSED_TO_LIFE)) and
   checkunit[u]
slayit[u]
count += 1
end
}
puts "slain #{count} undeads"

else
raw_race = df.match_rawname(race, all_races.keys)
raise 'invalid race' if not raw_race

race_nr = df.world.raws.creatures.all.index { |cr| cr.creature_id == raw_race }

count = 0
df.world.units.active.each { |u|
if u.race == race_nr and checkunit[u]
slayit[u]
count += 1
end
}
puts "slain #{count} #{raw_race}"

end
Title: Re: DFHack 0.34.11 r3
Post by: Rose on August 27, 2013, 11:56:53 am
Question: The spatter_add plugin is loaded when dfhack finds the string SPATTER_ADD_ in the raws. Correct? Any other strings that activate the plugin?

Incorrect. The plugin is always loaded.
Title: Re: DFHack 0.34.11 r3
Post by: fricy on August 27, 2013, 12:54:39 pm
Question: The spatter_add plugin is loaded when dfhack finds the string SPATTER_ADD_ in the raws. Correct? Any other strings that activate the plugin?
Incorrect. The plugin is always loaded.

Thx Japa. Hmmm. So the "hooks detected" message in the console is not the plugin loading. Ok.
I'm trying to hunt down a crash on osx that seems to be connected to the add_spatter plugin and masterwork mod v3. At least when I remove the plugin the game doesn't crash.

Here's what I know: I tested the raws of MW mod 2h, and the mod works. However with any version of masterwork v3+ the game crashes at worldgen/load. After ag found the buffer overflow bug, and Meph fixed the reactions I was hoping the the crash would go away, but no. So I started deleting the reactions/interactions/entities from the MW.3.g raws to narrow down a possible faulty reaction. I even replaced the "spatter" string in the language files to make sure it doesn't interferes, eliminated every spatter reaction from the raws, but the game still crashes on worldgen when placing the civs. The crash report blames the spatter_add plugin, even though the spatter string is absent in the raws folder. http://pastebin.com/YcR9CEuP http://pastebin.com/Ppnz7z49

I tested the same "spatterless" 3.g raws (https://www.dropbox.com/s/t8xzwbdzluceg14/mw_3g_raw_no_spatter.zip) on windows, the game seems to work, but I got a couple of crashes, and the lenght of the worldgen seems to be random.
I'm now out of ideas how to proceed, any tips?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 06:37:58 am
Is there a flag for hungry/starving? I have several lua scripts that target a unit and change attributes, like this: "unit.status.current_soul.traits.ANXIETY=1", if I could replace this with hunger YES/NO that would allow me to make stables to feed grazers. Like "unit.status.hunger=0" or so... I initially tried with NO_EAT, but that doesnt work. It adds the tag, but it only suspends the hunger. as soon as NO_EAT runs out, the creature is back to starving.

I only found this on github:
Code: [Select]
// Hunger etc timers

    bool is_adventure = (gamemode && *gamemode == game_mode::ADVENTURE);
...
 
996
997
998
999
        rating, is_adventure, unit->counters2.hunger_timer,
        75000, 75000, 172800, 1209600, 2592000
    );
    if (is_adventure && unit->counters2.sleepiness_timer >= 846000)



EDIT: For Ag, or whoever wants to try their luck:

Reproduceable Crash Save (http://vlyn.at/files/region1.zip)

Save crashes after about 15 seconds.

Errorlog shows these:
*** Error(s) found in the file "data/save/crash v3g/raw/objects/creature_random_rc.txt"
CREATURE_1UIHEAXII_RC:Body Token Recognized But Could Not Connect: 3TOES_FQ_REG
CREATURE_1OUGEUAAM_RC:Attack SCRATCH seems to have correct format but could not find proper BPs in any caste, so not added
CREATURE_1VXHUFWOM_RC:Attack BITE seems to have correct format but could not find proper BPs in any caste, so not added
CREATURE_1FZQUUEJA_RC Color Mod Ending With (BLACK,1) Was Not Used
CREATURE_1LBXMNTFA_RC:Attack CLAW seems to have correct format but could not find proper BPs in any caste, so not added
Unrecognized Caste Token in Body Transformation Effect: creature X a lot
Unrecognized Inorganic Token: WARPSTONE_SOLID X a lot.

The first 5 are from random creatures from Talvienos random creature generator. The unrecognized creatures are from kobold mode, because they are removed when you play dwarves. The warpstone is missing because the person is playing with "Harder Mining:Off", which removes this harmfull stone. None of these cause crashes.

I did "unload all" on dfhack and burrowed all the dwarves, so its neither a dfhack plugin (I hope), nor a job that is finished and that creates some kind of game-breaking item. It his however the 4th crash I get that crashes in autumn, with no traders on the map. I strongly suspect that the caravan brings either invalid items or materials that crash the game. I checked the embark selection for dwarves for any weird entries, but all looks fine. Is there a way to check what kinds of items/materials a civ has access to?
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 28, 2013, 10:32:43 am
Nope, no crashing for me - neither with dfhack, nor in a fully vanilla copy of DF, both windows and linux.

You can check if it crashes for you in a fresh original copy, and if  not, see what changes to the options and files make things start breaking.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 10:58:00 am
Interesting. I loaded it 4 times, and it crashed 4 times, no matter what I did. So it is system dependant. Did a caravan arrive in your game?  If yes, could you upload the save with the caravan on the map? I would really like to check what kind of items their carry.

I have Win7 on my netbook. He has Win7 as well.

Adding the save to a fresh DF copy makes no sense, because all the raw-modding would be ported over. If it does not crash for you with my patched exe, then it has nothing to do with the exe itself. The Settings.exe does only modify the base-raws, the set that DF uses to make a new world, it does not influence a save. In general, I dont update saves with new raws...

But thats good news, in a way. Thanks for the effort. :)
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 28, 2013, 11:13:27 am
Well, adding the save to a fresh copy is what I do, since I have no others. It's either fully fresh copy, or the same with my usual graphics pack and development build of dfhack installed. And if by any chance it doesn't crash in a fresh copy for you too, then you can start from that to figure out what specific difference between fresh and non-fresh copy affects it.

Re operating system, I tested it on linux, linux+wine and a Win XP VM.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 11:18:17 am
When you say fresh copy, do you mean DF, or MasterworkDF? I somehow assumed that you meant to vanilla game. If you use the mod, then a few parts are different... custom written dfhack scripts, patched exe, things like that.
Title: Re: DFHack 0.34.11 r3
Post by: ag on August 28, 2013, 11:22:56 am
By fresh copy I do mean a vanilla copy.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 11:41:01 am
No wonder that you can reproduce the crash. ^^ But I am surprised, I did do "unload all" which should stop all dfhack shenanigans... I think if you load the save with the mod, then you would get the crash as well. And if only you can tell me the name of the script that crashes it, I would raise a monument to your name (ingame, of course) ;)

I will try the save again with a vanilla df exe, see if that changes anything. After that it can only be any of the custom scripts.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 28, 2013, 11:58:19 am
Coincidentally, I do have a script that sets hunger to 0 lying around (for adventure mode only)

Code: [Select]
local player = df.global.world.units.active[0]

player.counters2.hunger_timer=0

That should give you a hint :V
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 12:35:33 pm
hunger_timer=0... hope I can find a way to add this to a creature.
EDIT: Looked at some scripts... no idea. ^^
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 28, 2013, 12:51:53 pm
What do you mean "add this"? Like, use a syndrome?

syndromeTrigger.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 01:41:45 pm
Putnam: Add it to a creature. I want a dwarf that runs a reaction that triggers autosyndrome with fovcommand (like hire-guard, targetting everything in field of view) that adds hunger_timer=0 to all nearby pets. Effectively feeding grazers :) But I am missing the script that adds the hunger_timer=0 to a selected creature. Thats all.

Ag: You magnificent son of a very nice lady. You kinda found it. Its the exe. It was the string dump replacements I did. A dog dies of infection and crashes the game, because the new death message for "succumbed to infection" was too long. I changed that back to default and it works. :) I was using this: |succumbed to infection.|succumbed to infection. After a long battle against sickness and necrosis, the corrupted flesh has found its way into the heart.| before, and the new sentence crashed the game.

YES!!! You can believe how happy I am, I am sure this (and the other long deathmessages, like frostbite) are the sources of the crashes people suddenly have since V.3d.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 28, 2013, 03:00:49 pm
I have no idea how autosyndrome selects creatures that aren't the worker. If I did know, I could write it for you right now.

Also, Meph: yeah, don't use long strings and ESPECIALLY don't change the length of the strings that are noted.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 03:21:03 pm
fovcommand. It does it automatically. Any script that works on a selected unit with 'k', it can target by field of view of the worker.

For example make_legendary.lua. It needs a unit to be selected with 'k', so autosyndrome cant find it. But this would work:
Code: [Select]
[SYN_CLASS:\COMMAND]
[SYN_CLASS:fovcommand]
[SYN_CLASS:\WORKER_ID]
[SYN_CLASS:make_legendary]
[SYN_CLASS:DWARF]

So all I need is a script that works on the selected unit. :)
Title: Re: DFHack 0.34.11 r3
Post by: uggi on August 28, 2013, 03:36:11 pm
fovcommand. It does it automatically. Any script that works on a selected unit with 'k', it can target by field of view of the worker.

For example make_legendary.lua. It needs a unit to be selected with 'k', so autosyndrome cant find it. But this would work:
Code: [Select]
[SYN_CLASS:\COMMAND]
[SYN_CLASS:fovcommand]
[SYN_CLASS:\WORKER_ID]
[SYN_CLASS:make_legendary]
[SYN_CLASS:DWARF]

So all I need is a script that works on the selected unit. :)

I used this script to keep an injured and starving dwarf alive, to see how long it would take for anyone to bother rescuing him. 40 idle dorfs and no-one paid attention to him until shortly after I reset his hunger/thirst timers back to 0. Seems to work with grazers too.

Code: (hunger.lua) [Select]
-- Shows/resets hunger and thirst counters

function run(cmd)
local unit=dfhack.gui.getSelectedUnit()
if unit then
local name = dfhack.units.getVisibleName(unit)
if name and name.has_name then
unitname = dfhack.TranslateName(name)
else
unitname = "unit"
end


if cmd == 'status' then
print("Status for "..unitname..":")
print("Hunger:", unit.counters2.hunger_timer)
print("Thirst:", unit.counters2.thirst_timer)
elseif cmd == 'reset' then
print("Resetting hunger and thirst counters for "..unitname)
unit.counters2.hunger_timer=0
unit.counters2.thirst_timer=0
end
end
end

local cmd = ...
if not cmd then
qerror('Usage: hunger status/reset')
end
run(cmd)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 28, 2013, 03:47:11 pm
...can someone point to me the code for fovcommand?

EDIT: Derp, pretty sure I used it for slavery in drow.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 05:23:11 pm
fovcommand.lua
Code: [Select]
-- Will execute a command over the field of view for the selected unit in a radius of 10.
--[[

This script requires the fov plugin from the Hire guard reaction mods :
http://dffd.wimbli.com/file.php?id=7785
 
It will calculate the field of view of the source unit and will run a dfhack command for every
unit found within this field of view. This is used, for example, as an effect from a workshop
reaction that will affect nearby creatures.
 
If no source unit is provided
 
This will unfortunatly only support lua scripts.
 
Usage : fovcommand <source_unit> <command> [<target_raw>] [<arg>]
- command : The name of the script that will run on the targets.
- source_unit : The id of the unit whose field of view will be checked.
- target_raw (optional) : A creature raw's ID, this will limit the effect to this creature only.
- arg (optional) : An additional argument to give to the command.
 
The target script will be run as "myscript <target> <arg>".
 
Usage with autosyndrome :
This script works with autosyndrome, here's an example.
 
[SYN_CLASS:\COMMAND]
[SYN_CLASS:fovcommand]
[SYN_CLASS:\WORKER_ID]
[SYN_CLASS:myscript]
[SYN_CLASS:DOG]
[SYN_CLASS:BITING]
 
This will run "myscript <id> BITING" for every dog in the vinicity of the worker.
@version 1.0
@author Boltgun
 
]]
local fov = require 'fov'
 
-- Checks
if not dfhack.isMapLoaded() then qerror('Map is not loaded.') end
if not ... then qerror('No arguments provided, please provide the source\'s id and a script name') end
 
local args = {...}
local radius = 10
local unitList = df.global.world.units.active
local unit = nil
local target_raw = nil
local view, i, unitTarget
 
-- Checking args
if not args[2] then qerror('Please enter the command you wish to run on the target units') end
 
-- Finding the source unit
function findUnit(searchId)
local k, _
 
for k, _ in ipairs(unitList) do
if unitList[k].id == searchId then
return unitList[k]
end
end
 
return nil
end
 
-- Check if the unit is seen and valid
function isSelected(unit, view)
local unitRaw = df.global.world.raws.creatures.all[unitTarget.race]
 
if not dfhack.units.isDead(unit) and not dfhack.units.isOpposedToLife(unit) then
if not target_raw or unitRaw.creature_id == target_raw then
return validateCoords(unit.pos, view)
end
end
 
return false
end
 
-- Check boundaries and field of view
function validateCoords(pos, view)
 
if pos.x < view.xmin or pos.x > view.xmax then
return false
end
 
if pos.y < view.ymin or pos.y > view.ymax then
return false
end
 
return view.z == pos.z and view[pos.y][pos.x] > 0
 
end
 
 
-- action
unit = findUnit(tonumber(args[1]))
if not unit then qerror('Source unit not found') end
 
if args[3] then target_raw = args[3] end
view = fov.get_fov(radius, unit.pos)
 
-- Check through the list for the right units
for i = #unitList - 1, 0, -1 do
unitTarget = unitList[i]
if isSelected(unitTarget, view) then
 
if args[4] then
dfhack.run_script(args[2], unitTarget.id, args[4])
else
dfhack.run_script(args[2], unitTarget.id)
end
 
end
end

feed.lue
Code: [Select]
-- Shows/resets hunger and thirst counters

function run(cmd)
local unit=dfhack.gui.getSelectedUnit()
if unit then
local name = dfhack.units.getVisibleName(unit)
if name and name.has_name then
unitname = dfhack.TranslateName(name)
else
unitname = "unit"
end


if cmd == 'status' then
print("Status for "..unitname..":")
print("Hunger:", unit.counters2.hunger_timer)
elseif cmd == 'reset' then
print("Resetting hunger and thirst counters for "..unitname)
unit.counters2.hunger_timer=0
end
end
end

local cmd = ...
if not cmd then
qerror('Usage: hunger status/reset')
end
run(cmd)

inorganic mat:
Code: [Select]
[INORGANIC:PET_FEEDING]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE] => boils away, triggers autosyndrome
[STATE_NAME_ADJ:ALL:Feed a nearby grazer]
[MATERIAL_VALUE:0]
[SYNDROME]
[SYN_CLASS:\COMMAND]
[SYN_CLASS:fovcommand]
[SYN_CLASS:\WORKER_ID]
[SYN_CLASS:feed]
[SYN_AFFECTED_CLASS:PET_HEALING] => only works on pets

Sadly, this results in 5 messages of "No Unit is selected in the UI." in the dfhack window. Anyone got a clue why?

EDIT:If I use
   [SYN_CLASS:\COMMAND]
   [SYN_CLASS:fovcommand]
   [SYN_CLASS:\WORKER_ID]
   [SYN_CLASS:feed]
   [SYN_CLASS:hunger]

then nothing at all happens, not even the error message.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 28, 2013, 06:05:14 pm
Because it's using dfhack.gui.getSelectedUnit() instead of using an argument from fovcommand. Here's a simple script for you:

Code: [Select]
local unit = df.global.world.units.all[tonumber(...)] --assuming that fovcommand uses the unit's position in the "all units" list, which it seems to

unit.counters2.hunger_timer=0
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 06:38:24 pm
Thanks, but again, I only get error messages. I think I wait for boltgun to say something, he gave me the fovcommand. ^^

Code: [Select]
...terworkDF v3g\Dwarf Fortress\hack\scripts/feedsimple.lua:1: Cannot read field vector<unit*>.193: index out of bounds.
stack traceback:
        [C]: in function '__index'
        ...terworkDF v3g\Dwarf Fortress\hack\scripts/feedsimple.lua:1: in main chunk
        (...tail calls...)
        ...terworkDF v3g\Dwarf Fortress\hack\scripts/fovcommand.lua:111: in main chunk
        (...tail calls...)
...terworkDF v3g\Dwarf Fortress\hack\scripts/feedsimple.lua:1: Cannot read field vector<unit*>.177: index out of bounds.
stack traceback:
        [C]: in function '__index'
        ...terworkDF v3g\Dwarf Fortress\hack\scripts/feedsimple.lua:1: in main chunk
        (...tail calls...)
        ...terworkDF v3g\Dwarf Fortress\hack\scripts/fovcommand.lua:111: in main chunk
        (...tail calls...)
[DFHack]#
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 28, 2013, 06:42:43 pm
Those errors mean that there aren't that many units in the loaded area of the world (i'm trying to teach you here meph :P). That means that fovcommand doesn't do what I thought it did and I have no idea how to select units based on ID >_>
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 28, 2013, 06:53:59 pm
Well, neither do I. I had 4 hungry creatures with the correct creature_class pastured nearby, 3 tiles away, tested, nothing... then pastured them on the workshop, tested, nothing.

I always feel dumb if I cant get this stuff to work, although half of the time its the script that doesnt work. ^^ And I hate bothering other people, but believe me, I know less about fovcommand then you do ;)

I only know that I have a stables-building and some reactions set up to feed animals, and have to wait till someone finds time to make this script happen. I initially had high hopes for the NO_EAT, but it doesnt work. Transformations are a way, but thats over the top... fully healing a creature just to feed it.
Title: Re: DFHack 0.34.11 r3
Post by: Kurik Amudnil on August 29, 2013, 12:12:24 am
to get a unit by id
Code: (lua) [Select]
local utils = require 'utils'
local unit = utils.binsearch(df.global.world.units.all, id, 'id')
if unit then
    ...
end

or

Code: (lua) [Select]
local unit = df.unit.find(id)
if unit then
    ...
end

I think the df.unit.find method is the fastest way as it uses compiled code, and it is easier to use.

Also on the feeding front, in addition to setting unit.counters2.hunger_timer = 0 ; unit.counters2.stomach_content and stomach_food probably ought to get some attention.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 29, 2013, 01:02:46 am
I've found that the hunger counter is good enough to stave hunger for a good while, but you're right and oh well here's the super-simple script fixed this time.
Code: [Select]
local unit = df.unit.find(tonumber(...))

unit.counters2.hunger_timer=0
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 29, 2013, 01:20:38 am
Ok, I tested both again. Thanks both of you.

Kurik Amudnils version does spit out an errorlog about a number being required. I assume thats the viewrange.

Putnams... does work. :) All pets that were hungry are reset to non-hungry. I have to see how far the range goes, and if it goes through walls and such, but all in all its great. Even that it targets every pet, and not just one, because that would make micromanagement very hardcore.

Now I can add my stables to the game. :)
(http://i.imgur.com/ev9zZ1E.png)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on August 29, 2013, 01:23:47 am
Kurik's version is an example of how to search by id, not an actual script :P
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 29, 2013, 01:34:37 am
I did add the hunger-counter line to it all by myself. :P Probably why it didnt work. :P

But seriously, I have a 11x11 workshop now that allows indoor feeding of animals with plants, seeds or hay. Hay being a custom tool that you can buy. Edit: Make that buy or make from pigtail grass, longland grass or cave wheat grass. And feed them with leaves. That should cover everything. :)

EDIT: Works.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on August 29, 2013, 04:05:49 am
Does anyone know of or have a way to turn off the announcement ticker at the bottom of the screen? 

Besides the aesthetic issues, I also find that it often covers the happiness stats and generally gets annoying eventually.  There's also this lovely new announcement tool (http://www.bay12forums.com/smf/index.php?topic=130030), which displays a filterable and configurable view of the gamelog and combat reports in another window - and it would be nice if it was possible to disable the default when using it. 
Title: Re: DFHack 0.34.11 r3
Post by: Meph on August 29, 2013, 04:08:31 am
Have a look at data/init/announcements.txt, you can disable and enable what you want to show up. If you disable all, there wont be announcements. Dont know if the announcement ticker will still recognize them though.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on August 29, 2013, 04:12:04 am
<...> I also find that it often covers the happiness stats and generally gets annoying eventually.  <...>

Lol @ vanilla feature interfering with tool feature, kind of makes me want to say "back in my day..." :D
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on August 29, 2013, 05:56:09 am
Have a look at data/init/announcements.txt, you can disable and enable what you want to show up. If you disable all, there wont be announcements. Dont know if the announcement ticker will still recognize them though.

I tried deleting all instances of D_D or D_DISPLAY "the announcement will be displayed in the main dwarf announcement log (and at the bottom)" - while this did prevent them popping up at the bottom, they also never make it into the gamelog, so it's a self-defeating kind of move.  The same tag controls the ticker and the gamelog, hence the hack-question. 

Lol @ vanilla feature interfering with tool feature, kind of makes me want to say "back in my day..." :D
Heh, I started playing in 0.31; the various tools were what got me back into 0.34.  Automation and UI improvement; most of the complaints I hear are solved by various hacks and that's why I started my LNP. 
Title: Re: DFHack 0.34.11 r3
Post by: Noobshock on September 01, 2013, 04:21:27 pm
I've heard the crash on pushing e at the wrong time in military screen is somehow related to a dfhack search function. Is this true and is there anything I can do about this crash? I save and reload regularly in feat of crashing my game there :(
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 02, 2013, 12:39:57 am
Could somebody please direct me to where I might figure out how to write a plugin for DFhack? The only API I see is the LUA api, but all the plugins are  in C++.

EDIT: Just realized I should also note that I'm already fluent in C++, so I don't need any guidance on the fundamentals of programming.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on September 02, 2013, 12:50:20 am
I don't think there is a tutorial anywhere on how to write the Lua plugins, but it's pretty simple to figure out.  I just used some of the other Lua scripts as examples of where to put the file and how to handle arguments.  Past that it's all just a matter of using whatever Lua statements you want in the script.  If you want to do simple manipulation of units it's pretty straightforward if you've used the command line interpreter at all.

Speaking of which, the structures on Github can be hard to read, so I usually just use the printall() command inside the interpreter to see what fields are available on a given structure.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on September 02, 2013, 01:13:22 am
Could somebody please direct me to where I might figure out how to write a plugin for DFhack? The only API I see is the LUA api, but all the plugins are  in C++.

EDIT: Just realized I should also note that I'm already fluent in C++, so I don't need any guidance on the fundamentals of programming.
There are few "types" of plugins. Depending of the type you are recommended (or don't have a choice in some cases) to use either lua/ruby or C++.
Here is my view on it:
As for official C++ api there is none (afaik) but the code is documented well and usually you can pick it up quite fast. Although you will need a huge understanding of what happens in DF to do anything complicated. Whereas in lua/ruby you can start coding almost instantly and with help of lua api + generated headers + irc channel make a lot of things.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on September 02, 2013, 02:54:27 am
I've heard the crash on pushing e at the wrong time in military screen is somehow related to a dfhack search function. Is this true and is there anything I can do about this crash? I save and reload regularly in feat of crashing my game there :(

If you get the latest bundle of plugins linked in my sig, it includes a fixed search plugin.
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on September 02, 2013, 01:54:41 pm
to get a unit by id
Code: (lua) [Select]
local utils = require 'utils'
local unit = utils.binsearch(df.global.world.units.all, id, 'id')
if unit then
    ...
end

or

Code: (lua) [Select]
local unit = df.unit.find(id)
if unit then
    ...
end

I think the df.unit.find method is the fastest way as it uses compiled code, and it is easier to use.

Also on the feeding front, in addition to setting unit.counters2.hunger_timer = 0 ; unit.counters2.stomach_content and stomach_food probably ought to get some attention.

Oddly enough when I tried unit.find I ran into errors. Hence the terrible loop through the site units that I wrote.
Now it seems to perform ok, I guess I had some typing errors back in the day.

Time to update all my scripts I guess :
fovcommand : https://gist.github.com/Devduweb/6350270
animaltrain : https://gist.github.com/Devduweb/6409714
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 02, 2013, 11:12:31 pm
I'm trying to get into C++ plugin writing, but as of now it's me throwing code at the wall and seeing what sticks, except I don't have a wall to throw the code at, so I'm going to throw it at you guys so you can tell me what's wrong. (Not if it's wrong, what is :P)

http://pastebin.com/UhYXrDMj

Clearly incomplete, but I want some feedback on what I have. I'm trying to make it so that the lua code in itemsyndrome can be run on equip, and, after looking around, that vmethod was the best I could find. Not sure if it does anything even remotely similar to what I want, though.
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 03, 2013, 01:25:49 am
Okay... this is weird, I thought something might be wrong with the version of dfhack I have, but no, it appears this way on the github repository as well. All (or at least most) of the header files in the library contain #includes for header files that aren't where they think they are. Namely, it seems like these header files used to be under the directory "/df", but are now under "/modules". Am I doing something wrong here?

(http://i.imgur.com/Pj911nO.png)
Title: Re: DFHack 0.34.11 r3
Post by: Rose on September 03, 2013, 01:28:03 am
Yes. Those header files are generated automatically when you build for the first time. Just go ahead and build once, and they'll appear where they're needed.
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 03, 2013, 02:30:10 am
Oh, of course. I was trying to work straight off the .h and .cpp files like some sort of loose cannon vigilante programmer. Well, building solved that problem, even though it didn't seem to be entirely successful (8 succeeded, 3 failed), but I'm not going to look a gift horse in the mouth and try to untangle more problems that turn out to not actually be problems. I do enough of that with my usual programming.
Title: Re: DFHack 0.34.11 r3
Post by: Maulkin on September 03, 2013, 03:44:54 pm
Hi!
Note sure if this is the right place to ask, but here goes:

Am i missing someting on the Workflow plugin, i enable it, and suddenly i cant delete old repeat jobs in Workshops, even those not covered by workflow Amount setups.

Is it some way to mark only the repeat jobs you want to not get canceled? since i cant manually delete them either with the plugin on, and its a hassle to jump back and forth disabeling it to cancel Repeat jobs i dont need anymore. OR in some cases where they have been adding up and so filling up the work queue.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 03, 2013, 03:48:49 pm
Unrepeat them.
Title: Re: DFHack 0.34.11 r3
Post by: sirdave79 on September 03, 2013, 07:37:23 pm
I just attempted to use the marriage script posted earlier in the thread. I get the following output

d:\latest LNP\Dwarf Fortress 0.34.11\hack\scripts/marry.lua:60: Cannot write field histfig_hf_link_spousest.anon_1: not found.
stack traceback:
    [C]: in function '__newindex'
    d:\latest LNPzDwarf Fortress 0.34.11\hack\scipts/marry.lua:60 in function <d:\latest LNP\Dwarf Fortress 0.34.11\hack\scripts/marry.lua:5>
    [C]: in function 'with suspend'
    d:\latest LNP\Dwarf Fortress 0.34.11\hack\scripts/marry/lua:83. in main chunk

Can anybody advise what this means and what I might need to do to get the script to work for me ?

I used LUA and the command "print(dfhack.gui.getSelectedUnit().id)" to obtain 2 unit IDS 15218 and 14631, exited LUA and then typed

"marry 15218 14631"

and obtained the output above. Entering "marry x y" in LUA gives a syntax error and doesnt seem to run the command so I presume im right to run this in dfhack not LUA.

Cheers



Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 03, 2013, 08:41:30 pm
anon_1 has probably been replaced with something else. Let me check...

EDIT: I think I've seen this fixed before.

EDIT 2: Replace all instances of "anon_1" with "link_strength" and hope that it doesn't mess anything up.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on September 03, 2013, 08:42:21 pm
Hi!
Note sure if this is the right place to ask, but here goes:

Am i missing someting on the Workflow plugin, i enable it, and suddenly i cant delete old repeat jobs in Workshops, even those not covered by workflow Amount setups.

Is it some way to mark only the repeat jobs you want to not get canceled? since i cant manually delete them either with the plugin on, and its a hassle to jump back and forth disabeling it to cancel Repeat jobs i dont need anymore. OR in some cases where they have been adding up and so filling up the work queue.

What putnam said. Just remove the repeat before removing the job. The protection of repeated jobs is something that workflow does that, in my oppinion, should never be removed, because it's damn useful.
Title: Re: DFHack 0.34.11 r3
Post by: sirdave79 on September 03, 2013, 08:58:57 pm
Thanks for the reply Putnam.

I think your reply was to me ? I tried what you said. I didnt get a different output. Its late now though, ill try again tomorrow from scratch.

Cheers
Title: Re: DFHack 0.34.11 r3
Post by: Maulkin on September 04, 2013, 02:27:34 am
Unrepeat them.

Doh! I feel sheepish! the one thing i did not try, and also THE MOST LOGICAL!!!!

Love the program, made my Df life a lot more fun. This.and evemon are must haves.

So.thanks for.the work!
Title: Re: DFHack 0.34.11 r3
Post by: Maulkin on September 04, 2013, 03:33:47 am

What putnam said. Just remove the repeat before removing the job. The protection of repeated jobs is something that workflow does that, in my oppinion, should never be removed, because it's damn useful.

Yeah, its brilliant, just sometimes, i wantet to get rid of a repeat job, just could not figure it out...... turns out it was simple...  Must have been to simple fro my complex mind ;)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on September 04, 2013, 09:27:34 am
Is it possible for me to run an arbitrary lua script every few steps? If so, could someone show me how to set it up?

What I would like to be doing is to run a battle simulation in the arena, where I would have the script output health info on participants and make slight changes to certain variables over time. I can do this now by toggling to the dfhack command window and manually running the script, but automating the process would certainly save my fingers some trouble.

Unrelated, how could I run the "cls" command or duplicate its effects to clear the dfhack command window from inside a lua script?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 04, 2013, 12:35:40 pm
Code: [Select]
function example()
    print("Hello, world!")
    dfhack.timeout(50,"ticks",example)
end

I don't think that works in arena mode, though...
Title: Re: DFHack 0.34.11 r3
Post by: ag on September 04, 2013, 01:03:13 pm
Code: [Select]
    dfhack.timeout(50,"ticks",example)
I don't think that works in arena mode, though...

There is a "frames" timer which always works, but it counts frames and will fire regularly even when the game is paused.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on September 04, 2013, 02:55:47 pm
Code: [Select]
    dfhack.timeout(50,"ticks",example)
I don't think that works in arena mode, though...

There is a "frames" timer which always works, but it counts frames and will fire regularly even when the game is paused.

Thanks, I'll experiment with this when I get home (to my computer with DF).

Is there a danger of overflow due to lengthy or infinite recursion?

Would the code below allow the automatic termination of the script?
Code: [Select]
function example()
    print("Hello, world!")
    if foo(spam) == false then
         dfhack.timeout(50,"ticks",example)
    end if
end

How do you manually end the script? Is this something that allows DF to run, but locks up the dfhack command window until you exit the script or force-close dfhack? I guess that I can't activate the repeating script and then use other dfhack commands.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 04, 2013, 03:09:50 pm
Code: [Select]
if string.lower(...) == "disable" then
    example = nil
end

If it helps, itemsyndrome is a repeating command exactly like this one.
Title: Re: DFHack 0.34.11 r3
Post by: ag on September 04, 2013, 03:21:03 pm
How do you manually end the script? Is this something that allows DF to run, but locks up the dfhack command window until you exit the script or force-close dfhack? I guess that I can't activate the repeating script and then use other dfhack commands.

Incorrect. The script execution ends, but the code remains in memory and will be called after the time elapses. When it does, it can request to be called again after a while, and so on. Global variable values are shared between all calls to a script, so this background code and later direct calls to the script can interact. For instance, what that "example = nil" above does is clear the global variable that holds the reference to the function, so the next time it tries to do dfhack.timeout in the background it doesn't do anything.

This may be cleaner though:

Code: [Select]
function example()
  print('Tick!')

  if not dfhack.timeout_active(timeout_id) then
    timeout_id = dfhack.timeout(50,"frames",example)
  end
end

if string.lower(...) == "disable" then
  dfhack.timeout_active(timeout_id, nil)
else
  example()
end

The advantage is that if the script is called twice before the timer has a chance to fire, it won't start two "threads" of timers - that check in the example function prevents it by tracking the active timer via the timeout_id global variable. Or you can always cancel the running timer and start a new one when the script is run explicitly:

Code: [Select]
function example()
  print('Tick!')
  timeout_id = dfhack.timeout(50,"frames",example)
end

dfhack.timeout_active(timeout_id, nil)
if string.lower(...) ~= "disable" then
  example()
end
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on September 04, 2013, 08:12:51 pm
Does anyone know why I get redundant reports on tweaks when I start dfhack?

(http://i.imgur.com/WczzrtG.png)

I've checked the stuff that's obvious to me, and I'm stumped. 
Spoiler: dfhack.init (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 04, 2013, 09:31:22 pm
I get them too.
Title: Re: DFHack 0.34.11 r3
Post by: Taverius on September 04, 2013, 11:09:14 pm
Autolabor is pretty awesome, but the ignore-on-burrow plays hell with civilian alerts.

Would probably be better with something with custom profession names, ie profession ending in '-' is ignored or something.
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 05, 2013, 12:41:55 am
Can anybody enlighten me as to the significance of the numbers here? They seem to correlate to what kind of event you're listening for (all the syndrome handlers use 1, job_completed handlers use 5), but I can't for the life of me figure out why.

(http://i.imgur.com/k8yR1vQ.png)

Edit: woops, forgot image.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on September 05, 2013, 01:18:18 am
Can anybody enlighten me as to the significance of the numbers here? They seem to correlate to what kind of event you're listening for (all the syndrome handlers use 1, job_completed handlers use 5), but I can't for the life of me figure out why.

(http://i.imgur.com/k8yR1vQ.png)

Edit: woops, forgot image.
Could be wrong, but i think it's check frequency. So in a  sense syndromes are checked 5 times more frequently then job_completed. This is done to prevent lag as much as possible because depending on event type it could be iterating through HUGE arrays each N ticks.
Title: Re: DFHack 0.34.11 r3
Post by: Taverius on September 05, 2013, 01:22:47 am
Does anyone have any documentation for autofarm?
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 05, 2013, 02:00:49 am
EDIT 2: ELECTRIC BOOGALOO I figured it out, I needed to #include "df/job.h", not just "modules/Job.h". Gawddamn names. Now to wait for the next problem.

I'm trying to do things with the item that a job is using, but this is like a navigating a 4-dimensional maze. With a blindfold on. Is there any chance someone could give me a tip on how to get the item object a job is using? according to this, it should be passing my listener a pointer to an object of type df::job, but I can't seem to actually do anything with the object. The IDE tells me an incomplete type is not allowed.
EDIT: i should say it tells me that when I try to cast it to a (df::job*) pointer, when I don't it just tells me it doesn't have a pointer-to-class type, which I thought should be remedied by casting it as the type I know it is already (df::job*).

(http://i.imgur.com/F2Rwr3G.png)

(http://i.imgur.com/4GcStqx.png)

God I hope I'm not missing something incredibly simple as usual.
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 05, 2013, 04:09:45 am
And of course, I can't build it for various mysterious reasons I'll probably have to make a pact with some elder god to solve.

gzip_stream.obj : error LNK2019: unresolved external symbol deflate referenced in function "public: bool __cdecl google::protobuf::io::GzipOutputStream::Close(void)" (?Close@GzipOutputStream@io@protobuf@google@@QEAA_NXZ)

I suspect these errors lead to

fatal error C1083: Cannot open include file: 'CoreProtocol.pb.h': No such file or directory

Anyone with a similar problem?
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 05, 2013, 04:41:04 am
Alright, that linker issue is solved, now there's some other issues but i'm way too tired for this now.
Title: Re: DFHack 0.34.11 r3
Post by: ag on September 05, 2013, 10:53:12 am
Does anyone know why I get redundant reports on tweaks when I start dfhack?

That's because it prints one line per hook:

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 05, 2013, 11:57:53 am
So, every plugin (including the default ones, so it's not my code that's an issue) I've built makes DF crash (on startup). compile.html says "When you open the solution in MSVC, make sure you never use the Debug builds. Those aren't binary-compatible with DF. If you try to use a debug build with DF, you'll only get crashes." But I'm using Release, not Debug, not even RelWithDebInfo. I tried building ALL_BUILD and PACKAGE and using the dlls output by each, both caused exactly the same crashes. Again, it's not my code, all the other plugins do it too.

Am I building the wrong package or something? There seems to be a syntax error or two when compiling "misery" and "prospector", but errors in those shouldn't make entirely unrelated plugins crash.
Title: Re: DFHack 0.34.11 r3
Post by: ag on September 05, 2013, 12:55:42 pm
Which msvc? Also, what about building using the bat files coming with dfhack, without any fancy editor stuff?
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 05, 2013, 03:46:40 pm
Visual Studio 2012, so the compiler version is 11. I didn't use the batch files because for whatever reason, visual studio refuses to properly add its compiler to my path, so I can't easily compile from command line. I can try them when I get home by editing them to explicitly locate the compiler executable.
Title: Re: DFHack 0.34.11 r3
Post by: ag on September 05, 2013, 03:59:59 pm
DFHack must be built with the MSVC 2010 compiler same as DF itself, or it won't work.
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 05, 2013, 05:58:28 pm
Yay. Now I get to deal with more of microsoft's lovely software. Hopefully installing an older version alongside a newer one works better than vice versa, I originally had to uninstall version 10 because it made 11 not work for some raisins. Yes, raisins.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on September 05, 2013, 08:40:39 pm
I think you need to install the older one first, before the newer one, but it may work anyway.

The good news is that, once you have the older one installed, you can use the older compilers with 2012, so you still get to use the nicer IDE. This process is pretty automatic when you open the project files.
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 05, 2013, 11:25:11 pm
Well that's what I originally did, but that broke things, I don't remember how but I uninstalled it. The good news is everything seems to be shipshape now with that, I installed MSVC 2010, fixed my system environment path and compiled from command line and the plugins don't crash DF anymore. The bad news is that just means it's time for the real bug hunting to begin.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on September 05, 2013, 11:57:50 pm
Does anyone know why I get redundant reports on tweaks when I start dfhack?
Because it prints one line per hook: <snip>

Hmmm.  Any way to get it to not do that?  Besides leaving 'cls' at the bottom of the init anyway, I get the feeling that's... not a great idea given that errors may get thrown then wiped. 
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on September 06, 2013, 01:25:40 am
Code: [Select]
    dfhack.timeout(50,"ticks",example)
I don't think that works in arena mode, though...

There is a "frames" timer which always works, but it counts frames and will fire regularly even when the game is paused.

In arena mode, I am checking df.global.world.frame_counter, which starts at 1 for a "fresh" arena and actually increases by 1 per tick. If it stops increasing, I know the game is paused.
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 06, 2013, 01:44:03 am
Can someone enlighten me as to how job items work? Apparently the PlantSeeds job has 0 job items. However, I'm using the job_item_ref* vector, because a job_item_ref object has a pointer to the actual item itself (I think). Am I using the wrong vector, or what?

(http://i.imgur.com/ohit0Hw.png)

Update: okay, the job_item* vector has 1 item in it, but how am I actually supposed to access that item object?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 06, 2013, 02:30:00 am
Does any code exist to change the amount of starting/embark points? Similar to "startdwarf X", which changes the amount of dwarves you embark with. Doesnt matter if ruby or lua.
Title: Re: DFHack 0.34.11 r3
Post by: ag on September 06, 2013, 02:59:00 am
Can someone enlighten me as to how job items work? Apparently the PlantSeeds job has 0 job items. However, I'm using the job_item_ref* vector, because a job_item_ref object has a pointer to the actual item itself (I think). Am I using the wrong vector, or what?

It would be better to ask such things in the IRC channel, although don't expect to always get an instant answer :)

There's an IRC channel on freenode: #dfhack (irc://irc.freenode.net/dfhack (http://irc::://irc.freenode.net/dfhack) or web client (http://webchat.freenode.net/?channels=dfhack&uio=d4))

Re job items, a specific item is bound to a usual job only while it is being executed, by matching filters specified by job_item objects. Only some special jobs like storing into stockpile or building things have pre-assigned (http://github.com/angavrilov/dfhack/blob/master/library/modules/Buildings.cpp#L986) items (and some of them can actually work with filters too if created (http://github.com/angavrilov/dfhack/blob/master/library/modules/Buildings.cpp#L1023) that way by dfhack, with some additional help (http://github.com/angavrilov/dfhack/blob/master/library/modules/Buildings.cpp#L140)).
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 06, 2013, 04:13:08 am
Alright, thanks for clearing that up, but why do we get all the spam from PlantSeeds job cancellations if they don't need any specific single item? I figured they had claimed X seed in Y barrel, and while en route to get it the barrel was stolen by a hauler.
Title: Re: DFHack 0.34.11 r3
Post by: ag on September 06, 2013, 04:19:49 am
and while en route to get it the barrel

That's exactly the time when there is a link to a specific item.
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 06, 2013, 04:22:41 am
Well yes, but if the farmer's job didn't want a single specific predetermined item that from that barrel, why is there a problem, why doesn't he grab a different seed?
Title: Re: DFHack 0.34.11 r3
Post by: vjek on September 06, 2013, 09:31:02 am
Does any code exist to change the amount of starting/embark points? Similar to "startdwarf X", which changes the amount of dwarves you embark with. Doesnt matter if ruby or lua.

This may be helpful..?

[lua]# print(df.global.world.worldgen.worldgen_parms.embark_points)
2500
[lua]# df.global.world.worldgen.worldgen_parms.embark_points=3000

I've used that on the embark selection screen, prior to pressing 'e', and it's reflected in the "Prepare for the journey carefully" interface.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 06, 2013, 02:14:23 pm
That's exactly what he's looking for ;)

Anyway, here's the simplest script possible for that:

Code: [Select]
df.global.world.worldgen.worldgen_parms.embark_points=tonumber(...)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 06, 2013, 04:31:41 pm
Then I'll have more reason to wait ;V

Fuck it. Tried to rewrite it for the current DFHack version, couldn't figure out what "size_info" was supposed to be, work well enough anyway.
Title: Re: DFHack 0.34.11 r3
Post by: Spacebat on September 06, 2013, 11:16:18 pm
Is there a way to have my tick handler activate every X ticks instead of just once?

I asked the IRC, but that place is pretty dead. If I get an answer there I'll update this post with it so other people can know.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 07, 2013, 12:16:15 am
Is there a way to have my tick handler activate every X ticks instead of just once?

I asked the IRC, but that place is pretty dead. If I get an answer there I'll update this post with it so other people can know.

You're in C++, right? I think you want onUpdate for that.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 07, 2013, 05:02:37 am
Quick question: I recently saw someone post a script that adds a vampire flag/tag/token/something to a creature.

I have a reaction in the mod thats adds BLOODSUCKER and all the other tags as seen in the Interaction Examples folder for vampires, making my own vampires in a fort. Is that not enough to make them real vampires? As in: Recognized by the justice system as one?

Comes down to: If I want to make vampires by reaction, would I need to run this script on the worker, or is the raw part enough? I currently use:

Code: [Select]
[INORGANIC:DWARF_VAMPIRES]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL:Inflict vampirism][DISPLAY_COLOR:1:0:0]
[SYNDROME]
[SYN_AFFECTED_CREATURE:DWARF:ALL]
[SYN_CLASS:\WORKER_ONLY]
[CE_ADD_TAG:BLOODSUCKER:NO_AGING:STERILE:NOT_LIVING:NOEXERT:NOPAIN:NOBREATHE:NONAUSEA:NO_DIZZINESS:NO_FEVERS:PARALYZEIMMUNE:NO_EAT:NO_DRINK:NO_SLEEP:NO_PHYS_ATT_GAIN:NO_PHYS_ATT_RUST:START:0]
[CE_PHYS_ATT_CHANGE:STRENGTH:200:0:AGILITY:200:0:TOUGHNESS:200:0:START:0]
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 07, 2013, 12:01:55 pm
I feel BLOODSUCKER is probably enough.
Title: Re: DFHack 0.34.11 r3
Post by: Snaake on September 07, 2013, 04:16:15 pm
Would it be possible to get/does a tweak exist that could be used to toggle the ingame sounds on/off while a game was running? There is one for for the water level display, and I'd prefer to be able to (ctrl-m)ute the game if I want to listen to some other song or watch a youtube video once in a while when I'm playing. (Without having to open up windows volume mixer and muting DF from there, since I then also have to scroll over to the side some.)

Yes, I'm lazy, but "it doesn't seem like it should be hard to do." The bane of coders, that sentence? :P
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 07, 2013, 05:15:19 pm
My attempts to change the volume and turn off the sound through DFHack ended up with the sound only changing when I actually went to manually change the volume in-game.

It really is easy to do, though.

Code: [Select]
df.global.init.media.volume=0
You could always press escape, go to the "music and sound" menu, then click the bottom line.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 07, 2013, 08:29:53 pm
Putnam & Vjek : Thanks for the embark scripts, I will try both out. :)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 08, 2013, 04:14:33 am
some info for viewscreen_setupadventurest: anon_5 is skill points allowed to be allocated. anon_12 is attribute points. Both are remaining, not total. unk1.anon_4 is unit skills after allocation. unk1.anon_1 is adventurer unit's name.

unk1.anon_10 through unk1.anon_15 are physical attributes, on a scale from 0 to 6 (very low to superior). unk_1.anon_16 is the same for mental attributes, but a vector for some reason/the first 6 aren't vectors for some reason.

unk1.anon_3 is the adventurer unit's caste; unk1.anon_2 his/her race.

anon_2 appears to be... a name. It's currently "ekantz", which is a beforan name in Fortbent. Not sure what the name represents; perhaps it was the default first name.

I would call unk1 "adventurer_info" or thereabouts.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on September 08, 2013, 10:12:16 am
...
unk_1.anon_16 is the same for mental attributes, but a vector for some reason/the first 6 aren't vectors for some reason.
...

Probably related to how mental attributes are stored in the soul, and physical attributes are stored in the body. Units can have more than one soul, but only one body.
Title: Re: DFHack 0.34.11 r3
Post by: Snaake on September 08, 2013, 02:28:18 pm
My attempts to change the volume and turn off the sound through DFHack ended up with the sound only changing when I actually went to manually change the volume in-game.

It really is easy to do, though.

Code: [Select]
df.global.init.media.volume=0
You could always press escape, go to the "music and sound" menu, then click the bottom line.

Thanks, I'll try that out when I get to play again tomorrow. And yea, I'd completely forgotten about the menu screen, since I really just automatically press esc-down-enter to save most of the time, without even looking. Kinda like b-C-w, d-b-d etc. ;)
Title: Re: DFHack 0.34.11 r3
Post by: Vagabond. on September 08, 2013, 03:48:48 pm
Just a really, really stupid question:
How does one use the Simple_Embark command? My attempts to use it keeps on saying that there is no command...
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on September 09, 2013, 12:43:06 am
Has someone figured out how to pacify an invader?

I want to transform an invader into my fort's race then use makeown on it. These two parts work fine but unfortunately the unit is still an invader/hostile.

Even worse is that after the makeown, that unit will cause a loyalty cascade if freed.

I tried setting the marauder flag to false and the invasion_id to -1, but that was not enough. Any clues?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on September 09, 2013, 01:57:28 am
Has someone figured out how to pacify an invader?

I want to transform an invader into my fort's race then use makeown on it. These two parts work fine but unfortunately the unit is still an invader/hostile.

Even worse is that after the makeown, that unit will cause a loyalty cascade if freed.

I tried setting the marauder flag to false and the invasion_id to -1, but that was not enough. Any clues?

Other flags that may be connected to hostility:
active_invader
hidden_in_ambush
invader_origin
coward
hidden_ambusher
invades
underworld
resident
visitor_uninvited
Title: Re: DFHack 0.34.11 r3
Post by: A_S00 on September 09, 2013, 12:29:45 pm
Cross post from the growth bug thread:


I'm attempting to get this fix working on a pre-existing install (no LNP).  I followed Okami's guide post (http://www.bay12forums.com/smf/index.php?topic=126558.msg4315204#msg4315204) on how to manually add Kurik's fix via dfhack.  I get the confirmation message "FixGrowth: Running" when I start DF, but as soon as I load my game, my dfhack window gets spammed with error messages going by too fast for me to read.  I can't find dfhack's error log anywhere (I'm sure there is one...), but the part of the error message I can read says:

-----

onupdate cb String can't be coerced into Fixnum

...and then what looks like a line-by-line error traceback through a few files in my /hack/ruby folder.

-----

Anybody have any idea what's wrong?

If I can't get it working, I can just use Putnam's .lua fix (http://www.bay12forums.com/smf/index.php?topic=91166.msg4312699#msg4312699), but his posts in the dfhack thread seem to indicate that that one only works as an init.lua file in the raw folder for a save, and I'd prefer a fix that I didn't have to repeat each time I start a new region.

Thanks for your help!


Any ideas?  Thanks in advance...

Fixed by updating to latest release of dfhack.  Sorry for bein' dumb, and thanks for all you do!
Title: Re: DFHack 0.34.11 r3
Post by: Snaake on September 09, 2013, 03:44:41 pm
My attempts to change the volume and turn off the sound through DFHack ended up with the sound only changing when I actually went to manually change the volume in-game.

It really is easy to do, though.

Code: [Select]
df.global.init.media.volume=0
You could always press escape, go to the "music and sound" menu, then click the bottom line.

Thanks, I'll try that out when I get to play again tomorrow. And yea, I'd completely forgotten about the menu screen, since I really just automatically press esc-down-enter to save most of the time, without even looking. Kinda like b-C-w, d-b-d etc. ;)

Yea, so, total noob regarding scripting here, tried to just run the above line in dfhack, said "... is not a recognized command." Does it need to be in a script file or something? Related: is there a thread here at bay12forums, or some other resource, that you could point me to, where I could start learning dfhack scripting some more, or even lua/etc. in general?

(done some basic coding courses with c, c++, java, matlab, so other people's scripts are somewhat intelligible, but wouldn't really know how to start myself)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 09, 2013, 03:46:16 pm
It needs to be in a script or you could just run the line in the lua interactive console accessible with the "lua" command.

also, as I said, the sound only changes when you actually go to manually change the volume in-game.

https://github.com/peterix/dfhack/blob/master/Lua%20API.rst
Title: Re: DFHack 0.34.11 r3
Post by: tofof on September 09, 2013, 03:52:56 pm

It took a bit longer than I thought, but you can try this (after a good backup of course)

Spoiler: magic-shovel.lua (click to show/hide)

EDIT:  Found out that it isn't working for simple dig ...
EDIT2: Fixed part of the problem ...
EDIT3: Ahh, found the last problem.  it should now dig.
EDIT4: performance improvement, only check each tile for designations if has block.flags.designated set .. and fix a refactoring bug I made when fixing the plain dig

Is this the final version of this code?  I found your script in a repackaged collection and it wasn't really working for dig, but did for channel. For reference, the version I have contains a typo'd "varinat" variable in the findTileTypes declaration. 

I'm assuming that your edits updated the code in your spoilerblock and that the one there is the final version with all those fixes, but just want to make sure.
Title: Re: DFHack 0.34.11 r3
Post by: Snaake on September 09, 2013, 05:28:29 pm
It needs to be in a script or you could just run the line in the lua interactive console accessible with the "lua" command.

also, as I said, the sound only changes when you actually go to manually change the volume in-game.

https://github.com/peterix/dfhack/blob/master/Lua%20API.rst

Ah, yea, can confirm that now. :S
Title: Re: DFHack 0.34.11 r3
Post by: TheMole on September 10, 2013, 06:40:40 am
I am having trouble with DF Hack CreateItem not creating logs of wood. I have tried many times/combinations of tags and looked around the internet but none have the createitem code for wood. Please help.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on September 10, 2013, 10:23:29 am
How do I get workflow to only detect plant thread as I'm trying to make a workflow to make the farners workshops auto proccess plants, specifically pig tail and rope weed anyway. I'm asking because it's detecting the animal hair thread which kind of screws the range.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on September 10, 2013, 10:30:44 am
There's a plugin that will make the process plant job specifically make pig tail or rope reed thread. Just have two jobs in there, with specific workflow outputs, and you're fine.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on September 10, 2013, 11:42:27 am
I don't have any other kinds of plant to proccess and the workshops only take from the stockpile which stores the pig tail and rope weed, so that isn't the problem I'm having.

The problem that I'm having is that when I tried to do the workflow thing, it was detecting animal hair thread as well, I tried to get it to only show or count plant thread, but it didn't work, or at least the workflow order didn't seem to change. I'm not even sure if I'm doing it right anyway.

Also, I know DFhack has the plugin that fixes taking a small amount of thread from each stack of thread or yarn, but I'm still seeing the occasional piece of unusable thread/yarn that gets put back into the stockpile. The only way I can tell that they are unusable is when I have thread and yarn, but the jobs get cancelled. So is that plugin actually working? I did the command and it says it's enabled, five times in a row.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on September 10, 2013, 12:14:51 pm
Oh, I know you don't have more plants to process. The issue is that Workflow can't tell that easily.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on September 10, 2013, 12:26:00 pm
What I mean is that I'm trying to get the workflow material to only be plant material or cloth or whatever so that it doesn't see the hair thread, but it's not working, it's just not generating the workflow.

What I'm trying to do is get the workshops to automatically proccess the rope weed and pig tail but it's not working, so how do I do that.
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on September 11, 2013, 12:58:08 am


Other flags that may be connected to hostility:
active_invader
hidden_in_ambush
invader_origin
coward
hidden_ambusher
invades
underworld
resident
visitor_uninvited

Yay, it was... the coward flag that blocked the process. Thank you for the pointers.
Title: Re: DFHack 0.34.11 r3
Post by: ag on September 11, 2013, 03:01:44 am
I don't have any other kinds of plant to proccess and the workshops only take from the stockpile which stores the pig tail and rope weed, so that isn't the problem I'm having.

Stockpiles and suchlike are too complicated to check, so workflow doesn't care a bit what kind of arrangements you have. All that matters is the job itself.

Therefore what you do is first edit the job to only accept a specific kind of plant using this gui script (http://github.com/peterix/dfhack/blob/master/Readme.rst#guiworkshop-job), and only when that is done create the constraint (http://github.com/peterix/dfhack/blob/master/Readme.rst#guiworkflow).

Also, I know DFhack has the plugin that fixes taking a small amount of thread from each stack of thread or yarn, but I'm still seeing the occasional piece of unusable thread/yarn that gets put back into the stockpile. The only way I can tell that they are unusable is when I have thread and yarn, but the jobs get cancelled. So is that plugin actually working? I did the command and it says it's enabled, five times in a row.

That tweak has nothing whatsoever to do with that. What it does is actually enable custom reactions in raws to use a fraction of an item instead of a whole one. This is intended for use together with the plugin that enables coating weapons etc with stuff.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 11, 2013, 05:21:09 am
Just two quick questions:

#1. Can dfhack be used to make a reaction unique? Run it once, can't run it twice, or at least: Do not run the script behind the reaction twice. Player has "Spawn awesome something", runs it, gets item or interaction or autosyndrome triggering a script, but can only do it once per save.

#2. Can dfhack be used to simulate a GET_ITEM_FROM_REAGENT:reagent-name: token? For example in normal raws I can say: "Get a metal sword and make a new sword, based on the swords material" but I cant say: "Get a rusty steel weapon and make a steel weapon, based on the weapon-type". If I take WEAPON:NONE as a reagent it accepts any reagent, good. But if I use WEAPON:NONE as a product, it will spew out a random weapon, not the weapon-type that was used as a reagent.

This is just one example, but many new jobs would be possible this way.
Title: Re: DFHack 0.34.11 r3
Post by: Snaake on September 11, 2013, 03:28:43 pm
There's a plugin that will make the process plant job specifically make pig tail or rope reed thread. Just have two jobs in there, with specific workflow outputs, and you're fine.

I was just about to ask which one this was (had heard of it before, tbh), but found the keybind in dfhack.init on my own. Finally got tired of fiddling with my quantum rock stockpiles and give orders to the mason's workshops to get exactly the right amount of blocks/furniture out of a certain stone (yes, I can be a bit OCD about materials sometimes)! Thank you dfhack plugin writers!
Title: Re: DFHack 0.34.11 r3
Post by: RickRollYou2 on September 12, 2013, 02:07:09 am
Does anyone know if the dfusion friendship plugin will work, and if yes how?

So far I have created friendship.o but I have no idea what to put in it, and calling

plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","DWARF","HUMAN","ELF"}

generates this error:
Spoiler (click to show/hide)

Does it simply not work with Dfhack r3 now? From previous versions I am vaguely aware that there's supposed to be a races.txt, but with my limited knowledge... :-\ Many thanks to whoever knows! :)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on September 12, 2013, 02:23:10 am
Does anyone know if the dfusion friendship plugin will work, and if yes how?

So far I have created friendship.o but I have no idea what to put in it, and calling

plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","DWARF","HUMAN","ELF"}

generates this error:
Spoiler (click to show/hide)

Does it simply not work with Dfhack r3 now? From previous versions I am vaguely aware that there's supposed to be a races.txt, but with my limited knowledge... :-\ Many thanks to whoever knows! :)
hmm... you say you have created friendship.o? it should be included in hack/plugins/dfusion. The races.txt way was removed. And unfortunetly this (and that migrants plugin) is the worst maintained code.
Title: Re: DFHack 0.34.11 r3
Post by: RickRollYou2 on September 12, 2013, 03:17:59 am
Nope, just re-downloaded another DFHack r3, no friendship.o in there...

I can understand the "not being maintained" thing though, what with all the new plugins and advfort and everything :)

Still. Any suggestions on how to make it work, or must I use castes for my labour?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on September 12, 2013, 06:10:49 am
Nope, just re-downloaded another DFHack r3, no friendship.o in there...

I can understand the "not being maintained" thing though, what with all the new plugins and advfort and everything :)

Still. Any suggestions on how to make it work, or must I use castes for my labour?
Ah yes, i think i did not include it in build process or something... I'll try to fix that when i get home.
Or try this: here (https://github.com/warmist/dfhack/raw/master/plugins/lua/dfusion/friendship.o)
save it to hack/lua/plugins/dfusion/friendship.o
Title: Re: DFHack 0.34.11 r3
Post by: RickRollYou2 on September 12, 2013, 08:33:10 am
Well, there aren't any errors, but I can't seem to assign labours? Which is kinda the point, but hey. No errors. :) (Also is there a way to remove races I don't want anymore? And when do I call the lua scripts? I've been calling them every chance I get.)

EDIT: It works! I was being an idiot and not calling the right races  ::) Thanks again!

EDIT2: Well, it actually looks as though any race can be assigned labours to... Again, anyway to turn this off? Any idea if they will demand burial?

EDIT3: Welp, actually it looks like they'll only do fishing... Hm. Will need to play around more :(
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 12, 2013, 10:32:18 am
The fishing can even be done without dfhack. Any intelligent civ-member that is not the creature type of your founding civ can be assigned labors, but only fishing is done. This way I added fisher-gremlin pets to the kobold mode of my mod, but I cant explain why fishing works, and the rest not. Presumably hunting works in theory as well, but they cancel it because they wont take weapon, ammo and quivers.
Title: Re: DFHack 0.34.11 r3
Post by: SeelenJägerTee on September 12, 2013, 02:04:29 pm
Code: [Select]
df.global.world.world_data.region_details[0].elevation[x][y] = n (where n is an int)lets you set the elevation of a tile in the embark screen.
Is there something similar for volcanism?
I want to try if increasing the volcanism level of a tile makes magma tubes rise higher towards the surface.
Title: Re: DFHack 0.34.11 r3
Post by: Zavvnao on September 12, 2013, 04:22:03 pm
deleted message. sorry.
Title: Re: DFHack 0.34.11 r3
Post by: Zavvnao on September 12, 2013, 04:57:50 pm
ignore again, glitchy keyboard typing in wring place, won't happen again.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on September 12, 2013, 10:01:00 pm
Bear with me for a moment...

I've got a nice script set up that processes all the legends mode exports (Map Maker, optipng-ify, create archive for legends viewer, move to User Content folder), but for anyone who didn't know about it it's not particularly obvious that it exists. 

I'd like to set it up so that it can be run from dfhack, which enables keybinding and so on - the ideal would be if someone could expand 'exportmaps.lua' to export all legends, and I could add a processing stage; a version with a UI hint would be even better. 

And I'm stuck; I have no idea what I'm doing.  I've worked out how to call a batch file from lua, but I just get
           "<path>\mitmcaller.bat is not recognised as an internal or external command, operable program, or batch file"
... and it is a batch file, I've confirmed it's working and it's about as simple as they come.   
Code: (mitmcaller.bat) [Select]
echo off
call "%CD%\..\..\__Process Legends Exports.bat"

Is what I'm trying to do even possible?

Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 12, 2013, 10:02:55 pm
I don't think "batch file" refers to windows batch files.
Title: Re: DFHack 0.34.11 r3
Post by: Dragor on September 14, 2013, 07:55:15 am
Hi,

Is there something to differenciate all the forts we make ? Like an unique hash for each fort ? It would be to save and load data for each fort individually.

I've thinked of the hash from the concatenation of save folder, fort's name, world's name, world's seeds, but nothing unique there...
Title: Re: DFHack 0.34.11 r3
Post by: Caldfir on September 14, 2013, 09:12:42 pm
Does anybody have some experience with the assortment of "selection areas" that exist in DF?  I'm fairly close to having a workable play-through-stonesense setup, but it really won't be practical to use until you can see yourself designating rooms and placing constructions in stonesense. 

Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on September 15, 2013, 12:09:07 pm
Does anybody have some experience with the assortment of "selection areas" that exist in DF?  I'm fairly close to having a workable play-through-stonesense setup, but it really won't be practical to use until you can see yourself designating rooms and placing constructions in stonesense. 


This reminds me of the Khazad incident. Has there been a good discussion recently of how far we should go with DFHack and DF modding in general?

The other sketchy modding that I've seen recently was people editing the text strings in the exe to be different, so that the text in things like the hardcoded menus would be different. To me, at least, this kind of thing is only ethical if you limit yourself to language localization. Not that anyone has done this, but distributing modded exe files where Tarn Adams' name has been removed from the About DF and main menu pages is clearly wrong.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 15, 2013, 01:21:26 pm
Removing his name is wrong, but I don't see anything wrong with changing the embark message so it doesn't reference Dwarves.

Please don't compare this to you-know-what, we don't want Stonesense axed. It's nothing like that, it requires DF to run, it doesn't replace DF. If it ever gets to a point where it can start without having to load a save first, then we should add credit to the brothers Adams.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 15, 2013, 02:08:10 pm
I've never seen any mod that actually removes Toady's name with the localization patch. If I did, I'd probably report them...
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 15, 2013, 08:06:26 pm
Is it still possible to actually start a multi-race fort, or are the old DFusion functions axed for the time being?
Title: Re: DFHack 0.34.11 r3
Post by: Caldfir on September 15, 2013, 10:01:55 pm
Does anybody have some experience with the assortment of "selection areas" that exist in DF?  I'm fairly close to having a workable play-through-stonesense setup, but it really won't be practical to use until you can see yourself designating rooms and placing constructions in stonesense. 


This reminds me of the Khazad incident. Has there been a good discussion recently of how far we should go with DFHack and DF modding in general?

The other sketchy modding that I've seen recently was people editing the text strings in the exe to be different, so that the text in things like the hardcoded menus would be different. To me, at least, this kind of thing is only ethical if you limit yourself to language localization. Not that anyone has done this, but distributing modded exe files where Tarn Adams' name has been removed from the About DF and main menu pages is clearly wrong.

I agree completely that anything trying to remove references to Bay12 or Toady, as well as anything attempting to steal their work and become it's own entity is certainly unethical (in addition to being illegal) and should never be undertaken. 

I would, however, like to make a point here and say that nothing stonesense does, or has any aspirations of doing, could be described in this way.  All I've done is redirected a visualizer's display back to DF using the available SDL code.  If anything, this makes stonesense less like a standalone program, and more like a "complicated graphics pack" than it was before.  I do always try to be polite and curb confrontations I see on the Bay12 forums, but this post is (whether intended or not) an assault on my good name and integrity, and I'm not going to pretend not to be upset about it.  The characterization of what I've put together as "sketchy" is both ignorant and extremely offensive. 

That said, I'd rather not dwell on the matter anymore, and in stead ask again: can anyone give some information about how selection areas work, and what in DFhack would I need to look at to get stonesense able to display them?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 15, 2013, 10:54:41 pm
Quote
The other sketchy modding that I've seen recently was people editing the text strings in the exe to be different, so that the text in things like the hardcoded menus would be different. To me, at least, this kind of thing is only ethical if you limit yourself to language localization. Not that anyone has done this, but distributing modded exe files where Tarn Adams' name has been removed from the About DF and main menu pages is clearly wrong.
I have changed to main menu to show the version file of the mod (Instead of "Play Dwarf Fortress" it says "Play Masterwork Dwarf Fortress V.#) and the worldgen to (Standard) and (Recommended), to let people know which one they should use with the mod. Dont know how thats sketchy. ;)

I think total conversions can use this for a lot of things, changing the hardcoded vanilla building names to more futuristic/fitting names.

Caldfir: Hope you get it working. :)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 15, 2013, 10:58:45 pm
Is it still possible to actually start a multi-race fort, or are the old DFusion functions axed for the time being?

friendship.o isn't included in r3 for some reason, but I have a windows-compiled version in Fortbent but also here (https://dl.dropboxusercontent.com/u/13790475/friendship.o). You'll want to put it in ..\hack\lua\plugins\dfusion
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 16, 2013, 12:28:53 am
Thanks, but how do I run it?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 16, 2013, 12:47:45 am
In init.lua in the raw folder (NOT raw/objects, just raw):

Code: [Select]
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"SOMETHING","SOMETHING","OTHER_THING","ANOTHER_THING"}

And so on. Apparently, the first argument doesn't work, but repeating it should be fine.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 16, 2013, 01:16:10 am
Will the same thing work for Embark?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 16, 2013, 01:16:42 am
I haven't heard anything about embark's current syntax.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on September 16, 2013, 01:22:03 am
I haven't heard anything about embark's current syntax.
It's very similar:
Code: [Select]
plug=require"plugins.dfusion.embark"
plug.Embark:install{{"DWARF",0},{"HUMAN",-1},{"ELF",-1},{"HUMAN",0},{"ANT_MAN",0},{"ANT_MAN",0},{"ANT_MAN",0}} -- second number is caste and "-1" means random.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 16, 2013, 01:32:33 am
So, in the save file's /raw folder, I should create a lua script that contains only

Code: [Select]
plug=require"plugins.dfusion.embark"
plug.Embark:install{{"DWARF",0},{"HUMAN",-1},{"ELF",-1},{"HUMAN",0},{"HUMAN",0}} -- second number is caste and "-1" means random.
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","HUMAN","ELF","KOBOLD"}

?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 16, 2013, 01:34:37 am
You probably want -1 for all of the creatures. You'll also need 7 creatures. As it is now, you're embarking with 5 creatures: a female dwarf, a male or female human, a male or female elf and two female hhumans.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 16, 2013, 01:37:42 am
But with the right number of creatures, a lua script containing only those (corrected) lines will work?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 16, 2013, 01:40:30 am
Yeah.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 16, 2013, 01:51:52 am
Opening up the site select screen for a new Fortress mode game coughs up a very long error list in the DFhack console, starting with

...\Dwarf Fortress 0.34.11\hack\lua\plugins\dfusion.lua:145: in function 'load'
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 16, 2013, 02:15:08 am
Copy the whole thing. I'm guessing it's embark.o being missing as well, I'll see if I can get you one.

(top of window--right click -> edit -> mark -> highlight -> enter)

EDIT: embark.o (https://dl.dropboxusercontent.com/u/13790475/embark.o)
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 16, 2013, 02:32:21 am
Hey, works perfectly now. Before I had tried copying Embark.o from the "/DFusion" folder in the main directory.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 16, 2013, 05:33:50 am
Wait. So this runs on dfhack r3 and allows multi-race forts with working civ-members of different creatures?

Because with the spawnunit I can do civ-members from other races, which do not work. Do you think I can spawn a friendly goblin into my fort, and affect him with friendship, to become a true fort member? That would be awesome. Better yet would be rare migrants, but spawnunit is enough.

EDIT: Just to make sure I understand the install correctly:
I downloaded embark.o and friendship.o that were posted by putnam. I put them into hack/lua/plugins/dfusion/, which already contained a .lua version of both files.

I added a init.lua into the DwarfFortress/raw directory, which reads like this:
Code: [Select]
plug=require"plugins.dfusion.embark"
plug.Embark:install{{"DWARF",-1},{"KOBOLD",-1},{"GOBLIN",-1},{"DROW",-1},{"ELF",-1},{"HUMAN",-1},{"HUMAN",-1}} -- second number is caste and "-1" means random.
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","HUMAN","ELF","KOBOLD","DROW","GOBLIN"}

I embark... and nothing.
Title: Re: DFHack 0.34.11 r3
Post by: Askot Bokbondeler on September 16, 2013, 05:47:51 am
i haven't used it in a long time, but friendship used to support other race migrants with tweakable frequency
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on September 16, 2013, 06:01:48 am
Wait. So this runs on dfhack r3 and allows multi-race forts with working civ-members of different creatures?

Because with the spawnunit I can do civ-members from other races, which do not work. Do you think I can spawn a friendly goblin into my fort, and affect him with friendship, to become a true fort member? That would be awesome. Better yet would be rare migrants, but spawnunit is enough.
It does. But i would not recommend it. This is due to it's ultra-hacky nature. Some stuff will crash df (like interracial children have corrupt dna and they crash on birth), some will just be strange (like you CANNOT change the races that are used for friendship without df restart) and it's not as actively maintained as the rest of dfhack. So use it at your own risk. For limited number of different races i suggest trying other methods first.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 16, 2013, 06:14:38 am
Ok, I wont touch it then. I had enough of the crashes, with 2 unstable version...

I did everything I could think of using raws, and nothing worked. Your spawn-script raised high hopes again, because it allows multi-race forts. But the new races are marked as (tame), while being civ members. Is that the same with your build for the upcoming dfhack version?

I would very much like to have rare drow/gnome/elf/human/kobold migrants for the dwarf-forts, but never could get it running. I know Boltgun is looking at a similar problem, he tries to use captured invaders to make slaves, but so far it only works by transforming them into his civs creature.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on September 16, 2013, 06:22:12 am
Ok, I wont touch it then. I had enough of the crashes, with 2 unstable version...

I did everything I could think of using raws, and nothing worked. Your spawn-script raised high hopes again, because it allows multi-race forts. But the new races are marked as (tame), while being civ members. Is that the same with your build for the upcoming dfhack version?

I would very much like to have rare drow/gnome/elf/human/kobold migrants for the dwarf-forts, but never could get it running. I know Boltgun is looking at a similar problem, he tries to use captured invaders to make slaves, but so far it only works by transforming them into his civs creature.
The most attractive idea is to use job-worker replacement. E.g. have immigration officer that does "assign job" job, which in turn triggers a small script that replaces the workers from <your-race-creature> to <any-valid-civ-creature>. This works because only job assignment checks if unit is correct race, but if they somehow get the job they perform it.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 16, 2013, 10:05:08 am
To get the friendship to work, you need to put the init.lua script in the save's raw folder, and have the .o files in /hack/lua/plugins/dfusion. Seriously, make sure those are in the right locations.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 16, 2013, 11:31:12 am
HugoLuman: Didnt knew about the save folder raws... I put it into the main raw folder, I try... but if warmist says that it might lead to crashes, I better not. ;)

Ok, I wont touch it then. I had enough of the crashes, with 2 unstable version...

I did everything I could think of using raws, and nothing worked. Your spawn-script raised high hopes again, because it allows multi-race forts. But the new races are marked as (tame), while being civ members. Is that the same with your build for the upcoming dfhack version?

I would very much like to have rare drow/gnome/elf/human/kobold migrants for the dwarf-forts, but never could get it running. I know Boltgun is looking at a similar problem, he tries to use captured invaders to make slaves, but so far it only works by transforming them into his civs creature.
The most attractive idea is to use job-worker replacement. E.g. have immigration officer that does "assign job" job, which in turn triggers a small script that replaces the workers from <your-race-creature> to <any-valid-civ-creature>. This works because only job assignment checks if unit is correct race, but if they somehow get the job they perform it.
Thats for single jobs? So a dwarf goes to a custom workshop, doing one job, to assign another job to a foreign migrant? Somehow I dont see the benefit. If it would do a labor, like "activate mining" for the migrant, and he will do mining from then on, that would be great. Or, I misunderstood you.

Anyway, with Rendermax, DiggingInvaders, SpawnUnit, my UI, Spacefox&ObsidianSoul tilesets, and my own ideas... I have enough to do for 3 months at least. If I do find the time.

EDIT: Well, I tested it anyway, but it didnt work... doesnt matter. But since I am here already: Is there a way to raise the embark skills a dwarf has? Currently he gets 10 in total, with 5 points max per skill... is there any way to raise that, so people can do a legendary skilled dwarf?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on September 16, 2013, 03:27:43 pm
Code: [Select]
{name="Mount",f=function (unit_list,pos)

horse=getCreatureAtPointer()
for k,unit_rider in pairs(unit_list) do
if unit_rider.pos.x==horse.pos.x and unit_rider.pos.y==horse.pos.y
and unit_rider.pos.z==horse.pos.z then --check if they are on the same tile
horse.general_refs:insert("#",{new=df.general_ref_unit_riderst,unit_id=unit_rider.id})
unit_rider.relations.rider_mount_id=horse.id
unit_rider.flags1.rider=true
horse.flags1.ridden=true
  require("utils").insert_sorted(df.global.world.units.other.ANY_RIDER,unit_rider,"id")
break -- make it only one rider mounts horse
end
end
return true
end},
collab with anga, warmist to bring you MOUNTS
toss this baby into Companion order and it will work.
here's a more simple mount code so that you don't have to shove a companion on top of another unit
Code: [Select]
{name="Mount",f=function (unit_list,pos)

horse=getCreatureAtPointer()
for k,unit_rider in pairs(unit_list) do
--if unit_rider.pos.x==horse.pos.x and unit_rider.pos.y==horse.pos.y
--and unit_rider.pos.z==horse.pos.z then --check if they are on the same tile
horse.general_refs:insert("#",{new=df.general_ref_unit_riderst,unit_id=unit_rider.id})
unit_rider.relations.rider_mount_id=horse.id
unit_rider.flags1.rider=true
horse.flags1.ridden=true
  require("utils").insert_sorted(df.global.world.units.other.ANY_RIDER,unit_rider,"id")
break -- make it only one rider mounts horse
end
--end
return true
end},
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 16, 2013, 03:41:22 pm
Imma just real quick translate for you guys

Put that code into the companion order lua and it will allow you to ride stuff in adventure mode (I'm pretty sure).
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 16, 2013, 03:43:23 pm
Huzzah!
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on September 16, 2013, 04:32:23 pm
Imma just real quick translate for you guys

Put that code into the companion order lua and it will allow you to ride Carry stuff on your back in adventure mode (I'm pretty sure).
due to how riders are being a rider in adventure mode will lock you out of controls until you use dfhack to remove the rider flag. but now you could set companions to ride wagon creatures and have the wagon creature be pulled by animals.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on September 17, 2013, 01:10:00 pm
Is there some way of having an 'untubefill' command? I'd like to carefully carve around all the adamantine splinters in the most aesthetically pleasing way possible, but to do that I'd have to either reveal the tubes fully or spend a lot of time mapping out each level before force-quitting and making up a final design.

If the 'tubefill' command were reversible, I could reveal the whole area without revealing where it becomes hollow.

Alternatively, some sort of range function on 'digl'. It can be used to outline each level of the spire, but in the process will set pretty much the whole z-level to be dug.
Title: Re: DFHack 0.34.11 r3
Post by: kingubu on September 17, 2013, 05:12:11 pm
I don't understand what your situation is, so this may be a stupid answer.

"reveal hell", designate your digging while paused, and then "unreveal".
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on September 17, 2013, 05:37:43 pm
I don't want to see where the hollow part of the spire starts.

Edit: Thought of another way of doing with what I have: change the colours around so that both the adamantine and the hollow tiles are black, but the stone around them isn't.
Title: Re: DFHack 0.34.11 r3
Post by: ab9rf on September 18, 2013, 10:15:06 pm
Autolabor is pretty awesome, but the ignore-on-burrow plays hell with civilian alerts.
No, it doesn't.  A dwarf is only excluded if s/he is personally assigned to a burrow.  Civilian alerts are handled differently and do not trigger the exclusion code.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 19, 2013, 12:27:22 am
A manual / how to for the mount/rider script would be nice. :)
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 19, 2013, 12:36:38 am
If you use createitem PET to make a non-vermin creature, is there a way to get it to stop acting like a vermin?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 19, 2013, 12:42:35 am
No, but warmist made a spawn script and putnam ported it to dfhackr3 to spawn non-vermin creatures. Its in beta stage, so some issues with body-material, attacks and old-age might occur.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 19, 2013, 12:50:17 am
I don't care. I have discovered that if you spawn elves this way, cats will chase them down and eat them.

But can I get a link for the most recent version of this script?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 19, 2013, 12:56:11 am


Dont ask me which one works better, both are ok. I noticed small/set bodysizes with warmists, and dying-of-old-age with putnams.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 19, 2013, 12:58:29 am
Warmist's is better. Do not use mine. It causes a memory leak.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 19, 2013, 01:06:20 am
Good that I use yours in my mod then :P
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 19, 2013, 01:12:47 am
Any way to prevent this dying of old age?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 19, 2013, 01:16:30 am
Don't use creatures with low MAX_AGEs.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 19, 2013, 01:23:15 am
Define "low"
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 19, 2013, 01:24:48 am
my kobolds are 25 years, and insta-die.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 19, 2013, 01:37:39 am
Is 100 years low?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 19, 2013, 01:53:25 am
Try setting it to 2 billion or something. I have a weird feeling "low" here means "within any given set of numbers".

If so, I'll see what can be done.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 19, 2013, 01:54:11 am
I've got a creature with 80:120 max age. Sometimes is survives, sometimes not.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 19, 2013, 02:04:23 am
Found it:

Code: [Select]
unit.relations.old_year=math.random(caste.misc.maxage_min,caste.misc.maxage_max)
This sets the year of death to be between the minimum MAXAGE and maximum MAXAGE.

It doesn't care what the current year is.

So, if it's year 50, no dwarves will die of old age if they're spawned. If it's year 90, ~50% will. If it's year 250, 100% will.

The line should be this:

Code: [Select]
unit.relations.old_year=math.random(caste.misc.maxage_min,caste.misc.maxage_max)+df.global.cur_year
Here's a fixed version:
Code: [Select]
--create unit at pointer or given location. Usage e.g. "spawnunit DWARF 0 Dwarfy"
 
--Made by warmist, but edited by Putnam for the dragon ball mod to be used in reactions
 
--note that it's extensible to any autosyndrome reaction to spawn anything due to this; to use in autosyndrome, you want \COMMAND spawnunit CREATURE caste_number name \LOCATION
 
args={...}
function getCaste(race_id,caste_id)
    local cr=df.creature_raw.find(race_id)
    return cr.caste[caste_id]
end
function genBodyModifier(body_app_mod)
    local a=math.random(0,#body_app_mod.ranges-2)
    return math.random(body_app_mod.ranges[a],body_app_mod.ranges[a+1])
end
function getBodySize(caste,time)
    --todo real body size...
    return caste.body_size_1[#caste.body_size_1-1] --returns last body size
end
function genAttribute(array)
    local a=math.random(0,#array-2)
    return math.random(array[a],array[a+1])
end
function norm()
    return math.sqrt((-2)*math.log(math.random()))*math.cos(2*math.pi*math.random())
end
function normalDistributed(mean,sigma)
    return mean+sigma*norm()
end
function clampedNormal(min,median,max)
    local val=normalDistributed(median,math.sqrt(max-min))
    if val<min then return min end
    if val>max then return max end
    return val
end
function makeSoul(unit,caste)
    local tmp_soul=df.unit_soul:new()
    tmp_soul.unit_id=unit.id
    tmp_soul.name:assign(unit.name)
    tmp_soul.race=unit.race
    tmp_soul.sex=unit.sex
    tmp_soul.caste=unit.caste
    --todo skills,preferences,traits.
    local attrs=caste.attributes
    for k,v in pairs(attrs.ment_att_range) do
       local max_percent=attrs.ment_att_cap_perc[k]/100
       local cvalue=genAttribute(v)
       tmp_soul.mental_attrs[k]={value=cvalue,max_value=cvalue*max_percent}
    end
    for k,v in pairs(tmp_soul.traits) do
        local min,mean,max
        min=caste.personality.a[k]
        mean=caste.personality.b[k]
        max=caste.personality.c[k]
        tmp_soul.traits[k]=clampedNormal(min,mean,max)
    end
    unit.status.souls:insert("#",tmp_soul)
    unit.status.current_soul=tmp_soul
end
function CreateUnit(race_id,caste_id)
    local race=df.creature_raw.find(race_id)
    if race==nil then error("Invalid race_id") end
    local caste=getCaste(race_id,caste_id)
    local unit=df.unit:new()
    unit.race=race_id
    unit.caste=caste_id
    unit.id=df.global.unit_next_id
df.global.unit_next_id=df.global.unit_next_id+1
if caste.misc.maxage_max==-1 then
unit.relations.old_year=-1
else
unit.relations.old_year=math.random(caste.misc.maxage_min,caste.misc.maxage_max)+df.global.cur_year
end
unit.sex=caste.gender
    local body=unit.body
   
    body.body_plan=caste.body_info
    local body_part_count=#body.body_plan.body_parts
    local layer_count=#body.body_plan.layer_part
    --components
    unit.relations.birth_year=df.global.cur_year
    --unit.relations.birth_time=??
   
    --unit.relations.old_time=?? --TODO add normal age
    local cp=body.components
    cp.body_part_status:resize(body_part_count)
    cp.numbered_masks:resize(#body.body_plan.numbered_masks)
    for num,v in ipairs(body.body_plan.numbered_masks) do
        cp.numbered_masks[num]=v
    end
   
    cp.body_layer_338:resize(layer_count)
    cp.body_layer_348:resize(layer_count)
    cp.body_layer_358:resize(layer_count)
    cp.body_layer_368:resize(layer_count)
    cp.body_layer_378:resize(layer_count)
    local attrs=caste.attributes
    for k,v in pairs(attrs.phys_att_range) do
        local max_percent=attrs.phys_att_cap_perc[k]/100
        local cvalue=genAttribute(v)
        unit.body.physical_attrs[k]={value=cvalue,max_value=cvalue*max_percent}
        --unit.body.physical_attrs:insert(k,{new=true,max_value=genMaxAttribute(v),value=genAttribute(v)})
    end
 
    body.blood_max=getBodySize(caste,0) --TODO normal values
    body.blood_count=body.blood_max
    body.unk_494=0 --infection level
    unit.status2.body_part_temperature:resize(body_part_count)
    for k,v in pairs(unit.status2.body_part_temperature) do
        unit.status2.body_part_temperature[k]={new=true,whole=10067,fraction=0}
       
    end
    --------------------
    local stuff=unit.enemy
    stuff.body_part_878:resize(body_part_count) -- all = 3
    stuff.body_part_888:resize(body_part_count) -- all = 3
    stuff.body_part_relsize:resize(body_part_count) -- all =0
 
    --TODO add correct sizes. (calculate from age)
local size=caste.body_size_2[#caste.body_size_2-1]
body.physical_attr_tissues[0]=size
body.physical_attr_tissues[1]=size
body.physical_attr_tissues[2]=math.pow(size,0.666)
body.physical_attr_tissues[3]=math.pow(size,0.666)
    body.physical_attr_tissues[4]=math.pow(size*10000,0.333)
body.physical_attr_tissues[5]=math.pow(size*10000,0.333)

    stuff.were_race=race_id
    stuff.were_caste=caste_id
    stuff.normal_race=race_id
    stuff.normal_caste=caste_id
    stuff.body_part_8a8:resize(body_part_count) -- all = 1
    stuff.body_part_base_ins:resize(body_part_count)
    stuff.body_part_clothing_ins:resize(body_part_count)
    stuff.body_part_8d8:resize(body_part_count)
    unit.recuperation.healing_rate:resize(layer_count)
    --appearance
   
    local app=unit.appearance
    app.body_modifiers:resize(#caste.body_appearance_modifiers) --3
    for k,v in pairs(app.body_modifiers) do
        app.body_modifiers[k]=genBodyModifier(caste.body_appearance_modifiers[k])
    end
    app.bp_modifiers:resize(#caste.bp_appearance.modifier_idx) --0
    for k,v in pairs(app.bp_modifiers) do
        app.bp_modifiers[k]=genBodyModifier(caste.bp_appearance.modifiers[caste.bp_appearance.modifier_idx[k]])
    end
    --app.unk_4c8:resize(33)--33
    app.tissue_style:resize(#caste.bp_appearance.style_part_idx)
    app.tissue_style_civ_id:resize(#caste.bp_appearance.style_part_idx)
    app.tissue_style_id:resize(#caste.bp_appearance.style_part_idx)
    app.tissue_style_type:resize(#caste.bp_appearance.style_part_idx)
    app.tissue_length:resize(#caste.bp_appearance.style_part_idx)
    app.genes.appearance:resize(#caste.body_appearance_modifiers+#caste.bp_appearance.modifiers) --3
    app.genes.colors:resize(#caste.color_modifiers*2) --???
    app.colors:resize(#caste.color_modifiers)--3
   
    makeSoul(unit,caste)
   
    df.global.world.units.all:insert("#",unit)
    df.global.world.units.active:insert("#",unit)
    --todo set weapon bodypart

local num_inter=#caste.body_info.interactions
unit.curse.anon_5:resize(num_inter)
unit.curse.anon_6:resize(num_inter)
    return unit
end
function findRace(name)
for k,v in pairs(df.global.world.raws.creatures.all) do
if v.creature_id==name then
return k
end
end
qerror("Race:"..name.." not found!")
end
function PlaceUnit(race,caste,name,position)
local pos=position or copyall(df.global.cursor)
if pos.x==-30000 then
qerror("Point your pointy thing somewhere")
end
race=findRace(race)
local u=CreateUnit(race,tonumber(caste) or 0)
u.pos:assign(pos)
if name then
u.name.first_name=name
u.name.has_name=true
end
u.civ_id=df.global.ui.civ_id
 
local desig,ocupan=dfhack.maps.getTileFlags(pos)
if ocupan.unit then
ocupan.unit_grounded=true
u.flags1.on_ground=true
else
ocupan.unit=true
end
--createNemesis(u)
end
function createFigure(trgunit)
    local hf=df.historical_figure:new()
    hf.id=df.global.hist_figure_next_id
    hf.race=trgunit.race
    hf.caste=trgunit.caste
    df.global.hist_figure_next_id=df.global.hist_figure_next_id+1
    hf.name.first_name=trgunit.name.first_name
    hf.name.has_name=true
 
 
    df.global.world.history.figures:insert("#",hf)
    return hf
end
function createNemesis(trgunit)
    local id=df.global.nemesis_next_id
    local nem=df.nemesis_record:new()
    nem.id=id
    nem.unit_id=trgunit.id
    nem.unit=trgunit
    nem.flags:resize(1)
    nem.flags[4]=true
    nem.flags[5]=true
    nem.flags[6]=true
    nem.flags[7]=true
    nem.flags[8]=true
    nem.flags[9]=true
    --[[for k=4,8 do
        nem.flags[k]=true
    end]]
    df.global.world.nemesis.all:insert("#",nem)
    df.global.nemesis_next_id=id+1
    trgunit.general_refs:insert("#",{new=df.general_ref_is_nemesisst,nemesis_id=id})
    trgunit.flags1.important_historical_figure=true
    local gen=df.global.world.worldgen
    nem.save_file_id=gen.next_unit_chunk_id;
    gen.next_unit_chunk_id=gen.next_unit_chunk_id+1
    gen.next_unit_chunk_offset=gen.next_unit_chunk_offset+1
   
    --[[ local gen=df.global.world.worldgen
    gen.next_unit_chunk_id
    gen.next_unit_chunk_offset
    ]]
    nem.figure=createFigure(trgunit)
end
 
local argPos
 
if #args>3 then
argPos={}
argPos.x=args[4]
argPos.y=args[5]
argPos.z=args[6]
end
 
PlaceUnit(args[1],args[2],args[3],argPos) --Creature (ID), caste (number), name, x,y,z for spawn.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 19, 2013, 02:14:40 am
Awesome! Now there are no restrictions on what to spawn!

Does it always crash when spawning a creature with a name in quotes?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 19, 2013, 02:16:09 am
Its doesnt for me. names in quotes I use for names that include space.

And awesome, thanks for the fix. And it explains why I can spawn kobolds in my 1-10 year old testforts, but get reports about them dying for some people.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 19, 2013, 04:42:23 am
Now just to figure out how to give item quality to spawned items, or even better, give them names...

Theoretically, would an Artifact ice weapon be unmeltable?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 19, 2013, 04:48:13 am
Dont know about the ice, but you can do quality items like this:

Make a unit that instanly dies, which has an itemcorpse with a quality, spawn it with the script. Voila, items with specific quality.
Title: Re: DFHack 0.34.11 r3
Post by: ab9rf on September 19, 2013, 07:15:15 am
If you use createitem PET to make a non-vermin creature, is there a way to get it to stop acting like a vermin?
No, because a non-vermin creature is supposed to be a unit, not an item, and createitem creates items, not units.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 19, 2013, 12:02:34 pm
Already answered, though
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on September 19, 2013, 02:13:48 pm
You can give orders to the mount through Companion order, though currently the mount will move only a set feat you need to set both the adventurer's and the mount's path destination for any chance of the mount to move in that direction. sadly my dire lion mount died from a pack of coyotes before I could take it on a test drive around the city.
Title: Re: DFHack 0.34.11 r3
Post by: SeelenJägerTee on September 19, 2013, 02:38:55 pm
Where can I find documentation about the DF data structures.
I know that df.global.world.world_data.region_details[0].elevation[X][Y] controls the elevation of a certain tile, because someone wrote in a forum post.
However what else contains df.global.world.world_data..... ?
What command in the lua console would display me the contents?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 19, 2013, 02:41:24 pm
printall(struct or vector or table or what-have-you)
Title: Re: DFHack 0.34.11 r3
Post by: Eric Blank on September 19, 2013, 04:34:53 pm
Dumb question here, but where do you install that spawnunits script and call it up in DFhack?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 19, 2013, 04:48:07 pm
scripts folder
Title: Re: DFHack 0.34.11 r3
Post by: Eric Blank on September 19, 2013, 05:35:06 pm
Thanks! It appears to be working now, although their birthdate is apparently the 1st of granite of the current year, which means come next spring they will revert to children, or maybe babies?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on September 20, 2013, 04:35:16 pm
Theoretically, would an Artifact ice weapon be unmeltable?
No, it would not - Artifacts are only immune to wear (and thus cannot burn away), but they are still totally capable of melting.
Title: Re: DFHack 0.34.11 r3
Post by: SeelenJägerTee on September 21, 2013, 06:29:17 am
I wanted to set Workflow to keep a certain amount of coke.
So I set the "Make coke from lignite" job on repeat.
gui/workflow opens up the workflow constraints window, when I press [shift]+[A] the new window appears where I can select either "bars of coal" or "bars of any material".
When I select "bars of coal" dfhack console gives an error message:
Code: [Select]
Cannot find material: COAL:COKE
...r35\Dwarf Fortresss 0.34.11\hacks\scripts/gui/workflow.lua:950: invalid constraint : BAR//COAL:COKE
stack traceback:
     [C]: in function 'setConstraint'
     ...r35\Dwarf Fortresss 0.34.11\hacks\scripts/gui/workflow.lua:950: in function 'saveConstraint'
     ...r35\Dwarf Fortresss 0.34.11\hacks\scripts/gui/workflow.lua:980: in function 'on_select'
     ... LNP r35\Dwarf Fortress 0.34.11\hack\lua\gui\dialogs.lua:193: in function 'on_submit'
     ... LNP r35\Dwarf Fortress 0.34.11\hack\lua\gui\widgets.lua:576: in function 'submit'
     ... LNP r35\Dwarf Fortress 0.34.11\hack\lua\gui\widgets.lua:588: in function 'onInput'
     ... isErrant LNP r 35\Dwarf Fortress 0.34.11\hack\lua\gui.lua:472: in function 'inputToSubviews'
     ... LNP r35\Dwarf Fortress 0.34.11\hack\lua\gui\dialogs.lua:224: in function <... LNP r 35\Dwarf Fortress 0.34.11\hack\lua\gui\dialogs.lua:217>
     [C]: in ?
Obviously it has some problems with the coke bar. I guess it is a known issue, but I thought I will post it just in case.
Title: Re: DFHack 0.34.11 r3
Post by: SeelenJägerTee on September 21, 2013, 12:18:37 pm
Doublepost but I think, this may be interesting for some other people as well.

In the lua console with:
Code: [Select]
printall(df.global.world.world_data.region_details[0].features[X][Y]you get a list of all the features. It's just numbers (let's call them n) from 0 to m and the corresponding address.

With
Code: [Select]
printall(df.global.world.world_data.region_details[0].features[X][Y][n]you can display this structures.
E.g you get something like this.
Code: [Select]
-> printall(df.global.world.world_data.region_details[0].features[9][13][0])
feature_idx      = 66
layer              = -1
region_tile_idx  = -1
min_z             = -30000
max_z            = -30000
unk_c             = <coord2d[]: 0x148ea2f0>
unk_28           = 0
seed              = 3771020645
unk_30           = <BitArray<>: 0x148ea310>
unk_38           = <int16_t[]:0x148ea318>
top_layer_idx  = -1

-> printall(df.global.world.world_data.region_details[0].features[9][13][1]
feature_idx      = -1
layer              = 23
region_tile_idx  = 18
min_z             = 130
max_z            = 134
unk_c             = <coord2d[]:0x148e77d0>
unk_28           = 0
seed              = 2425933355
unk_30           = <BitArray<>: 0x148e77f0>
unk_38           = <int16_t[]:0x148e77f8>
top_layer_idx  = 0
So it happened that tile [9][13] showed an volcano on the embark-screen. There were 4 features similar to the second one in my example that hat "top_layer_idx" from 0 (shown) to 4. I assumed this were the cave layers 1, 2 and 3, the HFS and perhaps the magma sea.
This would leave the first entry for the volcano.

I embarked on this site and used reveal to show me the map. I noticed that [10][14] has a magma tube, that I guessed would be
Code: [Select]
-> printall(df.global.world.world_data.region_details[0].features[9][13][0])
feature_idx      = 83
layer              = -1
region_tile_idx  = -1
min_z             = -30000
max_z            = -30000
unk_c             = <coord2d[]: 0x0a97bc70>
unk_28           = 0
seed              = 1039045029
unk_30           = <BitArray<>: 0x0a97bc90>
unk_38           = <int16_t[]:0x0a97bc98>
top_layer_idx  = 1
At the point of testing I didn't realize that the top_layer idx was 1 for this and not -1. I assumed volcano / magma tube would always have -1 well wrong I was.
I then proceeded to use
Code: [Select]
df.global.world.world_data.region_details[0].features[9][13][0] = 83and voila the volcano disappeared on the embark screen.
Code: [Select]
df.global.world.world_data.region_details[0].features[10][14][0] = 66made an volcano appear on the other tile.

And indeed. After embarking the volcano and the magma tube had changed their positions.

I checked some other volcanoes in this world two had feature_idx = 66 and one 65 and another one 61.
So it appears to me that this is what controls weather it is a volcano or not.
For obvious reasons checking of Magma tubes is harder as you don't see them pre embark I had one with 69 on [9][15] in my experimental embark.
I'd like to say that it probably is related to embark depth or something like that. But my initial embark is flat, there was one volcano with 66, one magma tube with 83 and one with 69. But the 69 tube was actually LOWER than the 83 tube. So there is no easy to see relationship between height/embark depth and the feature_idx value.

This method should enable you to convert magma tubes to surface volcanoes. However if you have no volcano somewhere near your desired location you would probably have to use a brute-force attempt and guess numbers until it appears on the embark-screen. This happens to be difficult as you would have to enter somewhere around 100 numbers and when I tried it DF stopped responding at 89 or something like that.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on September 23, 2013, 01:13:39 am
oh hey guys I found out how to play as any race in adventure mode with out use of raw manipulation.
(http://www.truimagz.com/host/fortcrush2/dd6/discover-something.png)
 so... now I can finally play as a Toolkit, or a scarecrow, or a wagon at the start of the game.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 23, 2013, 01:15:47 am
Aaaand now it's time to right a script for that, huh?

Heck, to add to it, here's the info I found about viewscreen_setupadventurst:

some info for viewscreen_setupadventurest: anon_5 is skill points allowed to be allocated. anon_12 is attribute points. Both are remaining, not total. unk1.anon_4 is unit skills after allocation. unk1.anon_1 is adventurer unit's name.

unk1.anon_10 through unk1.anon_15 are physical attributes, on a scale from 0 to 6 (very low to superior). unk_1.anon_16 is the same for mental attributes, but a vector for some reason/the first 6 aren't vectors for some reason.

unk1.anon_3 is the adventurer unit's caste; unk1.anon_2 his/her race.

anon_2 appears to be... a name. It's currently "ekantz", which is a beforan name in Fortbent. Not sure what the name represents; perhaps it was the default first name.

I would call unk1 "adventurer_info" or thereabouts.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on September 23, 2013, 01:49:53 am
Aaaand now it's time to right a script for that, huh?

Heck, to add to it, here's the info I found about viewscreen_setupadventurst:

some info for viewscreen_setupadventurest: anon_5 is skill points allowed to be allocated. anon_12 is attribute points. Both are remaining, not total. unk1.anon_4 is unit skills after allocation. unk1.anon_1 is adventurer unit's name.

unk1.anon_10 through unk1.anon_15 are physical attributes, on a scale from 0 to 6 (very low to superior). unk_1.anon_16 is the same for mental attributes, but a vector for some reason/the first 6 aren't vectors for some reason.

unk1.anon_3 is the adventurer unit's caste; unk1.anon_2 his/her race.

anon_2 appears to be... a name. It's currently "ekantz", which is a beforan name in Fortbent. Not sure what the name represents; perhaps it was the default first name.

I would call unk1 "adventurer_info" or thereabouts.
so I decided to see if this also the same for fort mode.
surprisingly
(http://www.truimagz.com/host/fortcrush2/dd6/forgotten-fortress.png)
yeah the game didn't instant crumble the fort when I swap the Civ race id to forgottenbeasts though there is a difference between Play now and preparing due to preparing creates new units which draws from the Civ's race id.
how I did this is using gm-editor's get cur viewscreen when you move where you want to embark, then editing the available civs's race id at the start then prepare for journey.
well time to test if I can run a fort with nothing but forgotten beasts.

edit: uhh what happens when 7 forgotten beasts grow unhappy?
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 23, 2013, 01:52:08 am
Is it possible to alter the climate temperature of my map?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on September 23, 2013, 02:17:09 am
continue report on Forgotten fort, I figure out how to give them labors. didn't help
and the group finally snap into deep depression.
(http://www.truimagz.com/host/fortcrush2/dd6/aww-poor-moss-beast.png)
They have no hands and they want to fight.

So will the 7 miserable beasts hold on emotionally until migrants arrive? Will I learn what just happens when the entire fort falls to moods?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 23, 2013, 02:25:50 am
Yeah, they're gonna die :P

(did I ever mention that your illustrated exploits in hacking DF are my favorite things ever)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on September 23, 2013, 02:31:02 am
poor beasts, not only they are forgotten, but also so unhappy :D
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on September 23, 2013, 02:54:34 am
I got a migrant a peasant and a Butcher, no names, the butcher also brought pets, but all the FB's started to die off so I just retired the fort.

When I started back again I notice I can't select the civ again, so uhh yeah now I have a mountain home which is just nothing but miserable 4 legged Moss beasts and a Civ made up of them.
hope any dwarves love to see a caravan of disgruntled FB's willing to trade their moss for mechanical Arms.
note to self figure out how to make more Civs so that I can run more test forts.

edit: okay time to see if I can start a new Civ by reclaiming the old fort,
oh wait what's that oh my urist
(http://www.truimagz.com/host/fortcrush2/dd6/ggghost-beasts.png)
well guys we got Funghosts. Good thing being a ghost means you don't gain any cool interactions.
Title: Re: DFHack 0.34.11 r3
Post by: HyphyHonkey on September 23, 2013, 08:40:35 am
Hey, was wondering if anyone knew how to spawn a creature you can interact with via DFhack. There's a lot of strange behavior with the "pet" version that ends up creating un-trainable, un-claimed "tame" creatures.
Title: Re: DFHack 0.34.11 r3
Post by: CaptainArchmage on September 23, 2013, 04:09:20 pm
I've found the make-monarch command. Is there a way to DFhack in a replacement for the Baron, Count, or Duke?
Title: Re: DFHack 0.34.11 r3
Post by: Pink Photon on September 23, 2013, 04:55:09 pm
Can you use DFHack to start a beekeeping industry when your embark has no colonies? Either a way to spawn a colony, or to create live bees inside a hive?
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 23, 2013, 07:03:33 pm
Hey, was wondering if anyone knew how to spawn a creature you can interact with via DFhack. There's a lot of strange behavior with the "pet" version that ends up creating un-trainable, un-claimed "tame" creatures.

Asked the same question not 2 days ago, try the spawnunit script. Details ~3 pages ago.
Title: Re: DFHack 0.34.11 r3
Post by: Clatch on September 23, 2013, 07:10:17 pm
I've never really gotten into DFHack before until I started using the new MacNewbie pack.  I have Dwarf Therapist, which is an amazing program.  But most of the time, I just enjoy throwing DF in full screen mode and toning down the lights.  All the extra screens and utilities give me a headache - and remind me too much of work.  ;D

That said, I'm using the Dwarf Therapist-style plugin (not sure what you'd call it) that's part of DFHack.  It has pretty much all the features I was interested in anyway with Dwarf Therapist.  Awesome!
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on September 23, 2013, 08:33:47 pm
okay figured out what all those forgotten beast went insane.
Toady one coded in a script on top of clothes that makes it so that any civ with no clothes will take a hit in happiness each tick and FB doesn't have any clothes to wear thus they start going insane.
Title: Re: DFHack 0.34.11 r3
Post by: HyphyHonkey on September 24, 2013, 05:09:57 am
Hey, was wondering if anyone knew how to spawn a creature you can interact with via DFhack. There's a lot of strange behavior with the "pet" version that ends up creating un-trainable, un-claimed "tame" creatures.

Asked the same question not 2 days ago, try the spawnunit script. Details ~3 pages ago.

So I tried saving the script in a text editor, changing file type to lua, placing it in scripts.

I can spawn creatures, but apparently I end up with "tame" yet not tame animals. I was hoping for something the creates a proper wild hostile kinda' unit spawner. One that can actually be trained.

EDIT: Seemed reloading fixed some things.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on September 24, 2013, 09:43:46 am
That said, I'm using the Dwarf Therapist-style plugin (not sure what you'd call it) that's part of DFHack.  It has pretty much all the features I was interested in anyway with Dwarf Therapist.  Awesome!
That would be Dwarf Manipulator, the Labor Manager (written by yours truly). If you think there are any other features missing that wouldn't be too hard to implement, by all means post them here.
Title: Re: DFHack 0.34.11 r3
Post by: CLA on September 24, 2013, 11:04:59 am
If you think there are any other features missing that wouldn't be too hard to implement, by all means post them here.

Now that you say it, there are a few things I would be grateful to see.

Regarding the happiness indicator; If you could choose to only see a colored symbol (I guess the standard smiley or maybe a solid square) instead of the exact number, that would be great.
Similarly, I would prefer to not see the exact amount of experience of the selected dwarf. So instead of "Talented Woodcutter (260/1100)", just "Talented Woodcutter".
I guess it could be implemented as option to toggle between a detailed and not so detailed view.


Another thing:
My graphic set uses custom tiles for the military professions, but lets the game determine the color. In Dwarf Manipulator, these are shown as white. It would be nice if it could check if the graphics are set to AS_IS or ADD_COLOR and in that case add the color itself.
For the civilian professions, I use the default smiley symbol. But for consistency I think it would be nice if they would be shown, properly colored anyway.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 24, 2013, 12:01:15 pm
Is it possible to alter the climate temperature of my map?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 25, 2013, 06:53:55 am
And another question: Is it possible to add or extend EVIL/GOOD biomes to caverns?
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 25, 2013, 12:35:20 pm
They take the alignment of the region above them, I think.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 25, 2013, 12:46:56 pm
They dont. All underground grasses, plants, trees and creatures ignore GOOD/EVIL token.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 25, 2013, 01:15:00 pm
Except, Goblins get trolls no matter where they settle, while dwarves don't ever get trolls, because they use underground animals but ALSO evil ones.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 25, 2013, 02:36:59 pm
Yes, but trolls appear in every biome, ignoring good/evil. This is what Meph is talking about.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 25, 2013, 02:51:31 pm
Yes, but the game doesn't ignore the tag, as it can still be used for distributing pets.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 25, 2013, 03:03:14 pm
That's not relevant to Meph's question.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 25, 2013, 03:26:41 pm
I am mostly asking, because plants (grasses and the like, that give the cavern their look) ignore the biomes tokens. GOOD underground grasses grow in every cavern, be it good, neutral, or evil. Same for neutral ones, same for evil ones.

It would be nice if I could make the caverns change their look, just like the surface changes, and allows special trees, like the feather (good) and glumprong (Evil).
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 25, 2013, 04:57:39 pm
Unfortunately, each layer of the Caverns is uniform throughout. I suppose you could do alignment themed layers, though.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 25, 2013, 05:27:12 pm
I do have:
Cavern 1 => Green moss with purple/cyan giant mushrooms.
Cavern 2 => Crystals and Glass, bright cyan and bright blue glass thorn and crystal trees.
Cavern 3 => Grey floor tiles (grass), and totem-like nethertrees and blueish nether-creeper/vines.

They are already distincly different, I was just asking if I can do this somehow:
Good mossy cavern 1, with healing mushrooms and moss that gives bonus strength to grazers.
Evil mossy cavern 1, with poisonous mushooms and moss that makes grazers go berserk.

Similar ideas for cavern 2 and 3. Would make embarks more fun. :)
Title: Re: DFHack 0.34.11 r3
Post by: SeelenJägerTee on September 26, 2013, 12:54:00 pm
The bodysize of a dwarf determines what weapons he can use one-handed/two-handed.
DT tells me all dwarfes were 60000.
So where do I find the body size of the dwarf.
I guess i'd find it somewhere under "gui/gm-editor -> body" but I can't find it.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 26, 2013, 02:00:25 pm
blood_max and physical_attr_tissues.AGILITY are both body size in decimeters.
Title: Re: DFHack 0.34.11 r3
Post by: SeelenJägerTee on September 26, 2013, 02:20:17 pm
Thanks a lot.
Title: Re: DFHack 0.34.11 r3
Post by: IRIS_EYE_AZURE on September 27, 2013, 04:44:34 pm
Can Lua coroutines be used in user scripts (scripts directory, or game save init.lua)?

Potential use would be limit computation time per game tick for scripts such as Putnam's itemsyndrome.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 27, 2013, 04:59:15 pm
Eh, why not. I'll try it out.

EDIT: Itemsyndrome kinda requires access to a single gamestate for the duration of operation. Having it yield after every single unit would be awkward-appearing in-game. However, it would be pretty nice in different scripts, like my various Fortbent ones.
Title: Re: DFHack 0.34.11 r3
Post by: Pink Photon on September 27, 2013, 09:46:01 pm
I'm trying to change a log into a tower-cap log. When I use the command

changeitem here m PLANT:TOWER_CAP

it says

change denied:subtype doesn't match. use 'force' to override.

Doing so results in a "tower-cap plant log". How would I make a regular "tower-cap log"?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 27, 2013, 10:21:19 pm
You forgot WOOD.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on September 27, 2013, 10:24:30 pm
I'm trying to change a log into a tower-cap log. When I use the command

changeitem here m PLANT:TOWER_CAP

it says

change denied:subtype doesn't match. use 'force' to override.

Doing so results in a "tower-cap plant log". How would I make a regular "tower-cap log"?

You forgot WOOD.
Specifically, you want PLANT_MAT:TOWER_CAP:WOOD.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 28, 2013, 12:31:22 am
Can Lua coroutines be used in user scripts (scripts directory, or game save init.lua)?

Potential use would be limit computation time per game tick for scripts such as Putnam's itemsyndrome.

Sorta related:

Code: [Select]
local function checkAllUnitsForIdleMagicExperienceAndGiveThemMagicSpells() --long-ass function name
local delayCounter = 1
for k,unit in ipairs(df.global.world.units.active) do
if unitHasMagicSkill(unit) then
dfhack.timeout(delayCounter,"ticks",function() iterateSkill(unit) end)
dfhack.timeout(delayCounter+1,"ticks",function() assignSpells(unit) end)
delayCounter = delayCounter+2
end
end
end

This function gives each unit 2 ticks to do its thing. I think this should minimize the FPS impact, or at least reduce noticeable lag. I'm warming up to itemsyndrome using a similar system, since I realized that you're probably not going too many units in active to work with within, say, 150 ticks if you give each tick 5-10 units.
Title: Re: DFHack 0.34.11 r3
Post by: ag on September 28, 2013, 01:08:48 am
Can Lua coroutines be used in user scripts (scripts directory, or game save init.lua)?

Everything called from the console actually already runs in a coroutine. Also:

https://github.com/peterix/dfhack/blob/master/library/lua/gui/script.lua (https://github.com/peterix/dfhack/blob/master/library/lua/gui/script.lua)
Title: Re: DFHack 0.34.11 r3
Post by: Eric Blank on September 28, 2013, 01:54:26 am
I've been having an issue with migrants from other players' forts (on a succession game) showing up in awful moods and/or already being insane. Using the 'ls' command in the dfhack console I was able to find a plugin that removes the bad thoughts, leaving some of the dwarves healthy and happy once again, but I couldn't find a command that allows one to "cure" insanity. Is there no such command in there, or did I just gloss over it 2-3 times?

If there isn't already a command for it, does anyone have a script that will work as a plugin?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on September 28, 2013, 03:03:34 am
Can Lua coroutines be used in user scripts (scripts directory, or game save init.lua)?

Potential use would be limit computation time per game tick for scripts such as Putnam's itemsyndrome.

Since I took interest, warmed up, then immediately worked on it and loved the results, thank you and here's the implementation:

Code: [Select]
local function findItems()
    local unitDelay=1
    local numberOfUnitsToWorkOnAtOnce = math.ceil((#df.global.world.units.active*2)/delayTicks) --should end up so that it takes slightly less than half the delayTicks to work on every unit
    if itemsyndromedebug then print(numberOfUnitsToWorkOnAtOnce) end
    if numberOfUnitsToWorkOnAtOnce~=0 then --an "index out of bounds" error happens without this
        for _uid=0,#df.global.world.units.active-1 do --note that this for loop runs all at once; the syndrome assignment is delayed until later, but the assignment of ticks on which they happen is all in one tick
            local unit=df.global.world.units.active[_uid]
            dfhack.timeout(unitDelay,"ticks",function()
                for i=1,numberOfUnitsToWorkOnAtOnce do --this is the meat of it; without this, it could cause a situation where every tick involves a unit being checked, as opposed to ~20-50% as it is now.
                    applySyndromesBasedOnItems(_uid,unit)
                    _uid=_uid+1
                end
            end
            )
            unitDelay=unitDelay+1
        end
    end
end

The FPS losses as number of units increase is minimal; diminishing returns makes it a moot point past delayTicks*1.5 active units.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on September 28, 2013, 05:40:58 am
okay back from civ messing to release a script to allow you to play as any civ, which means you could start a bandit camp, gobbo fort, elven resort, kobold cave, batman den, snake pit, Demon fort. though you have to reapply the script each time you want to play that civ, and depending on the entity raws you could end up with scrapping for supplies with no trade option and no military. play now nets you folks from the civ than created ones so if you parked a bunch of zombies in Town of Ghoulville and you play as them expect zombies as citizens, oh and the game doesn't crash if your entire group is consider a pet though you need to give orders via dwarf manipulator.

Code: [Select]
function addaciv()
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[112],"id")
end
To use this you need to be on the world map where you can choose your civ, this will add an additional civ to that list.
now to change the civ you need to edit 112 to any number you want.
well off to struggle playing a hamlet civ.
Title: Re: DFHack 0.34.11 r3
Post by: IRIS_EYE_AZURE on September 28, 2013, 01:06:02 pm
Can Lua coroutines be used in user scripts (scripts directory, or game save init.lua)?

Potential use would be limit computation time per game tick for scripts such as Putnam's itemsyndrome.

Since I took interest, warmed up, then immediately worked on it and loved the results, thank you and here's the implementation:

... code deleted ...

The FPS losses as number of units increase is minimal; diminishing returns makes it a moot point past delayTicks*1.5 active units.

Glad I was able to spark an idea...

And ag, thanks for the pointer to script.lua
Title: Cleaning map tiles
Post by: tofof on September 28, 2013, 11:49:53 pm
I noticed that spotclean doesn't actually clean up the 'debris' graphic (left by broken arrows, bolts, catapult shots, etc), but that clean map does.

This struck me as odd, given that the help claims that spotclean "Works like 'clean map snow mud', but only for the tile under the cursor."

Investigating the behavior, I noticed that the spotclean function sets spatter amounts to zero, whereas the cleanmap function erases all 'events' on the block.  From the indexing, I'm guessing cleanmap operates on a 256-tile block at a time.

Is the different functionality by design?  If so, it'd be great to be able to spotclean ammunition debris. If not, perhaps the documentation should be updated.

Title: Re: DFHack 0.34.11 r3
Post by: Treah on September 30, 2013, 01:29:18 am
fixdiplomats and fixmerchants works with existing worlds. You only need to run them once per world however.


:)
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 30, 2013, 10:52:12 am
You know what we need? A script to separate bone and wool stacks, so we can actually get a decent number of crafts out of that dragon bone(323) instead of just 4, or more than 1 yarn out of an entire sheep.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 30, 2013, 03:32:56 pm
Vanilla bone crafts actually work fine and respect stacks... for custom reactions I have a silly workaround, I made a helm, its enabled in the entity, can only be made of bone, and is called "(separate)". So people open the craftsdwarf, go to the bone menu, and can make "bone (separate)" which can then be used one by one in custom reactions. Its an extra workstep, but you can use every single bone of the stack this way.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on September 30, 2013, 06:36:22 pm
However, people still use an entire stack of wool to make a single yarn thread.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on September 30, 2013, 06:40:24 pm
I am not saying that using dfhack to fix the stack bug is a bad idea (I suggested that as well at some point, but Quietust explained why it wouldnt work), but you can do this:

Code: [Select]
[REACTION:CLEAN_WOOL]
[NAME:comb a fleece]
[BUILDING:TANNER:CUSTOM_E]
[REAGENT:A:1:NONE:NONE:NONE:NONE][USE_BODY_COMPONENT][UNROTTEN]
[HAS_MATERIAL_REACTION_PRODUCT:WOOL_MAT]
[PRODUCT:100:3:THREAD:NONE:GET_MATERIAL_FROM_REAGENT:A:NONE]
[SKILL:TANNER]
[AUTOMATIC]
Make your own wool-spinning reaction that gives more then 1 thread. Its the same with skin and leather, that can be fixed in a similar fashion, taking the creatures bodysize into account.
Title: Re: DFHack 0.34.11 r3
Post by: Drakeero on October 02, 2013, 11:46:57 am
I don't wish to disturb the current conversation too much but I am suddenly very interested in use of the "tweak makeown" command.  A particular embark had a great number of various creature people wandering around the surface and I picked a number of them up after seeing someone mention that they were able to assign them labors and actually have them perform the duties.

It's not going quite as smoothly for me, then again I'm probably not as skilled in screwing around with things like other people.  Is this actually possible?  Can a tweaked make-own perform various labors or is there a catch like the labors must correspond with any applicable tokens in the creature-man's RAWs?

Any pitfalls that might not be common knowledge?  (For some reason a pair of swallow people froze in the air and stopped moving - their friends are moving just fine after being recruited.)
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on October 02, 2013, 12:07:07 pm
To assign labors, you must switch your CURRENT_RACE to the species in question using DFusion, then switch back once done.
Title: Re: DFHack 0.34.11 r3
Post by: Drakeero on October 02, 2013, 12:21:12 pm
To assign labors, you must switch your CURRENT_RACE to the species in question using DFusion, then switch back once done.

Are you sure this is required?

By using the original labor interface (not the DFHack one) I was able to enable fishing labors for some of the otter people - and they seem to be ferociously good at it.  I have them working a stream which hopefully shouldn't suffer that extinction problem because there's a small food pile that's already full of pond turtles and raw mussels.  However, with the exception of hauling their catch, no specific hauling labors for otter or swallow people in general seem to be happening.
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on October 02, 2013, 10:23:01 pm
Fishing can be done by intelligent pets and even ghosts in rare circumstances. This is because it is an "idle job", a job which is performed by otherwise idling dwarves, that requires no tools or ability to grasp.

Hunting, another idle job, can be initiated by intelligent pets, but then immediately cancelled because they don't have a crossbow or any ammo, because they can't pick anything up.

Every other job will require you to temporarily change your current race or look around to see if there is a way to get the friendship plug-in to work again. Though friendship can be buggy at times, so I wouldn't recommend it.

The reason that the swallow-men are stuck is because of how flight path-finding works. Since there is no land path for them to take, they won't move. I'm not sure how to fix this without hurting them, unfortunately.
Title: Re: DFHack 0.34.11 r3
Post by: Drakeero on October 03, 2013, 01:49:47 am
Ah, alright.  So you still can't quite recruit (or enslave) others yet.  At least not effectively.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 03, 2013, 02:08:54 am
I do it by changing their civ alignments and transforming them into a generic caste of the civ creature.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on October 03, 2013, 07:11:18 am
or just switch around the fort's civ race.
Title: Re: DFHack 0.34.11 r3
Post by: ElenaRoan on October 04, 2013, 12:37:07 am
My apologies if this is in the wrong place, searching didn't show me a specific thread for it.

My question is in regards to the burrow command, I'd like to be able to remove tiles of an evil alignment from a burrow; is there a way to do this other than manually?
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on October 04, 2013, 06:49:40 pm
Is there a working version of that Marriage script anywhere?

EDIT: I've fixed the script. Why was it "anon_1" anyway? Changed that to "target_hf"


Code: [Select]

-- Marries two specified creatures.  Take care when using this on creatures that are already married!

function marry (victim1, victim2)

local historic_victim1
local historic_victim2

if df.isnull(victim1) then
print('The first unit was not found.')
return
end
if df.isnull(victim2) then
print('The second unit was not found.')
return
end

if victim1.relations.spouse_id ~= -1 then
print('Warning: the first unit is already married.  Their marriage will be replaced.')
end
if victim2.relations.spouse_id ~= -1 then
print('Warning: the second unit is already married.  Their marriage will be replaced.')
end

print("Marrying " .. victim1.name.nickname .. " and " .. victim2.name.nickname)

for key, value in pairs(df.global.world.history.figures) do
if value.id == victim1.hist_figure_id then
historic_victim1 = value
end
if value.id == victim2.hist_figure_id then
historic_victim2 = value
end
end

if df.isnull(historic_victim1) then
print('The historical figure for the first unit was not found.')
return
end
if df.isnull(historic_victim2) then
print('The historical figure for the second unit was not found.')
return
end

local new_link1 = df.histfig_hf_link_spousest:new()
local new_link2 = df.histfig_hf_link_spousest:new()

-- Not documented, but this is the historical figure id
new_link1.target_hf = victim2.hist_figure_id
new_link1.link_strength = 100

new_link2.target_hf = victim1.hist_figure_id
new_link2.link_strength = 100

local link_count1 = #historic_victim1.histfig_links
local link_count2 = #historic_victim2.histfig_links

historic_victim1.histfig_links:resize(link_count1 + 1)
historic_victim1.histfig_links[link_count1] = new_link1
historic_victim2.histfig_links:resize(link_count2 + 1)
historic_victim2.histfig_links[link_count2] = new_link2

victim1.relations.spouse_id = victim2.id
victim2.relations.spouse_id = victim1.id
end

unit_1 = dfhack.gui.getSelectedUnit()
if unit_1 == nil then
print ("You must place the cursor over the first target.")
return
end

print("Target second unit and press enter")
test = dfhack.lineedit("")

unit_2 = dfhack.gui.getSelectedUnit()
if unit_2 == nil then
print ("You must place the cursor over the second target.")
return
end

dfhack.with_suspend(marry, unit_1, unit_2)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 04, 2013, 07:20:57 pm
It was anon_1 because it was written in DFHack 0.34.11r2.

I'd already posted a fixed version here, I thought?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on October 04, 2013, 07:27:23 pm
I love how the units for marriage are called victim in the script. ^^ Maybe people can build a chapel and use a reaction to marry civ-members. ;)
Title: Re: DFHack 0.34.11 r3
Post by: chronomad on October 05, 2013, 07:41:21 pm
New user here, bear with me :)

I've been trying to change the caste of an existing dwarf in masterwork using dfhack by changing its caste property like so:

unit.caste = 37

37 being an example. This is the casteid I found for a wrestler caste (querying other units with unit.caste as well). When I change it, I see the change reflected in the "thoughts" screen for the unit in the game. However, as soon as I unpause the game, I get an announcement "Dwarf_Name, Profession has transformed into a dwarf!" and if I check the thoughts screen, the caste is no longer there.

Any help appreciated, thank you :)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 05, 2013, 07:52:46 pm
You'll want to change unit.enemy.normal_caste; doing this will cause a transformation message, but the transformation is permanent and works perfectly.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on October 05, 2013, 07:59:57 pm
Does that work for race as well?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 05, 2013, 08:01:41 pm
Yeah.
Title: Re: DFHack 0.34.11 r3
Post by: chronomad on October 05, 2013, 08:06:26 pm
You'll want to change unit.enemy.normal_caste; doing this will cause a transformation message, but the transformation is permanent and works perfectly.

Works like a charm. Much appreciated. Odd how it works. If I wanted to find more info on unit properties where could I go? Thanks again :)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 05, 2013, 08:28:04 pm
https://github.com/peterix/df-structures/blob/master/df.units.xml
Title: Re: DFHack 0.34.11 r3
Post by: ElenaRoan on October 05, 2013, 11:45:15 pm
no response to my question? not even an "impossible"?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on October 06, 2013, 10:45:16 pm
Some things I discovered when examining the combat calculations:
https://github.com/angavrilov/df-structures/blob/master/df.items.xml#L164

Code: [Select]
"item::vtable","1","0x148","0x4","vmethod","getVolume","int32_t","" <- the total volume of the piece of armor is also used as the armor's thickness (weapon penetration distance)

"item::vtable","1","0x304","0x4","vmethod","getBaseWeight","int32_t","" <- actually appears to get the SIZE/10 of the item. This is used along with the stack size by getVolume to calculate volume. Density only comes into play in code outside of the vmethod.

"item::vtable","1","0x360","0x4","vmethod","vmethod216","",""  <- determines the volume of armor being struck (i.e. the volume under the contact area of the weapon)

"item::vtable","1","0x364","0x4","vmethod","vmethod217","",""  <- checks an armor item for STRUCTURAL_ELASTICITY_* related flexibility (i.e. mail, clothing)

"item::vtable","1","0x368","0x4","vmethod","vmethod218","",""  <- checks an armor item for STRUCTURAL_ELASTICITY_WOVEN_THREAD related capping of SHEAR values (i.e. clothing)

Also re-discovered (as was found in that bolt properties thread) how armor thickness scales with volume, but body part thickness scales with the cube root of volume. It looks unintended on Toady's part, since armor and clothing for giant creatures is absurdly thick and massive.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 08, 2013, 03:18:06 am
Can Lua coroutines be used in user scripts (scripts directory, or game save init.lua)?

Everything called from the console actually already runs in a coroutine. Also:

https://github.com/peterix/dfhack/blob/master/library/lua/gui/script.lua (https://github.com/peterix/dfhack/blob/master/library/lua/gui/script.lua)

uh

error loading module 'gui.script' from file '..\hack\lua\gui\script.lua':
        ..\hack\lua\gui\script.lua:157: ')' expected (to close '(' at line 156) near '='

which is caused by this:

function showMaterialPrompt(title, prompt)
    require('gui.materials').MaterialDialog{
        frame_title = title,
        prompt = prompt,
        on_select = mkresume(true,
        on_cancel = mkresume(false),
        on_close = qresume(nil)
    }:show()
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on October 08, 2013, 01:56:53 pm
 (http://www.truimagz.com/host/fortcrush2/dd6/mount-control-fancy-image.png) (https://gist.github.com/Rumrusher/6888984)
Behold the fancy way for adventurers to move around on their mounts. the script comes with 7 controls and one that sets the mount for control.  You need the mount script (http://www.bay12forums.com/smf/index.php?topic=91166.msg4610068#msg4610068) to be able to use this properly, also to get off the mount you just need to travel.
warning if you mount say a ghost you will ride through solid rock and beware of magma also flyers are kinda crazy with pathing and will fly high and low also mount might run to fight wild animals or run from them.
edit: or you could use this mount script. (https://gist.github.com/Rumrusher/6903877)
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on October 08, 2013, 11:45:04 pm
In light of dfterm3 looking pretty stable...  Is it possible to pass dfhack commands from a GUI popup in DF itself? 

There are search bars and so on which can take text, and I imagine it's possible to somehow pass this back to run as a command - displaying the some output as the console would be cool but plain input is enough to open up new horizons for dfterm.  As it stands, you can't (eg) enable workflow or use autodump without having set up keybindings for them beforehand; and while Falconne's keybinding list plugin is cool I don't binding everything possible is a good answer. 

Is this even possible?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 09, 2013, 12:18:05 am
It's possible to run scripts, but I don't know about plugins.
Title: Re: DFHack 0.34.11 r3
Post by: ag on October 09, 2013, 01:02:39 am
The problem with using df itself for input is that plugins expect that they are running on a different thread and using a completely separate input system, so some may do stuff like lock the game state mutex and wait for input. This is a big deadlock hazard.
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on October 10, 2013, 05:04:20 pm
I'm assuming you were thinking of running commands through the web interface. This wouldn't necessarily require running them through the DF interface - a separate prompt could be set up fairly easily to run simple commands from the web interface, but I don't know if interactive I/O would be possible (basically, commands using the command line like "tiletypes" would be tricky).
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on October 10, 2013, 06:53:18 pm
I'm assuming you were thinking of running commands through the web interface. This wouldn't necessarily require running them through the DF interface - a separate prompt could be set up fairly easily to run simple commands from the web interface, but I don't know if interactive I/O would be possible (basically, commands using the command line like "tiletypes" would be tricky).

If it's possible to pass commands from a dfterm client, that's a big improvement - you can (eg) toggle workflow, force sieges, turn on auto-whatever, etc.  Full interactive I/O would be very nice, but even input alone would be pretty nice. 
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 10, 2013, 07:05:06 pm
Related:

DFHack-run works fine for connecting to the DFHack console, however, it does not have the ability to connect over a network, and this is intentional, as a security feature. If you want that ability, you need to modify the source to allow connections to and from other computers.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on October 10, 2013, 09:30:51 pm
Does anyone know how I could target a worker with removebadthoughts.rb ? I can run "removebadthoughts all" without problem, but not "removebadthoughts him" while using autosyndrome, because it only get a location, not the unit id, as a target.

In the end, I would like a reaction that removes the bad thoughts from the worker. Any ideas?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 10, 2013, 10:04:18 pm
I think what Meph is saying is that every script should have an option to include a unit ID as an argument :P

(I've started doing it because it's really convenient)
Title: Re: DFHack 0.34.11 r3
Post by: ag on October 11, 2013, 02:08:45 am
If it's possible to pass commands from a dfterm client, that's a big improvement - you can (eg) toggle workflow, force sieges, turn on auto-whatever, etc.  Full interactive I/O would be very nice, but even input alone would be pretty nice.

It's easy to run commands from a c++ plugin, you just need to implement the color_ostream interface to feed the output wherever you need it, and then call the command (https://github.com/peterix/dfhack/blob/master/library/RemoteTools.cpp#L714). Making sure you don't mess up access to whatever mutexes you use and cause a deadlock is on you though. :P Also, when commands and scripts want to output text from background handlers and suchlike, they use the true console directly, so you won't get that output.

For interactive commands it would be necessary to introduce some kind of abstract interactive_ostream interface too (or add the necessary methods to color_ostream); currently that is still baked in into the normal console class.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 12, 2013, 01:36:57 am
This code

Code: [Select]
local function fusion(reaction,unit,input_items,input_reagents,output_items,call_native)
    local tbl={}
    for k,u in ipairs(df.global.world.units.active) do
local name=dfhack.TranslateName(dfhack.units.getVisibleName(u))
if name=="" then name="?" end
if (df.global.gamemode==1 and u.race==df.global.world.units.active[0].race) or (df.global.gamemode==0 and dfhack.units.isDwarf(u) and dfhack.units.isCitizen(u)) then table.insert(tbl,{name,nil,u}) end
end
table.sort(tbl,function(a,b) return getPowerLevel(a[3])>getPowerLevel(b[3]) end)
    script.start(function()
local unitsToFuse={}
local f=function(name,C)
table.insert(unitsToFuse,C[3])
script.mkresume(true)
end
repeat
dialog.showListPrompt("Unit Selection","Choose first Saiyan to fuse (by power level)",COLOR_WHITE,tbl,f)
script.wait()
dialog.showListPrompt("Unit Selection","Choose second Saiyan to fuse (by power level)",COLOR_WHITE,tbl,f)
script.wait()
if unitsToFuse[1]==unitsToFuse[2] then unitsToFuse[1]=nil unitsToFuse[2]=nil unitsToFuse={} end
until unitsToFuse[1] and unitsToFuse[2] and unitsToFuse[1]~=unitsToFuse[2]
fuseUnits(unitsToFuse[1],unitsToFuse[2])
end)
call_native.value=false
end

Produces this error

Code: [Select]
...\Dwarf Fortress\Mods\Dragon Ball\hack\lua\gui\script.lua:46: Not in a gui scr
ipt coroutine.
stack traceback:
        [C]: in function 'error'
        ...\Dwarf Fortress\Mods\Dragon Ball\hack\lua\gui\script.lua:46: in function 'getinst'
        ...\Dwarf Fortress\Mods\Dragon Ball\hack\lua\gui\script.lua:68: in function 'mkresume'
        ...Fortress\Mods\Dragon Ball/data/save/region5/raw/init.lua:277: in function 'on_select'
        ...Dwarf Fortress\Mods\Dragon Ball\hack\lua\gui\dialogs.lua:193: in function 'on_submit'
        ...Dwarf Fortress\Mods\Dragon Ball\hack\lua\gui\widgets.lua:576: in function 'submit'
        ...Dwarf Fortress\Mods\Dragon Ball\hack\lua\gui\widgets.lua:588: in function 'onInput'
        ...y Games\Dwarf Fortress\Mods\Dragon Ball\hack\lua\gui.lua:472: in function 'inputToSubviews'
        ...Dwarf Fortress\Mods\Dragon Ball\hack\lua\gui\dialogs.lua:224: in function <...Dwarf Fortress\Mods\Dragon Ball\hack\lua\gui\dialogs.lua:217>
        [C]: in ?

The error says that this:
Code: [Select]
local f=function(name,C)
table.insert(unitsToFuse,C[3])
script.mkresume(true)
end

Is not a gui script coroutine.

I'm not sure why. I've tried 5 different completely hackish solutions (none of which I'm proud of), culminating in this:

Code: [Select]
local function fusion(reaction,unit,input_items,input_reagents,output_items,call_native)
    local tbl={}
    for k,u in ipairs(df.global.world.units.active) do
local name=dfhack.TranslateName(dfhack.units.getVisibleName(u))
if name=="" then name="?" end
if (df.global.gamemode==1 and u.race==df.global.world.units.active[0].race) or (df.global.gamemode==0 and dfhack.units.isDwarf(u) and dfhack.units.isCitizen(u)) then table.insert(tbl,{name,nil,u}) end
end
table.sort(tbl,function(a,b) return getPowerLevel(a[3])>getPowerLevel(b[3]) end)
local unitsToFuse={}
local f=function(name,C)
end
repeat
script.showListPrompt("Unit Selection","Choose first Saiyan to fuse (by power level)",COLOR_WHITE,tbl,function() table.insert(unitsToFuse,C[3]) local inst = getinst() return curry(invoke_resume, inst, inst.gen, false) --[[yeah I had to make it an in-line function to work... but it still doesn't]] end)
script.showListPrompt("Unit Selection","Choose second Saiyan to fuse (by power level)",COLOR_WHITE,tbl,function() table.insert(unitsToFuse,C[3]) local inst = getinst() return curry(invoke_resume, inst, inst.gen, false) end)
if unitsToFuse[1]==unitsToFuse[2] then unitsToFuse[1]=nil unitsToFuse[2]=nil unitsToFuse={} end
until unitsToFuse[1] and unitsToFuse[2] and unitsToFuse[1]~=unitsToFuse[2]
fuseUnits(unitsToFuse[1],unitsToFuse[2])
call_native.value=false
end

Combined with editing gui.scripts from this:

Code: [Select]
function showListPrompt(title, text, tcolor, choices, min_width, filter)
    dlg.ListBox{
        frame_title = title,
        text = text,
        text_pen = tcolor,
        choices = choices,
        frame_width = min_width,
        with_filter = filter,
        on_select = mkresume(true),
        on_cancel = mkresume(false),
        on_close = qresume(nil)
    }:show()

    return wait()
end

to this:

Code: [Select]
function showListPrompt(title, text, tcolor, choices, on_select, min_width, filter)
    dlg.ListBox{
        frame_title = title,
        text = text,
        text_pen = tcolor,
        choices = choices,
        frame_width = min_width,
        with_filter = filter,
        on_select = on_select,
        on_cancel = mkresume(false),
        on_close = qresume(nil)
    }:show()

    return wait()
end

And none of it's working.

Am I misunderstanding some basic aspect of the code (https://github.com/peterix/dfhack/blob/master/library/lua/gui/script.lua)? The example given is too basic for me to work with, given what I'm doing. Reading the prompts reveals that they are apparently only capable of resuming the script and showing the user various prompts that do nothing, so it's not really useful. Am I overcomplicating asking for two inputs?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on October 12, 2013, 02:19:29 am
It basically says what is wrong: it's not in gui script coroutine. The script thingies are designed to run in gui screens.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 12, 2013, 02:25:17 am
So then I have a better question:

Quote
Am I overcomplicating asking for two inputs?

Also, has anyone ever... used... the script code? I mean, there's a typo on github right now that prevents it from working in r3, an unclosed paren on line 156. I had to manually edit that to get it to work in the first place.
Title: Re: DFHack 0.34.11 r3
Post by: ag on October 12, 2013, 04:04:01 am
Am I misunderstanding some basic aspect of the code (https://github.com/peterix/dfhack/blob/master/library/lua/gui/script.lua)? The example given is too basic for me to work with, given what I'm doing. Reading the prompts reveals that they are apparently only capable of resuming the script and showing the user various prompts that do nothing, so it's not really useful. Am I overcomplicating asking for two inputs?

Yes, you are utterly misunderstanding how coroutines work. You are not supposed and should not edit anything in script. This is how you are supposed to use it:

Code: [Select]
local ok, name, C = script.showListPrompt("Unit Selection","Choose first Saiyan to fuse (by power level)",COLOR_WHITE,tbl)
if ok then table.insert(unitsToFuse,C[3]) end

Some details may be wrong, but this is how it works.
         
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 12, 2013, 04:11:38 am
Ok, cool!

This is why when I do anything I feel is stupid, I do it in a test copy far away from the master copy of the mod I'm working on.
Title: Re: DFHack 0.34.11 r3
Post by: ag on October 12, 2013, 04:27:36 am
A good analogy to understand coroutines in more conventional terms is think that code can execute in two role contexts: coroutine (similar to a thread in a cooperatively multitasking os) and supervisor (non-threaded os kernel that chooses which thread runs). The confusing thing about lua is that those roles can only exist in your mind and aren't separated in any way by the actual interpreter.

Thus, you can imagine that the code executes like that:


(In a real os with separate address spaces script.showListPrompt would probably execute in kernel mode, but scheduled on the application thread.)

The main thing the script.lua does actually is keeping a counter to make all mkresume closures for a specific thread expire once a wait returns: you don't want resuming some other wait with unexpected return values if the gui screen glitches out and calls the closure multiple times.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on October 12, 2013, 04:44:01 pm
https://github.com/angavrilov/df-structures/blob/master/df.projectile.xml#L22
Projectile flag unk6 is set when objects are thrown during tantrums that will hit friendly creatures in the projectile's path.

https://github.com/angavrilov/df-structures/blob/master/df.projectile.xml#L54
Projectile unk22 is the speed or velocity used on non-parabolic (older-code) projectiles.
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on October 12, 2013, 04:52:21 pm
is it possible to make it rain blood without going to a evil biome using dfhack
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 12, 2013, 04:55:48 pm
https://github.com/angavrilov/df-structures/blob/master/df.projectile.xml#L22
Projectile flag unk6 is set when objects are thrown during tantrums that will hit friendly creatures in the projectile's path.

That's absolutely wonderful.

is it possible to make it rain blood without going to a evil biome using dfhack


It's an interaction effect. It's likely possible, but I'm not sure how it could be done.
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on October 12, 2013, 05:20:41 pm
https://github.com/angavrilov/df-structures/blob/master/df.projectile.xml#L22
Projectile flag unk6 is set when objects are thrown during tantrums that will hit friendly creatures in the projectile's path.

That's absolutely wonderful.

is it possible to make it rain blood without going to a evil biome using dfhack


It's an interaction effect. It's likely possible, but I'm not sure how it could be done.
can you show me a example of the interaction effect
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 12, 2013, 05:27:31 pm
Code: [Select]
[I_TARGET:C:MATERIAL]
[IT_MATERIAL:MATERIAL:INORGANIC:IRON:WEATHER_FALLING_MATERIAL]
[I_EFFECT:MATERIAL_EMISSION]
[IE_TARGET:C]
[IE_INTERMITTENT:WEEKLY]

Also, is there a good way to get rid of a unit without killing the unit?
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on October 12, 2013, 05:40:17 pm
last thing make me a interaction that makes it rain blood everywhere and forever because i'm get mad at no pink/purple evil biome that actcely rain nonething please
Title: Re: DFHack 0.34.11 r3
Post by: Meph on October 12, 2013, 09:53:56 pm
Code: [Select]
[I_TARGET:C:MATERIAL]
[IT_MATERIAL:MATERIAL:INORGANIC:IRON:WEATHER_FALLING_MATERIAL]
[I_EFFECT:MATERIAL_EMISSION]
[IE_TARGET:C]
[IE_INTERMITTENT:WEEKLY]

Also, is there a good way to get rid of a unit without killing the unit?
I second the two question above. A script that can start non-standard rains (inorganic:id:weather_falling_mat) just like weather rain or weather snow would be amazing. Truly amazing. Mages let it rain fire, a dark ritual scares away invaders with rains of blood, a boon of armok is a rain of beer.

The other, removing creatures without killing them: Godsend to get rid of migrants. "Go back home"-reaction, deletes migrant and all items in his inventory, no bad thoughts.

Both would be great to see. :)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 12, 2013, 10:19:13 pm
Hmm. Setting unit.flags1.dead to true seems to make the unit disappear with no negative consequences after a short time, but I didn't test long.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on October 13, 2013, 02:06:36 am
Could you copy flags or other settings from a caravan to cause the unit to walk off the map at the end of the season? Might as well let the game clean up properly for you.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on October 13, 2013, 02:07:54 am
Hmm. Setting unit.flags1.dead to true seems to make the unit disappear with no negative consequences after a short time, but I didn't test long.
uhh about that... while that's true that kinda opens up to them coming back as ghosts(or coming back after you accidentally use a HEAL ALL CIV command). your better off flipping the merchant flag or using the delete unit flags.
fake edit:Warning - while you were typing a new reply has been posted. You may wish to review your post.
oh man
Title: Re: DFHack 0.34.11 r3
Post by: Meph on October 13, 2013, 02:17:50 am
That does sound like its possible :)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 13, 2013, 02:29:50 am
Could you copy flags or other settings from a caravan to cause the unit to walk off the map at the end of the season? Might as well let the game clean up properly for you.

I'm looking for something instant, is the issue. I'll keep that in mind, though.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on October 13, 2013, 11:51:49 am
Could you copy flags or other settings from a caravan to cause the unit to walk off the map at the end of the season? Might as well let the game clean up properly for you.

I'm looking for something instant, is the issue. I'll keep that in mind, though.

If you could find a way to teleport the unit to the map edge and then trigger whatever settings are necessary to have the unit leave immediately (probably borrow from leaving diplomats) it would appear to be instant.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on October 13, 2013, 11:58:56 am
I'd be ok with a "leave the map, even if the unit has to walk to the map-edge" script. ;)
Title: Re: DFHack 0.34.11 r3
Post by: Deon on October 15, 2013, 11:20:13 pm
Hello there friends! I've been away from modding for too long. Could someone like Meph who is everywhere and knows everything update me on some new cool scripts which could be used for amazing feats of modding which appeared during the last 1-2 months? I already noticed Rendermax, but it has its own thread.

Sometimes there's some really grand script hidden in a single barely noticeable post.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 16, 2013, 12:02:31 am
Spawnunit. (https://gist.github.com/warmist/6542463)

Heck, for easier searching and future-proofing, this is now the post you're going to see in a search.

DFHack spawn unit spawnunit spawn-unit unit spawning reaction r3 create unit with reaction
Title: Re: DFHack 0.34.11 r3
Post by: Deon on October 16, 2013, 12:18:15 am
Woah, amazing. I've also noticed Rumrusher's script to control mounts in adventure mode. Honestly, I did not expect anything less from Rumrusher.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on October 16, 2013, 01:32:54 am
Check out the librarytrain in my hack/scripts folder... i do all my skill training with it. There is also a script to feed grazers, convert  captured invaders, train animal skills (like training a dog in biting or melee combat), the spawnunit can be used tl spawn friendly FBs and Demons, hire-guard allows to bribe caravan guards to stay in your fort, and you know putnams scripts. i also have some to change embark dwarves and points, you can emark with 100 dwarves and 250000 points if you wanted to. Growthbug fix is also very important. oh, and what do you say about digging invaders and FBs? :)
Title: Re: DFHack 0.34.11 r3
Post by: Deon on October 16, 2013, 04:19:04 am
I am more interested in combining spawn unit and riding scripts to make mount summons for adventure mode right now.

Digging invaders is something I considered as an option too.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on October 16, 2013, 11:49:26 am
Woah, amazing. I've also noticed Rumrusher's script to control mounts in adventure mode. Honestly, I did not expect anything less from Rumrusher.
oh you might miss the discovery of changing or adding new Civ types into the Embark state allowing you to play different races or different Civs.
Code: [Select]
function addaciv()
local testciv=df.global.world.entities.all
--df.viewscreen_choose_start_sitest.available_civs:insert("#",{new=df.global.world.entities.all,112})
  --require("utils").insert_sorted(df..available_civs,df.global.world.entities.all[1],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[112],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[302],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[234],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[134],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[32],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[274],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[47],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[16],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.local_sites,df.global.world.world_data.sites[747],"id")
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().parent.available_civs,df.global.world.entities.all[427],"id")
  --require("utils").insert_sorted(dfhack.gui.getCurViewscreen().viewscreen_choose_start_sitest.available_civs,df.global.world.entities.all[1],"id")
end
though I haven't figure out how to make it stick so it has to be reapplyed each time you abandon or retire, though I haven't figure out how to unlock military so you're pretty much playing a challenge run where you need to train loads of war animals and hunt.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 16, 2013, 02:36:35 pm
Military needs an appointable commander.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on October 16, 2013, 04:16:06 pm
well I haven't dabble in eventful or item syndromes but I think it's possible to make a creature that infects someone and latch on it's infected host. So you could add more fun in special ways.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on October 16, 2013, 10:29:29 pm
Spawnunit. (https://gist.github.com/warmist/6542463)

Heck, for easier searching and future-proofing, this is now the post you're going to see in a search.

DFHack spawn unit spawnunit spawn-unit unit spawning reaction r3 create unit with reaction

It would be more convenient to collect them in a separate thread. It's not like it costs money to make new ones.

well I haven't dabble in eventful or item syndromes but I think it's possible to make a creature that infects someone and latch on it's infected host. So you could add more fun in special ways.

In the next version, syndromeTrigger will allow at least part of this. It triggers dfhack commands whenever someone becomes infected with a syndrome for any reason. Hook that up just right and you can probably do some cool stuff.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 16, 2013, 10:31:27 pm
It would be more convenient to collect them in a separate thread. It's not like it costs money to make new ones.
I ain't doing it, hehe.

well I haven't dabble in eventful or item syndromes but I think it's possible to make a creature that infects someone and latch on it's infected host. So you could add more fun in special ways.

In the next version, syndromeTrigger will allow at least part of this. It triggers dfhack commands whenever someone becomes infected with a syndrome for any reason. Hook that up just right and you can probably do some cool stuff.

Quote
probably do some cool stuff

This is the biggest understatement I have ever seen.
Title: Re: DFHack 0.34.11 r3
Post by: LittleQuick on October 17, 2013, 12:21:03 am
Probably a dumb question but I can't seem to properly createitem. I keep trying to make an axe over and over again, can someone just show me how it should be properly typed? I wanted to test out a great axe..
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 17, 2013, 12:32:13 am
createitem WEAPON:ITEM_WEAPON_AXE_BATTLE INORGANIC:STEEL
Title: Re: DFHack 0.34.11 r3
Post by: LittleQuick on October 17, 2013, 12:44:18 am
OHHHH, wait I was doing it right, I just wasn't selecting the unit correctly. Thank you so much. -facepalm-
Title: Re: DFHack 0.34.11 r3
Post by: Kyphis on October 18, 2013, 04:22:10 pm
I'm working on trying to get a reliable way to create living plants going, and have created a thread here (http://www.bay12forums.com/smf/index.php?topic=132221.0). Its based around the Tiletypes and lua plugins.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on October 18, 2013, 05:21:45 pm
well I haven't dabble in eventful or item syndromes but I think it's possible to make a creature that infects someone and latch on it's infected host. So you could add more fun in special ways.

In the next version, syndromeTrigger will allow at least part of this. It triggers dfhack commands whenever someone becomes infected with a syndrome for any reason. Hook that up just right and you can probably do some cool stuff.

Quote
probably do some cool stuff

This is the biggest understatement I have ever seen.

Any Fun ideas?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 18, 2013, 07:33:57 pm
Nearly every script I've made has something to gain from that, it makes me capable of having creatures control the weather, it gives me the ability to have my shapechange script actually shapechange the creature that uses it, allow instant_transmission to be done with an interaction rather than a hotkey, give the DF AI the ability to use scripts as attack or fleeing actions...
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on October 18, 2013, 07:58:25 pm
Is there a way to set recurring commands? 

I've got a larger and older fort than usual, and I find myself using cleanowned, clean and so on regularly - setting them to repeat every x thousand frames would be awesome, not having to keep glancing at fps to see if it's dumping time again. 

It could also be (ab)used to, for example, cause constant invasions via force siege and turn the game into tower defense (autodump-destroy to keep fps up); simulate hyper-fertile soil with regrass and grow; seasonal bushfires with immolate (Australia is currently having it's earliest ever start to the fire season, and I'm in a biome with kangaroos at the moment); slayrace cats; there are so many interesting things I could try just by repeating existing scripts. 
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 18, 2013, 11:01:54 pm
For lua scripts, yeah:

Code: [Select]

repeatingScripts=repeatingScripts or {}

args={...}
function repeatScript()
    local script = function()
        local t
        for i=4,#args do
            table.insert(t,args[i])
        end
        return t
    end
    script=script()
    dfhack.run_script(table.unpack(script))
    repeatingScripts[args[4]]=dfhack.timeout(tonumber(args[2]),args[3],repeatscript)
end
if args[1]~="disable" then repeatScript() else dfhack.timeout_active(timeout[args[2]],nil) end

If you call this, say, "repeat.lua" then this is the syntax:

Code: [Select]
repeat enable 1 months force siege EVIL

It should save that until you type, say:

Code: [Select]
repeat disable force

at which point the repeat will disable.

(Note: untested!)
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on October 19, 2013, 01:02:09 am
Unfortunately...

(http://i.imgur.com/iwU5rg7.png)

I got essentially the same error whatever I did... after three attempts to get rid of the typos in
         repeat enable 1 days multicmd cleanowned scattered x ; clean all ; autodump destroy
It could have been beautiful, even a keybinding! [/s]
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 19, 2013, 01:16:46 am
... change "local t" to "local t = {}" >_>
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on October 19, 2013, 04:46:23 am
Getting a similar problem with the same input.  "bad argument #3 to 'timeout' (function expected, got nil)".  If I'm reading it right, it's something to do with "repeatscript()"?

Spoiler: Current code (click to show/hide)

Also:  how do you have a different profile pic every time I refresh?  It's been teasing me ever since I noticed...
Title: Re: DFHack 0.34.11 r3
Post by: ag on October 19, 2013, 09:19:59 am
Getting a similar problem with the same input.  "bad argument #3 to 'timeout' (function expected, got nil)".  If I'm reading it right, it's something to do with "repeatscript()"?

Change "args = {...}" to "local args = {...}", "function repeatScript()" to "local function repeatScript()", "repeatscript" to "repeatScript", and "timeout[args[2]]" to "repeatingScripts[args[2]]".
Title: Re: DFHack 0.34.11 r3
Post by: Meph on October 19, 2013, 10:32:16 am
well I haven't dabble in eventful or item syndromes but I think it's possible to make a creature that infects someone and latch on it's infected host. So you could add more fun in special ways.

In the next version, syndromeTrigger will allow at least part of this. It triggers dfhack commands whenever someone becomes infected with a syndrome for any reason. Hook that up just right and you can probably do some cool stuff.

Quote
probably do some cool stuff

This is the biggest understatement I have ever seen.

Any Fun ideas?
Yes, Sir ;)
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on October 19, 2013, 05:28:06 pm
Now works perfectly, at least for 'force'.  I got a siege with 340 invaders, which dropped fps 80%...
Title: Re: DFHack 0.34.11 r3
Post by: mc876898 on October 20, 2013, 01:25:18 am
Is there a way to sort your inventory items in adventure mode?

The sort-items function isn't working.
Title: Re: DFHack 0.34.11 r3
Post by: Mohreb el Yasim on October 22, 2013, 05:19:41 pm
Could it be editable how random creatures are generated during worldgen? (or to modifie them after worldgen?)
(if there are easiely accesible data on those parts for DFHack)
Title: Re: DFHack 0.34.11 r3
Post by: Box on October 22, 2013, 05:26:03 pm
Is it possible to paint with tiletypes above ground level?  I can convert the ground level outdoors to anything I want, but when I go up a z-level stuff like the walls below have no floor above them and I can't paint any floors or walls, even with the filter set to any or air.

Is there some way at all to fix this?  I'm trying to fix up the area above ground for a megaproject and I'd rather not set dwarf speed to 0 just so they can make a bunch of non-rough walls by digging up a world layer underground since I can't find a proper location to embark at normally.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on October 23, 2013, 01:25:15 am
I believe map sections above ground aren't actually allocated entirely until a construction is built nearby.  I ran into odd behavior trying to move units up in the air, and that was the explanation given to me.  I believe the map is chunked into 16x16 tile sections for this purpose?

I'm doubtful that there's an easier way to fix that than to build nearby.
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on October 23, 2013, 09:58:00 am
I've been able to successfully paint a set of walls, then a floor on top of them with tyletypes above ground.  It worked fine at least in the first 2 z levels above ground level.  However, if your embark wagon z level is already the highest solid z level in the map, that may make for issues.  I cannot confirm.  I typically embark on at least moderately hilly areas for FUN.
Title: Re: DFHack 0.34.11 r3
Post by: Rose on October 23, 2013, 11:04:03 am
Sky areas are not allocated until you build in them normally. Have your dorves construct a staircase in the general area you want to do stuff, then you can use tile types there.
Title: Re: DFHack 0.34.11 r3
Post by: Aerval on October 23, 2013, 04:28:28 pm
Is it possible to paint with tiletypes above ground level?  I can convert the ground level outdoors to anything I want, but when I go up a z-level stuff like the walls below have no floor above them and I can't paint any floors or walls, even with the filter set to any or air.

Is there some way at all to fix this?  I'm trying to fix up the area above ground for a megaproject and I'd rather not set dwarf speed to 0 just so they can make a bunch of non-rough walls by digging up a world layer underground since I can't find a proper location to embark at normally.

The infiniteSky plug-in should do what you want (or at least did when I used it back when it came out)
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on October 23, 2013, 04:34:52 pm
That actually does something slightly different. It doesn't actually allocate sky blocks. It creates a place for unallocated sky blocks to go for higher z levels than exist before it was run.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on October 23, 2013, 05:24:25 pm
Speaking of which, I'd love a script to actually allocate more sky blocks. I hate it when my flying adventurers get mauled by crocodiles because there's no Z-level to flee up to. Only towns and mountains reliably offer vertical refuge...
Title: Re: DFHack 0.34.11 r3
Post by: Box on October 23, 2013, 08:28:51 pm
Thank you all for the excellent help.  Love it when the technical bits are explained so you know WHY you have to do something rather than just that you need to do something to bring about a solution.
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on October 24, 2013, 09:56:04 am
Quick question. (May not lead to quick answers.)

In the bug report for Bug 6364, Urist DaVinci posts the following binary patch to correct the divide by X rounding number issue:

0x006C8BE2 : 89 b5 f8 14 -> d7 c5 6d 34
0x006C8BEE : 0D -> 0B

That's for the Win32 v0.34.11 SDL

Is that in a format that can be used directly in a .dif file by the binpatcher.exe file packaged with DFHack?  Or does it need to be in a byte by byte format one line at a time?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on October 24, 2013, 03:34:17 pm
DF's binpatch utility requires one byte per line, so you'd need the following:

Code: [Select]
006C8BE2: 89 d7
006C8BE3: b5 c5
006C8BE4: f8 6d
006C8BE5: 14 34
006C8BEE: 0D 0B
Title: Re: DFHack 0.34.11 r3
Post by: Mr S on October 24, 2013, 05:57:40 pm
Excellent. (Insert photo of Mr. Burns rubbing hands together)

I thought it might be something along those lines, but wasn't sure if it was a one to one split like so.

Thank you QT, you save the day again!
Title: Re: DFHack 0.34.11 r3
Post by: mc876898 on October 24, 2013, 11:43:48 pm
Anybody know how to remove a mummy's curse with dfhack?
Title: Re: DFHack 0.34.11 r3
Post by: RickRollYou2 on October 26, 2013, 07:02:42 am
Does anyone have a script for revealing ambushes? It would be nice to be able to test that ambushes are appearing when I force them with a script instead of calling slayrace every so often  :P

EDIT: Suddenly, a DFHack r4 on DFFD! What??
Title: Re: DFHack 0.34.11 r3
Post by: fricy on October 26, 2013, 08:19:31 am
Does anyone have a script for revealing ambushes? It would be nice to be able to test that ambushes are appearing when I force them with a script instead of calling slayrace every so often  :P

EDIT: Suddenly, a DFHack r4 on DFFD! What??

Wow, that was unexpected. Osx version? Please? :)
Title: Re: DFHack 0.34.11 r3
Post by: BoogieMan on October 26, 2013, 04:53:56 pm
I messed around a little with the liquids command and spawned a river source, which worked very nicely but it spewed out a LOT of critters and fish with it. I'm glad it makes it an "alive" river, but the amounts seemed like they were too high. However, I did spawn it on the side of a cliff and not in a realistic channeled region like a river would normally be in so I don't know if that somehow played a role in the creature spawning. What governs that? I'd like to use it at a embark location to add some spice to it, but the numbers of creatures (especially vermin types) was so high that it was getting heavily cluttered within just a few minutes of game time. If it kept up like that throughout the life of a real fort it would just get crazy. I also wondered if it was spawning multiple sources due to more than one tile being spawned, all classified as river sources.

I would also like some advice on what bug-fix type of commands I should run to help with FPS and other game problems. I'm aware of stable-temp and growth-bug and to run dead-units from time to time. I knew there were more, but I couldn't remember which ones and I never discovered if they should be ran every time you load your game.. So some clarification on this would be appreciated. Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on October 27, 2013, 06:17:22 pm
Windows r4 link: http://dffd.wimbli.com/file.php?id=8068
Linux r4 link: http://dffd.wimbli.com/file.php?id=8067

New stuff: https://github.com/expwnent/dfhack/blob/0.34.11-r4/NEWS

Also forgot to put in that document: the eventful script now exposes EventManager events to lua scripts. See the lua documentation for details.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on October 27, 2013, 06:49:58 pm
Could you please tell me how/if that affects scripts that have been written for dfhack r3? Like falconnes plugins, or hire-guard, or the growthbug fix, and autofixhandedness, all these custom scripts flying around.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 27, 2013, 07:34:09 pm
The scripts aren't too affected, though spawnunit has to be updated (you can find it on Warmist's gist). Plugins are the main things that need to be updated, but for some I believe it shouldn't be difficult.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on October 27, 2013, 10:42:24 pm
just wanted to say thanks for all the patch work in latest dfhack.  My military is finally training properly and i'm kicking ass in mwmod.  I've survived 4 sieges and I already have 5 legendary dwarfs.
Title: Re: DFHack 0.34.11 r3
Post by: Robsoie on October 29, 2013, 12:39:05 pm
Windows r4 link: http://dffd.wimbli.com/file.php?id=8068
Linux r4 link: http://dffd.wimbli.com/file.php?id=8067

New stuff: https://github.com/expwnent/dfhack/blob/0.34.11-r4/NEWS

Also forgot to put in that document: the eventful script now exposes EventManager events to lua scripts. See the lua documentation for details.

Hello, i downloaded the window version and noticed that unlike in r3, there's no "stonesense' folder in the download.
Is stonesense removed intentionally, not supported anymore or is that just the packager that forgot to include it ?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 29, 2013, 02:38:58 pm
It was removed intentionally for reasons other than the one described and will likely be in the official release.
Title: Re: DFHack 0.34.11 r3
Post by: Ranold on October 29, 2013, 04:10:25 pm
It's been sometime since I went through the list of functions and wow. Thanks to everyone helping with this :)

EDIT:
1. What FPS hit should I expect when using Fortress activity management?
2. In my last DF game, one of my dwarfs made a mistake of taking a brake in the wrong place at the wrong time and I just wanted to smite him with righteous fury or better yet pick him and drop him in my torturer chamber(i have been riding the nostalgia train with 'war for the underworld' a DK remake). Is there any way to teleport a dwarfs?
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on October 30, 2013, 09:24:18 pm
You can always use the Lua interface to set their position manually.  Select the unit and run the command dfhack.gui.getSelectedUnit().pos.x = whatever, or pos.y or pos.z as desired.  This works in general, but beware that it leaves some map flags in inconsistent states that will make units do funny things like crawl on tiles instead of walk through them because they believe they're still occupied.

A correct implementation should be possible, but I'm not aware of one, and I haven't gotten around to trying to write it myself.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 30, 2013, 09:53:22 pm
Code: [Select]
local function teleport(unit,pos)
    local unitoccupancy = dfhack.maps.getTileBlock(unit.pos).occupancy[unit.pos.x%16][unit.pos.y%16]
    unit.pos.x = pos.x
    unit.pos.y = pos.y
    unit.pos.z = pos.z
    if not unit.flags1.on_ground then unitoccupancy.unit = false else unitoccupancy.unit_grounded = false end
end

local function getArgsTogether(args)
    local settings={
    pos={}}
    for k,v in ipairs(args) do
        v=string.lower(v)
        if v=="unit" then settings.unitID=tonumber(args[k+1]) end
        if v=="x" then settings.pos['x']==tonumber(args[k+1]) end
        if v=="y" then settings.pos['y']==tonumber(args[k+1]) end
        if v=="z" then settings.pos['z']==tonumber(args[k+1]) end
        if v=="showunitid" then print(dfhack.gui.getSelectedUnit(true).id) end
        if v=="showpos" then printall(df.global.cursor) end
    end
    if not settings.pos.x or not settings.pos.y or not settings.pos.z then settings.pos=nil end
    if not settings.unitID and not settings.pos.x then qerror("Needs a position, a unit ID or both, but not neither!") end
    return settings
end

local args = {...}

local teleportSettings=getArgsTogether(args)

local unit = teleportSettings.unitID and df.unit.find(teleportSettings.unitID) or dfhack.gui.getSelectedUnit(true)

local pos = teleportSettings.pos and teleportSettings.pos or df.global.cursor

teleport(unit,pos)

syntax:

Code: [Select]
teleport x 50 y 35 z 20
will send unit under cursor to position 50 35 20

Code: [Select]
teleport unit 3503
will send unit #3503 to the position under cursor

Code: [Select]
teleport showUnitID
caps insensitive; will show the ID of the unit under the cursor.

Code: [Select]
teleport showPos
same as above, will show number values of position under cursor
Title: Re: DFHack 0.34.11 r3
Post by: ResMar on October 30, 2013, 10:38:48 pm
A theoretical question: how painful would it be to redeploy Dwarf Therapist with DFHackTM inside?

I am wondering whether or not this is a longer-term possibility.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 30, 2013, 10:40:31 pm
What do you mean? Have Therapist include a DFHack window? Have Therapist work on a DFHack base?
Title: Re: DFHack 0.34.11 r3
Post by: Tonren on October 30, 2013, 10:51:27 pm
Is anyone now unable to run dfhack since upgrading to OS X 10.9 Mavericks? I get an error about libdfhack being the wrong architecture.
Title: Re: DFHack 0.34.11 r3
Post by: narhiril on October 30, 2013, 11:50:18 pm
Can someone smarter than I am explain what's going on with the new autoSyndrome?  I have "autoSyndrome 1" in my dfhack.init, but the console is printing out "autoSyndrome disabled".  I have several reactions that rely very heavily on it, so I really need to know if it's working or not.  Is it a conflict with having syndromeTrigger enabled at the same time?

Also, is there any more detailed documentation for syndromeTrigger?  Namely, what's new and how to use it?
 

Nevermind, found the new documentation.  https://github.com/peterix/dfhack#syndrometrigger
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on October 31, 2013, 12:04:02 am
here's the pertinent code from autosyndrome

Code: [Select]
command_result autoSyndrome(color_ostream& out, vector<string>& parameters) {
    if ( parameters.size() > 1 )
        return CR_WRONG_USAGE;

    bool enable = false;
    if ( parameters.size() == 1 ) {
        if ( parameters[0] == "enable" ) {
            enable = true;
        } else if ( parameters[0] == "disable" ) {
            enable = false;
        } else {
            int32_t a = atoi(parameters[0].c_str());
            if ( a < 0 || a > 1 )
                return CR_WRONG_USAGE;

            enable = (bool)a;
        }
    }

    out.print("autoSyndrome is %s\n", enabled ? "enabled" : "disabled");
    return plugin_enable(out, enable);
}

I don't see anything wrong, so... I would probably just have it be "autoSyndrome enable" instead of "autoSyndrome 1".
Title: Re: DFHack 0.34.11 r3
Post by: ag on October 31, 2013, 02:36:34 am
Code: [Select]
    out.print("autoSyndrome is %s\n", enabled ? "enabled" : "disabled");

This ends up printing the state the plugin was in before running the command, not what it becomes. It should really be "enable ?", not "enabled ?".

In any case, the new way to enable stuff is "enable autosyndrome". :)
Title: Re: DFHack 0.34.11 r3
Post by: Roses on October 31, 2013, 09:47:45 am
Is it possible to have custom workshops require power using DFhack?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on October 31, 2013, 12:10:40 pm
Is it possible to have custom workshops require power using DFhack?
I think so. But afaik only with c++ plugin.
Title: Re: DFHack 0.34.11 r3
Post by: Tonren on October 31, 2013, 02:42:56 pm
ATTENTION OS X USERS!

"WRONG ARCHITECTURE" ERROR

If you upgraded to OS X 10.9 Mavericks and are now receiving the following error upon running the "dfhack" script:

Code: [Select]
dyld: could not load inserted library './hack/libdfhack.dylib' because no suitable image found.  Did find:
        ./hack/libdfhack.dylib: mach-o, but wrong architecture

Then you must perform the following workaround:


"X11 REQUIRED" ERROR

If you get a popup asking if you'd like to install X11, but you have already installed it, there is a (thankfully simple) workaround: just re-install from the package file you originally downloaded way back when. It should be called something like XQuartz-2.7.4.dmg. Now Dwarf Fortress will detect X11 and you can get back to playing.
Title: Re: DFHack 0.34.11 r3
Post by: nekoexmachina on November 01, 2013, 12:54:00 pm
Please, don't use ridicolous wine thing and use this:
http://dethware.org/dfhack/download/dfhack-0.34.11-r3-Darwin.zip
Title: Re: DFHack 0.34.11 r3
Post by: TuefelHundenIV on November 01, 2013, 04:08:11 pm
I have been tinkering around and testing a few build ideas out and I don't want to spend large amounts of time gathering or trading for the resources just to dink around.

I tried using the createitem command but for the life of me I can't suss out how to generate either raw ore for non-alloy metal or refined bars.  I can't seem to find anywhere that points out the command line for createitem.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on November 01, 2013, 05:05:29 pm
I have been tinkering around and testing a few build ideas out and I don't want to spend large amounts of time gathering or trading for the resources just to dink around.

I tried using the createitem command but for the life of me I can't suss out how to generate either raw ore for non-alloy metal or refined bars.  I can't seem to find anywhere that points out the command line for createitem.

http://dwarffortresswiki.org/index.php/Item_token
http://dwarffortresswiki.org/index.php/DF2012:Material_token
Title: Re: DFHack 0.34.11 r3
Post by: TuefelHundenIV on November 02, 2013, 12:28:56 am
Of course.  It had to be so simple I would have tripped over it.  Thanks for the info man.

To make sure I am not mangling this. createitem BAR:INORGANIC:IRON or STEEL:(amount here) correct?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on November 02, 2013, 01:46:44 am
Of course.  It had to be so simple I would have tripped over it.  Thanks for the info man.

To make sure I am not mangling this. createitem BAR:INORGANIC:IRON or STEEL:(amount here) correct?

createitem ITEM:SUBTYPE MATERIAL #

So for 5 steel bars it would be

createitem BAR INORGANIC:STEEL 5
Title: Re: DFHack 0.34.11 r3
Post by: urmane on November 02, 2013, 08:38:59 am
(I see r4 is out - will try that shortly, the following is for r3)

Doing some testing with fix/growthbug.rb on linux.  Based on what I'm seeing for unit birth_times - mostly 0, 1, double digit ints, or huge positive/negative ints - and the large number getting modified every time I run - ~100 "fixed" each time I run "fix/growthbug now", once a second immediately after start - I would guess that perhaps the birth_time variable is not mapping to the correct memory location.  This theory is bolstered by the fact that the hang happens when an assignment is attempted - running a version of the script that does not write to unit.relation.birth_time works just fine.

Thoughts?

Cut-n-paste of current (ie not original, modified for testing) code snippet:
Code: [Select]
def process
                count = 0
                df.world.units.active.each do |unit|
                        if unit and unit.relations and unit.relations.birth_time then
                                puts "unit has birth_time #{unit.relations.birth_time}"
                                if unit.relations.birth_time > 0 then
                                        r = unit.relations.birth_time % 10
                                        if r > 0 then
                                                unit.relations.birth_time -= r
                                                puts "  unit now has birth_time #{unit.relations.birth_time}"
                                                count += 1
                                        end
                                end
                        end
                end
                puts "FixGrowth: Fixed #{count} units so that their size will grow/thicken." unless count == 0

End of output just before hang:
Code: [Select]
unit has birth_time 0
unit has birth_time 7012459
  unit now has birth_time 7012450
unit has birth_time 0
unit has birth_time 0
unit has birth_time 0
unit has birth_time 0
unit has birth_time 274006465
  unit now has birth_time 274006460
unit has birth_time -1
unit has birth_time 40
unit has birth_time 0
unit has birth_time -1
unit has birth_time -1718639376
unit has birth_time 0
unit has birth_time 0
unit has birth_time -1702744808
unit has birth_time 1
  unit now has birth_time 0
unit has birth_time 69
  unit now has birth_time 60
unit has birth_time -1258291026
unit has birth_time 35
  unit now has birth_time 30
unit has birth_time 0
unit has birth_time 0
unit has birth_time -1370843632
unit has birth_time 50332165
  unit now has birth_time 50332160
unit has birth_time 69
  unit now has birth_time 60
unit has birth_time 0
unit has birth_time 0
unit has birth_time 0
FixGrowth: Fixed 106 units so that their size will grow/thicken.
[DFHack]# fix/growthbug now
(hung)
Title: Re: DFHack 0.34.11 r3
Post by: RickRollYou2 on November 03, 2013, 03:58:06 am
What would it take to change the target of the catsplosion plugin to another animal? Merely editing CAT doesn't seem to work.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on November 04, 2013, 10:22:36 am
Is it possible to have custom workshops require power using DFhack?
I think so. But afaik only with c++ plugin.
I'd like to second a request for a plugin like that. Something along the lines of "all buildings with NEEDS_POWER_ in their building ID, require as much power as the millstone for reactions.
Title: Re: DFHack 0.34.11 r3
Post by: ag on November 04, 2013, 10:47:19 am
Ask Toady for that. Anything dfhack can do will have the same weird restrictions on build order as the steam engine.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on November 04, 2013, 11:07:43 am
Which means:
1. It has to be a workshop.
2. It needs to be build before the axles.
3. Axles have to be added at the top right/left corner.

Is that about it? The water access is not necessary, is it?
Title: Re: DFHack 0.34.11 r3
Post by: ag on November 04, 2013, 12:04:45 pm
Workshop and built before the axles. This quirk seems to be rather confusing to people.

This can be improved a lot if Toady can just slap 'virtual' on the method that is used to add the set of possible connection points of a building to a certain list, so that I can override that part of the code too. Currently only the action of checking the building against the previously constructed list is overridable, which leads to this weird dependency on build order.

Of course, official support for defining machine connection points and power requirement in the raws would be even better. It will help steam engine too, since it would only have to manage producing power then.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on November 04, 2013, 12:11:51 pm
The workshop-only is of no consequence to the player, it only matters to the modders. If the modders make it clear that the only remaining issue is "the workshop must be build before you build the axles", then I think the players would catch the drift.

I know the deon can use this for his Fallout mod, then the Pony Fallout mod, I know I am very much looking forward to it, for a tech/steampunk race of Gnomes, Roses asked about it for his mod, and I'm sure other tech/scifi related mods like LfR or Underhive Settlement would make use of it.

I cant ask Toady to do stuff... I am still trying to muster up the courage to get baughn and lxnt together to bug Toady about the graphics/shaders.

I dont know how much work this plugin would be, but my hope is that its a copy of the Steamengine Plugin, with some lines replaced. It would really help. Please, have a try at it, or show this request around in the dfhack crew. :)
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on November 04, 2013, 01:23:22 pm
Code: [Select]
function addmilitary()
  local D=dfhack.gui.getCurViewscreen().parent.civ_idx

local grabbag=dfhack.gui.getCurViewscreen().parent.available_civs[D]
  --require("utils").insert_sorted(grabbag.positions.site,grabbag.positions.own,"id")
  grabbag.positions.site:insert("#",{new=true,entity_position})
  --grabbag.positions.own:insert("#",{new=true,entity_position})
  --local OBag= grabbag.positions.own
  --local E=dfhack.gui.getCurViewscreen().parent.available_civs[D].positions.next_positions_id
  local SBag=grabbag.positions.site
  SBag[0].flags.MILITARY_SCREEN_ONLY=1
  SBag[0].flags.IS_LEADER=1
  SBag[0].flags.DO_NOT_CULL=1
  SBag[0].flags.RULES_FROM_LOCATION=1
  SBag[0].responsibilities.RECEIVE_DIPLOMATS=1
  SBag[0].responsibilities.MANAGE_PRODUCTION=1
  SBag[0].responsibilities.TRADE=1
  SBag[0].responsibilities.LAW_MAKING=1
  SBag[0].responsibilities.LAW_ENFORCEMENT=1
  SBag[0].responsibilities.ATTACK_ENEMIES =1
  SBag[0].responsibilities.HEALTH_MANAGEMENT=1
  SBag[0].responsibilities.RELIGION=1
  SBag[0].responsibilities.TAME_EXOTICS=1
  SBag[0].responsibilities.MAKE_INTRODUCTIONS=1
  SBag[0].responsibilities.MILITARY_GOALS=1
  SBag[0].responsibilities.MILITARY_STRATEGY=1
  SBag[0].responsibilities.MAKE_TOPIC_AGREEMENTS=1
  SBag[0].responsibilities.ACCOUNTING=1
  SBag[0].responsibilities.BUILD_MORALE=1
  SBag[0].squad_size=20
  SBag[0].code="BOSSCHEEF"
  SBag[0].name[0]="BOSSCHEEF"
 
end
here's a script for patching a civ with access to military. for it to work you need to shove it into a gui lua, or remove the .parent. bit and run it normally. kinda made this for warmist spellbook script
the script doesn't work well on it's own but works great when combined with this which also needs to be stuffed into spellbook or remove the .parent.  bit to work (https://gist.github.com/Rumrusher/7153674) proper use of this would be to reclaim a fort using the invader civ just to see how well they would handle your spot of land.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 05, 2013, 03:04:06 am
EDIT: Post cleared.
Title: Re: DFHack 0.34.11 r3
Post by: koter on November 05, 2013, 04:14:08 am
Is there a way to find a retired adventurer if I cannot unretire? I have found the hamlet where I retired him (-ish), but cannot locate the unit to use bodyswap.
Title: Re: DFHack 0.34.11 r3
Post by: jeancallisti on November 05, 2013, 08:59:20 am
Hi,

Where can I publish small tutorials about DFHack plugins writing?

I mean,
- DF has a wiki, but I'm too sure people are allowed to create pages specifically about DFHack.
- DFHack has a git repository, but (afaik) no Wiki.
- This forum is not the best place for readbility of formatted tutorials.

Let me know what you recommend.
For the time being I'll start from a brand new .rst file (like DFHack's readme) and host it on my Dropbox.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on November 05, 2013, 10:00:07 am
Is there a way to change the makeown script so that it has a time limit? (I.e. after a certain number of ticks the creature reverts to their previous allegiances). This would allow a 'charm' spell effect.

EDIT: Similarly, can this be done with the spawn script, that is, can the creature spawned with the spawn script be forced to disappear after a set time?
Title: Re: DFHack 0.34.11 r3
Post by: jeancallisti on November 05, 2013, 11:16:06 am
DFHack Plugin tutorial:
- First Draft (1.0) : here (https://www.dropbox.com/s/059sgov0o40d4ad/PLUGIN%20TUTORIAL.rst)
- 05/11/2013 (1.1) : here (https://www.dropbox.com/s/nr1vec88bpzur7n/PLUGIN%20TUTORIAL%201.1.rst) (.rst) or here  (https://www.dropbox.com/s/hfasrbq7rljvk2o/DFHack%20plugin%20tutorial%201.1.html)(.html , more readable)
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on November 05, 2013, 11:35:02 am
Here is my first draft of DFHack Plugin tutorial: https://www.dropbox.com/s/059sgov0o40d4ad/PLUGIN%20TUTORIAL.rst
Some spots that need correction:
1. You have "return CR_OK;" outside of the relevant function body immediately above and below the "Simplest possible plugin: Hello World!" section.
2. In the "Create your own viewscreen" section, you mention the need to interpose vmethods. This is not necessary in this case - the only time you need to interpose is if you want to modify DF's own viewscreens (in the case of buildingplan, it is hooking into viewscreen_dwarfmodest so it can override keystrokes to invoke itself, as well as display its shortcut key labels where appropriate).

You might want to look at manipulator.cpp for a potentially simpler example of custom viewscreen implementation.
Title: Re: DFHack 0.34.11 r3
Post by: jeancallisti on November 05, 2013, 12:29:49 pm
Some spots that need correction:

excellent. Thanks.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on November 05, 2013, 02:20:17 pm
The wiki has a "utility" namespace (*not* DF2012:pagename which is the default, Utility:pagename) and while there's no dfhack category yet, there really should be.

Make a page, in a similar spot to the dfhack page (http://dwarffortresswiki.org/index.php/Utility:DFHack)  and add some links.
Title: Re: DFHack 0.34.11 r3
Post by: jeancallisti on November 05, 2013, 05:28:52 pm

Make a page, in a similar spot to the dfhack page (http://dwarffortresswiki.org/index.php/Utility:DFHack)  and add some links.

OK, I'll have a look.

Uploaded the plugin tutorial 1.1 here (http://www.bay12forums.com/smf/index.php?topic=91166.msg4742594#msg4742594).
Title: Re: DFHack 0.34.11 r3
Post by: AssasinInTheDark on November 05, 2013, 06:16:11 pm
Hey guys i've been trying to figure out the Createitem plugin and for the life of me I cant get it to work, i have a dwarf that needs 3 different cloths for a masterpiece they want to make, and i have only just started and don't have access to them yet, can anyone help me?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on November 05, 2013, 06:43:18 pm
Try these:

createitem CLOTH GRASS_TAIL_PIG:THREAD

createitem CLOTH SPIDER_CAVE:SILK

createitem CLOTH SHEEP:HAIR

The first is for a plant fiber cloth, the second is silk, and the third is for wool cloth.
Title: Re: DFHack 0.34.11 r3
Post by: AssasinInTheDark on November 05, 2013, 08:08:21 pm
well that seems to spawn the items but they don't seem to want to use them they just sit in a pile on the floor.

does anyone know why this happens
Title: Re: DFHack 0.34.11 r3
Post by: Mattzz on November 06, 2013, 01:08:02 am
Sorry if this has already been asked and answered, I did a quick search through this thread and also looked at the repo.

any way I was going to try making a util in DF and was going to hook my dll in but I noticed DFHack already does this
I want to be able to use DFHack with my program but now I need to know how I would go about drawing my gui.
Do I have to make a plugin?
Thank you
Matt
Title: Re: DFHack 0.34.11 r3
Post by: jeancallisti on November 06, 2013, 06:37:52 am
I want to be able to use DFHack with my program but now I need to know how I would go about drawing my gui.

2 solutions :
- this (http://www.bay12forums.com/smf/index.php?topic=91166.msg4742594#msg4742594)
or
- that (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst)
Title: Re: DFHack 0.34.11 r3
Post by: jeancallisti on November 06, 2013, 06:48:40 am
Make a page, in a similar spot to the dfhack page (http://dwarffortresswiki.org/index.php/Utility:DFHack)

I tried to create page http://dwarffortresswiki.org/index.php/Utility:DFHack_programming but I don't have permissions to create a page.
Title: Re: DFHack 0.34.11 r3
Post by: fricy on November 06, 2013, 07:07:19 am
Make a page, in a similar spot to the dfhack page (http://dwarffortresswiki.org/index.php/Utility:DFHack)

I tried to create page http://dwarffortresswiki.org/index.php/Utility:DFHack_programming but I don't have permissions to create a page.

Send a PM to Briess (http://www.bay12forums.com/smf/index.php?action=profile;u=18951). Or here (http://dwarffortresswiki.org/index.php/User_talk:Briess).
Title: Re: DFHack 0.34.11 r3
Post by: jeancallisti on November 06, 2013, 10:00:42 am
Send a PM to Briess (http://www.bay12forums.com/smf/index.php?action=profile;u=18951).

Done. Thanks again.
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on November 06, 2013, 04:55:39 pm
Here's the page (http://dwarffortresswiki.org/index.php/Utility:DFHack/Programming) (it's a subpage of Utility:DFHack to make organization easier). Also, if you're planning on doing a lot of editing you might want to create an account - it lets you skip captchas and create pages after 3 edits.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on November 07, 2013, 01:49:34 am
A quick question about a legends bug caused by workflow: 

Workflow, like many other plugins, stores data in a way that gets exported with the legends.xml - I did look up some details in the API, but the bit I understand isn't particularly relevant.  Unlike other plugins, workflow's storage includes non-printing characters.  This can mysteriously break most things that try to parse the xml for legends, which is a leading cause of frustration with Legends Viewer.  You can work around it - either by removing all your constraints before exporting, or by running a script over the xml (http://www.bay12forums.com/smf/index.php?topic=72702.msg4629392#msg4629392) - but it's still not a good thing. 

Since we have dfhack r4 coming up, could workflow be tweaked to avoid using non-printing characters?  Is there a downside to this? 
Title: Re: DFHack 0.34.11 r3
Post by: ag on November 07, 2013, 03:34:45 am
This should hide the fake historical figures from xml export completely:

https://github.com/angavrilov/dfhack/commit/53bd1125153f5625249aebca85f37632a3688da7 (https://github.com/angavrilov/dfhack/commit/53bd1125153f5625249aebca85f37632a3688da7)
Title: Re: DFHack 0.34.11 r3
Post by: jeancallisti on November 07, 2013, 03:46:03 am
Here's the page (http://dwarffortresswiki.org/index.php/Utility:DFHack/Programming) (it's a subpage of Utility:DFHack to make organization easier). Also, if you're planning on doing a lot of editing you might want to create an account - it lets you skip captchas and create pages after 3 edits.

Thanks! I hope Briess won't create a duplicate of some sort.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on November 07, 2013, 12:35:51 pm
r4 is out. If we rereleased with some changes and called the new release r4 also it would cause confusion and problems.

http://www.bay12forums.com/smf/index.php?topic=91166.msg4720997#msg4720997
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on November 07, 2013, 01:23:00 pm
Hi, I have a quick about spawnunit (the r3 version by Warmist, I'll migrate to r4 when the mac build will be available).

I used it successfully to spawn creature, it works well and I can manipulate those with further scripts alright.

However, since I am in dwarf mode, the animals screen does not update with the newcomers. I suppose it is because DF cached the animal list does not see spawnunit as an update to this list.

Is there a way to tell df to rescan the units to update the animal list?
Saving and reloading does the job but that would be annoying to do that only to start training your freshly summoned/built creatures.

Thanks
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on November 08, 2013, 08:17:37 pm
in screwing around in Fort mode news, 34 things happen:
fallen fort broke out into a crusade after I moved in a merfolk group,
The River Refreezes the entrance sometimes locking the new residents out and keeping the old in.
Merfolk group broke out into melancholy from lack of clothes.
move in a Centaur group with out properly adding a miltary for them and now the lone Fisherwoman Fallen is their medic and is now being haunted by her murderous ghost peers.
Spoiler (click to show/hide)
oh discovered that the Historical entity position is what ever their Civ ID is minus 800.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on November 08, 2013, 08:24:21 pm
For a second I was hoping merfolk citizens meant you'd gotten people to willingly live underwater.
Title: Re: DFHack 0.34.11 r3
Post by: Just Some Guy on November 08, 2013, 10:39:33 pm
I have full fledged human citizens due to the friendship plugin, but they can't haul. The game says they're "incapable of carrying."

Can this be fixed?

If this question has been answered before, please give me the link.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on November 08, 2013, 10:45:00 pm
Send a PM to Briess (http://www.bay12forums.com/smf/index.php?action=profile;u=18951).

Done. Thanks again.
I've created the page myself - you should be able to add whatever you want to it.
Title: Re: DFHack 0.34.11 r3
Post by: Isylwin on November 09, 2013, 02:08:57 pm
As I can't think of a better place to put it atm, I'll go ahead and post it right here. I had a dwarf go berserk on me, as it was quite an important dwarf I kinda wanted it back. So after some searching (couldnt find it on ze google) and asking around I found a fix for it. Just removing the mood berserk doesnt work as they also become an former member and enemy of your current civ. So running this how to remove berserk code in dfhack:
Code: [Select]
[dfhack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit
[dfhack]# fix/loyaltycascade
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on November 10, 2013, 07:06:10 am
For a second I was hoping merfolk citizens meant you'd gotten people to willingly live underwater.
I ran a similar fort based on that idea but found out sooner that yeah I need to figure out how to open up pathing so that a unit could walk through water that more than 2 z levels high.
Code: [Select]
function playallcivs()
for y,x in pairs(df.global.world.entities.all) do
  require("utils").insert_sorted(dfhack.gui.getCurViewscreen().available_civs,x,"id")
end
here's a simple script that pulls all the civs from your worldgen into your embark select. the only good reason I see doing this is if you want to pick a random or specific Civ then run my military script to gain basic access to military controls.
said script is right here

Code: [Select]
function addmilitary()
  local D=dfhack.gui.getCurViewscreen().parent.civ_idx

local grabbag=dfhack.gui.getCurViewscreen().available_civs[D]
  --require("utils").insert_sorted(grabbag.positions.site,grabbag.positions.own,"id")
  grabbag.positions.site:insert("#",{new=true,entity_position})
  --grabbag.positions.own:insert("#",{new=true,entity_position})
  --local OBag= grabbag.positions.own
  --local E=dfhack.gui.getCurViewscreen().available_civs[D].positions.next_positions_id
  local SBag=grabbag.positions.site
  SBag[0].flags.MILITARY_SCREEN_ONLY=1
  SBag[0].flags.IS_LEADER=1
  SBag[0].flags.DO_NOT_CULL=1
  SBag[0].flags.RULES_FROM_LOCATION=1
  SBag[0].responsibilities.RECEIVE_DIPLOMATS=1
  SBag[0].responsibilities.MANAGE_PRODUCTION=1
  SBag[0].responsibilities.TRADE=1
  SBag[0].responsibilities.LAW_MAKING=1
  SBag[0].responsibilities.LAW_ENFORCEMENT=1
  SBag[0].responsibilities.ATTACK_ENEMIES=1
  SBag[0].responsibilities.HEALTH_MANAGEMENT=1
  SBag[0].responsibilities.RELIGION=1
  SBag[0].responsibilities.TAME_EXOTICS=1
  SBag[0].responsibilities.MAKE_INTRODUCTIONS=1
  SBag[0].responsibilities.MILITARY_GOALS=1
  SBag[0].responsibilities.MILITARY_STRATEGY=1
  SBag[0].responsibilities.MAKE_TOPIC_AGREEMENTS=1
  SBag[0].responsibilities.ACCOUNTING=1
  SBag[0].responsibilities.BUILD_MORALE=1
  SBag[0].squad_size=20
  SBag[0].code="BOSSCHEEF"
  SBag[0].name[0]="BOSSCHEEF"
 
end
chances are this doesn't work due to trying to make it more user friendly (and was originally used in a lua script that boot up a gui which causes get viewscreen() to bug out.)
in discovery of reclaims news I some how bug my test site so that the noble of the area is just a fallen fisherwoman who now the only 'citizen' of the fort. like currently every time I reclaim shes still in the Citizens list and I have access to alter her labors, though that doesn't really effect anything and each fort retire the 'tamed' citizens impale bits of the former fallen founders on spears though merfolk(second reclaim lost their minds), the centaur(third reclaim no military lost their minds), and the ratkin(fourth reclaim all but 2 died from wounds from a bad bird attack gone wrong and retired before one of the ratkin snap and choked the other in their hospital bed, the berserk ratkin was later murder by the local spider-monster who while tame survive 3 reclaims with out being removed or killed.)
Title: Re: DFHack 0.34.11 r3
Post by: narhiril on November 11, 2013, 02:01:40 am
Noob question time!  Is there a way to automatically enter one or more DFHack commands every time a savegame is loaded?  I want the game to run the commands "itemsyndrome enable" and "fix/cloth-stockpile" every time a saved game is loaded.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on November 11, 2013, 02:13:56 am
cloth-stockpile already does and...

okay, yeah, I'm going to fix that up for you, that's an itemsyndrome bug.

EDIT: It should already be doing that >_<

EDIT 2: Too many quotes, fixed.
Title: Re: DFHack 0.34.11 r3
Post by: narhiril on November 11, 2013, 02:22:29 am
My bad on fix/cloth-stockpile, I was reading the r3 documentation instead of the r4 (derp).

I'll take the itemsyndrome stuff back to its proper thread.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on November 11, 2013, 04:27:56 am
Noob question time!  Is there a way to automatically enter one or more DFHack commands every time a savegame is loaded?  I want the game to run the commands "itemsyndrome enable" and "fix/cloth-stockpile" every time a saved game is loaded.

If you create a file called onLoad.init or onUnload.init in your data/save/world1/raw folder, then the commands inside it will be run at the appropriate times in r4. They have the same format as dfhack.init in the main df folder. You can use the main one, but that does commands when you open the game, not when you load/unload a save.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on November 11, 2013, 04:31:20 am
Oh, cool.

Note also that these files are copied to saves if you simply put them in the mod's raw folder.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 11, 2013, 11:31:17 pm
I am considering the problem of invaders who stand around and do nothing after their leader is killed. Does anyone know of any special issues that could crop up if I made a script to change the group leader id to a living (and uncaged) creature in the group?

Probable steps:
1. I need to identify the flags or whatever that seperates a group leader from the followers.
2. A follower needs to assume the leadership.
3. The other followers need to now follow the new leader - should be just as easy as changing the group_leader_id

Anyone else done any experimenting down this path?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on November 12, 2013, 12:05:41 am
I haven't done anything like that, but that sounds like a useful thing.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on November 12, 2013, 02:34:34 am
I am considering the problem of invaders who stand around and do nothing after their leader is killed. Does anyone know of any special issues that could crop up if I made a script to change the group leader id to a living (and uncaged) creature in the group?

Probable steps:
1. I need to identify the flags or whatever that seperates a group leader from the followers.
2. A follower needs to assume the leadership.
3. The other followers need to now follow the new leader - should be just as easy as changing the group_leader_id

Anyone else done any experimenting down this path?
that sounds like messing with adventure mode scripts(companion stuff) or just branch into the path of recruiting invaders into your fort I did some dabbling but not enough to make a script for converting caged gobbos into proper fort citizens.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 12, 2013, 04:00:07 am
Testing so far on a goblin siege squad:

The leader has unit.relations.group_leader_id=-1, whereas the followers have unit.relations.group_leader_id=20633 (the leader's id).

If one of the followers is given unit.relations.group_leader_id=-1, he stands around clueless. However, if I then give other goblins unit.relations.group_leader_id=20640 (the NEW leader's id), the whole NEW squad starts to act like a squad and advance. When the goblins decided to retreat and end the siege, the NEW squad also retreated.

The original leader doesn't even have to die - I can choose another "leader" goblin in the group and split the squaddies 50/50 between the old and new group leader, forming two independant half-size squads. Each leader needs at least one follower to be able to move around.

unit.relations.unk_238 was different for the leader of a building destroyer creature squad - otherwise it appears to be zero. The number didn't match any unit ids.

Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on November 12, 2013, 11:39:20 am
group leader ID is what links companions to follow your character in adventure mode.
so pretty much has the same mechanics from that in fort mode I'm guessing toady reuse his invasion code for adventure mode since the group following one guy mechanic is good enough for recruits.
that said, you might want to add in a line that has them fight/spar for leadership. like randomly pick 2 then the one who isn't prone and tired out is the leader then set all the remaining force as companions. that said I could see some humor if you could win over the goblins by tossing a dwarf into the warring gobbo's and any dwarf who wins gains a entourage of goblin bodyguards.
Title: Re: DFHack 0.34.11 r3
Post by: Dirtcopter77 on November 12, 2013, 07:54:04 pm
Sorry if I've missed something, but I can't get DFhack to work. Launching it without the game running makes the console flash briefly on the screen and disappear. Launching it with the game running and a fort loaded does the same thing. I've checked Task Manager and no DFhack-related processes are running in the background.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on November 12, 2013, 08:51:54 pm
Sorry if I've missed something, but I can't get DFhack to work. Launching it without the game running makes the console flash briefly on the screen and disappear. Launching it with the game running and a fort loaded does the same thing. I've checked Task Manager and no DFhack-related processes are running in the background.
You don't "launch DFHack" - when you run Dwarf Fortress, DFHack automatically loads along with it. If a separate "DFHack" console window does not open on startup, then you've installed it incorrectly.
Title: Re: DFHack 0.34.11 r3
Post by: Dirtcopter77 on November 12, 2013, 10:02:08 pm
Sorry if I've missed something, but I can't get DFhack to work. Launching it without the game running makes the console flash briefly on the screen and disappear. Launching it with the game running and a fort loaded does the same thing. I've checked Task Manager and no DFhack-related processes are running in the background.
You don't "launch DFHack" - when you run Dwarf Fortress, DFHack automatically loads along with it. If a separate "DFHack" console window does not open on startup, then you've installed it incorrectly.

Whoops, thanks.  ::)
Title: Re: DFHack 0.34.11 r3
Post by: Sorg on November 14, 2013, 07:09:02 pm
I want to use "restrictice" command from "filltraffic" plugin, but I have a problem. The command is not present in dfhack r3, so I decided to compile r4 from github. Something gone wrong and r4 is crashing at startup. So I rolled back to r3 and tried to compile only "filltraffic" plugin from r4 and put in to r3, but when I start dfhack it says that plugin is compiled for other version of dfhack and will not work.
Is there any way to compile new filltraffic for r3?

p.s. I'm kinda new to this compile/github/linux thing...
Title: Re: DFHack 0.34.11 r3
Post by: Meph on November 15, 2013, 12:59:32 pm
I tried running this patched version of my mod: http://www.bay12forums.com/smf/index.php?topic=133174.0 (http://www.bay12forums.com/smf/index.php?topic=133174.0), which includes dfhack r4. It shows an error message as soon as it starts, in a textbox, ??OVMethodInterposeLinkBase@DFhack@@QAE@PAVirtual_Identity@HPAX1H@Z wasnt found in the DLL SDL.dll.

All I can do it press OK, and then DF starts, and DFhack starts... I have no idea what the consequences are. Does anyone have any idea?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on November 15, 2013, 01:05:25 pm
It's an outdated plugin. Remove cls from dfhack.init and it should say which.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on November 15, 2013, 01:08:51 pm
its not in the dfhack window, its in a textbox. Maybe Rendermax or Hotkey, the two you mentioned before? I'll try and let you know.

EDIT: I get errors about stockflow, TrueTransformation and Stonesense. None of them work. I'll just use R3 for now, till things are official, updated, and have a readme. There is next to no info about autosyndrome now.
Title: Re: DFHack 0.34.11 r3
Post by: narhiril on November 15, 2013, 02:40:36 pm
its not in the dfhack window, its in a textbox. Maybe Rendermax or Hotkey, the two you mentioned before? I'll try and let you know.

EDIT: I get errors about stockflow, TrueTransformation and Stonesense. None of them work. I'll just use R3 for now, till things are official, updated, and have a readme. There is next to no info about autosyndrome now.

Have you looked here (https://github.com/peterix/dfhack#autosyndrome)?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on November 15, 2013, 02:51:22 pm
I had not. Thanks. :) I'll still stay with r3 for now, because of the other errors I had, and Rendermax. I have no new features for r4 anyway, havent started modding for SyndromeTrigger at all.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on November 15, 2013, 04:18:43 pm
TrueTransformation is now part of syndromeTrigger. There is no need to update it.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on November 15, 2013, 06:02:21 pm
Meph: https://github.com/peterix/dfhack/blob/master/Readme.rst#mod-interaction
Title: Re: DFHack 0.34.11 r3
Post by: ytterbium on November 16, 2013, 05:08:57 am
Hello, I have a little problem : I can't launch stonesense (under Linux)

I have the stonesense plugin, I can load it, I have df_linux/hack/plugin/stonesense.plug.so, but as soon as I tape either stonesense or ssense in the DFHack command line, it say me that "stonesense is not a recognized command."

Is there an other way to launch stonesense, or is it a bug ?
Title: Re: DFHack 0.34.11 r3
Post by: gzoker on November 16, 2013, 06:53:18 pm
Is it possible to make an API for dfhack from the part of dwarf fortress which handles combat, or at least the part which creates the announcements/combat logs/gamelog.txt? It would be nice if we could add syndromes/modify creatures/activate scripts during combat.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on November 16, 2013, 07:31:15 pm
syndromeTrigger does that pretty well.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on November 16, 2013, 08:40:30 pm
Yeah, if you can make it work by applying syndromes, then you can do it with syndromeTrigger. See the above link I made for the documentation.
Title: Re: DFHack 0.34.11 r3
Post by: urmane on November 18, 2013, 10:39:16 am
Hello, I have a little problem : I can't launch stonesense (under Linux)

I have the stonesense plugin, I can load it, I have df_linux/hack/plugin/stonesense.plug.so, but as soon as I tape either stonesense or ssense in the DFHack command line, it say me that "stonesense is not a recognized command."

Is there an other way to launch stonesense, or is it a bug ?

Try the instructions here: http://dwarffortresswiki.org/index.php/Masterwork:Linux

YMMV
Title: Re: DFHack 0.34.11 r3
Post by: narhiril on November 18, 2013, 03:52:25 pm
Would it be possible to create a script that puts equipment on certain creatures as they enter the map?  Like, say I want to make a rare breed of wildlife called the "Red Chinchilla of Justice" and use a script to make it so that whenever one enters the map, it gets equipped with a cape.  I know this is possible to simulate with bodyparts and itemcorpses, but that can lead to some weird behavior (i.e. armor being severed), so I was wondering if there was another way.  Could also allow for some interesting, less stupid ideas, like demons that wield unique weapons.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on November 19, 2013, 09:05:08 pm
Would it be possible to create a script that puts equipment on certain creatures as they enter the map?  Like, say I want to make a rare breed of wildlife called the "Red Chinchilla of Justice" and use a script to make it so that whenever one enters the map, it gets equipped with a cape.  I know this is possible to simulate with bodyparts and itemcorpses, but that can lead to some weird behavior (i.e. armor being severed), so I was wondering if there was another way.  Could also allow for some interesting, less stupid ideas, like demons that wield unique weapons.
make an entity race that adds stuff like that as a normal clothing option and have them be a Sieger maybe that would work?
Title: Re: DFHack 0.34.11 r3
Post by: narhiril on November 20, 2013, 02:18:18 am
Would it be possible to create a script that puts equipment on certain creatures as they enter the map?  Like, say I want to make a rare breed of wildlife called the "Red Chinchilla of Justice" and use a script to make it so that whenever one enters the map, it gets equipped with a cape.  I know this is possible to simulate with bodyparts and itemcorpses, but that can lead to some weird behavior (i.e. armor being severed), so I was wondering if there was another way.  Could also allow for some interesting, less stupid ideas, like demons that wield unique weapons.
make an entity race that adds stuff like that as a normal clothing option and have them be a Sieger maybe that would work?

I don't want all of the baggage or limitations that come with making them an entity.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on November 20, 2013, 08:32:32 am
It should be possible to write a plugin or script that ran frequently and spawned the item for a creature if they needed it.  The obvious problem here is that if it gets dropped they'll get a new one, and it might take a short while for the weapon to spawn the first time.  You probably wouldn't want to run this check every frame.

I can't remember the exact syntax for doing this in Lua, but there's an example floating around in the thread somewhere.  No idea about C++.
Title: Re: DFHack 0.34.11 r3
Post by: vjek on November 20, 2013, 02:30:59 pm
Testing so far on a goblin siege squad:

The leader has unit.relations.group_leader_id=-1, whereas the followers have unit.relations.group_leader_id=20633 (the leader's id).

If one of the followers is given unit.relations.group_leader_id=-1, he stands around clueless. However, if I then give other goblins unit.relations.group_leader_id=20640 (the NEW leader's id), the whole NEW squad starts to act like a squad and advance. When the goblins decided to retreat and end the siege, the NEW squad also retreated.

The original leader doesn't even have to die - I can choose another "leader" goblin in the group and split the squaddies 50/50 between the old and new group leader, forming two independant half-size squads. Each leader needs at least one follower to be able to move around.

unit.relations.unk_238 was different for the leader of a building destroyer creature squad - otherwise it appears to be zero. The number didn't match any unit ids.
This is excellent progress, Urist, please, keep it up.  To get this fixed would mean a great deal to my designs of automated goblin melting machines. :)  Vaporizing the leader always leads to frustration, currently.
Title: Re: DFHack 0.34.11 r3
Post by: narhiril on November 20, 2013, 02:59:14 pm
It should be possible to write a plugin or script that ran frequently and spawned the item for a creature if they needed it.  The obvious problem here is that if it gets dropped they'll get a new one, and it might take a short while for the weapon to spawn the first time.  You probably wouldn't want to run this check every frame.

I can't remember the exact syntax for doing this in Lua, but there's an example floating around in the thread somewhere.  No idea about C++.

Don't units have unique ID's?  Couldn't I, conceivably, record the ID and exclude them from future checks after the first equip?  I'm probably not competent enough with Lua to do it myself, though.  I'll have to dig through some internet tutorials and existing scripts to try to figure it out.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on November 20, 2013, 03:05:59 pm
They do and you can; I tend to do it like this:

Code: [Select]
unitAlreadyChecked={}

function checkUnit(unit)
    ...stuff...
    unitAlreadyChecked[unit.id]=true
end

This is better used in an init.lua, given cross-world contamination.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 20, 2013, 09:40:09 pm
Testing so far on a goblin siege squad:

The leader has unit.relations.group_leader_id=-1, whereas the followers have unit.relations.group_leader_id=20633 (the leader's id).

If one of the followers is given unit.relations.group_leader_id=-1, he stands around clueless. However, if I then give other goblins unit.relations.group_leader_id=20640 (the NEW leader's id), the whole NEW squad starts to act like a squad and advance. When the goblins decided to retreat and end the siege, the NEW squad also retreated.

The original leader doesn't even have to die - I can choose another "leader" goblin in the group and split the squaddies 50/50 between the old and new group leader, forming two independant half-size squads. Each leader needs at least one follower to be able to move around.

unit.relations.unk_238 was different for the leader of a building destroyer creature squad - otherwise it appears to be zero. The number didn't match any unit ids.
This is excellent progress, Urist, please, keep it up.  To get this fixed would mean a great deal to my designs of automated goblin melting machines. :)  Vaporizing the leader always leads to frustration, currently.

I know how to write lua scripts, but we aren't close to a fix yet. Probable script logic:
Code: [Select]
For all units do:
   If I am a living invader and my squad leader is a valid unit but is dead/caged/? then:
      Elect a new squad leader using CriteriaFunction() from all living noncaged squad members including myself
      Alter the new squad leader to use the proper leader-ish settings and not be a follower anymore
      Update all squad members (those who share the same previous squad leader) with the new squad leader
   end
end

I am not sure if the logic is ok for all possible situations. I am not sure about criteria to use for leader elections, including how to elect or break ties if the ratings are equal. Obviously if the living invader is the only surviving member of the squad, he becomes the leader of his one-person squad. The script would ignore non-invader types since I don't want to reassign dwarven militia squads or anything silly like that.
Title: Re: DFHack 0.34.11 r3
Post by: milo christiansen on November 21, 2013, 11:54:51 am
Is there any way to make a generic reaction use up water or magma, just like the steam engine does, just for any reaction?

Some kind of script I can call via autosyndrome maybe?

Something like this would be invaluable for making better "fill magma bottle" type reactions, as well as allowing you to make a workshop that uses magma and water to make obsidian.
Title: Re: DFHack 0.34.11 r3
Post by: Yacc on November 21, 2013, 02:05:30 pm
i have a question about the workflow plugin: ive created some constraints and they are working, but my problem is that only one workshop is active at a time. when i manually unsuspend the repeated orders of the other ones, they are working as wanted for a moment, but get suspended by the workflow plugin very soon. its not cool having tons of material and idle dwarfs hanging around :'(. are there some settings i missed whic can solve that problem?
Title: Re: DFHack 0.34.11 r3
Post by: Ravendarksky on November 22, 2013, 04:57:38 am
is it possible to use dfhack to make a dwarf give birth?
Title: Re: DFHack 0.34.11 r3
Post by: gzoker on November 22, 2013, 05:20:52 am
Is it possible to write a script that would forbid a type of items every few ticks, if a type of building doesn't exist on the map?
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on November 22, 2013, 08:29:28 am
Don't units have unique ID's?  Couldn't I, conceivably, record the ID and exclude them from future checks after the first equip?  I'm probably not competent enough with Lua to do it myself, though.  I'll have to dig through some internet tutorials and existing scripts to try to figure it out.

Yeah, they do, but I don't know where you'd store them to exclude them from future checks.  I know DFHack supports saving things to your world save somehow, but it had limited storage if I recall and would probably run out quickly.

is it possible to use dfhack to make a dwarf give birth?

Are they already pregnant?  If so, open the Lua interpreter and run this after putting the cursor over the unit:

Code: [Select]
dfhack.gui.getSelectedUnit().relations.pregnancy_timer = 0

I think that's the code for it, but if not it should be pretty similar..  It's been a while.

Is it possible to write a script that would forbid a type of items every few ticks, if a type of building doesn't exist on the map?

I'm pretty certain it's possible, but don't know off the top of my head what the code looks like.  You'd have to iterate through the entire item list and whatever building list there is, so it's probably not something you'd want to do too frequently.
Title: Re: DFHack 0.34.11 r3
Post by: Thundercraft on November 22, 2013, 11:19:59 am
is it possible to use dfhack to make a dwarf give birth?

Are they already pregnant?  If so, open the Lua interpreter and run this after putting the cursor over the unit:

Code: [Select]
dfhack.gui.getSelectedUnit().relations.pregnancy_timer = 0

I think that's the code for it, but if not it should be pretty similar..  It's been a while.

If they're not already pregnant, you could use the DFHack empregnant tool to make the dwarf that way.
Title: Re: DFHack 0.34.11 r3
Post by: ag on November 22, 2013, 04:40:56 pm
Yeah, they do, but I don't know where you'd store them to exclude them from future checks.  I know DFHack supports saving things to your world save somehow, but it had limited storage if I recall and would probably run out quickly.

The storage is unlimited, but rather costly: to store a string key with a string value plus a few ints, it uses a whole historical figure structure. If you don't mind the overhead and complexity of serializing and parsing, you can store about 10000 characters as that single string value though.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 23, 2013, 09:43:19 pm
https://github.com/angavrilov/df-structures/blob/master/df.ui.xml#L618

unk6 in the dead_citizens vector is ghost_type (see https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L202 )
I suspect the timer is used for ghost spawning.

Ghost types are set upon creature death. They eventually silently spawn at the locations of their deaths. No announcements are made unless they do something. I updated http://dwarffortresswiki.org/index.php/DF2012:Ghost . In general, strange moods, insanity, or some personality traits lead to certain ghost types. You also always get a murderous ghost if you deconstruct the slab of a ghost which was previously "put to rest", causing it to return some time later.

I haven't waited around to see if it works, but in theory one could DFHack a new entry onto the vector, making the game create murderous ghosts of dead goblins etc. Tinker at your own risk.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on November 24, 2013, 02:46:21 am
I haven't been following the updates lately but there now seems to be a DFHack r4 out there... is that a release candidate? When is the official release?

I noticed that most of my plugins are out of date in Peterix's repo, having last been merged months ago; a number of bugfixes have been done since then. If anyone's still updating the central repo I now have a DFhack_r4 branch in my repo, created from the r4 tag in the central repo, where I've merged my master branch into. If not I guess I'll wait till the official release then these updates can go into r5.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 24, 2013, 01:12:46 pm
I've got a few questions on DFhack commands.

1. How do I look at the adventurers histfig/entity info using DFhack? Quietust mentioned about it in a bug report, but really though, what's the command?

2. How do I do a pre-fishing population check with DFhack? UristDaVinci said he did that in a bug report about the bug with cave fish, but nobody explained how to do that.

3. How is the removewear command supposed to work? I tried it once and it didn't work.

Also, the readme should be updated as theres some new stuff that is not on there.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on November 24, 2013, 03:09:29 pm
To answer 1: gui/gm-editor df.historical_figure.find(df.global.world.units.active[0].hist_figure_id)
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 24, 2013, 09:42:24 pm
...
2. How do I do a pre-fishing population check with DFhack? UristDaVinci said he did that in a bug report about the bug with cave fish, but nobody explained how to do that.
...

Like this:

Code: (chkfish.lua) [Select]
--list all local vermin populations in fisherdwarf's region tile
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting!")
return
end

test=dfhack.maps.getTileBlock(unit.pos)

for k,v in pairs(df.global.world.populations) do
if v.type==1 and v.population.region_x==test.region_pos.x and v.population.region_y==test.region_pos.y then
if df.global.world.raws.creatures.all[v.race].flags.VERMIN_FISH then

print(df.global.world.raws.creatures.all[v.race].creature_id)
--printall(v)
print("Local population in this region:",v.quantity)
printall(v.population)
print(" ")
end
end
end

It identifies the local fish populations based on the location of the selected creature. Typically, river fish have feature_idx 0.
Title: Re: DFHack 0.34.11 r3
Post by: Yaotzin on November 25, 2013, 09:26:25 am
Probably a trivial problem but I suck at searching.

I'd like dfhack to read a long list of commands, basically read a text file I guess. How can I do so? Specifically I want to input a long list of workflow constraints.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on November 25, 2013, 01:17:41 pm
Hey, just heard about the dfhack r4 "outside-only" plugin. Thanks for that :) I dont know who wrote it, but that is a nice utility to have, for example for wind/sun-related buildings, farms and orchads and the like. Could a "inside-only" plugin be added to that? Thinking of evil races or underground races, like Antmen and the like.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on November 26, 2013, 10:15:42 am
https://github.com/angavrilov/df-structures/blob/master/df.ui.xml#L618

unk6 in the dead_citizens vector is ghost_type (see https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L202 )
I suspect the timer is used for ghost spawning.

Ghost types are set upon creature death. They eventually silently spawn at the locations of their deaths. No announcements are made unless they do something. I updated http://dwarffortresswiki.org/index.php/DF2012:Ghost . In general, strange moods, insanity, or some personality traits lead to certain ghost types. You also always get a murderous ghost if you deconstruct the slab of a ghost which was previously "put to rest", causing it to return some time later.

I haven't waited around to see if it works, but in theory one could DFHack a new entry onto the vector, making the game create murderous ghosts of dead goblins etc. Tinker at your own risk.
it's less spawn and more they convert the dead unit into a ghostly type.
Spoiler: semantic rant (click to show/hide)
good find Da Vinci

Title: Re: DFHack 0.34.11 r3
Post by: Meph on November 26, 2013, 12:01:08 pm
Does any of that ghost-business result in useable scripts, like a workshop to banish all ghosts, or call all ghosts, something like that? Or cursed items that bring all ghosts back for a few days, before all of them are automatically banished. That would be fun.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 27, 2013, 10:26:23 am
Does any of that ghost-business result in useable scripts, like a workshop to banish all ghosts, or call all ghosts, something like that? Or cursed items that bring all ghosts back for a few days, before all of them are automatically banished. That would be fun.

1. Setting the timer to 400000 causes that ghost to appear once the game is unpaused. This number is based upon a "lucky guess" and not any kind of research or disassembly-reading.

2. Setting the unk6 (ghost type) before the ghost appears will alter the type of ghost that appears.

3. Erasing the entries in the dead citizens vector appears to prevent those dead citizens from coming back as ghosts. 

4. I will attempt to cause more FUN with this and let everyone know.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 27, 2013, 03:59:51 pm
I'm using the latest DFhack that is with r41 of Peridexis's LNP and stripcaged is behaving a bit differently now and is confusing me a little, is it supposed to not dump the goblins clothes? Before, it dumped everything and now when I used stripcaged on some goblin thieves, it only dumped the bags and daggers.
Title: Re: DFHack 0.34.11 r3
Post by: KroganElite on November 27, 2013, 04:20:49 pm
Can someone please help me. Stonesense is not working. I run DF, load up my fortress, type "stonesense" in dfhack and it just opens a window. There is literally nothing inside the window, it copies whatever is behind the window and when you drag it it just smears the image all over. Please help. I've tried multiple fresh installs and it still doesnt work.

edit:
Using the R3 DFhack doesnt work but i tried R1 and it works?
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on November 27, 2013, 05:39:09 pm
how do you spawn a forgotten beast with the dfhack command "spawn"?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on November 27, 2013, 06:26:26 pm
how do you spawn a forgotten beast with the dfhack command "spawn"?

For forgotten beasts the creature ID is

FORGOTTEN_BEAST_#

For demons it is

DEMON_#

For titans it would be

TITAN_#

Instead of putting #, put a number higher than zero. I'm not too sure what the highest number allowed would be, but I know that it depends on the size of the world, as well as any advanced world generation settings regarding demons and titans.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 27, 2013, 06:42:39 pm
Anybody know whether stripcaged has a different behavior in this version because in the list, it says that it dumps ALL items in cages, but it's not doing that, and no the goblin thieves weren't naked when they came on the map.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 27, 2013, 09:44:18 pm
I was able to spawn non-citizen ghosts such as ghostly wagons or ghostly goblin axe lords, but the wagons instantly scuttle and the others just stand around not doing anything. I guess that you'd have to set the non-citizens to use citizen/dwarf AI in order to see proper ghost actions.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on November 28, 2013, 01:09:59 am
why not use dwarven ghosts? I thought a bit more about it, and it would be hilarious if a script would automatically spawn all dead dwarves as harmless ghosts for a few days/a week, once a year on dwarven halloween. :) Together with an announcement.. I would totally add this as an option into my mod, should scare a few dwarves good, especially if they are close to the graveyard.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 28, 2013, 10:31:01 am
Anybody know whether the function of stripcaged changed? Because it certainly seems like it did.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on November 29, 2013, 12:34:17 am
oh man fun fact about ghosts since urist is diving into it,
ghosts can take damage by minecarts,
ghosts can't phase through walls if they hold onto any item, but can phase through walls normally if they are carrying any unit.
ghosts are able to talk to any one in adventure mode.
Any living person can become a ghost by a simple switch of a creature flag.
with some scripting you could build an army of ghosts who could do hauling jobs or murder a bunch of gobbos.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 29, 2013, 12:56:14 am
Are people ignoring my question or is it that nobody knows what's up with it? At least a verification whether the function did change or not would be nice :P
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on November 29, 2013, 12:58:16 am
Are people ignoring my question or is it that nobody knows what's up with it? At least a verification whether the function did change or not would be nice :P

Usually people only answer when they can actually answer.

I don't know if there has been any changes, as I've never used stripcaged. The only thing I can think to ask is if you are using any mods such as masterwork, as there is a chance that the script may have been changed by the mod creator.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 29, 2013, 01:03:55 am
Nah, I'm not using any mods and it's Peridexiserrants LNP.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on November 29, 2013, 02:15:10 am
Uh, maybe try getting it directly from github and seeing if that makes any difference?  If there's an issue with the script in the pack let me know and I'll try to fix it (get a different version).
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 29, 2013, 02:03:31 pm
Stripcaged working funny is the least of my concerns in the fort atm because things are getting a little busy right now, because well, for one, my population exploded right up to 100 and I need to secure a water source and do a bunch of other things. Besides, I need to wait for more goblins to get captured because I suspect that it was because I had unforbidden the goblins clothes before autodumping.

Still, can't someone run stripcaged with the latest and tell me what it does? Because it's not doing it completely.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 29, 2013, 04:23:03 pm
Uh, maybe try getting it directly from github and seeing if that makes any difference?  If there's an issue with the script in the pack let me know and I'll try to fix it (get a different version).

How do I go about that? Download the master version?

Edit: Uh, the DFhackmaster and DFhack bugfixes are are compiled differently, or whatever the term is, but the way its arranged is different from the way the one on the first page download is arranged. Different files and stuff, so I don't know how to deal with those.

Edit2: Okay, I extracted over the DFhack from the first post (on a copy of the DF folder) and ran DF, and did stripcaged (no difference between stripcaged and stripcaged all), it did the same thing as it did before, it only dumped the weapons and bags the thieves were holding. I haven't caged any soldiers yet though.

Also, when I started it up, it gave me an error about entry point not found and start-dfterm3 not being a recognized command, worked fine otherwise.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on November 29, 2013, 08:12:27 pm
What exactly did you type? Was it "stripcaged all" or something more targeted? And what do you mean by "it doesn't work"? Does it not dump any items, or does it only dump some items?
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 29, 2013, 08:37:50 pm
What exactly did you type? Was it "stripcaged all" or something more targeted? And what do you mean by "it doesn't work"? Does it not dump any items, or does it only dump some items?

I tried both, just stripcaged and stripcaged all, and it only dumps weapons and the bags that thieves have. Haven't gotten any soldiers in the traps yet though, so I don't know about things other than thieves.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 30, 2013, 01:37:28 pm
What exactly did you type? Was it "stripcaged all" or something more targeted? And what do you mean by "it doesn't work"? Does it not dump any items, or does it only dump some items?

I tried both, just stripcaged and stripcaged all, and it only dumps weapons and the bags that thieves have. Haven't gotten any soldiers in the traps yet though, so I don't know about things other than thieves.

I tested "stripcaged all" on a pair of goblin crossbowmen that were caught in cage traps, and got the following results:

Dumped:
Crossbows
Quivers
Bolts that were embedded in a wound

Not Dumped:
Clothing
Armor
Bolts in the quiver

Using DFHack r4
EDIT: and there is no visible change between the code in the .rb file from r3 to r4. Haven't tested r3 behavior.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 30, 2013, 05:25:05 pm
What exactly did you type? Was it "stripcaged all" or something more targeted? And what do you mean by "it doesn't work"? Does it not dump any items, or does it only dump some items?

I tried both, just stripcaged and stripcaged all, and it only dumps weapons and the bags that thieves have. Haven't gotten any soldiers in the traps yet though, so I don't know about things other than thieves.

I tested "stripcaged all" on a pair of goblin crossbowmen that were caught in cage traps, and got the following results:

Dumped:
Crossbows
Quivers
Bolts that were embedded in a wound

Not Dumped:
Clothing
Armor
Bolts in the quiver

Using DFHack r4
EDIT: and there is no visible change between the code in the .rb file from r3 to r4. Haven't tested r3 behavior.

THANK YOU for confirming what I was trying to tell you guys. Doing it the old fashioned way works fine at least.

For some reason, the version says r3, but since Urist Da Vinci says that this is r4 and I'm seeing the same behavior, I guess I'm using r4. However, the behavior is exactly the same as Urist Da Vinci saw, the clothes don't get dumped, but the weapons (and bags apparently) do. Also, I'm using LNP r41, which is still the latest right now.

I'll see if it dumps corpses in cages and things left in there from animal training when I get the chance.

Also, I used stripcaged all the time in the previous r3 version and I can tell you. It used to have a few options like stripcaged all, stripcaged items and a few others. The behavior in the old r3 is what the description says, when I do stripcaged all, it dumps everything inside the cages, corpses, weapons, clothes, armor, stuff from taming, everything. Previously it would give the list of options if you just type stripcaged, but now it doesn't.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on November 30, 2013, 05:33:25 pm
My pack is still using r3.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 30, 2013, 05:43:28 pm
My pack is still using r3.

Really? Strange, the stripcaged command was working fine a couple LNP revisions back, r38. That at least gives a bit of a timeline.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 30, 2013, 06:37:14 pm
...

Also, I used stripcaged all the time in the previous r3 version and I can tell you. It used to have a few options like stripcaged all, stripcaged items and a few others. The behavior in the old r3 is what the description says, when I do stripcaged all, it dumps everything inside the cages, corpses, weapons, clothes, armor, stuff from taming, everything. Previously it would give the list of options if you just type stripcaged, but now it doesn't.

This is the content of the ruby script from R4:
Code: [Select]
# mark stuff inside of cages for dumping.

def plural(nr, name)
# '1 cage' / '4 cages'
"#{nr} #{name}#{'s' if nr > 1}"
end

def cage_dump_items(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsItemst)
next if ref.item_tg.flags.dump
count += 1
ref.item_tg.flags.dump = true
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'item')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_armor(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsUnitst)
ref.unit_tg.inventory.each { |it|
next if it.mode != :Worn
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'armor piece')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_weapons(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsUnitst)
ref.unit_tg.inventory.each { |it|
next if it.mode != :Weapon
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'weapon')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_all(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
case ref
when DFHack::GeneralRefContainsItemst
next if ref.item_tg.flags.dump
count += 1
ref.item_tg.flags.dump = true
when DFHack::GeneralRefContainsUnitst
ref.unit_tg.inventory.each { |it|
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
end
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'item')} in #{plural(count_cage, 'cage')}"
end


def cage_dump_list(list)
count_total = Hash.new(0)
empty_cages = 0
list.each { |cage|
count = Hash.new(0)

cage.general_refs.each { |ref|
case ref
when DFHack::GeneralRefContainsItemst
count[ref.item_tg._rtti_classname] += 1
when DFHack::GeneralRefContainsUnitst
ref.unit_tg.inventory.each { |it|
count[it.item._rtti_classname] += 1
}
# TODO vermin ?
else
puts "unhandled ref #{ref.inspect}" if $DEBUG
end
}

type = case cage
       when DFHack::ItemCagest; 'Cage'
       when DFHack::ItemAnimaltrapst; 'Animal trap'
       else cage._rtti_classname
       end

if count.empty?
empty_cages += 1
else
puts "#{type} ##{cage.id}: ", count.sort_by { |k, v| v }.map { |k, v| " #{v} #{k}" }
end

count.each { |k, v| count_total[k] += v }
}

if list.length > 2
puts '', "Total: ", count_total.sort_by { |k, v| v }.map { |k, v| " #{v} #{k}" }
puts "with #{plural(empty_cages, 'empty cage')}"
end
end


# handle magic script arguments
here_only = $script_args.delete 'here'
if here_only
it = df.item_find
list = [it]
if not it.kind_of?(DFHack::ItemCagest) and not it.kind_of?(DFHack::ItemAnimaltrapst)
list = df.world.items.other[:ANY_CAGE_OR_TRAP].find_all { |i| df.at_cursor?(i) }
end
if list.empty?
puts 'Please select a cage'
throw :script_finished
end

elsif ids = $script_args.find_all { |arg| arg =~ /^\d+$/ } and ids.first
list = []
ids.each { |id|
$script_args.delete id
if not it = df.item_find(id.to_i)
puts "Invalid item id #{id}"
elsif not it.kind_of?(DFHack::ItemCagest) and not it.kind_of?(DFHack::ItemAnimaltrapst)
puts "Item ##{id} is not a cage"
list << it
else
list << it
end
}
if list.empty?
puts 'Please use a valid cage id'
throw :script_finished
end

else
list = df.world.items.other[:ANY_CAGE_OR_TRAP]
end


# act
case $script_args[0]
when /^it/i
cage_dump_items(list)
when /^arm/i
cage_dump_armor(list)
when /^wea/i
cage_dump_weapons(list)
when 'all'
cage_dump_all(list)
when 'list'
cage_dump_list(list)
else
puts <<EOS
Marks items inside all cages for dumping.
Add 'here' to dump stuff only for selected cage.
Add a cage id to dump stuff for this cage only.

See 'autodump' to actually dump stuff.

Usage:
  stripcaged items
    dump items directly in cages (eg seeds after training)
 
  stripcaged [armor|weapons] here
    dump armor or weapons of caged creatures in selected cage

  stripcaged all 28 29
    dump every item in cage id 28 and 29, along with every item worn by creatures in there too
 
  stripcaged list
    show content of the cages

EOS

end

NONE of the argument options work, and they all produce the same result. Did something change in how the arguments are read or passed?
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 30, 2013, 08:16:46 pm
*snip*
NONE of the argument options work, and they all produce the same result. Did something change in how the arguments are read or passed?

Wish I knew, all of the options are there in that code, but it's not working for some reason. I still have the zip for LNP r38 (and r23 if we need one further back), so I'll get the ruby code from there.

While grabbing the code, I noticed that while r41 was neatly formatted in notepad, the others weren't formatted neatly. I don't know if that means anything, might not.

Edit: Did a visual comparison of r41 and r38 and I'm not seeing any differences. Maybe there is something else interfering?

r41 to use as a starting point.
Code: [Select]
# mark stuff inside of cages for dumping.

def plural(nr, name)
# '1 cage' / '4 cages'
"#{nr} #{name}#{'s' if nr > 1}"
end

def cage_dump_items(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsItemst)
next if ref.item_tg.flags.dump
count += 1
ref.item_tg.flags.dump = true
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'item')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_armor(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsUnitst)
ref.unit_tg.inventory.each { |it|
next if it.mode != :Worn
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'armor piece')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_weapons(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsUnitst)
ref.unit_tg.inventory.each { |it|
next if it.mode != :Weapon
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'weapon')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_all(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
case ref
when DFHack::GeneralRefContainsItemst
next if ref.item_tg.flags.dump
count += 1
ref.item_tg.flags.dump = true
when DFHack::GeneralRefContainsUnitst
ref.unit_tg.inventory.each { |it|
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
end
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'item')} in #{plural(count_cage, 'cage')}"
end


def cage_dump_list(list)
count_total = Hash.new(0)
empty_cages = 0
list.each { |cage|
count = Hash.new(0)

cage.general_refs.each { |ref|
case ref
when DFHack::GeneralRefContainsItemst
count[ref.item_tg._rtti_classname] += 1
when DFHack::GeneralRefContainsUnitst
ref.unit_tg.inventory.each { |it|
count[it.item._rtti_classname] += 1
}
# TODO vermin ?
else
puts "unhandled ref #{ref.inspect}" if $DEBUG
end
}

type = case cage
       when DFHack::ItemCagest; 'Cage'
       when DFHack::ItemAnimaltrapst; 'Animal trap'
       else cage._rtti_classname
       end

if count.empty?
empty_cages += 1
else
puts "#{type} ##{cage.id}: ", count.sort_by { |k, v| v }.map { |k, v| " #{v} #{k}" }
end

count.each { |k, v| count_total[k] += v }
}

if list.length > 2
puts '', "Total: ", count_total.sort_by { |k, v| v }.map { |k, v| " #{v} #{k}" }
puts "with #{plural(empty_cages, 'empty cage')}"
end
end


# handle magic script arguments
here_only = $script_args.delete 'here'
if here_only
it = df.item_find
list = [it]
if not it.kind_of?(DFHack::ItemCagest) and not it.kind_of?(DFHack::ItemAnimaltrapst)
list = df.world.items.other[:ANY_CAGE_OR_TRAP].find_all { |i| df.at_cursor?(i) }
end
if list.empty?
puts 'Please select a cage'
throw :script_finished
end

elsif ids = $script_args.find_all { |arg| arg =~ /^\d+$/ } and ids.first
list = []
ids.each { |id|
$script_args.delete id
if not it = df.item_find(id.to_i)
puts "Invalid item id #{id}"
elsif not it.kind_of?(DFHack::ItemCagest) and not it.kind_of?(DFHack::ItemAnimaltrapst)
puts "Item ##{id} is not a cage"
list << it
else
list << it
end
}
if list.empty?
puts 'Please use a valid cage id'
throw :script_finished
end

else
list = df.world.items.other[:ANY_CAGE_OR_TRAP]
end


# act
case $script_args[0]
when /^it/i
cage_dump_items(list)
when /^arm/i
cage_dump_armor(list)
when /^wea/i
cage_dump_weapons(list)
when 'all'
cage_dump_all(list)
when 'list'
cage_dump_list(list)
else
puts <<EOS
Marks items inside all cages for dumping.
Add 'here' to dump stuff only for selected cage.
Add a cage id to dump stuff for this cage only.

See 'autodump' to actually dump stuff.

Usage:
  stripcaged items
    dump items directly in cages (eg seeds after training)
 
  stripcaged [armor|weapons] here
    dump armor or weapons of caged creatures in selected cage

  stripcaged all 28 29
    dump every item in cage id 28 and 29, along with every item worn by creatures in there too
 
  stripcaged list
    show content of the cages

EOS

end

LNP r38, it worked here.
Code: [Select]
# mark stuff inside of cages for dumping.

def plural(nr, name)
# '1 cage' / '4 cages'
"#{nr} #{name}#{'s' if nr > 1}"
end

def cage_dump_items(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsItemst)
next if ref.item_tg.flags.dump
count += 1
ref.item_tg.flags.dump = true
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'item')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_armor(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsUnitst)
ref.unit_tg.inventory.each { |it|
next if it.mode != :Worn
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'armor piece')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_weapons(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsUnitst)
ref.unit_tg.inventory.each { |it|
next if it.mode != :Weapon
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'weapon')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_all(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
case ref
when DFHack::GeneralRefContainsItemst
next if ref.item_tg.flags.dump
count += 1
ref.item_tg.flags.dump = true
when DFHack::GeneralRefContainsUnitst
ref.unit_tg.inventory.each { |it|
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
end
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'item')} in #{plural(count_cage, 'cage')}"
end


def cage_dump_list(list)
count_total = Hash.new(0)
empty_cages = 0
list.each { |cage|
count = Hash.new(0)

cage.general_refs.each { |ref|
case ref
when DFHack::GeneralRefContainsItemst
count[ref.item_tg._rtti_classname] += 1
when DFHack::GeneralRefContainsUnitst
ref.unit_tg.inventory.each { |it|
count[it.item._rtti_classname] += 1
}
# TODO vermin ?
else
puts "unhandled ref #{ref.inspect}" if $DEBUG
end
}

type = case cage
       when DFHack::ItemCagest; 'Cage'
       when DFHack::ItemAnimaltrapst; 'Animal trap'
       else cage._rtti_classname
       end

if count.empty?
empty_cages += 1
else
puts "#{type} ##{cage.id}: ", count.sort_by { |k, v| v }.map { |k, v| " #{v} #{k}" }
end

count.each { |k, v| count_total[k] += v }
}

if list.length > 2
puts '', "Total: ", count_total.sort_by { |k, v| v }.map { |k, v| " #{v} #{k}" }
puts "with #{plural(empty_cages, 'empty cage')}"
end
end


# handle magic script arguments
here_only = $script_args.delete 'here'
if here_only
it = df.item_find
list = [it]
if not it.kind_of?(DFHack::ItemCagest) and not it.kind_of?(DFHack::ItemAnimaltrapst)
list = df.world.items.other[:ANY_CAGE_OR_TRAP].find_all { |i| df.at_cursor?(i) }
end
if list.empty?
puts 'Please select a cage'
throw :script_finished
end

elsif ids = $script_args.find_all { |arg| arg =~ /^\d+$/ } and ids.first
list = []
ids.each { |id|
$script_args.delete id
if not it = df.item_find(id.to_i)
puts "Invalid item id #{id}"
elsif not it.kind_of?(DFHack::ItemCagest) and not it.kind_of?(DFHack::ItemAnimaltrapst)
puts "Item ##{id} is not a cage"
list << it
else
list << it
end
}
if list.empty?
puts 'Please use a valid cage id'
throw :script_finished
end

else
list = df.world.items.other[:ANY_CAGE_OR_TRAP]
end


# act
case $script_args[0]
when /^it/i
cage_dump_items(list)
when /^arm/i
cage_dump_armor(list)
when /^wea/i
cage_dump_weapons(list)
when 'all'
cage_dump_all(list)
when 'list'
cage_dump_list(list)
else
puts <<EOS
Marks items inside all cages for dumping.
Add 'here' to dump stuff only for selected cage.
Add a cage id to dump stuff for this cage only.

See 'autodump' to actually dump stuff.

Usage:
  stripcaged items
    dump items directly in cages (eg seeds after training)
 
  stripcaged [armor|weapons] here
    dump armor or weapons of caged creatures in selected cage

  stripcaged all 28 29
    dump every item in cage id 28 and 29, along with every item worn by creatures in there too
 
  stripcaged list
    show content of the cages

EOS

end

LNP r23, probably not neccesary, but I guess having one much further back can help to double check against.
Code: [Select]
# mark stuff inside of cages for dumping.

def plural(nr, name)
# '1 cage' / '4 cages'
"#{nr} #{name}#{'s' if nr > 1}"
end

def cage_dump_items(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsItemst)
next if ref.item_tg.flags.dump
count += 1
ref.item_tg.flags.dump = true
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'item')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_armor(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsUnitst)
ref.unit_tg.inventory.each { |it|
next if it.mode != :Worn
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'armor piece')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_weapons(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
next unless ref.kind_of?(DFHack::GeneralRefContainsUnitst)
ref.unit_tg.inventory.each { |it|
next if it.mode != :Weapon
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'weapon')} in #{plural(count_cage, 'cage')}"
end

def cage_dump_all(list)
count = 0
count_cage = 0
list.each { |cage|
pre_count = count
cage.general_refs.each { |ref|
case ref
when DFHack::GeneralRefContainsItemst
next if ref.item_tg.flags.dump
count += 1
ref.item_tg.flags.dump = true
when DFHack::GeneralRefContainsUnitst
ref.unit_tg.inventory.each { |it|
next if it.item.flags.dump
count += 1
it.item.flags.dump = true
}
end
}
count_cage += 1 if pre_count != count
}

puts "Dumped #{plural(count, 'item')} in #{plural(count_cage, 'cage')}"
end


def cage_dump_list(list)
count_total = Hash.new(0)
empty_cages = 0
list.each { |cage|
count = Hash.new(0)

cage.general_refs.each { |ref|
case ref
when DFHack::GeneralRefContainsItemst
count[ref.item_tg._rtti_classname] += 1
when DFHack::GeneralRefContainsUnitst
ref.unit_tg.inventory.each { |it|
count[it.item._rtti_classname] += 1
}
# TODO vermin ?
else
puts "unhandled ref #{ref.inspect}" if $DEBUG
end
}

type = case cage
       when DFHack::ItemCagest; 'Cage'
       when DFHack::ItemAnimaltrapst; 'Animal trap'
       else cage._rtti_classname
       end

if count.empty?
empty_cages += 1
else
puts "#{type} ##{cage.id}: ", count.sort_by { |k, v| v }.map { |k, v| " #{v} #{k}" }
end

count.each { |k, v| count_total[k] += v }
}

if list.length > 2
puts '', "Total: ", count_total.sort_by { |k, v| v }.map { |k, v| " #{v} #{k}" }
puts "with #{plural(empty_cages, 'empty cage')}"
end
end


# handle magic script arguments
here_only = $script_args.delete 'here'
if here_only
it = df.item_find
list = [it]
if not it.kind_of?(DFHack::ItemCagest) and not it.kind_of?(DFHack::ItemAnimaltrapst)
list = df.world.items.other[:ANY_CAGE_OR_TRAP].find_all { |i| df.at_cursor?(i) }
end
if list.empty?
puts 'Please select a cage'
throw :script_finished
end

elsif ids = $script_args.find_all { |arg| arg =~ /^\d+$/ } and ids.first
list = []
ids.each { |id|
$script_args.delete id
if not it = df.item_find(id.to_i)
puts "Invalid item id #{id}"
elsif not it.kind_of?(DFHack::ItemCagest) and not it.kind_of?(DFHack::ItemAnimaltrapst)
puts "Item ##{id} is not a cage"
list << it
else
list << it
end
}
if list.empty?
puts 'Please use a valid cage id'
throw :script_finished
end

else
list = df.world.items.other[:ANY_CAGE_OR_TRAP]
end


# act
case $script_args[0]
when /^it/i
cage_dump_items(list)
when /^arm/i
cage_dump_armor(list)
when /^wea/i
cage_dump_weapons(list)
when 'all'
cage_dump_all(list)
when 'list'
cage_dump_list(list)
else
puts <<EOS
Marks items inside all cages for dumping.
Add 'here' to dump stuff only for selected cage.
Add a cage id to dump stuff for this cage only.

See 'autodump' to actually dump stuff.

Usage:
  stripcaged items
    dump items directly in cages (eg seeds after training)
 
  stripcaged [armor|weapons] here
    dump armor or weapons of caged creatures in selected cage

  stripcaged all 28 29
    dump every item in cage id 28 and 29, along with every item worn by creatures in there too
 
  stripcaged list
    show content of the cages

EOS

end
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 30, 2013, 09:39:38 pm
*snip*
NONE of the argument options work, and they all produce the same result. Did something change in how the arguments are read or passed?

Wish I knew, all of the options are there in that code, but it's not working for some reason. I still have the zip for LNP r38 (and r23 if we need one further back), so I'll get the ruby code from there.

While grabbing the code, I noticed that while r41 was neatly formatted in notepad, the others weren't formatted neatly. I don't know if that means anything, might not.

Edit: Did a visual comparison of r41 and r38 and I'm not seeing any differences. Maybe there is something else interfering?

r41 to use as a starting point.
...
LNP r38, it worked here.
...
LNP r23, probably not neccesary, but I guess having one much further back can help to double check against.
...

The script hasn't changed from "LNP r23" onwards, so perhaps the thing that reads/interprets the script is different now?

If I knew how to code in Ruby, I would write a test script that would just print (echo) all the arguments that were passed to the function.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on November 30, 2013, 10:08:05 pm
The pack has used r3 all the way through, and I don't remember ever updating the script - it would be in the changelog if I had. The only change I can think of is that I set up dfterm3, which iirc has some extra stuff for the binary?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on November 30, 2013, 10:45:15 pm
Red herring - typing "stripcaged" calls the stripcaged.plug.dll plugin located in "\hack\plugins" and NOT the stripcaged.rb script.

If I move the offending plugin to a backup folder, THEN the .rb script is called and works properly.  8)

What is the purpose of that plugin?
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 30, 2013, 11:35:49 pm
Red herring - typing "stripcaged" calls the stripcaged.plug.dll plugin located in "\hack\plugins" and NOT the stripcaged.rb script.

If I move the offending plugin to a backup folder, THEN the .rb script is called and works properly.  8)

What is the purpose of that plugin?

Is it something found only in the LNP or is it in the main DFhack download?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on November 30, 2013, 11:45:31 pm
Red herring - typing "stripcaged" calls the stripcaged.plug.dll plugin located in "\hack\plugins" and NOT the stripcaged.rb script.

If I move the offending plugin to a backup folder, THEN the .rb script is called and works properly.  8)

What is the purpose of that plugin?

Is it something found only in the LNP or is it in the main DFhack download?

I just DL'd DFHack, and it looks like stripcaged.plug.dll is not present. The only things that start with st are steam-engine, stockpiles, and stonesense.

Stripcaged.rb is present in the scripts folder.

E: For clarification, I downloaded version R3 from the first page of this thread.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on November 30, 2013, 11:52:20 pm
Maybe something that got left by accident while compiling the LNP r41?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on December 01, 2013, 01:04:57 am
It is present in the dfhack-0.34.11-r4-Windows.7z "zip" file that I downloaded on 5 November 2013.

IIRC at the time, R4 was "unofficial", but people started to upgrade to it anyways, and then an "official" R4 was released.
Title: Re: DFHack 0.34.11 r3
Post by: smjjames on December 01, 2013, 01:34:35 am
It is present in the dfhack-0.34.11-r4-Windows.7z "zip" file that I downloaded on 5 November 2013.

IIRC at the time, R4 was "unofficial", but people started to upgrade to it anyways, and then an "official" R4 was released.

Yeah, I looked at the r38 folder and there is no stripcaged.plug.dll while the file is in r41, so I guess Peridexis downloaded r4 without realizing it?.

As for what the plugin does, doing stripcaged now outputs what specific items were dumped, which it didn't before. Well, it did, but it didn't say whether they were shoes, large daggers, etc. Since the ruby code is unchanged, maybe that is what the plugin is for?

Can I go and remove it into a backup folder for now or wait on that?

Edit: Went and moved it to a backup folder. Without the plugin, it just says x number of items removed from y number of cages. Knowing just what specifically was dumped is a nice little feature, but I'd rather have it be functional.
Title: Re: DFHack 0.34.11 r3
Post by: Thundercraft on December 02, 2013, 02:48:38 am
I recently read a discussion on the DF 2012v0.34 question and answer thread (http://www.bay12forums.com/smf/index.php?topic=101379.msg4802943#msg4802943) that relates somewhat to the functionality of DFHack commands autodump and changeitem:

How do I get my dwarves to store an artifact large gem and an artifact gem flask? I'd like to get them out of the farming area.

Unfortunately you can't. Stockpiles can only store small cut gems. All other things made of gemstone are not stockpile-able, they simply aren't options in the stockpile materials lists.

Hm, is there a way I can move them via DFhack?

There might be a script that would work, but I don't know of one. The only thing I can think of would be autodump, but since you can't mark an artifact for dumping, autodump won't be usable.

You might be able to use changeitem to change the artifact material to something that can be stockpiled, then change it back once it is put away, but I have never used changeitem on an artifact, so I have no idea of any potential problems with that.

This relates to 0004430: Large gems not moved to stockpile (http://www.bay12games.com/dwarves/mantisbt/view.php?id=4430). It's not just artifacts.

It seems a shame to have such things just clutter up a workshop simply because there is no way to move them. Artifacts can not be traded. But ordinary large gems can be moved to a Trade Depot. However, even then, they will be stuck there forever:

DF2012:Trade depot > Bugs (http://dwarffortresswiki.org/index.php/DF2012:Trade_depot#Bugs)
Quote
Large gems, once selected to be traded, will remain at the Depot forever. This bug occurs because no stockpile accepts large gems, and is not specific to the Depot.

Question 1: Will using changeitem to change the material of artifact mess it up?

Question 2: How difficult would it be to add functionality to autodump to allow moving items that can not be selected for dumping?

I was thinking of an autodump function similar to autodump-destroy-here that works on items under the cursor. Perhaps it works on items under cursor, then prompts you to move the cursor to another location where you want them moved to? Or maybe have items under cursor instantly moved to the nearest square in the nearest garbage dump zone?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on December 02, 2013, 11:53:54 am
Will using changeitem to change the material of artifact mess it up?
Not that I can see - beyond the item itself, the artifact doesn't appear to keep track of what it's made of.

The only possible problem I can think of would be of art images depicting the creation of the artifact (i.e. they might continue to depict the original material), though I don't have time to verify whether or not that would even happen.
Title: Showmood
Post by: xcorps on December 03, 2013, 08:45:58 pm
Sorry if this is the wrong thread, not really sure where to post it.

I just did a showmood and got :
Item 1: any plant fibre cloth, quantity 30000

Surely that can't be right?

Title: Re: Showmood
Post by: BlackFlyme on December 03, 2013, 08:59:46 pm
Sorry if this is the wrong thread, not really sure where to post it.

I just did a showmood and got :
Item 1: any plant fibre cloth, quantity 30000

Surely that can't be right?

No, that's fine. Cloth, thread, and bars have different quantities than other items. One bar is 150, one cloth is 10,000, and one piece of thread is 15,000.

Your mooder wants three pieces of plant cloth.
Title: Re: DFHack 0.34.11 r3
Post by: xcorps on December 03, 2013, 09:14:03 pm
Thanks for the quick response, I had the fort on hold until I knew if I needed to wall him in.
Title: Re: DFHack 0.34.11 r3
Post by: greycat on December 03, 2013, 10:09:19 pm
The new LFR release says it uses DFHack r4.  Apparently DFHack r4 is not actually a thing.  Unless it is.  Maybe.  It's very confusing.

So anyway, it looks like what I'm supposed to do is build DFHack from git source code.  I have a Debian 7.2 amd64 system.  Many of the i386 libraries were already installed, as I have been playing DF on this system (including the previous LFR release with DFHack r3).

I installed the following packages:

I did a git clone https://github.com/peterix/dfhack, and then followed the instructions from Compile.html:
Code: [Select]
cd build
cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=/usr/local/src/df_linux

This aborted with an error about hash map and making sure I had 32-bit GCC >= 4.4.  I couldn't find a definitive response to this, so I installed one additional package:

Then I tried the cmake command again... but instead of going through the "looking for..." steps, it only printed 3 lines.  I figured that was bad.  But there was no "cmake clean" command (I tried with and without the ..), so then I improvised and adapted the Mac OS X instructions:

Code: [Select]
cd ..
mkdir build-2
cd build-2
cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=/usr/local/src/df_linux
make install

This proceeded along with a bunch of warnings about variables that are too small to hold enums, until it aborted with this error:

Code: [Select]
Scanning dependencies of target eventful
[ 71%] Building CXX object plugins/CMakeFiles/eventful.dir/eventful.cpp.o
In file included from /usr/local/src/dfhack/library/include/df/unit.h:56:0,
                 from /usr/local/src/dfhack/plugins/eventful.cpp:11:
/usr/local/src/dfhack/library/include/df/tile_designation.h:19:38: warning: ‘df::tile_designation::<anonymous struct>::dig’ is too small to hold all values of ‘enum df::enums::tile_dig_designation::tile_dig_designation’ [enabled by default]
/usr/local/src/dfhack/library/include/df/tile_designation.h:27:37: warning: ‘df::tile_designation::<anonymous struct>::liquid_type’ is too small to hold all values of ‘enum df::enums::tile_liquid::tile_liquid’ [enabled by default]
/usr/local/src/dfhack/library/include/df/tile_designation.h:30:34: warning: ‘df::tile_designation::<anonymous struct>::traffic’ is too small to hold all values of ‘enum df::enums::tile_traffic::tile_traffic’ [enabled by default]
/usr/local/src/dfhack/plugins/eventful.cpp: In function ‘void enableEvent(int, int)’:
/usr/local/src/dfhack/plugins/eventful.cpp:232:15: error: ‘runtime_error’ is not a member of ‘std’
make[2]: *** [plugins/CMakeFiles/eventful.dir/eventful.cpp.o] Error 1
make[1]: *** [plugins/CMakeFiles/eventful.dir/all] Error 2
make: *** [all] Error 2

Now what?
Title: Re: DFHack 0.34.11 r3
Post by: falconne on December 03, 2013, 10:51:45 pm
That DFHack r4 tag doesn't build on Linux (or OSX, due to another error).

Regarding the specific error you got, I fixed it for myself with this commit: https://github.com/Falconne/dfhack/commit/25b06a48c113a33fc7f64fc37838cdc4552fd3db

It's probably been fixed differently by others.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on December 04, 2013, 05:30:53 am
Quick request -

I'd love a script that could export all the information that it's possible to export from legends mode - and if at all possible add a GUI hint for it.  This should be fairly easy to do the basics for, since "exportmaps.lua" (http://dffd.wimbli.com/file.php?id=7696) already handles all the detailed maps.  All that needs to be added is the XML, sites/pops/map, and site maps.  I tried, but I don't actually use Lua and I kept running into errors - xml worked alone but not combined, and the others stuff I never got. 

I've already got a batch script that processes a complete set of exports (http://www.bay12forums.com/smf/index.php?topic=13130), and I'm in the process of porting it to Python 3 (as a learning exercise, and for cross-platform availability).  If a dfhack script could export everything, I could then append a call to the processor for the LNP and everything would be super-easy for newbies; exploring the worldgen is a massively underrated activity that could be made way more accessible. 
Title: Re: DFHack 0.34.11 r3
Post by: Blaze on December 04, 2013, 04:45:51 pm
Dfusion appears to not work at all, I just get errors when I try to use any commands.

Also there no longer appears to be a way to change the number of starting dwarves. Am I missing something?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 04, 2013, 04:47:42 pm
starting dwarves is startdwarf.rb, not sure if it comes with DFHack 0.34.11 r3

Yeah, all of the .o files for dfusion are missing and have to be manually compiled right now
Title: Re: DFHack 0.34.11 r3
Post by: greycat on December 04, 2013, 07:40:17 pm
That DFHack r4 tag doesn't build on Linux (or OSX, due to another error).

Regarding the specific error you got, I fixed it for myself with this commit: https://github.com/Falconne/dfhack/commit/25b06a48c113a33fc7f64fc37838cdc4552fd3db

It's probably been fixed differently by others.

Awesome, thanks!  It built for me with that one-line change.

------------------------------------------------------------------------------------------------------------------

Hmm.  OK, next problem:

Code: [Select]
golem:/usr/local/src/df_linux+DFHack_r4_git$ ./dfhack
./libs/Dwarf_Fortress: /usr/local/src/df_linux+DFHack_r4_git/libs/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /usr/local/src/df_linux+DFHack_r4_git/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
-e

Inspecting the libs/libstdc++.so.6 file shows:

Code: [Select]
$ nm -D libs/libstdc++.so.6 | grep CXXABI
00000000 A CXXABI_1.3
00000000 A CXXABI_1.3.1
00000000 A CXXABI_1.3.2
00000000 A CXXABI_1.3.3
00000000 A CXXABI_1.3.4

$ nm -D libs/libstdc++.so.6 | grep GLIBCXX
00000000 A GLIBCXX_3.4
00000000 A GLIBCXX_3.4.1
00000000 A GLIBCXX_3.4.10
00000000 A GLIBCXX_3.4.11
00000000 A GLIBCXX_3.4.12
00000000 A GLIBCXX_3.4.13
00000000 A GLIBCXX_3.4.14
00000000 A GLIBCXX_3.4.2
00000000 A GLIBCXX_3.4.3
00000000 A GLIBCXX_3.4.4
00000000 A GLIBCXX_3.4.5
00000000 A GLIBCXX_3.4.6
00000000 A GLIBCXX_3.4.7
00000000 A GLIBCXX_3.4.8
00000000 A GLIBCXX_3.4.9

Googling led me to http://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html which seems to say that GLIBCXX_3.4.14 and CXXABI_1.3.4 come from gcc 4.5.0.  And I have gcc 4.7.2 on this computer.  Does this mean my gcc is too new, and I should try to build with 4.5 instead?

------------------------------------------------------------------------------------------------------------------

All right, let's see.  Debian 7.2 has three multilib-enabled versions of gcc packaged: 4.4, 4.6 and 4.7.  Guess what's missing.  Yeah.  gcc 4.5 is missing.

I tried building with gcc/g++ 4.4 (on Debian this is 4.4.7) and got this error:

Code: [Select]
[ 41%] Building CXX object library/CMakeFiles/dfhack.dir/Core.cpp.o
In file included from /usr/local/src/dfhack/library/Core.cpp:47:
/usr/local/src/dfhack/library/include/modules/EventManager.h:83: error: ‘hash’ is not a template
/usr/local/src/dfhack/library/include/modules/EventManager.h:83: error: explicit specialization of non-template ‘std::hash’
/usr/local/src/dfhack/library/include/modules/EventManager.h:94: error: ‘hash’ is not a template
/usr/local/src/dfhack/library/include/modules/EventManager.h:94: error: ‘std::hash’ is not a template type
make[2]: *** [library/CMakeFiles/dfhack.dir/Core.cpp.o] Error 1
make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
make: *** [all] Error 2

Then I tried with gcc 4.6 (which on Debian is 4.6.3) and it built, but I got the same runtime errors that I did with gcc 4.7.

Not sure what to try next, or why gcc 4.5 is not packaged....
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on December 04, 2013, 10:29:12 pm
From what I've heard from people who have compiled it, you do need GCC 4.5. I guess you could try building it from source (it does take a while, but it's fairly straightforward). Also, I was able to install it on OS X with Homebrew, so Linuxbrew (https://github.com/Homebrew/linuxbrew) might work (although I haven't tried it).

Speaking of OS X, I've been trying to compile r4 and I'm about 90% done with "make" so far. (If anyone's interested, there was an error with MapCache.cpp which I "fixed" by adding "(unsigned int)" before "layer_mats" on line 1146. I also used Falconne's fix above for eventful.) Here's the current problem I'm dealing with:
Code: [Select]
[ 91%] Building CXX object plugins/CMakeFiles/zone.dir/zone.cpp.o
In file included from dfhack-r4/library/include/LuaTools.h:32:0,
                 from dfhack-r4/plugins/zone.cpp:45:
dfhack-r4/library/include/DataDefs.h: In static member function 'static DFHack::compound_identity* df::identity_traits<T>::get() [with T = long unsigned int]':
dfhack-r4/library/include/DataFuncs.h:139:1:   instantiated from 'static void df::function_wrapper<void (*)(DFHack::color_ostream&, A1, A2, A3, A4), true>::execute(lua_State*, int, void (*)(DFHack::color_ostream&, A1, A2, A3, A4)) [with A1 = long unsigned int, A2 = long unsigned int, A3 = long unsigned int, A4 = long unsigned int, lua_State = lua_State]'
dfhack-r4/library/include/DataFuncs.h:222:59:   instantiated from 'void df::function_identity<T>::invoke(lua_State*, int) [with T = void (*)(DFHack::color_ostream&, long unsigned int, long unsigned int, long unsigned int, long unsigned int), lua_State = lua_State]'
dfhack-r4/plugins/zone.cpp:4515:1:   instantiated from here
dfhack-r4/library/include/DataDefs.h:441:54: error: '_identity' is not a member of 'long unsigned int'
This occurs with peterix/master and Falconne/DFHack-r4. I haven't found anything obvious that could be causing this - any ideas?
Title: Re: DFHack 0.34.11 r3
Post by: danaris on December 05, 2013, 07:57:41 pm
Oh, hey, saw your PM before I saw this, lethosor ;D

I have r4 building on OS X (tested successfully on 10.8 and 10.9); I just need to push a couple of changes to my repo on Github.
Title: Re: DFHack 0.34.11 r3
Post by: Ggobs on December 06, 2013, 08:15:58 pm
I've been playing DF since 40d and never tried DFHack--just Dwarf Therapist and Mayday.

Those two is all I need, but I want to give workflow a chance.

How long after the next release can I reasonably expect a DFHack to be updated to the new release?

Thanks
Title: Re: DFHack 0.34.11 r3
Post by: someone12345 on December 06, 2013, 08:20:29 pm
Advfort is not working for me. When I tried to dig using advfort, it did not work, even though I had a pick equipped. I had used R to move to dig, then took out a pick and pressed alt+up to dig into a wall. It said "correct tool not equipped". I put all of my weapons in my backpack, then tried again. It still did not work. Also, plant picking does not work. I stood on a shrub, then pressed alt+5. It said nothing, and the plant remained there. Can anyone help me?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on December 06, 2013, 10:25:28 pm
Advfort is not working for me. When I tried to dig using advfort, it did not work, even though I had a pick equipped. I had used R to move to dig, then took out a pick and pressed alt+up to dig into a wall. It said "correct tool not equipped". I put all of my weapons in my backpack, then tried again. It still did not work. Also, plant picking does not work. I stood on a shrub, then pressed alt+5. It said nothing, and the plant remained there. Can anyone help me?

Adv-fort can be strange sometimes.

With mining and woodcutting, the pick/axe has to be in your dominant hand. Try emptying your hands by either dropping everything or stowing everything in your pack, then take only your pick out. If you lost your dominant hand in a fight, you will not be able to mine or chop wood.

Not sure about plant picking, but it may be because you are hungry or thirsty. If you are hungry, thirsty, or tired, you will not be able to do jobs since the A.I. logic will try to eat or drink before doing the job, even if your character has nothing to eat or drink.
Title: Re: DFHack 0.34.11 r3
Post by: someone12345 on December 06, 2013, 10:33:46 pm
No, my character is not hungry, thirsty, or tired. Also, which is the dominant hand of a character? I only have a pick in my hands, and it is multigrasp.
Title: Re: DFHack 0.34.11 r3
Post by: greycat on December 06, 2013, 10:50:21 pm
From what I've heard from people who have compiled it, you do need GCC 4.5. I guess you could try building it from source (it does take a while, but it's fairly straightforward).

I was afraid of that.

I've actually managed to get it to build and run (though I haven't actually tested it beyond that).  It was not an easy process, so I'm going to try to piece together everything I did.  Maybe this will help someone else some day.

First thing I did was look through Debian bug reports, package archives, and the like.  There was a gcc-4.5 once upon a time, but it was completely removed in favor of gcc-4.6.  The packages are gone.  Totally deleted from the archive and everything.

So, next thing I did was install Debian 6.0 (squeeze) in a chroot, using debootstrap.  I decided to use the i386 version because DF is 32-bit.  No sense fighting multilib stuff at the same time I'm fighting everything else.  I installed build-essential and a few other packages.  It turns out Debian 6.0 has gcc-4.3 and gcc-4.4 only.

OK, so then I built gcc-4.5 and g++-4.5 from source.  This was not nearly as straightforward as I'd hoped, because the documentation says "don't give a target! we'll just figure it out for you", but that doesn't work so well in practice.  My kernel reports x86_64 because it's a 64-bit kernel, and gcc's bootstrap apparently decides, based on that, that I want a 64-bit compiler.  Which fails to build with a mysterious error somewhere along the way (something about missing gnu-stabs with a 64 somewhere in the pathname).  I finally managed to get it to build with: ../gcc-4.5.4/configure --enable-languages='c,c++' --disable-multilib i486-linux-gnu

(i486-linux-gnu was the target reported by "gcc -v" using Debian's gcc, so I used that.)

Next I copied the dfhack source directory into the chroot.  I installed cmake, libxml stuff, and so on.  I copied over the Dwarf Fortress 0.34.11 tarball and extracted that, exported CC=gcc-4.5 and CXX=g++-4.5 and then ran the cmake command for dfhack in an empty build directory.  This failed on zlib, so I fixed it by installing zlib1g-dev.  Blew away the build directory, recreated it, ran cmake again.  Then ran make -- which failed with a generate_headers error on some ruby-autogen thing at about 98% completion.

After inspecting the build.make files (the one in the chroot vs. the one not in the chroot -- they were different), I decided maybe the cmake version was wrong.  Debian 6.0 has cmake 2.8.2, and Debian 7.2 has cmake 2.8.9.  Going on that theory, I found cmake's web site and downloaded the latest source code for that, which was version 2.8.12.1.  I removed the cmake Debian package, and bootstrapped cmake 2.8.12.1 from source.  (This was in the terminal where CC and CXX were still exported to gcc-4.5 so it picked those up and used them.  I decided to let it go.)

Then back to the dfhack directory.  Blew away the build directory, recreated it yet again, re-ran cmake, and make.  And it finally worked!  Did the "make install", copied the modified df_linux directory from the chroot over to the regular system, and ran ./dfhack to be sure it actually starts up.  Which it did.

That's all I've got for now.
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on December 06, 2013, 11:03:55 pm
No, my character is not hungry, thirsty, or tired. Also, which is the dominant hand of a character? I only have a pick in my hands, and it is multigrasp.

The logic that tells a creature to eat, drink, or sleep will kick in shortly before the status effect will show in their info-screen, so you might not look hungry, but you might be. Or there might be something else keeping adv-fort from picking the plant. This might sound silly, but is the plant dead? Sometimes walking onto plants will kill them.

The dominant hand is chosen at random when a creature is created. To see which hand is dominant, drop everything then pick up something light enough to wield one-handed.

I'm not sure if holding your pick multi-grasp has any effect on adv-fort logic, so I can't comment on that.
Title: Re: DFHack 0.34.11 r3
Post by: ag on December 07, 2013, 02:29:48 am
Hmm.  OK, next problem:

Code: [Select]
golem:/usr/local/src/df_linux+DFHack_r4_git$ ./dfhack
./libs/Dwarf_Fortress: /usr/local/src/df_linux+DFHack_r4_git/libs/libstdc++.so.6: version `CXXABI_1.3.5' not found (required by ./hack/libdfhack.so)
./libs/Dwarf_Fortress: /usr/local/src/df_linux+DFHack_r4_git/libs/libstdc++.so.6: version `GLIBCXX_3.4.15' not found (required by ./hack/libdfhack.so)
-e

Just delete that libs/libstdc++.so.6 and let it use your system library.

How long after the next release can I reasonably expect a DFHack to be updated to the new release?

Could be a few weeks for the initial release in the worst case, depending on how much time people have to work on it. I'd suggest waiting a couple of weeks before getting impatient, and thus being nicely surprised if it takes less. :) Subsequent bugfix releases are a lot easier, since not so much changes.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on December 07, 2013, 10:50:57 am
No, my character is not hungry, thirsty, or tired. Also, which is the dominant hand of a character? I only have a pick in my hands, and it is multigrasp.

The logic that tells a creature to eat, drink, or sleep will kick in shortly before the status effect will show in their info-screen, so you might not look hungry, but you might be. Or there might be something else keeping adv-fort from picking the plant. This might sound silly, but is the plant dead? Sometimes walking onto plants will kill them.

The dominant hand is chosen at random when a creature is created. To see which hand is dominant, drop everything then pick up something light enough to wield one-handed.

I'm not sure if holding your pick multi-grasp has any effect on adv-fort logic, so I can't comment on that.
nah I found out that you will trample over the plant before you can get the chance to grab the item and since you're standing on said item for periods of time(to do a job) the game runs a random blah to check if did you step on the food you wanted to pick. this happens in fort mode also but only if your gardener is really slow, or your dwarves have some raw code that steps out plants.
then there a case the plant is really a shrub and will grow into a tree thus you can't 'pick it up'.

Title: Re: DFHack 0.34.11 r3
Post by: Zivilin on December 08, 2013, 03:36:14 pm
Apologies for intruding, I was wondering whether there is a way to ascertain which way a dwarf is facing using DFHack? I assume there must be some related variable which stores which way dwarves are facing, since they can be attacked from behind.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 08, 2013, 03:37:31 pm
No, AFAIK. It's pretty... kludgy as of now. I think this'll be improved as of next version.
Title: Re: DFHack 0.34.11 r3
Post by: Zivilin on December 08, 2013, 04:27:43 pm
No, AFAIK. It's pretty... kludgy as of now. I think this'll be improved as of next version.

Many thanks for Your prompt response. I suppose I'll have to do without.

Edit: Added quote for page break continuity
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on December 08, 2013, 06:58:12 pm
having a few issues trying to get showunitsyndromes.rb working in r4

I've been trying to follow putnams advice, but I seem to have an issue with a verb variable.

My progress from my last post

http://www.bay12forums.com/smf/index.php?topic=133174.msg4819400#msg4819400
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on December 08, 2013, 08:28:19 pm
Apologies for intruding, I was wondering whether there is a way to ascertain which way a dwarf is facing using DFHack? I assume there must be some related variable which stores which way dwarves are facing, since they can be attacked from behind.

It has something to do with the position of the creature's current target. You need an "ally" in melee range on the other side of the creature so that you can attack "from the side" or "from behind". If no-one is threatening a creature in melee, it doesn't appear to have a facing.
Title: Re: DFHack 0.34.11 r3
Post by: TheOnlySolitaire on December 09, 2013, 08:31:54 am
Hi guys,
I've been using 'spawnunit.lua' to quickly test things out in my forts, but every unit I have spawned has been friendly or 'tame'.  How exactly would I type out the command to make the spawned unit hostile? Or at least not be 'of my civ'?

Thanks in advance.

Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on December 09, 2013, 11:25:42 am
Hi guys,
I've been using 'spawnunit.lua' to quickly test things out in my forts, but every unit I have spawned has been friendly or 'tame'.  How exactly would I type out the command to make the spawned unit hostile? Or at least not be 'of my civ'?

Thanks in advance.
oh uhh just crack open the lua and remove the line that makes them that way.
spawn units normally (ala the code needed to spawn them) just a wild unit. or go into Gm-editor(gui/gm-editor) on the unit you spawn and find the civ section then replace what ever there with -1.
you really should keep a separate save file on you if you're using Spawnunit.
you could edit lua in Notepad.
the line should be at the bottom where the script goes and alter the unit.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 09, 2013, 03:14:11 pm
I'd be interested in a ''spawnunit friendly'', ''spawnunit civ'', ''spawnunit hostile'' and ''spawnunit pet''. Currently intelligent critters are civ-members, non-intelligent are pets, and with opposed to life or crazed I can do hostiles... but no friendlies, and not all that much control, especially the intelligent civ members that dont share the race with your civ. They are civ members, but cant do labors, just hang around the meeting areas.
Title: Re: DFHack 0.34.11 r3
Post by: Zivilin on December 09, 2013, 06:14:55 pm
Apologies for intruding, I was wondering whether there is a way to ascertain which way a dwarf is facing using DFHack? I assume there must be some related variable which stores which way dwarves are facing, since they can be attacked from behind.

It has something to do with the position of the creature's current target. You need an "ally" in melee range on the other side of the creature so that you can attack "from the side" or "from behind". If no-one is threatening a creature in melee, it doesn't appear to have a facing.

Ah, so that would mean that a single creature (with no allies close by) has no hope of ever performing a side/back attack, even on escaping enemies. Thank You for the information.
 
Title: Re: DFHack 0.34.11 r3
Post by: milo christiansen on December 11, 2013, 11:50:55 am
Is there any fix for units spawned by spawnunit being considered "not tame" and not showing up on the pets screen?
Title: Re: DFHack 0.34.11 r3
Post by: Ξlectɍonaughtƴ on December 11, 2013, 03:09:06 pm
Hi. I'm trying to use Workflow to run my fortress and I'd like to arrange this.

I have no bit. coal or lignite on the map but plenty of trees, However I can import fuel periodicly. I'd like to have a quotum of coal bars that prefers to make coal out of bit. coal or lignite but only when that is not in stock burn wood to fulfill the quotum.

Did I state that clearly enough? Is that possible to arrange?
Title: Re: DFHack 0.34.11 r3
Post by: TheOnlySolitaire on December 11, 2013, 06:26:33 pm
Hi, another ''spawnunit'' question:

Can I specify age and gender?
Specifically, being able to spawn children/young is what I want - but can it be done?

How exactly would I type out said command into dfhack? (I do not understand ruby or lua, so reading the file isn't often helpful...)

PS: if the above isn't possible, can I modify age using the gm-editor?

Thanks in advance
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on December 11, 2013, 06:33:49 pm
Hi, another ''spawnunit'' question:

Can I specify age and gender?
Specifically, being able to spawn children/young is what I want - but can it be done?

How exactly would I type out said command into dfhack? (I do not understand ruby or lua, so reading the file isn't often helpful...)

PS: if the above isn't possible, can I modify age using the gm-editor?

Thanks in advance

I don't know about age, but you can select a caste by entering the caste number beside the creature ID. The very first caste is always number 0.

For example, entering 'spawnunit ROC 0' will spawn a female, while entering a 1 will spawn a male.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 11, 2013, 06:43:29 pm
No age; the age should be exact moment of adulthood though.
Title: Re: DFHack 0.34.11 r3
Post by: Thundercraft on December 11, 2013, 07:24:27 pm
No age; the age should be exact moment of adulthood though.

Hmm... So, in the case of spawning new dwarves, all the spawned dwarves will be exactly 12 years old and even share the same birthday (the month and day they were "spawned")?

Isn't it possible to script a random number generator with lua?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 11, 2013, 08:04:12 pm
It already is somewhat random AFAIK; they're all born at 15 years old, actually, on my version all creatures are, which is... a problem, to say the least, I just realized how stupid that is.

Yeah, it's random. They have random deathdays, at least.
Title: Re: DFHack 0.34.11 r3
Post by: TheOnlySolitaire on December 12, 2013, 06:40:41 am
thanks for the replies guys.

So is it possible to add the ability to change age? And if so, how hard is it to do?

I don't know ruby or lua at all, but I don't want to ask someone if they could do it or would kindly help me to, if it will take them hours to do so...
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on December 12, 2013, 10:56:46 am
thanks for the replies guys.

So is it possible to add the ability to change age? And if so, how hard is it to do?

I don't know ruby or lua at all, but I don't want to ask someone if they could do it or would kindly help me to, if it will take them hours to do so...
well it's just unit.age=100 or something or another though it's less and more the profession taking affect given you can have 50 year old 'babys' or 100 year old 'children' or 1 year old 'Peasant' you could just use empregnate on a dwarf and clone up an army that way.
Title: Re: DFHack 0.34.11 r3
Post by: milo christiansen on December 12, 2013, 10:59:43 am
About the "not tame" issue? It is really annoying not being able to wartrain spawned animals.

EDIT: Almost forgot why I came here in the first place...

I was looking through the scripts that come with Masterwork when I discovered "announcements" and "announcements2", both examples of... less than stellar codding.
Not to belittle anyone but... Well "inefficient" would be an excellent description.
And so I present "announce.lua" a simple script that takes two arguments, a message and a color.
Example: announce "Something happened!" COLOR_LIGHTRED
If no color is provided it defaults to white, the message is required :)
Code: [Select]

local args = {...}
if not args then qerror("Needs an argument.") end

-- Your message.
local text = args[1]

-- COLOR_BLACK
-- COLOR_BLUE
-- COLOR_GREEN
-- COLOR_CYAN
-- COLOR_RED
-- COLOR_MAGENTA
-- COLOR_BROWN
-- COLOR_GREY
-- COLOR_DARKGREY
-- COLOR_LIGHTBLUE
-- COLOR_LIGHTGREEN
-- COLOR_LIGHTCYAN
-- COLOR_LIGHTRED
-- COLOR_LIGHTMAGENTA
-- COLOR_YELLOW
-- COLOR_WHITE
local color_id = args[2]
if not color_id then color_id = "COLOR_WHITE" end

local color

-- Ugly, but it works
if color_id ==     "COLOR_BLACK" then color = COLOR_BLACK
elseif color_id == "COLOR_BLUE" then color = COLOR_BLUE
elseif color_id == "COLOR_GREEN" then color = COLOR_GREEN
elseif color_id == "COLOR_CYAN" then color = COLOR_CYAN
elseif color_id == "COLOR_RED" then color = COLOR_RED
elseif color_id == "COLOR_MAGENTA" then color = COLOR_MAGENTA
elseif color_id == "COLOR_BROWN" then color = COLOR_BROWN
elseif color_id == "COLOR_GREY" then color = COLOR_GREY
elseif color_id == "COLOR_DARKGREY" then color = COLOR_DARKGREY
elseif color_id == "COLOR_LIGHTBLUE" then color = COLOR_LIGHTBLUE
elseif color_id == "COLOR_LIGHTGREEN" then color = COLOR_LIGHTGREEN
elseif color_id == "COLOR_LIGHTCYAN" then color = COLOR_LIGHTCYAN
elseif color_id == "COLOR_LIGHTRED" then color = COLOR_LIGHTRED
elseif color_id == "COLOR_LIGHTMAGENTA" then color = COLOR_LIGHTMAGENTA
elseif color_id == "COLOR_YELLOW" then color = COLOR_YELLOW
elseif color_id == "COLOR_WHITE" then color = COLOR_WHITE
else qerror("Bad color.")
end

-- only works in fort/adv mode, not in main menu/startup.
if not dfhack.isMapLoaded() then
    qerror('Map is not loaded.')
end

dfhack.gui.showAnnouncement(text, color)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on December 12, 2013, 11:54:10 am
Code: [Select]

local args = {...}
if not args then qerror("Needs an argument.") end

-- Your message.
local text = args[1]

-- COLOR_BLACK
-- COLOR_BLUE
-- COLOR_GREEN
-- COLOR_CYAN
-- COLOR_RED
-- COLOR_MAGENTA
-- COLOR_BROWN
-- COLOR_GREY
-- COLOR_DARKGREY
-- COLOR_LIGHTBLUE
-- COLOR_LIGHTGREEN
-- COLOR_LIGHTCYAN
-- COLOR_LIGHTRED
-- COLOR_LIGHTMAGENTA
-- COLOR_YELLOW
-- COLOR_WHITE
local color_id = args[2]
if not color_id then color_id = "COLOR_WHITE" end

local color

color=_G[color_id]

-- only works in fort/adv mode, not in main menu/startup.
if not dfhack.isMapLoaded() then
    qerror('Map is not loaded.')
end

dfhack.gui.showAnnouncement(text, color)

this should work too...
Title: Re: DFHack 0.34.11 r3
Post by: milo christiansen on December 12, 2013, 12:11:44 pm
Ah, cool! I suck at lua and know next to nothing about the DFHack internals, so no surprise it could be improved upon. I'll just steal that for use in my "Better Dorfs/Libs/DFHack/Announcements" Rubble addon :)

(That addon allows you to make reaction products to show an announcement by just calling "{DFHACK_ANNOUNCMENT;Rubble is AWSOME!;COLOR_BLUE}", the material is automatically generated and shared by all calls that have the same arguments.)
Title: Re: DFHack 0.34.11 r3
Post by: VerdantSF on December 12, 2013, 12:35:40 pm
I have no bit. coal or lignite on the map but plenty of trees, However I can import fuel periodicly. I'd like to have a quotum of coal bars that prefers to make coal out of bit. coal or lignite but only when that is not in stock burn wood to fulfill the quotum.

Not sure if there is a way in Workflow, but you might be able to work around it with stockpile distance.  Most workshops tend to pull from the closest available stockpile of reagents (kitchens are a big exception depending on items in containers or not).  If your log stockpile is further away from the wood furnace (let's just arbitrarily say 10 tiles) than your bituminous coal & lignite pile (adjacent), then the wood should only be used when the closer pile is empty.
Title: Re: DFHack 0.34.11 r3
Post by: Ξlectɍonaughtƴ on December 12, 2013, 01:31:00 pm
I have no bit. coal or lignite on the map but plenty of trees, However I can import fuel periodicly. I'd like to have a quotum of coal bars that prefers to make coal out of bit. coal or lignite but only when that is not in stock burn wood to fulfill the quotum.

Not sure if there is a way in Workflow, but you might be able to work around it with stockpile distance.  Most workshops tend to pull from the closest available stockpile of reagents (kitchens are a big exception depending on items in containers or not).  If your log stockpile is further away from the wood furnace (let's just arbitrarily say 10 tiles) than your bituminous coal & lignite pile (adjacent), then the wood should only be used when the closer pile is empty.

Thanks for the reply, but I'm affraid that won't work considering charcoal and coke are made at different workshops. Wood Burner and Smelter respectively. If it were the same shop I'd think your suggestion would work.

If the functionality is not in the current version of Workflow, is this the place to request that functionality?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on December 12, 2013, 03:45:10 pm
Would it work to set different constraints for each job? If I remember correctly, I've done something like this before:

If coke below 100, burn wood.
If coke below 1000, use bit coal / lignite.
Title: Re: DFHack 0.34.11 r3
Post by: Ξlectɍonaughtƴ on December 12, 2013, 04:03:02 pm
Would it work to set different constraints for each job? If I remember correctly, I've done something like this before:

If coke below 100, burn wood.
If coke below 1000, use bit coal / lignite.

Do you have an example of that configuration? It seems I can only specify output material, not Input material. Do I need to use the job-material utility for that?
Title: Re: DFHack 0.34.11 r3
Post by: VerdantSF on December 13, 2013, 12:53:17 pm
Thanks for the reply, but I'm affraid that won't work considering charcoal and coke are made at different workshops. Wood Burner and Smelter respectively. If it were the same shop I'd think your suggestion would work.

Whoops, I spaced out on that!  I'm using the gui add-on for Workflow atm.  I'm trying to figure out a set of constraints for PeridexisErrant's suggestion, but not having much luck so far.

*Edit* Not sure how to do separate constraints for coke from bit/lig and charcoal from coal.  Both are listed as coal.  Hmmm... there might be a way by using the foreign vs. locally made tags.  Since the bit/lignite is brought in through trade, I wonder if the foreign tag carries through to the final product?  I don't think so, but I'm not 100% sure.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on December 13, 2013, 05:45:39 pm
Apologies - I just went and checked my old fort, and it wasn't working the way I thought for coke (which explains where my logs kept disappearing to).  The similar trick is to set high thresholds for green glass, and lower for stone (eg pots); that way if the glass furnaces are bottlenecked for some reason the fort doesn't grind to a halt and tantrum. 

You might be able to stick something together with the Stockflow plugin (http://www.bay12forums.com/smf/index.php?topic=126389), I guess. 
Title: Re: DFHack 0.34.11 r3
Post by: greycat on December 14, 2013, 02:18:54 pm
I keep getting these errors in the tty console:
Code: [Select]
/usr/local/src/LFR/hack/scripts/itemsyndrome.lua:32: attempt to index local 'material' (a nil value)
stack traceback:
/usr/local/src/LFR/hack/scripts/itemsyndrome.lua:32: in function 'getMaterial'
/usr/local/src/LFR/hack/scripts/itemsyndrome.lua:269: in function 'checkAndAddSyndrome'
/usr/local/src/LFR/hack/scripts/itemsyndrome.lua:304: in function </usr/local/src/LFR/hack/scripts/itemsyndrome.lua:303>
This is with LFR 0.21a ASCII Edition and self-compiled DFHack from git, as described earlier in this thread.  The errors don't appear to cause the game to crash or misbehave (at least not in any obvious way), and they only appear once in a while, at times that don't follow any pattern I can see.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 14, 2013, 03:39:57 pm
DAMMIT, how many times do I have to fix that?

...

Use this version. (https://gist.github.com/Putnam3145/7005730)
Title: Re: DFHack 0.34.11 r3
Post by: Thundercraft on December 16, 2013, 11:50:58 pm
Recently, the breeding from egg-laying invader mounts (http://www.bay12forums.com/smf/index.php?topic=134347.0) thread caught my attention. It talked about the obstacles involved, with the main one being:

Invader mounts can be trained/tamed once, and only once, after which they disappear off your animal list. They will revert to wild status eventually and can't be retrained, but gain all the benefits of having been part of your fort: loyalty cascade if you kill them with soldiers and immunity to traps (not to lever or otherwise triggered upright spikes though), plus they remain an enemy iirc so instead of running away and hopefully off the map, they'll attack your dorfs.

Questions:
Shouldn't it be possible to use a DFHack script to at least change the hostility of said invader mounts, if not make them a permanent part of your fort?

What about the old "Toggle hostile" script from DFusion?

I did a search in the dfusion folder from the lastest (r3) release, but I could not find a script containing the name "hostile". Also, I can't find a mention of such a script in the DFHack readme (https://github.com/peterix/dfhack/blob/0.34.11-r2/Readme.rst).

Was "Toggle hostile" not ported over? Is DFHack still missing a lot of DFusion scripts? For that matter, would it even work in Fort mode? (Originally for Adventure mode.) Would it work on a hostile invader mount?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 16, 2013, 11:52:06 pm
Yes to all of that, right now.

Making enemies allies is not difficult at all. You just need to muck around with their entity links and allegiances.
Title: Re: DFHack 0.34.11 r3
Post by: Thundercraft on December 17, 2013, 12:04:04 am
Yes to all of that, right now.

Interesting. Though, I had assumed Toggle Hostile would not work properly for this purpose without a lot of changes.

Making enemies allies is not difficult at all. You just need to muck around with their entity links and allegiances.

Simple, perhaps, for those familiar with the inner workings of DF and DFHack.

I take it, then, there are not any scripts already written to do this? Perhaps something similar that I could study and apply to a different use? Or maybe some documentation? I could not find a mention of "entity links" or "allegiences" in the Readme. (Though, I also understand that the Readme desperately needs updating. Over a year old?)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on December 17, 2013, 12:25:31 am
The main source of "knowledge" about dfhack is not any readme, and will never be a readme. It can only tell you about the fixed part of dfhack i.e. the part we wrote, the part that has the infrastructure, the usage details of plugins etc... We can't (or at least i won't) write a guide/readme about the part thats from DF. The part that holds e.g. entity membership. The main reasons are: it will probably change with next df version, there is a ton of it, nobody (except Toady One) knows what does what exactly. Other than that the fastest way is either to dig through df-structures (https://github.com/angavrilov/df-structures/) , join our irc channel and ask around, try using gui/gm-editor to get the feel for structures and inner working of df, analyze the other plugins and scripts. The best example is creature creation script. It was not made for so long because nobody knew how it works and some fields were unknown. After some playing around (and df crashing) we have a working creature spawning script. Though it still is missing a lot of details and customization (e.g. memberships, history, starting afflictions, event birth date(age), inventory, maybe appearance customization, beliefs and family relations and so on) my idea was to spawn a creature and then modify it to your liking.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 17, 2013, 12:26:07 am
mmm I've got something that makes a unit an ally in adventure mode; it shouldn't be too difficult to edit it for fort mode.

Code: [Select]
local args={...}

local unit = args[1] and df.unit.find(args[1]) or dfhack.gui.getSelectedUnit()

local unitnem = dfhack.units.getNemesis(unit)

local unitfig = df.historical_figure.find(unit.hist_figure_id)

local adv = df.global.world.units.active[0]

local advnem = dfhack.units.getNemesis(adv)

unit.relations.group_leader_id=adv.id

if unitnem then
unitnem.group_leader_id=advnem.id
end
if advnem and unitnem then
advnem.companions:insert('#',unitnem.id)
end

if unitfig then
for i=1,#unitfig.entity_links do
unitfig.entity_links:erase(0)
end
end
unit.civ_id=(df.global.world.units.active[0].civ_id)
Title: Re: DFHack 0.34.11 r3
Post by: Thundercraft on December 17, 2013, 03:00:01 am
The main source of "knowledge" about dfhack is not any readme, and will never be a readme. It can only tell you about the fixed part of dfhack i.e. the part we wrote, the part that has the infrastructure, the usage details of plugins etc... We can't (or at least i won't) write a guide/readme about the part thats from DF...

Understood. I knew there wasn't a comprehensive guide or anything. But I had no idea where to start.

Other than that the fastest way is either to dig through df-structures (https://github.com/angavrilov/df-structures/) , join our irc channel and ask around, try using gui/gm-editor to get the feel for structures and inner working of df, analyze the other plugins and scripts. The best example is creature creation script...

:) Thank you for the tips.

mmm I've got something that makes a unit an ally in adventure mode; it shouldn't be too difficult to edit it for fort mode.

{code}

Oh, thanks! That looks like a good starting point.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 17, 2013, 10:24:31 am
What's COMBATHARDNESS called for the purposes of DFHack scripts? Specifically, I'd like it to be able to examine how 'tragic' an individual effect is.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on December 17, 2013, 01:28:28 pm
What's COMBATHARDNESS called for the purposes of DFHack scripts? Specifically, I'd like it to be able to examine how 'tragic' an individual effect is.
In Lua, you should be able to use "df.misc_trait_type.Hardened".
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 17, 2013, 02:49:39 pm
How do I use it? I've been using the getbloodcount script as a base and replacing unit.body.blood_count with whatever will make it give out the number I'm after, but it either gives me various errors or returns the number 15. I tried running that one on two dwarves with different descriptions of their combat hardiness, and should have gotten two different numbers.

The original getbloodcount script:

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 17, 2013, 03:59:01 pm
You should be using df.unit.find(num) there, not df.global.world.units.all[num].

Also, for combathardness you want dfhack.units.getMiscTrait(unit,df.misc_trait_type.Hardened,true)

The true is optional (it creates the misc trait if the creature doesn't have one) but I don't think it'll hurt anything.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 17, 2013, 06:40:09 pm
Okay, here's what I've got now.

Spoiler (click to show/hide)

What it's outputting now is <unit_misc_trait: 0x1C71a220> , with a different memory address for each unit.

I assume I need to connect the 'get_misc_trait' part of the script to the 'print(getTraumaCount(traumaCountUnit))' part, but I don't know how.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 17, 2013, 06:42:43 pm
You want to add a .value at the end of your getTraumaCount(traumaCountUnit) thing:

print(getTraumaCount(traumaCountUnit).value)
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 17, 2013, 08:58:29 pm
Excellent! It works now, thanks.

One odd result I've noticed is that a child who lost his father when he was a baby has 0 hardiness.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 17, 2013, 09:01:10 pm
It's called COMBATHARDNESS in the raws; it's mostly increased by combat, as far as I can tell. Give that child a good beating and it should go up.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 17, 2013, 10:32:16 pm
Ah, I've got it the wrong way round. I thought that thoughts marked as tragedies would make the dwarf become more resistant to future tragic events.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on December 18, 2013, 12:08:09 am
Ah, I've got it the wrong way round. I thought that thoughts marked as tragedies would make the dwarf become more resistant to future tragic events.

Babies are insane and are also prohibited from many things, such as learning skills or using skills (even if natural). Wouldn't surprise me if they are immune to hardening.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 18, 2013, 11:09:27 am
Just used DFHack to kill somebody's wife. He was unhappy about it, but not hardened by it.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 18, 2013, 12:17:58 pm
Hello everyone,

I am currently trying a undead race, but the game says "your settlement has crumbled", if all civ members are opposed to life. Not-Living is not enough to make civ-members friendly to undeads, but I remembered that vampires act neutral, and not even invading necromancer armies do attack them. At least I read forum posts about this.

My current plan it to set the vampire flag for all civ members with an automated dfhack script. It doesnt have to add any tags, like bloodsucker, it just needs to help the game identify the civ-members as vampires. (even if they are none)

I found this related post by Grewon:
I modified warmist's syndrome script from here (https://gist.github.com/warmist/4061959) so that it searches for the vampire syndrome id by checking the syndrome's displayed name(in this case vampire), and then infects the selected unit with the vampire syndrome, effectively making him a vampire. It also seems to work with necromancers.
Code: [Select]
function assignSyndrome(target,syn_id)
    if target==nil then
        qerror("Not a valid target")
    end
    local ns=df.unit_syndrome:new()
    local trg_syn=df.syndrome.find(syn_id)
    ns.type=trg_syn.id
    --ns.year=
    --ns.year_time=
    ns.ticks=1
    ns.unk1=1
    for k,v in ipairs(trg_syn.ce) do
        local sympt=df.unit_syndrome.T_symptoms:new()
        sympt.ticks=1
        sympt.flags=2
        ns.symptoms:insert("#",sympt)
    end
    target.syndromes.active:insert("#",ns)
end
function makeVampire(unit)
for i=0,#df.global.world.raws.syndromes.all-1 do
for j=0,#df.global.world.raws.syndromes.all[i].ce-1 do
for k,v in pairs(df.global.world.raws.syndromes.all[i].ce[j]) do
if k=="name" then
if v=="vampire" then --this can be changed to necromancer
print("Found vampire syndrome id:"..i)
assignSyndrome(unit,i)
print("Infected unit with vampire syndrome.")
return
end
end
end
end
end
end
local unit=dfhack.gui.getSelectedUnit()
makeVampire(unit)


P.S. this simple cure script removes all syndromes in case you want to undo the effects of the first script, or even if you want to cure genuinely infected units.
Code: [Select]
local unit=dfhack.gui.getSelectedUnit()
while #unit.syndromes.active > 0 do
unit.syndromes.active:erase(0)
end
while #unit.body.wounds > 0 do
unit.body.wounds:erase(0)
end
unit.body.wound_next_id=1

Unfortunately I dont know exactly how to get from this code to a lua-script that runs on each civ-member. I know how to run a script with SyndromeTrigger. I could write an interaction for the civ that targets themselves and runs a script, but I would need a script that adds the vampire-flag without any other syndromes. OR whatever else would lead to an undead civ, which is friendly to zombies, but does not end the game automatically.

I tried pretty much everything thats possible with modding, and it did not work. I have to ask for your assisstance (again ;) ). If anyone knows how to make civ-members friendly to undeads, please let me know. :)

EDIT: After more tests it seems to be possible with modding alone. SYN_CLASS:VAMPCURSE and/or the BLOODSUCKER tag allow allying with undeads. So please dont mind about this script anymore, I found a solution. Make all civ members bloodsuckers, but have no civ members with blood. ;)
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on December 18, 2013, 01:18:50 pm
EDIT: After more tests it seems to be possible with modding alone. SYN_CLASS:VAMPCURSE and/or the BLOODSUCKER tag allow allying with undeads. So please dont mind about this script anymore, I found a solution. Make all civ members bloodsuckers, but have no civ members with blood. ;)
It is almost definitely the BLOODSUCKER tag that triggers that behavior. Stuff like SYN_CLASS is typically arbitrary, assigned by the game for procedurally generated creatures but never specifically checked for by in-game logic (i.e. if you were to rename every SYN_CLASS consistently, it wouldn't have any effect on gameplay).

Necromancers are also "friendly to undead", and the one notable tag they get is NO_AGING - have you tried using that one?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 18, 2013, 01:56:18 pm
This is what I used on my last test. Without the BLOODSUCKER. I think you are right and its the NO_AGING. Wouldnt have guessed, to be honest. NOT_LIVING would have made a lot more sense, but I am just happy that it works. :)

Since NO_AGING is not a valid creature token (I think), I give each civ member a self-targetted interaction. The first 1 second ingame there is a bit of infighting between opposed to life civ-members and alive civ-members, but if I cant get the opposed to life dudes to actually do work, I will get rid of them anyway.

Code: [Select]
[INTERACTION:MAKE_VAMPIRE]
   [I_SOURCE:CREATURE_ACTION]
   [I_TARGET:A:CREATURE]
   [IT_LOCATION:CONTEXT_CREATURE]
[IT_CANNOT_TARGET_IF_ALREADY_AFFECTED]
   [I_EFFECT:ADD_SYNDROME]
[IE_TARGET:A]
[IE_IMMEDIATE]
[IE_ARENA_NAME:Test undead behaviour]
[SYNDROME]
[SYN_CLASS:VAMPCURSE]
[CE_ADD_TAG:NO_AGING:STERILE:NOT_LIVING:START:0]

Now I just have to figure out a nice way to make the Warlocks/Mages look differently from the Skeleton/Undead civ part. I want skeletons as workers, but currently they look the same. ALT_TILE doesnt work, because the creatures use sprites.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on December 19, 2013, 03:17:33 am
I've made this fun script that allows you to get rid of specific units in creative manners:

Code: (killitwith.lua) [Select]
--causes targeted unit to die in several possible manners
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor!  Aborting!")
return
end

if unit.flags1.dead==true then
print ("Dead unit!  Aborting!")
return
end

--fire heat cold gravity thirst hunger time(age)
--blood violence(berserk) water(drown) sabotage(scuttle)

args={...}

if #args ~= 1 then
print ("Use one of the following arguments when calling the script (all lowercase!):")
print ("fire")
print ("heat")
print ("cold")
print ("gravity")
print ("thirst")
print ("hunger")
print ("time")
print ("blood")
print ("violence")
print ("water")
print ("sabotage")
return
end

if args[1]=="fire" then
for k,v in pairs(unit.body.components.body_part_status) do
unit.body.components.body_part_status[k].on_fire=true
end
unit.flags3.body_temp_in_range=false
return
end


if args[1]=="heat" then
for k,v in pairs(unit.status2.body_part_temperature) do
unit.status2.body_part_temperature[k].whole=12000
end
return
end


if args[1]=="cold" then
for k,v in pairs(unit.status2.body_part_temperature) do
unit.status2.body_part_temperature[k].whole=0
end
return
end


if args[1]=="gravity" then
if unit.flags1.projectile==true then
print ("Already a projectile!  Aborting!")
return
end
if unit.flags1.rider==true or unit.flags1.caged==true or unit.flags2.swimming==true or unit.flags3.exit_vehicle1==true or

unit.flags3.exit_vehicle2==true then
print ("Not eligible (rider, caged, swimming, minecart)!  Aborting!")
return
end
local count=0
local l = df.global.world.proj_list
local lastlist=l
l=l.next
    while l do
      count=count+1
if l.next==nil then
lastlist=l
end
      l = l.next
    end
newlist = df.proj_list_link:new()
lastlist.next=newlist
newlist.prev=lastlist
proj = df.proj_unitst:new()
newlist.item=proj
proj.link=newlist
proj.id=df.global.proj_next_id
df.global.proj_next_id=df.global.proj_next_id+1
proj.unit=unit
proj.origin_pos.x=unit.pos.x
proj.origin_pos.y=unit.pos.y
proj.origin_pos.z=unit.pos.z
proj.prev_pos.x=unit.pos.x
proj.prev_pos.y=unit.pos.y
proj.prev_pos.z=unit.pos.z
proj.cur_pos.x=unit.pos.x
proj.cur_pos.y=unit.pos.y
proj.cur_pos.z=unit.pos.z
proj.flags.no_impact_destroy=true
proj.flags.piercing=true
proj.flags.parabolic=true
proj.flags.unk9=true
proj.speed_z=-200000
unitoccupancy = dfhack.maps.getTileBlock(unit.pos).occupancy[unit.pos.x%16][unit.pos.y%16]
if not unit.flags1.on_ground then
unitoccupancy.unit = false
else
unitoccupancy.unit_grounded = false
end
unit.flags1.projectile=true
unit.flags1.on_ground=false
return
end


if args[1]=="thirst" then
unit.counters2.thirst_timer=6000000
return
end


if args[1]=="hunger" then
unit.counters2.hunger_timer=9000000
unit.counters2.stored_fat=0
unit.counters2.stomach_food=0
return
end


if args[1]=="time" then
print("old age placeholder")
return
end


if args[1]=="blood" then
unit.body.blood_count=0
return
end


if args[1]=="violence" then
if unit.status.current_soul==nil then
print ("Soulless unit!  Aborting!")
return
end
unit.status.happiness=0
unit.status.insanity_chance=100
unit.status.current_soul.traits.ANGER=100
unit.status.current_soul.traits.VULNERABILITY=80
--eventually makes the unit go berserk
return
end


if args[1]=="water" then
print("drowning placeholder")
return
end


if args[1]=="sabotage" then
unit.flags3.scuttle=true
return
end


--none of the above
print ("Use one of the following arguments when calling the script (all lowercase!):")
print ("fire")
print ("heat")
print ("cold")
print ("gravity")
print ("thirst")
print ("hunger")
print ("time")
print ("blood")
print ("violence")
print ("water")
print ("sabotage")
--done

1. Any suggestions for other death types, if possible? The game doesn't allow me to create wounds and decapitate people via code, for example, because that needs certain combat functions to run. They just walk around without a head until they realize that they should suffocate. I could probably just provide a "lobotomy" option that removes/damages the brain.

2. I need to make the drowning and old age deaths work. I don't exactly understand how these are determined.

3. People probably want to check out the "gravity" option, since I discovered how to turn units into valid projectiles by studying dfhack.items.makeProjectile(item) and a disassembly of the code that runs when a creature steps off a cliff and falls under gravity. You could change the speed values to shoot creatures up or sideways, slowly or fast.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 19, 2013, 03:28:06 am
You could make it case insensitive with args[1]:lower()

You could also make it run faster by having a lookup table instead of going through all the arguments:

Code: [Select]
This:
    function hello() print('hello') end
    function world() print('world') end
    if args[1]=='hello' then hello() end
    if args[1]=='world' then world() end
Vs this:
    options={
        hello=function() print('hello') end --will make "options['hello']()" or "options.hello()" print "hello"
        world=function() print('world') end
    }
    options[args[1]]=options[args[1]] or function() print('invalid!') end --makes it so that it prints "invalid!" if options does not actually exist; if it does exist, this line in essence does nothing
    options[args[1]]()

But that's all Lua stuff :V
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 19, 2013, 02:46:28 pm
Just checking: Can the catsplosion.plug.dll be changed for another creature, like civ-members? Lets say a civ that is otherwise sterile? So you never have kids, but do a magic ritual and the workshop triggers catsplosion once, and all your civ-members pop out a kid?
Title: Re: DFHack 0.34.11 r3
Post by: Ravendarksky on December 19, 2013, 05:58:10 pm
Is it possible to tell how dehydrated a dwarf is using dfhack?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 19, 2013, 06:03:05 pm
Is it possible to tell how dehydrated a dwarf is using dfhack?

Yes. unit.counters2.thirst_timer (https://github.com/angavrilov/df-structures/blob/master/df.units.xml)
Title: Re: DFHack 0.34.11 r3
Post by: Ravendarksky on December 19, 2013, 06:33:23 pm
Excellent! Thank you very much. I will read through that whole xml file, it looks really useful.

I have a second question.... How do I tell when the unit is close to death? The number is going up but I've no idea how high before death!

EDIT: The answer is 75000.. at least for dwarf adults and children.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on December 20, 2013, 02:32:53 am
Just checking: Can the catsplosion.plug.dll be changed for another creature, like civ-members? Lets say a civ that is otherwise sterile? So you never have kids, but do a magic ritual and the workshop triggers catsplosion once, and all your civ-members pop out a kid?
AFAIR yes you can do that. Though more research into genetics might be needed.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 20, 2013, 04:59:52 am
Just checking: Can the catsplosion.plug.dll be changed for another creature, like civ-members? Lets say a civ that is otherwise sterile? So you never have kids, but do a magic ritual and the workshop triggers catsplosion once, and all your civ-members pop out a kid?
AFAIR yes you can do that. Though more research into genetics might be needed.
I was hoping for a lua script and I can just replace CAT with another creature id, but its a compiled plugin, not a script. Thats why I would need help. Otherwise I use spawnunit, but if the creature is lacking a history, they cant be nobles/soldiers, which is a big handycap. Any plans to add an automated history to the script in r4?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on December 20, 2013, 06:26:45 am
What does not allow it to be assigned as military/noble is two part: first missing nemesis record (which we had success in creating without corrupting your saves, but it still needs testing imho) and other one is adding your then created historical figure to your civ entity (easy task). I could see if there is a up-to-date script for that at home.
As for catsplosion lua file:
Code: [Select]
df::unit_genes *preg = new df::unit_genes;
preg->appearance = female->appearance.genes.appearance;
preg->colors = female->appearance.genes.colors;
female->relations.pregnancy_genes = preg;
female->relations.pregnancy_timer = rand() % 100 + 1;
female->relations.pregnancy_caste = 1;
this is the main idea which translates to:
Code: [Select]
local female=dfhack.gui.getSelectedUnit()
--[
local preg=df.unit_genes.new()
preg.appearance=female.appearance.genes.appearance
preg.colors=female.appearance.genes.colors
--] if the next line fails use this block...
female.relations.pregnancy_genes = {new=true,appearance=female.appearance.genes.appearance,colors=female.appearance.genes.colors}
female.relations.pregnancy_timer =10 --yeah i know fancy random timings, i'm too lazy to look up the lua api for that
female.relations.pregnancy_caste = 1 -- caste of born unit, should be set according to your race etc...
Title: Re: DFHack 0.34.11 r3
Post by: Zammer990 on December 21, 2013, 09:00:43 am
I just fullscreened the dfhack window and now I can't window it again, anyone know the key to do that?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on December 21, 2013, 01:48:24 pm
This is what I used on my last test. Without the BLOODSUCKER. I think you are right and its the NO_AGING. Wouldnt have guessed, to be honest. NOT_LIVING would have made a lot more sense, but I am just happy that it works. :)

Since NO_AGING is not a valid creature token (I think), I give each civ member a self-targetted interaction. The first 1 second ingame there is a bit of infighting between opposed to life civ-members and alive civ-members, but if I cant get the opposed to life dudes to actually do work, I will get rid of them anyway.

Code: [Select]
[INTERACTION:MAKE_VAMPIRE]
   [I_SOURCE:CREATURE_ACTION]
   [I_TARGET:A:CREATURE]
   [IT_LOCATION:CONTEXT_CREATURE]
[IT_CANNOT_TARGET_IF_ALREADY_AFFECTED]
   [I_EFFECT:ADD_SYNDROME]
[IE_TARGET:A]
[IE_IMMEDIATE]
[IE_ARENA_NAME:Test undead behaviour]
[SYNDROME]
[SYN_CLASS:VAMPCURSE]
[CE_ADD_TAG:NO_AGING:STERILE:NOT_LIVING:START:0]

Now I just have to figure out a nice way to make the Warlocks/Mages look differently from the Skeleton/Undead civ part. I want skeletons as workers, but currently they look the same. ALT_TILE doesnt work, because the creatures use sprites.
oh wait that would explain why elves/goblins are listed okay to walk into necrotowers I guess they had the no aging factor on them cause the undead to ignore them completely.
Title: Re: DFHack 0.34.11 r3
Post by: laularukyrumo on December 21, 2013, 01:57:17 pm
I'm having a weirdass problem with Kurik's script to fix the growth bug.

Stuck "fix/growthbug.rb enable" in my init file and....

onupdate cb String can't be coerced into Fixnum
./hack/ruby/ruby.rb:42:in `+'
./hack/ruby/ruby.rb:42:in `check_run'
./hack/ruby/ruby.rb:100:in `onupdate'
./hack/ruby/ruby.rb:99:in `each'
./hack/ruby/ruby.rb:99:in `onupdate'
(eval):42
onupdate cb String can't be coerced into Fixnum
./hack/ruby/ruby.rb:42:in `+'
./hack/ruby/ruby.rb:42:in `check_run'
./hack/ruby/ruby.rb:100:in `onupdate'
./hack/ruby/ruby.rb:99:in `each'
./hack/ruby/ruby.rb:99:in `onupdate'
(eval):42
onupdate cb String can't be coerced into Fixnum
./hack/ruby/ruby.rb:42:in `+'
./hack/ruby/ruby.rb:42:in `check_run'
./hack/ruby/ruby.rb:100:in `onupdate'
./hack/ruby/ruby.rb:99:in `each'
./hack/ruby/ruby.rb:99:in `onupdate'
(eval):42

etc etc etc..... Literally it repeats hundreds of times. Not even exaggerating. What did I do wrong?
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 22, 2013, 06:36:12 pm
What does
Code: [Select]
while #unit.body.wounds > 0 do
unit.body.wounds:erase(#unit.body.wounds-1)
end
do?

I've been fooling around with one of those dwarves who's been injured and subsequently ignored, and my initial method of doing so was to pare down the fullheal script and force the dwarf unconscious for a while. This seemed to work, so I set about removing the mysterious parts of fullheal that I'd previously ignored. Doing this resulted in a script that KO'd the dwarf as before (allowing them to be fed and watered), but who went right back to lying about once they regained consciousness.

A script that's just
Spoiler (click to show/hide)
gets the layabout dwarf up and eating and drinking and sleeping, but due to her injuries she was still crawling around. An attempt to reinjure her by standing her on a raising bridge resulted in the old wounds vanishing and being replaced by the bruising caused by the bridge throw.

So, I'm guessing that that bit of code erases all wounds, but doesn't actually do anything about the consequences of those wounds until a round of combat happens.

What I'm really trying for here is a script that either makes the dwarf take a Rest job, or gets another dwarf to rescue them. One thing I picked up on is that dwarves in this state have a negative unconsciousness count... I think.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on December 22, 2013, 08:17:16 pm
What does
Code: [Select]
while #unit.body.wounds > 0 do
unit.body.wounds:erase(#unit.body.wounds-1)
end
do?

I've been fooling around with one of those dwarves who's been injured and subsequently ignored, and my initial method of doing so was to pare down the fullheal script and force the dwarf unconscious for a while. This seemed to work, so I set about removing the mysterious parts of fullheal that I'd previously ignored. Doing this resulted in a script that KO'd the dwarf as before (allowing them to be fed and watered), but who went right back to lying about once they regained consciousness.

A script that's just
Spoiler (click to show/hide)
gets the layabout dwarf up and eating and drinking and sleeping, but due to her injuries she was still crawling around. An attempt to reinjure her by standing her on a raising bridge resulted in the old wounds vanishing and being replaced by the bruising caused by the bridge throw.

So, I'm guessing that that bit of code erases all wounds, but doesn't actually do anything about the consequences of those wounds until a round of combat happens.

What I'm really trying for here is a script that either makes the dwarf take a Rest job, or gets another dwarf to rescue them. One thing I picked up on is that dwarves in this state have a negative unconsciousness count... I think.

I'm away from my DFHack resources, but recall that the status stuff is tracked in several places - both a wound and some body component data would record a severed part, for example. There are some unit flags to get the game to recalculate the body, nerve, insulation, etc. structures.

Would it be better to go into each unit.body.wound entry and heal the wounds rather than erasing them?
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 22, 2013, 09:36:53 pm
I don't want them healed directly, I just want them to Rest so they can get medical treatment. There's an occasional issue with dwarves who are injured but don't fall unconscious and don't make their own way to a hospital bed. They're sort of active, since they'll climb out of water and respond to civilian alerts, but otherwise they'll lie around with No Job until they starve or dehydrate.

As I said above, knocking them out allows for Give Food / Give Water jobs. I haven't run the save for long after each script attempt to be sure, but I think a simple KO script will change the cause of death from starvation or dehydration to drowniness-induced insanity.

I've seen discussion of the issue a few times on the forums, but I can't find any of the topics or conversations about it. The usual method of solving it is to drop things on top of the dwarf until they get a hospital-worthy injury.

A script that runs once a month and makes creatures with <0 unconsciousness (this would seem to be the way of targeting only affected creatures) take a Rest job would be the neatest way of doing it, but I can't reverse-engineer the basic function from the 'Wake up -> Clean self' part of the fullheal script.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on December 23, 2013, 08:44:21 am
Based on research I've done on older versions, adding the unit ID of a wounded dwarf to ui.unk230c might generate a "Rescue Wounded" job to bring them to bed and/or make them Rest. No guarantee that it'll work, but it's worth a try.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on December 23, 2013, 09:24:51 am
I've fixed that a couple of times by knocking a dwarf out by setting the unconscious timer to some huge number, then toggling a few of the healthcare flags off and on.  I think it was the rq_diagnosis and needs_recovery flags.  I seem to recall this was somewhat unreliable, and might depend on setting the flags in a certain order or stepping the game between flag sets or unsets.
Title: Re: DFHack 0.34.11 r3
Post by: milo christiansen on December 23, 2013, 02:13:50 pm
Can anyone point me to the docs for trueTransform? I can't seem to find anything, and I really need to use it for the guild system I want to add to Better Dorfs.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 23, 2013, 03:42:03 pm
Can anyone point me to the docs for trueTransform? I can't seem to find anything, and I really need to use it for the guild system I want to add to Better Dorfs.

https://github.com/peterix/dfhack#true-transformation
Title: Re: DFHack 0.34.11 r3
Post by: milo christiansen on December 23, 2013, 04:17:16 pm
Exactly what I wanted...

BTW: How come my version of the DFHack r3 readme lacks that? It came with trueTransform (at least I think it did)
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 23, 2013, 07:43:47 pm
Back to the healthcare script...

Spoiler (click to show/hide)
This seems to work, though I did have to remove the barracks bed the desired dwarf had been plonked in. Apart from the desired dwarf, it also catches a few other units: an armourer who was wounded in the same attack but received a crutch, a baby, and some animals. The armourer was brought to a bed after being knocked out.

I'd like to exclude the babies at least, just in case it messes with their healthcare once they grow into children. I've got the profession number for babies (97), but I can't figure out how to use it. I don't know what the script does with wounded invaders, so limiting it to the currently-played race would be good too.

There's a minor display issue in that it gives the red 'no unit selected in UI' message if it's run twice in succession. Not sure whether it's because there are no dwarves affected, or because there are no creatures affected. I can probably work that out by picking apart the fat-dwarves script.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 23, 2013, 07:47:36 pm
It's because you included a completely superfluous local unit=dfhack.gui.getSelectedUnit() at the top.
Title: Re: DFHack 0.34.11 r3
Post by: Antalia on December 24, 2013, 08:56:01 am
I'm adding some more data to dwarfexport, and noticed a (probably minor) problem while I was working. The XML file written by dwarfexport claims to use 'ibm850' encoding, but that's not true if any dwarves' names contain common DF symbols. I think these are called "diacritics".

For example, "Edem" is a common dwarf name in my save data, but if diacritics are not removed, it is written "Ed‰m" by the game, and subsequently printed that way in the XML file by dwarfexport. "Ed‰m" isn't compatible with 'ibm850' encoding. So my XML viewer stops loading the XML and complains when it runs into that pesky "‰".

If I open the exported XML file in a plain text editor, and change the encoding string to 'ASCII', then my browser can properly read the XML file. (I think 'ASCII' is the most correct encoding. Maybe that should be a question...)

Should I correct the encoding string (from 'ibm850' to 'ASCII') in dwarfexport, while I'm in there? It's not a big deal - it's just confusing/annoying when I am using an XML viewer, and must manually change the encoding to 'ASCII' before the viewer will work.

Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on December 24, 2013, 09:11:03 am
Okay, I think this is good to go. Profession number for babies is actually 104, at least in 34.11.

Spoiler (click to show/hide)
Now it catches only the desired dwarf and the armourer. The armourer was injured in the same ambush, but ended up receiving medical care. She is knocked out, recovered, lies unconscious for a week, and then gets up and goes back to work.
Title: Re: DFHack 0.34.11 r3
Post by: Antalia on December 24, 2013, 09:40:11 am
I am adding a little data to dwarfexport (see above) and I am sorely tempted to fix something that has been driving me nuts for a long time:

When a dwarf lacks a middle name, dwarfexport writes the dwarf's first name twice in the XML <Name> attribute, followed by the surname(s).

For example, let's say you have nicknames set to [NICKNAME_DWARF:REPLACE_FIRST] or [NICKNAME_DWARF:CENTRALIZE] in d_init.txt. You have two dwarves, Urist Bistoksazir and `Bubbles' Zimeshinod (whose original first name was Zasit). You run dwarfexport. Dwarfexport writes <Name>Urist Urist Bistoksazir</Name> for Urist, and <Name>Zasit `Bubbles' Zimeshinod</Name> for Bubbles. (For completeness' sake, you'll get the same thing for Urist, and <Name>`Bubbles'</Name> for Bubbles, if your d_init.txt has the other nickname option, [NICKNAME_DWARF:REPLACE_ALL].)

I tentatively made a correction to dwarfexport, so that dwarves with no nickname just have their first name printed once in the <Name> attribute. So, Urist's record is always <Name>Urist Bistoksazir</Name>). (And, dwarves with nicknames behave exactly the same way as they do currently.)

BUT !

I don't know if anyone else is relying on dwarfexport's duplicated first names. (One of my applications relies very heavily on dwarfexport, but I don't know whether other DFHackers are using dwarfexport.) If anyone wants to keep the duplicate names, I will keep my hands off, and perhaps add a <CorrectName> attribute or something, that doesn't have first name duplication.

TLDR: Is anyone relying on duplicate first names, for dwarves lacking a nickname, in the <Name> attribute from dwarfexport?
Title: Re: DFHack 0.34.11 r3
Post by: darling on December 25, 2013, 06:38:58 am
Is there a version of dwarf manipulator where the custom labours of ☼MASTERWORK-DF☼ are a used.
I just installed V.4 of MDF and I got the vanilla job descriptions...

I like dwarf manipulator more than Dwarf Therapist, because it is ingame. Therapist gets me distracted from the game a lil bit.
I am about to write a little extension for dwarf manipulator, so I wondered about this.
Title: Re: DFHack 0.34.11 r3
Post by: ab9rf on December 25, 2013, 10:27:06 am
What exactly did you type? Was it "stripcaged all" or something more targeted? And what do you mean by "it doesn't work"? Does it not dump any items, or does it only dump some items?

I tried both, just stripcaged and stripcaged all, and it only dumps weapons and the bags that thieves have. Haven't gotten any soldiers in the traps yet though, so I don't know about things other than thieves.

I tested "stripcaged all" on a pair of goblin crossbowmen that were caught in cage traps, and got the following results:

Dumped:
Crossbows
Quivers
Bolts that were embedded in a wound

Not Dumped:
Clothing
Armor
Bolts in the quiver

Using DFHack r4
EDIT: and there is no visible change between the code in the .rb file from r3 to r4. Haven't tested r3 behavior.

THANK YOU for confirming what I was trying to tell you guys. Doing it the old fashioned way works fine at least.

For some reason, the version says r3, but since Urist Da Vinci says that this is r4 and I'm seeing the same behavior, I guess I'm using r4. However, the behavior is exactly the same as Urist Da Vinci saw, the clothes don't get dumped, but the weapons (and bags apparently) do. Also, I'm using LNP r41, which is still the latest right now.

I'll see if it dumps corpses in cages and things left in there from animal training when I get the chance.

Also, I used stripcaged all the time in the previous r3 version and I can tell you. It used to have a few options like stripcaged all, stripcaged items and a few others. The behavior in the old r3 is what the description says, when I do stripcaged all, it dumps everything inside the cages, corpses, weapons, clothes, armor, stuff from taming, everything. Previously it would give the list of options if you just type stripcaged, but now it doesn't.
There are two different things in DFHack called "stripcaged", a Ruby script that Falconne wrote that has been included since r3 I think, and a C++ plugin also called "stripcaged" that I wrote that has been included since r2.  My plugin was marked as "development" so it's not included in the default DFHack build, but some integrators may have added it to their builds.  Falconne's script is superior to my plugin in every conceivable way.

It's possible that the reason for the change in behavior is that you had been using the C++ plugin before and are now using the Ruby script.  Or vice versa.  If you're using the stock DFHack build you are using the script.  If you're using a DFHack build provided by an integrator, you'll have to talk to the integrator to find out which you have, as which you get depends on the build options selected by the integrator.  Or you can try typing "unload stripcaged"; if it doesn't give you an error, then you were using the C++ plugin.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 25, 2013, 10:28:39 am
Is there a version of dwarf manipulator where the custom labours of ☼MASTERWORK-DF☼ are a used.
I just installed V.4 of MDF and I got the vanilla job descriptions...

I like dwarf manipulator more than Dwarf Therapist, because it is ingame. Therapist gets me distracted from the game a lil bit.
I am about to write a little extension for dwarf manipulator, so I wondered about this.
There is no custom version. Someone who knows C++ would have to compile it again, changing the labor and profession names to fit the naming scheme in MDF.

I would like to repeat a request that I have made before: A plugin for power-requirements for workshops. Similar to the steamengine, just the other way around. IndigoFenix just started brainstorming a tech/steampunk race, and it would come in super handy. :)
Title: Re: DFHack 0.34.11 r3
Post by: darling on December 25, 2013, 01:58:41 pm
There is no custom version. Someone who knows C++ would have to compile it again, changing the labor and profession names to fit the naming scheme in MDF.

I would like to repeat a request that I have made before: A plugin for power-requirements for workshops. Similar to the steamengine, just the other way around. IndigoFenix just started brainstorming a tech/steampunk race, and it would come in super handy. :)

Well, if it's just changing the names, that would be easy. Have to think about it...
The extension I'm writing, colors the job columns of a dwarf according to his qualification for it, either green or red.
For micromanagement freaks like me, this can be handy, I think.
For later I had the idea of a new workshop, "job-center". Idea is, when dwarfs have no jobs for many periods or long periods of time, they would start to hang around the job center (starting fist fights, maybe :) ). In the job center menu, the system automatically will create job anouncements like "Another tanner is needed" or "The Magma Furnace needs a head".
Jobless dwarfs will eventually applicate for the anouncements and you can hire them, then.

The power-req-plugin on the other hand sounds more complicated to me. I have not digged that much into the code ( actually I wouldn't know where to make a start...)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 25, 2013, 02:11:33 pm
Its just renaming.

Spoiler: List of changed names (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: falconne on December 26, 2013, 04:26:04 pm
There are two different things in DFHack called "stripcaged", a Ruby script that Falconne wrote that has been included since r3 I think, and a C++ plugin also called "stripcaged" that I wrote that has been included since r2.  My plugin was marked as "development" so it's not included in the default DFHack build, but some integrators may have added it to their builds.  Falconne's script is superior to my plugin in every conceivable way.

I didn't write stripcaged.rb. Looking at the history, jjyg did.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on December 26, 2013, 05:48:13 pm
There are two different things in DFHack called "stripcaged", a Ruby script that Falconne wrote that has been included since r3 I think, and a C++ plugin also called "stripcaged" that I wrote that has been included since r2.  My plugin was marked as "development" so it's not included in the default DFHack build, but some integrators may have added it to their builds.  Falconne's script is superior to my plugin in every conceivable way.

I didn't write stripcaged.rb. Looking at the history, jjyg did.

Didn't we solve this problem 7 pages ago?:

http://www.bay12forums.com/smf/index.php?topic=91166.msg4801794#msg4801794
http://www.bay12forums.com/smf/index.php?topic=91166.msg4801930#msg4801930
http://www.bay12forums.com/smf/index.php?topic=91166.msg4802179#msg4802179
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 26, 2013, 06:30:50 pm
Quick question about Auto-Syndrome and r4:

Code: [Select]
[INORGANIC:GUILD_PRIEST3_F]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL:Becoma a Priest]
[SYNDROME][SYN_CLASS:\AUTO_SYNDROME][SYN_CLASS:\COMMAND][MELTING_POINT:9000][BOILING_POINT:905][SOLID_DENSITY:55520]
[SYN_AFFECTED_CREATURE:DWARF:PRIEST_FEMALE]
[CE_CAN_DO_INTERACTION:START:0:END:299]
[CDI:INTERACTION:TRANSFORM_GUILD_PRIEST3_F]
[CDI:TARGET:A:SELF_ONLY]
[CDI:TARGET_RANGE:A:1]
[CDI:MAX_TARGET_NUMBER:A:1]
[CDI:WAIT_PERIOD:300]

I have a couple of these in my mod. They add a syndrome that adds an interaction that runs truetransform (because truetransform didnt work when done from syndrome, it had to be an interaction, dont ask me why), and I was wondering if that COMMAND is strictly speaking necessary. I just want to know if I can delete it, or if it will break anything. Because there is no command I give dfhack, its just "run autosyndrome to affect that worker".
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 26, 2013, 07:59:19 pm
It's not necessary at all. \COMMAND is only for running DFHack commands through syndromes as they would in the console.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 26, 2013, 09:27:26 pm
I guessed that. But is it contraproductive? Because ingame, the guild transformation still seems to work. I just tested it. Probably because there are no more syn-classes after the \command.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 26, 2013, 09:30:50 pm
It might waste some CPU time, but... well, it's a negligible amount.

Mostly I'd worry about possible (harmless) errors that might pop up.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 26, 2013, 09:34:37 pm
There is no error message in dfhack. But I havent tested them all.. maybe some have LOCATION, which will probably result in a "location is not a recognized command". Dont worry. I just noticed this command in odd places in Teellox patched version, and was wondering if its intentional or not.
Title: Re: DFHack 0.34.11 r3
Post by: Grafsburg on December 26, 2013, 10:49:32 pm
Is there any way to use DFHack to edit Adventurer attributes and skills?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 26, 2013, 10:50:40 pm
Yes. gui/gm-editor df.global.world.units.active[0] will get you into editing your adventurer. Look around for some stuff. Skills and mental attributes are in status.current_soul, physical attributes are in body.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on December 27, 2013, 06:52:38 am
Is there a way to add body parts to creatures using dfhack? I am thinking a sort of warping effect where your dwarf grows horns or a tail or something?

Similarly, is it possible to change a creatures tissue materials with dfhack? Like turning all of their skin into stone?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 27, 2013, 10:56:13 am
Is there a way to add body parts to creatures using dfhack? I am thinking a sort of warping effect where your dwarf grows horns or a tail or something?

Similarly, is it possible to change a creatures tissue materials with dfhack? Like turning all of their skin into stone?
I dont think the bodyparts are possible, but the tissue material should be possible.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on December 27, 2013, 11:44:00 am
Is there a way to add body parts to creatures using dfhack? I am thinking a sort of warping effect where your dwarf grows horns or a tail or something?

Similarly, is it possible to change a creatures tissue materials with dfhack? Like turning all of their skin into stone?
I dont think the bodyparts are possible, but the tissue material should be possible.

Having it affect one creature and not the entire race/caste will be interesting.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 27, 2013, 11:52:49 am
SyndromeTrigger and tissue change would mean people can make stoneskin spells that actually change the tissue. Or melt enemies. Or become etheral, with all attacks passing through for a short time. Lots of fancy magic. And upgrade without the need for transformations.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on December 27, 2013, 07:39:44 pm
There is no error message in dfhack. But I havent tested them all.. maybe some have LOCATION, which will probably result in a "location is not a recognized command". Dont worry. I just noticed this command in odd places in Teellox patched version, and was wondering if its intentional or not.

It won't do any measurable harm to leave it in, and it won't cause any problems if you remove it. As for things like \LOCATION, it's intended for dfhack commands that take a location as an argument, so it you just do \COMMAND \LOCATION it would be equivalent to typing 40 24 195 or whatever directly into the console whenever the syndrome happens, which prints the error message.

Edit: Actually the first arg after \COMMAND might be treated specially, so it might take it as literal typing \LOCATION literally as a command, which would be a different error.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 27, 2013, 07:55:49 pm
Quote
Edit: Actually the first arg after \COMMAND might be treated specially, so it might take it as literal typing \LOCATION literally as a command, which would be a different error.
Yes, I remember those. ^^

Thanks for the answer, good to hear from the author.

Btw, another forum member has written a script that allows percentages on your Auto-Syndrome, something I asked you about sometimes. If the product of a reaction is 10%, it only has a 10% chance to trigger autosyndrome. Or if you have 5x10%, it has 50% chance to run one of them. Its quite nifty. :)
Title: Re: DFHack 0.34.11 r3
Post by: Roses on December 27, 2013, 09:19:00 pm
SyndromeTrigger and tissue change would mean people can make stoneskin spells that actually change the tissue. Or melt enemies. Or become etheral, with all attacks passing through for a short time. Lots of fancy magic. And upgrade without the need for transformations.

Thats what I was thinking about.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 28, 2013, 02:10:24 am
I'll see if I can experiment with materials involved in tissues.

I'm not entirely sure if there's stuff to be changed, but if there is, it should be fun to check out and see if it crashes horribly or something.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 28, 2013, 02:36:44 am
Mentioning crashes: Putnam, did you ever try more with these merchant flags and creature removal? We talked about this, removing civ-members from the fort, either by deleting them, or making them go to the map-edge.

When I deleted them, the game crashed a few days later. Tested 5 times.
When I made them "friendly", they just hang around the meeting zone.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on December 28, 2013, 05:19:06 am
I'll see if I can experiment with materials involved in tissues.

I'm not entirely sure if there's stuff to be changed, but if there is, it should be fun to check out and see if it crashes horribly or something.
Afaik only place where materials exist is creature raws (well caste raws to be exact) so i think there isn't a way to change materials only for one unit.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 28, 2013, 02:30:20 pm
I had an idea for time-limited items. I wanted to use a material that rots/withers away to make armor and weapons. The problem is that it doesnt work. Seems the mechanic is influenced by item type, not material type. Meat, Skin, Fish, Plants... they rot. Weapons, Tools, Armors, Boulders... they dont rot.

Can this somehow be affected by dfhack? Make a material that fades away, something like:
 - Material is created, counter starts ticking.
 - Material is 2 weeks old, gets "rotten/withered" tag. (this step is optional)
 - Material is 4 weeks old, gets deleted.

That would be awesome, because its something new. :)

EDIT: And unrelated: When a millstone is powered, it flashes, it flickers between tiles and inverted tiles. Could this be added to normal workshop, so that they always flash? (Actually, I just checked: The workshop flash when you hover 'q' over them, but millstone and other machinery uses other tiles, similar to ALT_TILE/FLASH_TILE in creatures.)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on December 28, 2013, 02:49:37 pm
I had an idea for time-limited items. I wanted to use a material that rots/withers away to make armor and weapons. The problem is that it doesnt work. Seems the mechanic is influenced by item type, not material type. Meat, Skin, Fish, Plants... they rot. Weapons, Tools, Armors, Boulders... they dont rot.

Can this somehow be affected by dfhack? Make a material that fades away, something like:
 - Material is created, counter starts ticking.
 - Material is 2 weeks old, gets "rotten/withered" tag. (this step is optional)
 - Material is 4 weeks old, gets deleted.

That would be awesome, because its something new. :)
actually every item has wear counter, which can (and is used e.g. in steam engines) to wear/rot item down where needed. To do this automatically either have a timer (and AUCH iterate all items yet again? though can be quite rare) or do something else (e.g. in reaction that do not use up the item?)
To use it just call item:setWear(item:getWear+wearAmount) df should take care of destroying it when not needed any more. There is also a rot timer but it is only usable for rottable items
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 28, 2013, 03:03:33 pm
Quote
To do this automatically either have a timer (and AUCH iterate all items yet again? though can be quite rare)
I think this would be best. Something like: every fullmoon all items of that material get destroyed.

The other way around cant be done, with each individual item having a shell-life?

EDIT: And yet another question (comes from not doing anything for a while, and then trying to do everything at once): I have two scripts, one a .lua and one a .rb. They need to be run at the embark selector (the map before you embark), and they determine the number of dwarves and the number of embark points.

Could I add this to a init.lua in the raw-folder and automate this? Whenever people open the embark selector, the two scripts are run, taking the values that are in the file? I would change the values in it from the GUI I include in the mod. People that never change them, never realize that the scripts are even there...
Title: Re: DFHack 0.34.11 r3
Post by: Roses on December 28, 2013, 06:55:05 pm
I'll see if I can experiment with materials involved in tissues.

I'm not entirely sure if there's stuff to be changed, but if there is, it should be fun to check out and see if it crashes horribly or something.

That would be awesome if it was possibly. Even if you had to pre-specify the material in the creature and then you chould change the tissue layers via dfhack.
Title: Re: DFHack 0.34.11 r3
Post by: Cocoprimate on December 29, 2013, 08:44:38 pm
is there a command available to summon a megabeast attack?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on December 29, 2013, 10:00:33 pm
http://www.bay12forums.com/smf/index.php?topic=123817.0
Title: Re: DFHack 0.34.11 r3
Post by: Cocoprimate on December 29, 2013, 10:32:49 pm
Thanks. Another question,

If I use reveal all so I can see the adamantine, but I don't unpause before unrevealing, will it still hurt my FPS by unleashing the clowns?

Is there any way to see the adamantine without hurting the FPS?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 29, 2013, 11:07:02 pm
If you dont unpause, no clowns are spawned, and it wont hurt FPS.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on December 30, 2013, 01:47:31 pm
To use it just call item:setWear(item:getWear+wearAmount) df should take care of destroying it when not needed any more.
There's a shortcut for that - item:incWearTimer(amount).
Title: Re: DFHack 0.34.11 r3
Post by: Roses on December 30, 2013, 11:38:22 pm
Is it possible to change what is being grown (trees and plants) through DFHack?

For instance, I run a script and it changes the plants currently being grown to different plants (strawberry -> corrupted strawberry).
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on December 31, 2013, 05:16:52 am
Yes it's possible: if it's grown in farmplots, it's an item in the farmplot (the building). If it's a tree it's in special per block array of plants IIRC.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on December 31, 2013, 08:25:11 pm
Could caste levels be added to slayrace.rb? For example instead of "slayrace GOBLIN" it could be "slayrace GOBLIN MALE". This would allow more freedom, and I might have a use for it.
Title: Re: DFHack 0.34.11 r3
Post by: Octobomb on December 31, 2013, 10:28:39 pm
So Meph gave me this advice:
When you say (no plugins needed), does that mean no dfhack? Because spatter-add, autosyndrome and itemsyndrome sounds very fitting for what you plan.

Otherwise its really only drinks with syndromes, and they are hard to micromanage.
And being way out of my depth, I decided to ask here (here, funnily enough, includes you, Meph). So: what do these do, how can I make them work in df and (desperately tries to come up with third question, cos patterns) why do I keep throwing myself in too deep?
Thanks in advance, o patient souls (I'll probably turn up every so often to pester you with questions).

EDIT: Ok, after a bit of poking around in everything from the masterwork files to the forum threads I found a few of my answers:
Spoiler (click to show/hide)

Autosyndrome appears to be a way to operate dfhack via syndromes. Not sure about how it works or how useful it might be, but the other two are.

NEW QUESTION! Can I use itemsyndrome to find a way to add timed syndromes (think stimpacks or buff spells in rpgs) on command?[/quote][/spoiler]
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on January 01, 2014, 03:05:08 pm
Well, I finally built a (mostly) working version of r4 on OS X: Download (http://www.mediafire.com/download/40pu9cpwah63zzs/df_osx_dfhack_r4_BETA.zip)
It's missing the zone plugin, which I was unable to compile, but other than that it appears to work. Hopefully Danaris or someone else will have an update with a working zone plugin soon.

Keep in mind that this is not an official build. I only put it up here because several people had asked about it, and I figured this was better than nothing. That said, it should work without any major problems.
Title: Re: DFHack 0.34.11 r3
Post by: darling on January 02, 2014, 05:29:43 pm
I am finished with the extension for dwarf manipulator.
Green and red fields signal if the dwarf is suitable for the job. You can somehow level the view with 'a','s' and 'd'. You'll get it.
If you want to lock the dwarfs that are not good at "Feed/Help Wounded", the normal view is recommended.
Glourious screenshot following:
Spoiler (click to show/hide)

That's with phoebus, as you can see. Beware, looking at it in raw mode.
No, I was kidding. It looks also awesome, then.
Here is the Download (http://www.mediafire.com/download/nkd1wc1d18nv65b/dfhack-0.34.11-r4-Windows-han.zip)
I maybe'll do a version for masterwork. First I'll have to play it.

Oh, also don't forget to "enable manipulator" in dfhack-init. It's a r4-release...
This is not an official release.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on January 02, 2014, 09:44:34 pm
What makes artifacts unimprovable, and can DFHack change that? I want to coat my shiny new dagger in GCS and helmet snake venom at the very least.
Title: Re: DFHack 0.34.11 r3
Post by: Broken on January 03, 2014, 03:52:32 am
What makes artifacts unimprovable, and can DFHack change that? I want to coat my shiny new dagger in GCS and helmet snake venom at the very least.

Reactions need [CAN_USE_ARTIFACT] for artifacts to be usable reagents. (To prevent antifact from being consummed). Add this to the improving reactions and it should work.

http://dwarffortresswiki.org/index.php/DF2012:Reactions#Reagents
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 03, 2014, 04:00:10 am
The main problem is that there are no improvement reactions in vanilla.
Title: Re: DFHack 0.34.11 r3
Post by: TheOnlySolitaire on January 03, 2014, 07:24:19 pm
Hi guys, not sure if this is the right place to post this - but it is a dfhack script. Not a question, just wanted to mention it as its something I've come across.

Spawnunit = I mentioned it before as spawned units cannot be trained and cannot be set as friendly/hostile/neutral or as children etc (they appear as age 1 adults)

But I just wanted to point out a potential issue with the script.
The spawned dwarves, which function perfectly at labors etc, have 2 major problems that are linked:

1) they cannot be assigned to military squads as they do not seem to appear in the list for applicants like regular fort members do - now I think of it, it may be because they are classed somehow as 'tame', but they can still be assigned labors and gain skills etc so maybe not.

2) when they die, because they are not listed like regular fort members, they come back as ghosts, but cannot be put to rest as their names do not appear in the slab memorial list. Which has lead to some FUN while testing.


Note: They DO appear in the (u)nits tab, but when they undead, they revert to [generic profession name] corpse - usually 'peasant corpse'. Unless they are thralled/husked, where they retain their name.

edit: could it be because they are listed as 1 year old, even though they are displayed and act as adults?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 03, 2014, 08:01:56 pm
1. they're not historical figures

2. they're not historical figures

Both of these problems can be fixed the same way, really.

I think the issue is stability.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 03, 2014, 08:07:39 pm
They also lack natural skills. If you make a creature with NATURAL_SKILL:AXE:20, and spawn it, it wont have any axe skills.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 03, 2014, 08:11:38 pm
They also lack natural skills. If you make a creature with NATURAL_SKILL:AXE:20, and spawn it, it wont have any axe skills.

Fascinating. Should be easy enough to fix, though.
Title: Re: DFHack 0.34.11 r3
Post by: TheOnlySolitaire on January 03, 2014, 08:13:42 pm
Thanks for the replies.

That makes a lot of sense - I guess it's like how peasants in villages are just their profession name until you talk to them or similar...

and how certain castes might have high natural skills in various areas, but still end up in jobs not suited to their skillset...


So how can that be fixed? I'm not a coder, but I've found the gmeditor is quite useful for getting around the hostile/friendly problem...
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 03, 2014, 08:16:56 pm
Quote
I've found the gmeditor is quite useful for getting around the hostile/friendly problem...
What is that, which problems?
Title: Re: DFHack 0.34.11 r3
Post by: TheOnlySolitaire on January 03, 2014, 08:20:52 pm
Well I posted here a little while ago, because all spawned units, wether dwarf or goblin or dragon, were always friendly.

But I fiddled with the gmeditor and can make creatures hostile.

I just changed the civ_id tag, which is usually a positive number, to -1, like invader_id and i thinks its population_id. That works, it's just rather clunky/a test of patience to do en-masse....
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 03, 2014, 08:24:22 pm
Oh, that is nice. I always made new creatures with the CRAZED tag for that. Didnt knew you could add this to a compiled plugin. (wait, its a script, so thats all right) Guess a "spawnunit" and "spawunit hostile" would be possible then. :)
Title: Re: DFHack 0.34.11 r3
Post by: TheOnlySolitaire on January 03, 2014, 08:33:24 pm
Yay! That would really make things easier for me- trying to test combat at a large scale, or for an extended period of time at the moment gets tedious, with having to manually edit each creatures id tags individually.

Would be brilliant to be able to spawn child equivalents of units too.

Anyway, I'll have a poke around the before I go to sleep, see if I can find a tag in the gmeditor that would make a creature a historical figure - although I'm reasonably sure that I won't find one. Or at least, one that I can make sense of....
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 03, 2014, 09:10:28 pm
Isnt it that part?

Quote
df.global.unit_next_id=df.global.unit_next_id+1
   unit.relations.old_year=df.global.cur_year-5

I wonder if you could make a civ with a caste that has a maxage of 2, then spawn that caste with natural skills, an age of one, calling it "helpful spirit" or something. It would automatically have the labors fitting to the skills assigned, "does as it pleases", and will do these jobs, but you cant control it directly. After a year, the spirit expires, by dying of old age.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 03, 2014, 09:31:17 pm
Isnt it that part?

Quote
df.global.unit_next_id=df.global.unit_next_id+1
   unit.relations.old_year=df.global.cur_year-5

I wonder if you could make a civ with a caste that has a maxage of 2, then spawn that caste with natural skills, an age of one, calling it "helpful spirit" or something. It would automatically have the labors fituting to the skills assigned, "does as it pleases", and will do these jobs, but you cant control it directly. After a year, the spirit expires, by dying of old age.
Old_year is actually death fromold age year.it should be in the future.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on January 03, 2014, 09:31:51 pm
Reactions need [CAN_USE_ARTIFACT] for artifacts to be usable reagents. (To prevent antifact from being consummed). Add this to the improving reactions and it should work.
Yup, that works!

I don't know why that change isn't in the Greasing Station raws by default.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 04, 2014, 03:07:09 am
Quote
I've found the gmeditor is quite useful for getting around the hostile/friendly problem...
What is that, which problems?

What do you mean, what is that?

I really think we should get the word out on gm-editor more...

gm-editor gives you a UI to edit the game's data structures. You can access with with gui/gm-editor (data structure). A few examples:

highlight a unit and type "gui/gm-editor dfhack.gui.getSelectedUnit()" in the console. You are now editing that unit.

You can also do that with getSelectedItem() and getSelectedBuilding(), mind. Also useful is dfhack.gui.getCurViewscreen().
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 04, 2014, 06:22:40 am
I do read this forum a lot, its the first time I hear about gmeditor. ^^ Even a forumwide search "gmeditor" yields nothing. Looking for "gm-editor" works. :)
Title: Re: DFHack 0.34.11 r3
Post by: TheOnlySolitaire on January 04, 2014, 06:37:16 am
sorry Meph, that's potentially my fault, confusing you with the wrong spelling/syntax or what have you..
I agree, the gm-editor should be talked about more. I'm still experimenting, and it does cause a lot of crashes, but it's really helpful sometimes - the uses for someone who actually knows and understands the thing...
Assuming that the gm-editor edits game files in the same way dfhack does, does that mean, whatever the gm-editor can do, can have a dfhack script written for it?

Also Putnam, you say there is an easy fix for the spawned units not being historical figures, how would I go about that, or is it something you would have to work on?
(I know you have a version of the plugin, but I'm not sure what 'forks' are being essentially coding illiterate...)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 04, 2014, 06:49:09 am
<...>
I agree, the gm-editor should be talked about more. I'm still experimenting, and it does cause a lot of crashes, but it's really helpful sometimes - the uses for someone who actually knows and understands the thing...
Assuming that the gm-editor edits game files in the same way dfhack does, does that mean, whatever the gm-editor can do, can have a dfhack script written for it?

Also Putnam, you say there is an easy fix for the spawned units not being historical figures, how would I go about that, or is it something you would have to work on?
(I know you have a version of the plugin, but I'm not sure what 'forks' are being essentially coding illiterate...)
1) yes, but reverse is not true (anything that you can do with dfhack script can't be done in gm-editor- example vmethod calls, or any function calls)
2)there is a fix, but not easy and will probably not work in adventure mode. Also it has chance to corrupt your saves :)
Title: Re: DFHack 0.34.11 r3
Post by: toomanysecrets on January 04, 2014, 05:41:46 pm
I've been searching around for something like the old "dfstatus" which opened a new window and listed metal and food stocks among other things. I've had no luck at all. Has anyone seen or come up with something like this lately?
Title: Re: DFHack 0.34.11 r3
Post by: Doktoro Reichard on January 05, 2014, 09:49:51 pm
I think I discovered (by discovered I mean things that aren't labeled yet or if they are, they aren't quite informative labels) some things about gm-editor. Being this the topic about dfhack it seems fit to place it here.

1. The !!Fire!! status seems to be a body.wound item. Didn't look much into this.
2. The amount of blood bled out by a dwarf is defined in body.components.body_layer_378 . There seems to be some sort of threshold (possibly body.blood_count) into which a part starts to bleed, as not all values are reflected in the body.wound item.
3. Melted body parts are defined in body.components.body_part_status where, for every melted body part, the 15 and 16 flags are defined as true.
4. Wounds seem to be calculated based on what exists in body.components
5. As I have yet to completely treat the dwarf in question, as he keeps bleeding (the values resurface as soon as I get out of pause) it seems values are also being stored elsewhere.

I am trying to save a dwarf from the effects of stupidity, hence the discovery, by comparison with healthy dwarves. Would need to look into this, but it seems to be accurate.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 05, 2014, 10:04:59 pm
This is all in r4.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on January 06, 2014, 02:14:51 am
I've been searching around for something like the old "dfstatus" which opened a new window and listed metal and food stocks among other things. I've had no luck at all. Has anyone seen or come up with something like this lately?

You may have seen this already - the author has just found the old source code again, and is planning to update it.  http://redd.it/1ugmqv
Title: Re: DFHack 0.34.11 r3
Post by: guitarxe on January 07, 2014, 08:07:55 pm
What's the command to load all plugins? If I type load all this doesn't seem to work.
Title: workflow script?
Post by: Bo-Rufus CMVII on January 07, 2014, 10:05:30 pm
Is there a way you can "run" a file that has all your workflow commands in it?

If you put them in the init file it won't process them because the world isn't loaded when it executes, and I can't seem to use cut-n-paste to transfer them into the dfhack console (linux-specific problem?).
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 07, 2014, 10:17:47 pm
I believe a batch file that runs dfhack-run followed by commands is what you're looking for.
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on January 07, 2014, 10:36:18 pm
I believe a batch file that runs dfhack-run followed by commands is what you're looking for.
Works great - thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 08, 2014, 04:43:20 pm
I'm working on writing many new spells (over 150 so far) to include in my mod, and was wondering if some different things were possible using DFHack.

The first is a mass movement/teleportation type command that could move all creatures within a specific radius to a given location (e.g. a Cyclone spell that moves all creatures caught in the cyclone to the center, maybe even up a z level or two)

The second is being able to spawn magma/water in a radius at a specific location. I know there is the liquids gui, but I didn't see a liquids command line script in the hack folder. (e.g a Volcano spell that creates magma)

The third is having time limits on certain scripts, like an item created with createitem or a creature spawned with spawn, only lasting for x number of seconds. (Side question, is it possible to change createitem so that instead of being created at the feet of the creature they are equipped with it?)

The last is using the tiletypes paint option to make walls out of a special materials (e.g. Wall of Fire spell)

Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 08, 2014, 04:47:08 pm
I made a version of spawn with a disappear time, but I forgot where exactly. I think it's in Fortbent.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 08, 2014, 04:57:08 pm
I'm working on writing many new spells (over 150 so far) to include in my mod, and was wondering if some different things were possible using DFHack.

The first is a mass movement/teleportation type command that could move all creatures within a specific radius to a given location (e.g. a Cyclone spell that moves all creatures caught in the cyclone to the center, maybe even up a z level or two)

The second is being able to spawn magma/water in a radius at a specific location. I know there is the liquids gui, but I didn't see a liquids command line script in the hack folder. (e.g a Volcano spell that creates magma)

The third is having time limits on certain scripts, like an item created with createitem or a creature spawned with spawn, only lasting for x number of seconds. (Side question, is it possible to change createitem so that instead of being created at the feet of the creature they are equipped with it?)

The last is using the tiletypes paint option to make walls out of a special materials (e.g. Wall of Fire spell)
1. two ways possible: simple move (boring), making them projectiles, aka throwing them (that should be fun)
2. possible, quite easy
3. possible, a bit complicated (even without changing, just create and then equip)
4. possible but will be buggy and will not work as you think. There will be a "wall of fire" material walls (or veins, depending on implementation) but they will be non-active and non passible. Though drawing flows somehow maybe would work as wanted (although i'm not sure how to make them not grow)
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 09, 2014, 12:41:16 pm
1. two ways possible: simple move (boring), making them projectiles, aka throwing them (that should be fun)
2. possible, quite easy
3. possible, a bit complicated (even without changing, just create and then equip)
4. possible but will be buggy and will not work as you think. There will be a "wall of fire" material walls (or veins, depending on implementation) but they will be non-active and non passible. Though drawing flows somehow maybe would work as wanted (although i'm not sure how to make them not grow)

1. Would making them projectiles really be possible? That would open a whole new set of spell possibilities.
2. I'll look over the liquids-gui and see what I can make of it, there used to be a command line script in the early days, is that still around somewhere?
3. Hmm, I have seen a force equip script before (I think one was made for when a creature transforms so they automatically re-equip everything). And I will look through your stuff Putnam and see if I can find it.
4. That's to bad. I really would like to include wall spells, but I don't really have a good idea of how to implement them. If anyone has any thoughts I am open to ideas.

I know I have said this before, but I REALLY need to learn DFHack, right now I am reliant on all of you. Any tips on how to get started? Right now I am just looking over all the different scripts that have been written, but it's not really sinking in.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 09, 2014, 12:53:59 pm
1. i could type it out (need that for one of my own things) also some testing needed to make sure how this would work
2. no, this probably would need to be coded from 0, but that is not much stuff
3. yeah it might work

The biggest drawback that i can't understand that system that everyone i using (with raw hacking). That needs a lot of boilerplate to get working.
As for learning dfhack, yes looking over scripts with this:  open  (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst) might be fastest way to learn. Unfortunately there is no guide for df types/structures. To explore those you need to look over xmls at  here  (https://github.com/angavrilov/df-structures/) and/or look over generated header files/project if you are using MSVC and/or try exploring with "gui/gm-editor df.global" <- basically a root node in df. (also possible to edit stuff if you have it selected and do 'gui/gm-editor' in dfhack in general)
Title: Re: DFHack 0.34.11 r3
Post by: Socharis on January 09, 2014, 02:00:13 pm
Looking at trying my hand with LUA and trying to do something better with Adventure Mode inventory management.  Is there anything in DFHack that can bootstrap me into getting a list of the adventurer's inventory?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 09, 2014, 02:21:58 pm
Looking at trying my hand with LUA and trying to do something better with Adventure Mode inventory management.  Is there anything in DFHack that can bootstrap me into getting a list of the adventurer's inventory?
I started a new thread: here  (http://www.bay12forums.com/smf/index.php?topic=135340.0)
Title: Re: DFHack 0.34.11 r3
Post by: Cocoprimate on January 09, 2014, 11:49:14 pm
Is there anyway I can use DFHack to play adventure mode with one of the dwarfs from my fortress?
Title: Re: DFHack 0.34.11 r3
Post by: Broken on January 11, 2014, 12:58:20 pm
Is there anyway I can use DFHack to play adventure mode with one of the dwarfs from my fortress?

yes, there is, although not bug free by far.

1: Type Mode set
2: Type 2. This puts the game in arena mode.
3: Whitouth unpausing (In arena mode everybody is enemy of everybody) Select the creature you want. Dwarfs, FBs, even ghosts. Anything
    is fair game.
4: Type Mode set again
5: Type 1 to select adventurer mode.

Voila, your adventurer is free to roam the world.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 11, 2014, 02:16:33 pm
Warmist did send me a new version of spawnunit for dfhack r4, which allows spawned units to use interactions and join military squads. I thought I better share it. :)

The entire implications of making the spawned units historical figures is not tested in the long run, so use with care.
Code: [Select]
--create unit at pointer or given location. Usage e.g. "spawnunit DWARF 0 Dwarfy"
 
--Made by warmist, but edited by Putnam for the dragon ball mod to be used in reactions
 
--note that it's extensible to any autosyndrome reaction to spawn anything due to this; to use in autosyndrome, you want \COMMAND spawnunit CREATURE caste_number name \LOCATION
 
args={...}
function getCaste(race_id,caste_id)
    local cr=df.creature_raw.find(race_id)
    return cr.caste[caste_id]
end
function genBodyModifier(body_app_mod)
    local a=math.random(0,#body_app_mod.ranges-2)
    return math.random(body_app_mod.ranges[a],body_app_mod.ranges[a+1])
end
function getBodySize(caste,time)
    --todo real body size...
    return caste.body_size_1[#caste.body_size_1-1] --returns last body size
end
function genAttribute(array)
    local a=math.random(0,#array-2)
    return math.random(array[a],array[a+1])
end
function norm()
    return math.sqrt((-2)*math.log(math.random()))*math.cos(2*math.pi*math.random())
end
function normalDistributed(mean,sigma)
    return mean+sigma*norm()
end
function clampedNormal(min,median,max)
    local val=normalDistributed(median,math.sqrt(max-min))
    if val<min then return min end
    if val>max then return max end
    return val
end
function makeSoul(unit,caste)
    local tmp_soul=df.unit_soul:new()
    tmp_soul.unit_id=unit.id
    tmp_soul.name:assign(unit.name)
    tmp_soul.race=unit.race
    tmp_soul.sex=unit.sex
    tmp_soul.caste=unit.caste
    --todo skills,preferences,traits.
    local attrs=caste.attributes
    for k,v in pairs(attrs.ment_att_range) do
       local max_percent=attrs.ment_att_cap_perc[k]/100
       local cvalue=genAttribute(v)
       tmp_soul.mental_attrs[k]={value=cvalue,max_value=cvalue*max_percent}
    end
    for k,v in pairs(tmp_soul.traits) do
        local min,mean,max
        min=caste.personality.a[k]
        mean=caste.personality.b[k]
        max=caste.personality.c[k]
        tmp_soul.traits[k]=clampedNormal(min,mean,max)
    end
    unit.status.souls:insert("#",tmp_soul)
    unit.status.current_soul=tmp_soul
end
function CreateUnit(race_id,caste_id)
    local race=df.creature_raw.find(race_id)
    if race==nil then error("Invalid race_id") end
    local caste=getCaste(race_id,caste_id)
    local unit=df.unit:new()
    unit.race=race_id
    unit.caste=caste_id
    unit.id=df.global.unit_next_id
    df.global.unit_next_id=df.global.unit_next_id+1
unit.relations.old_year=df.global.cur_year-5 -- everybody will be 15 years old
    if caste.misc.maxage_max==-1 then
        unit.relations.old_year=-1
    else
        unit.relations.old_year=df.global.cur_year+math.random(caste.misc.maxage_min,caste.misc.maxage_max)
    end
    unit.sex=caste.gender
local num_inter=#caste.body_info.interactions  -- new for interactions
unit.curse.anon_4:resize(num_inter) -- new for interactions
unit.curse.anon_5:resize(num_inter) -- new for interactions
    local body=unit.body
   
    body.body_plan=caste.body_info
    local body_part_count=#body.body_plan.body_parts
    local layer_count=#body.body_plan.layer_part
    --components
    unit.relations.birth_year=df.global.cur_year-15
    --unit.relations.birth_time=??
   
    --unit.relations.old_time=?? --TODO add normal age
    local cp=body.components
    cp.body_part_status:resize(body_part_count)
    cp.numbered_masks:resize(#body.body_plan.numbered_masks)
    for num,v in ipairs(body.body_plan.numbered_masks) do
        cp.numbered_masks[num]=v
    end
   
    cp.layer_status:resize(layer_count)
    cp.layer_wound_area:resize(layer_count)
    cp.layer_cut_fraction:resize(layer_count)
    cp.layer_dent_fraction:resize(layer_count)
    cp.layer_effect_fraction:resize(layer_count)
    local attrs=caste.attributes
    for k,v in pairs(attrs.phys_att_range) do
        local max_percent=attrs.phys_att_cap_perc[k]/100
        local cvalue=genAttribute(v)
        unit.body.physical_attrs[k]={value=cvalue,max_value=cvalue*max_percent}
        --unit.body.physical_attrs:insert(k,{new=true,max_value=genMaxAttribute(v),value=genAttribute(v)})
    end
 
    body.blood_max=getBodySize(caste,0) --TODO normal values
    body.blood_count=body.blood_max
    body.infection_level=0
    unit.status2.body_part_temperature:resize(body_part_count)
    for k,v in pairs(unit.status2.body_part_temperature) do
        unit.status2.body_part_temperature[k]={new=true,whole=10067,fraction=0}
       
    end
    --------------------
    local stuff=unit.enemy
    stuff.body_part_878:resize(body_part_count) -- all = 3
    stuff.body_part_888:resize(body_part_count) -- all = 3
    stuff.body_part_relsize:resize(body_part_count) -- all =0
 
    --TODO add correct sizes. (calculate from age)
    local size=caste.body_size_2[#caste.body_size_2-1]
    body.size_info.size_cur=size
    body.size_info.size_base=size
    body.size_info.area_cur=math.pow(size,0.666)
    body.size_info.area_base=math.pow(size,0.666)
    body.size_info.area_cur=math.pow(size*10000,0.333)
    body.size_info.area_base=math.pow(size*10000,0.333)
   
    stuff.were_race=race_id
    stuff.were_caste=caste_id
    stuff.normal_race=race_id
    stuff.normal_caste=caste_id
    stuff.body_part_8a8:resize(body_part_count) -- all = 1
    stuff.body_part_base_ins:resize(body_part_count)
    stuff.body_part_clothing_ins:resize(body_part_count)
    stuff.body_part_8d8:resize(body_part_count)
    unit.recuperation.healing_rate:resize(layer_count)
    --appearance
   
    local app=unit.appearance
    app.body_modifiers:resize(#caste.body_appearance_modifiers) --3
    for k,v in pairs(app.body_modifiers) do
        app.body_modifiers[k]=genBodyModifier(caste.body_appearance_modifiers[k])
    end
    app.bp_modifiers:resize(#caste.bp_appearance.modifier_idx) --0
    for k,v in pairs(app.bp_modifiers) do
        app.bp_modifiers[k]=genBodyModifier(caste.bp_appearance.modifiers[caste.bp_appearance.modifier_idx[k]])
    end
    --app.unk_4c8:resize(33)--33
    app.tissue_style:resize(#caste.bp_appearance.style_part_idx)
    app.tissue_style_civ_id:resize(#caste.bp_appearance.style_part_idx)
    app.tissue_style_id:resize(#caste.bp_appearance.style_part_idx)
    app.tissue_style_type:resize(#caste.bp_appearance.style_part_idx)
    app.tissue_length:resize(#caste.bp_appearance.style_part_idx)
    app.genes.appearance:resize(#caste.body_appearance_modifiers+#caste.bp_appearance.modifiers) --3
    app.genes.colors:resize(#caste.color_modifiers*2) --???
    app.colors:resize(#caste.color_modifiers)--3
   
    makeSoul(unit,caste)
   
    df.global.world.units.all:insert("#",unit)
    df.global.world.units.active:insert("#",unit)
    --todo set weapon bodypart
   
    local num_inter=#caste.body_info.interactions
    unit.curse.anon_5:resize(num_inter)
    return unit
end
function findRace(name)
    for k,v in pairs(df.global.world.raws.creatures.all) do
        if v.creature_id==name then
            return k
        end
    end
    qerror("Race:"..name.." not found!")
end

function createFigure(trgunit,he)
    local hf=df.historical_figure:new()
    hf.id=df.global.hist_figure_next_id
    hf.race=trgunit.race
    hf.caste=trgunit.caste
hf.profession = trgunit.profession
hf.sex = trgunit.sex
    df.global.hist_figure_next_id=df.global.hist_figure_next_id+1
hf.appeared_year = df.global.cur_year

hf.born_year = trgunit.relations.birth_year
hf.born_seconds = trgunit.relations.birth_time
hf.curse_year = trgunit.relations.curse_year
hf.curse_seconds = trgunit.relations.curse_time
hf.birth_year_bias = trgunit.relations.birth_year_bias
hf.birth_time_bias = trgunit.relations.birth_time_bias
hf.old_year = trgunit.relations.old_year
hf.old_seconds = trgunit.relations.old_time
hf.died_year = -1
hf.died_seconds = -1
hf.name:assign(trgunit.name)
hf.civ_id = trgunit.civ_id
hf.population_id = trgunit.population_id
hf.breed_id = -1
hf.unit_id = trgunit.id

    df.global.world.history.figures:insert("#",hf)

hf.info = df.historical_figure_info:new()
hf.info.unk_14 = df.historical_figure_info.T_unk_14:new() -- hf state?
--unk_14.region_id = -1; unk_14.beast_id = -1; unk_14.unk_14 = 0
hf.info.unk_14.unk_18 = -1; hf.info.unk_14.unk_1c = -1
-- set values that seem related to state and do event
--change_state(hf, dfg.ui.site_id, region_pos)


--lets skip skills for now
--local skills = df.historical_figure_info.T_skills:new() -- skills snap shot
-- ...
--info.skills = skills


he.histfig_ids:insert('#', hf.id)
he.hist_figures:insert('#', hf)

trgunit.flags1.important_historical_figure = true
trgunit.flags2.important_historical_figure = true
trgunit.hist_figure_id = hf.id
trgunit.hist_figure_id2 = hf.id
   
    hf.entity_links:insert("#",{new=df.histfig_entity_link_memberst,entity_id=trgunit.civ_id,link_strength=100})
    --add entity event
    local hf_event_id=df.global.hist_event_next_id
    df.global.hist_event_next_id=df.global.hist_event_next_id+1
    df.global.world.history.events:insert("#",{new=df.history_event_add_hf_entity_linkst,year=trgunit.relations.birth_year,
        seconds=trgunit.relations.birth_time,id=hf_event_id,civ=hf.civ_id,histfig=hf.id,link_type=0})
    return hf
end
function createNemesis(trgunit,civ_id)
    local id=df.global.nemesis_next_id
    local nem=df.nemesis_record:new()
local he=df.historical_entity.find(civ_id)
    nem.id=id
    nem.unit_id=trgunit.id
    nem.unit=trgunit
    nem.flags:resize(1)
    --not sure about these flags...
    nem.flags[4]=true
    nem.flags[5]=true
    nem.flags[6]=true
    nem.flags[7]=true
    nem.flags[8]=true
    nem.flags[9]=true
    --[[for k=4,8 do
        nem.flags[k]=true
    end]]
    df.global.world.nemesis.all:insert("#",nem)
    df.global.nemesis_next_id=id+1
    trgunit.general_refs:insert("#",{new=df.general_ref_is_nemesisst,nemesis_id=id})
    trgunit.flags1.important_historical_figure=true
   
    nem.save_file_id=he.save_file_id

    he.nemesis_ids:insert("#",id)
he.nemesis:insert("#",nem)
    nem.member_idx=he.next_member_idx
    he.next_member_idx=he.next_member_idx+1
    --[[ local gen=df.global.world.worldgen
    gen.next_unit_chunk_id
    gen.next_unit_chunk_offset
    ]]
    nem.figure=createFigure(trgunit,he)
end

function PlaceUnit(race,caste,name,position,civ_id)



    local pos=position or copyall(df.global.cursor)
    if pos.x==-30000 then
        qerror("Point your pointy thing somewhere")
    end
    race=findRace(race)


    local u=CreateUnit(race,tonumber(caste) or 0)
    u.pos:assign(pos)

    if name then
        u.name.first_name=name
        u.name.has_name=true
    end
    u.civ_id=civ_id or df.global.ui.civ_id

   
    local desig,ocupan=dfhack.maps.getTileFlags(pos)
    if ocupan.unit then
        ocupan.unit_grounded=true
        u.flags1.on_ground=true
    else
        ocupan.unit=true
    end
   
    if df.historical_entity.find(u.civ_id) ~= nil  then
        createNemesis(u,u.civ_id)
    end
end

local argPos
 
if #args>3 then
    argPos={}
    argPos.x=args[4]
    argPos.y=args[5]
    argPos.z=args[6]
end
 
PlaceUnit(args[1],args[2],args[3],argPos) --Creature (ID), caste (number), name, x,y,z , civ_id(-1 for enemy, optional) for spawn.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on January 11, 2014, 04:56:23 pm
How do I find a dwarf's cleanliness value?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on January 11, 2014, 09:47:35 pm
1. two ways possible: simple move (boring), making them projectiles, aka throwing them (that should be fun)
...

1. Would making them projectiles really be possible? That would open a whole new set of spell possibilities.
...
I know I have said this before, but I REALLY need to learn DFHack, right now I am reliant on all of you. Any tips on how to get started? Right now I am just looking over all the different scripts that have been written, but it's not really sinking in.
1. i could type it out (need that for one of my own things) also some testing needed to make sure how this would work
...

A few pages ago, I posted a "cause death" script in this thread. One of the deaths was a script that turns the creature into a projectile and slams it into the floor at high speed, exploding it into chunks. You could just use different x,y,z velocities to fling the creature in another direction.  :)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 12, 2014, 02:17:26 am
Urist Da Vinci: I didnt even see that. Nice, I might be able to use it for warlock spells. :)

Wait a second. Wouldnt the warmist work on powered workshop and that gravity script allow for a new trap-workshop? Unit walk on a workshop tile, gets launched into the air?

You could even make elevators that way, using timed hatches.
Title: Re: DFHack 0.34.11 r3
Post by: Mr Space Cat on January 12, 2014, 05:30:16 pm
Switching from Masterwork DF to Accelerated DF+Modest Mod (http://www.bay12forums.com/smf/index.php?topic=117954.0). I don't know if Accelerated DF's DFHack includes the fix for the growth bug with fortress-born creatures. Upon running DF, DFHack doesn't enable any "tweak" that sounds like it fixes growth.

How would I go about adding the fix to DFHack? I'm really really really unfamiliar with DFHack.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 12, 2014, 05:35:19 pm
Go to hack/scripts/growthbug.rb, copy it into the hack/scripts folder in the Accelerated mod, open dfhack.init in your Dwarf Fortress folder, add the new line 'fix/growthbug enable' without the '', and you are all set. Thats it, everything else is done automatically.
Title: Re: DFHack 0.34.11 r3
Post by: Mr Space Cat on January 12, 2014, 06:38:04 pm
Got it working, thanks. I didn't even think of just copying the script from Masterwork's files into Accelerated.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 13, 2014, 12:08:15 am
Trying my hand at DFHack and just have a little question.

I would like a script that checks for all units in a range of area on the map and was wondering if there was any easy or clever way of doing it? I think it should work by just using dfhack.maps.getTileFlags(x,y,z) and then check which tiles are occupied and get the unit ID from there, but was just wondering if the more experienced people might have a better idea before I try this method.

Also, is it possible to check a creatures classes and syndrome classes within DFHack?

EDIT: Also also, for dfhack.timeout(time,mode,callback), is the callback treated as a command line input or something else? (Am I write in thinking I can write a script to change a flag on a unit and then a specific amount of time later I can change the flag back?)
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on January 13, 2014, 01:13:09 pm
Where can you find a list of all the counters and things used by DFHack? I'm trying to write a script that turns complex and overlapping fractures into simple ones, but I don't know where to start.
Title: Re: DFHack 0.34.11 r3
Post by: Telgin on January 13, 2014, 02:35:07 pm
You mean this?  df-structures (https://github.com/angavrilov/df-structures/)

I find it difficult to read it sometimes, so I oftentimes just printall(something) within the Lua interface to see what is available and defined.  Some things you'll want or need the link above for though, like enums.

And, unless it's changed recently, I think a lot of the healthcare stuff was still undocumented.  If that's still true, you may not be able to do what you want without figuring out what those fields are yourself.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 13, 2014, 04:08:14 pm
Here is a sample spell that I put together from looking at other peoples scripts. It casts a cyclone that tosses around all creatures within a specified radius with a specified force. Usage is [SYN_CLASS:\COMMAND][SYN_CLASS:cyclone][SYN_CLASS:\UNIT_ID][SYN_CLASS:radius][SYN_CLASS:strength] where radius and strength are any positive integer. The actual strength of the wind is based on the size of the creature, with small creatures being tossed around like mad and larger creatures hardly moving.

I am sure there are some bugs with it, but it seemed to work fine in adventure mode testing. I am planning to release many of the new things I am doing all together, but figured I would release my first just to show my appreciation for everyones help.

Spoiler: cyclone.lua (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 13, 2014, 07:19:05 pm
Very much looking forward to it. :) Did you manage to get your water/magma-source spells to work?
Title: Re: DFHack 0.34.11 r3
Post by: Cocoprimate on January 13, 2014, 10:19:25 pm
Hey guys,

Is there any way I can fertilize eggs/impregnate a creature with dfhack?

Say, I have a female tame giant toad, and I want her to have babies. I've already modded them to be breedable. Could I have her hatch little toadlings?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on January 14, 2014, 10:14:31 am
You mean this?  df-structures (https://github.com/angavrilov/df-structures/)

I find it difficult to read it sometimes, so I oftentimes just printall(something) within the Lua interface to see what is available and defined.  Some things you'll want or need the link above for though, like enums.

...

Similar to how df.unit.find(unitID) works, IIRC you can print enums from within DFHack lua. I haven't tested it, but it might be printall(df.enum) or print(df.enum(ID)).
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 14, 2014, 12:51:50 pm
print-enum.lua:
Code: [Select]
--prints enum values
local args={...}
function isEnum(t)
    return t._kind=='enum-type'
end
function printEnum(t)
    if not isEnum(t) then
        qerror("type is not an enum")
    end
   
    for i=t._first_item, t._last_item do
        print(i,t[i])
    end
end
local f,err=load("return "..table.concat (args," "))
if f==nil then
    qerror(err)
end
printEnum(f())
Usage: print-enum df.building_type
Title: Re: DFHack 0.34.11 r3
Post by: Nopenope on January 15, 2014, 11:52:23 am
This will sound like a dumb question but what's the current dfhack version, r3 or r4? People talk as if r4 was already released but I see no link in the OP, is it in beta or something?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 15, 2014, 03:41:59 pm
r4 was released not quite officially...
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 15, 2014, 06:41:20 pm
A very random thought just crossed my mind: Does autosyndrome trigger on boulders made of creature mats? Something like PRODUCT:0:1:BOULDER:NONE:CREATURE_MAT:DFHACK_EXAMPLE:MUSCLE, if the muscle tissue/material has the \AUTOSYNDROME and \COMMAND?

I just ask because forgotten beasts, demons, titans and procedually generated content in general will use any inorganics in the raws, and that is a problem once you have several hundret fake inorganics that only exist to call dfhack scripts. One dfhack creature with a few hundret castes would solve that problem beautifully.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on January 16, 2014, 12:25:11 am
I'm 70% certain it won't work.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on January 16, 2014, 04:54:56 pm
I just ask because forgotten beasts, demons, titans and procedually generated content in general will use any inorganics in the raws
No they won't - any inorganic material marked with [SPECIAL], either explicitly (evil weather) or implicitly (by specifying [DEEP_SPECIAL] or [DEEP_SURFACE]), is ignored when selecting random-creature materials.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 16, 2014, 05:00:33 pm
I just ask because forgotten beasts, demons, titans and procedually generated content in general will use any inorganics in the raws
No they won't - any inorganic material marked with [SPECIAL], either explicitly (evil weather) or implicitly (by specifying [DEEP_SPECIAL] or [DEEP_SURFACE]), is ignored when selecting random-creature materials.
In that case let me just leave and slap SPECIAL on ~2000 mats, and I'll be right back.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on January 16, 2014, 05:52:16 pm
Just to clarify, what all does the [SPECIAL] tag do?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 16, 2014, 06:43:46 pm
I knew only that it restricts metals from being used in worldgen. If you have WONDERMETAL and give it the SPECIAL tag, traders wont bring it, and sieges wont use gear made from it.

It does not work with gems or rock. You can still buy/order SPECIAL tagged stone or gems.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 16, 2014, 06:47:52 pm
SPECIAL means basically that stuff won't show up at all except where it's explicitly made to. If you make stone that occurs anywhere, that counts as "explicitly made to". Reactions do not.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 16, 2014, 07:28:18 pm
I have a question about syndrometrigger. (Edit: its solved, I added the solution at the bottom of the post.)

I tried running animaltrain.lua on a specific caste only, but I cant get it to work. I started with this:

Code: [Select]
[INORGANIC:TRAIN_SKELETON_BITE]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL:Train one skill point]
[MATERIAL_VALUE:0]
[SYNDROME]
[SYN_CLASS:\AUTO_SYNDROME]
[SYN_CLASS:\COMMAND]
[SYN_CLASS:animaltrain]
[SYN_CLASS:\WORKER_ID]
[SYN_CLASS:BITE]

It works beautifully and adds 1 skill in biting to the creature running the reaction. Sadly, I cant restrict it to only accept a specific creature caste. So I thought I try syndrometrigger, which I have never used so far, and have never seen in other mods yet. I made an inorganic that teaches an interaction, and the interaction should trigger the script:

Code: [Select]
[INORGANIC:TRAIN_SKELETON_BITE]
[USE_MATERIAL_TEMPLATE:STONE_VAPOR_TEMPLATE]
[STATE_NAME_ADJ:ALL:Train one skill point]
[MATERIAL_VALUE:0]
[SYNDROME]
[SYN_CLASS:\AUTO_SYNDROME]
[SYN_AFFECTED_CREATURE:WARLOCK_CIV:SKELETON]
[SYN_AFFECTED_CREATURE:WARLOCK_CIV:IRONBONE_SKELETON]
[SYN_AFFECTED_CREATURE:WARLOCK_CIV:BLOODSTEEL_SKELETON]
[SYN_AFFECTED_CREATURE:WARLOCK_CIV:DREADNOUGHT_SKELETON]
      [CE_CAN_DO_INTERACTION:PROB:100:START:0:END:100]
         [CDI:INTERACTION:TRAIN_SKELETON_BITE]
[CDI:VERB:learn biting:learns how to bite better:NA]
[CDI:TARGET:A:SELF_ONLY]
[CDI:TARGET_RANGE:A:1]
[CDI:MAX_TARGET_NUMBER:A:1]
[CDI:WAIT_PERIOD:300]

Code: [Select]
[INTERACTION:TRAIN_SKELETON_BITE]
   [I_SOURCE:CREATURE_ACTION]
   [I_TARGET:A:CREATURE]
      [IT_LOCATION:CONTEXT_CREATURE]
      [IT_AFFECTED_CREATURE:WARLOCK_CIV:SKELETON]
      [IT_AFFECTED_CREATURE:WARLOCK_CIV:IRONBONE_SKELETON]
      [IT_AFFECTED_CREATURE:WARLOCK_CIV:BLOODSTEEL_SKELETON]
      [IT_AFFECTED_CREATURE:WARLOCK_CIV:DREADNOUGHT_SKELETON]
   [I_EFFECT:ADD_SYNDROME]
      [IE_TARGET:A]
      [IE_IMMEDIATE]
      [SYNDROME]
[SYN_CLASS:\COMMAND]
[SYN_CLASS:animaltrain][SYN_CLASS:\UNIT_ID][SYN_CLASS:BITE]

The skeletons use the interaction just fine, they show the "learns how to bite better" in the combat log. But the interaction does not trigger syndrometrigger. What did I do wrong?

Edit: SyndromeTrigger is enabled in the init. In case you were wondering.

EDIT: Ups. It actually needs some effect in that syndrome. I used
   [CE_SPEED_CHANGE:SPEED_PERC:99:START:0:END:10], and everything works just fine. :)
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 16, 2014, 07:52:22 pm
I've got a problem when trying to change the webbed counter with a script it doesn't stay changed. Is there another flag that I need to set to keep the creature webbed?

(for reference this is what I am doing, unitTarget.counters.webbed = 5000)


EDIT: Nevermind, stupid mistake. I had a > when I wanted a >= in an if statement.

New question. I am able to create items on the ground in front of units, and I am even able to create items in their inventory, but how do I create items in the air above their heads? Fiddling with the creation scripts I was able to get the item to appear, but it just hung in the air. Is there a flag to let it know it should fall?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 17, 2014, 05:34:08 pm
I've got a problem when trying to change the webbed counter with a script it doesn't stay changed. Is there another flag that I need to set to keep the creature webbed?

(for reference this is what I am doing, unitTarget.counters.webbed = 5000)


EDIT: Nevermind, stupid mistake. I had a > when I wanted a >= in an if statement.

New question. I am able to create items on the ground in front of units, and I am even able to create items in their inventory, but how do I create items in the air above their heads? Fiddling with the creation scripts I was able to get the item to appear, but it just hung in the air. Is there a flag to let it know it should fall?
I think you need to create them as projectiles. Though not sure how much is needed to be filled. Use "dfhack.items.makeProjectile(item)" for that and then set positions probably (if they are not set).
Title: Re: DFHack 0.34.11 r3
Post by: NeedsDF2GetThruWorkingDay on January 17, 2014, 09:08:31 pm
What does Dfusion's power up command do? It appears to be both opaque to googling, as well as not listed in the readme.
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on January 17, 2014, 09:13:50 pm
What does Dfusion's power up command do? It appears to be both opaque to googling, as well as not listed in the readme.

Boosts the selected dwarf's skills to legendary. All of their skills, even ones they don't have any experience in.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 18, 2014, 01:50:57 am
Does anyone know if simply changing an items material index will change all of the combat calculations and such, or is there more that needs to be changed?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on January 18, 2014, 04:41:10 pm
Does anyone know if simply changing an items material index will change all of the combat calculations and such, or is there more that needs to be changed?

The item's weight and sharpness don't auto-update, which matters if the new material has a different density or max_edge.




On another topic, can I call non-script DFHack commands, specifically "cls" (clear screen) from within a (lua) script?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 18, 2014, 04:44:48 pm
No, or at least not that i know.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 19, 2014, 11:23:47 am
I'm having some trouble with structures and enums...

Can someone explain how to do 2 things (in lua, preferably):
1. Determine the death cause of a creature.  I've found df.global.world.deaths.all, but how do I use it?  Preferably finding out if it was a slaughtered animal,
2. Set an enum item - specifically, I'm trying to set RevertWildTimer, found in misc_trait_type in the units file.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 19, 2014, 11:27:32 am
I dont know if you know the script, but there is a "deathcause.rb" included. (not lua, yes, but maybe it helps.)

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 19, 2014, 11:31:35 am
I dont know if you know the script, but there is a "deathcause.rb" included. (not lua, yes, but maybe it helps.)

Spoiler (click to show/hide)
I looked at that.  Doesn't help me, I need to get the variables into lua, and I can't figure out how to find them.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 19, 2014, 11:47:42 am
warning untested code ahead:
Code: [Select]
function getSlaugthered()
  local ret={}
  for _, d in ipairs(df.glboal.world.deaths.all) do
    if d.death_cause==df.death_type.SLAUGHTER then
      table.insert(ret,d)
    end
  end
  return ret
end
for other one use: "df.misc_trait_type.RevertWildTimer" not sure on details though...
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 19, 2014, 12:00:33 pm
warning untested code ahead:
Code: [Select]
function getSlaugthered()
  local ret={}
  for _, d in ipairs(df.glboal.world.deaths.all) do
    if d.death_cause==df.death_type.SLAUGHTER then
      table.insert(ret,d)
    end
  end
  return ret
end
for other one use: "df.misc_trait_type.RevertWildTimer" not sure on details though...

Um, so how would I go about using this?  I'm asking in more of a general sense, I'm looking for the death type in general, slaughter was just an example.
Basically I'm trying to make a system that goes over your fort's history and judges how nice you are to your pets, and make it easier or harder to attract and train animals based on that.  So (for example) if an animal is killed by invaders that's bad, if it dies of starvation that's worse, and if you slaughter it that's the worst.  I know how to iterate over all the animals in the fort's history and check if they're dead, but how would I check the cause of their death?

EDIT: Oh, I found the problem - slaughtered animals don't show up in the death list, probably because they don't run the usual process of go missing - found dead.  Well, then I could just check and see if they were marked for slaughter at the time of death instead.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 19, 2014, 02:34:10 pm
Code: [Select]
[SYNDROME]
[SYN_CLASS:\COMMAND]
[SYN_CLASS:createitem][SYN_CLASS:GOBLET][SYN_CLASS:SLADE][SYN_CLASS:1][SYN_CLASS:\UNIT_ID]
I tried to create items with interactions, but it doesnt work. The command should just be "createitem GOBLET SLADE 1", while marking a unit. So that above should work with SyndromeTrigger, but it doesnt.  :-\
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 19, 2014, 02:43:37 pm
You need an item type (like TOY, TOOL, WEAPON, etc...). GOBLET is not a valid item type (at least thats what I gathered from reading this (https://github.com/peterix/dfhack/blob/18a91ef221f531307ac5ddbe29532a3d6e0a04ec/plugins/createitem.cpp))
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 19, 2014, 02:58:36 pm
Goblet works. I can type that in and spawn a mug. I needed something that has no subtype, because cant use ':' in the syn-classes. DF itself reads the ':' and breaks the syn-class.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 19, 2014, 03:07:10 pm
Hmm, then I have no idea. It could be that it isn't configured to take the ID from \UNIT_ID, does it give you an error?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 19, 2014, 03:21:54 pm
It doesnt give an error, which is the weird part. Everything seems fine... but it doesnt create a unit. I guess it expects the pointer, and doesnt like the unit id.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 19, 2014, 03:33:11 pm
createitem does not accept unit id afaik.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 19, 2014, 03:38:59 pm
Ah, yeah. Its a ruby script, not a lua. I should have checked that, before driving myself crazy. -.- I just wanted caste-specific reactions... only a special caste can create items/use the workshop. It would have worked. ^^
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 19, 2014, 04:46:26 pm
It wouldn't be hard to make a lua script that would do what you want. I already have one for weapons, this will create a weapon of a specified type and inorganic.

Code: [Select]
args = {...}

local unit = df.unit.find(tonumber(args[1]))
local mat = args[3]
local mat_type = dfhack.matinfo.find(mat).type
local mat_index = dfhack.matinfo.find(mat).index

local item_index = df.item_type['WEAPON']
local item_subtype = 'nil'

for i=0,dfhack.items.getSubtypeCount(item_index)-1 do
  local item_sub = dfhack.items.getSubtypeDef(item_index,i)
  if item_sub.id == args[2] then
  item_subtype = item_sub.subtype
end
end

if item_subtype == 'nil' then
  print("No weapon of that type found")
  return
end

local item=df['item_weaponst']:new() --incredible
item.id=df.global.item_next_id
df.global.world.items.all:insert('#',item)
df.global.item_next_id=df.global.item_next_id+1
item:setSubtype(item_subtype)
item:setMaterial(mat_type)
item:setMaterialIndex(mat_index)
item:categorize(true)
item.flags.removed=true
item:setSharpness(1,0)
item:setQuality(0)
dfhack.items.moveToGround(item,{x=unit.pos.x,y=unit.pos.y,z=unit.pos.z})

Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 19, 2014, 04:55:15 pm
What I am trying to do is make this one guy (you only get one of his kind) to lead his minions on raids. He commandeers them and has to do the reactions. Its tools I want to use. I could make unique weapons for this, as well, with some unique inorganics.

The arguments for you script are "WEAPON" "SUBTYPE" "MATERIAL" "LOCATION" ?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 19, 2014, 05:17:33 pm
Ah, yeah. Its a ruby script, not a lua. I should have checked that, before driving myself crazy. -.- I just wanted caste-specific reactions... only a special caste can create items/use the workshop. It would have worked. ^^

createitems is a ruby script. createitem is a C++ plugin.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 19, 2014, 05:23:13 pm
What I am trying to do is make this one guy (you only get one of his kind) to lead his minions on raids. He commandeers them and has to do the reactions. Its tools I want to use. I could make unique weapons for this, as well, with some unique inorganics.

The arguments for you script are "WEAPON" "SUBTYPE" "MATERIAL" "LOCATION" ?

[SYN_CLASS:script][SYN_CLASS:\UNIT_ID][SYN_CLASS:ITEM_WEAPON_DAGGER_LONG][SYN_CLASS:IRON] will make an iron dagger.

Its possible to change it to tools as well, would just need to change a few lines. (actually I think the only thing you would need to change is 'WEAPON' to 'TOOL' and 'item_weaponst' to 'item_toolst'. Although I am not positive about that)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 19, 2014, 05:49:36 pm
[SYN_CLASS:script][SYN_CLASS:\UNIT_ID][SYN_CLASS:ITEM_WEAPON_DAGGER_LONG][SYN_CLASS:IRON] will make an iron dagger.

Its possible to change it to tools as well, would just need to change a few lines. (actually I think the only thing you would need to change is 'WEAPON' to 'TOOL' and 'item_weaponst' to 'item_toolst'. Although I am not positive about that)
I will give it a try tomorrow. :) Thanks for the help. Either one is fine, as long as I can create items from units. I might even be able to use this on pets.

Prisoner pet.
Pasture prisoner on workshop.
Run: "Search prisoner"
Has a small chance of activating this interaction on the prisoner.
Has a cannot-target-if-already-affected tag, so only works once per prisoner.
When activated, drops item.

Yeah for strip searches. I think normal people would be very confused when they read this.

EDIT: WORKS :)
Title: Re: DFHack 0.34.11 r3
Post by: splinterz on January 20, 2014, 12:10:23 pm
i've seen comments in dfhack about calculating the size of a creature from their age, what's that about?

i thought that the size of a creature could be read from body_size_info.size_cur, or calculated by taking the caste's body size, and then applying the appearance modifiers?
Title: Armories (Re: DFHack 0.34.11 r3)
Post by: Bo-Rufus CMVII on January 20, 2014, 12:24:19 pm
I posted this in another forum, but didn't draw the attention of anyone who knows the answer.

I think I understand the use of the weapon rack for the squad, and can get them to store several of their weapons in it, but I'm not clear on the armor stands, cabinets, and chests mentioned at https://github.com/peterix/dfhack (https://github.com/peterix/dfhack) for holding individual equipment.

Do you create a big "armory/barracks" with the weapon rack, then armor stands for each dwarf inside and assign them to the individual dwarves?  Do the cabinets and chests go in their rooms, or under the "umbrella" of their armor stand?

What's the usual setup to take advantage of all the dfhack fixups?

Also... If their schedule specifies no uniform when inactive, do they still "own" their uniform when they're off duty?
Title: Re: DFHack 0.34.11 r3
Post by: Togre on January 20, 2014, 04:33:33 pm
I am a complete newb at using dfhack.  All I really want to change in the growth bug.  I have the LNP, but I don't think I'm actually using it--I never copied/renamed folders.  That's okay--I just want my dwarfs and creature to grow to full size.

Okay, I've been reading and trying stuff, let's see if I mess things up or not.

I want to install/use Putnam's fix to the growth problem.

I have created a text file called init.lua and placed it in the df/raw folder and in the folder of my saves.  The content of the text file is
Spoiler (click to show/hide)


I've done this based on reading post #3955
Spoiler (click to show/hide)

and post #4006
Spoiler (click to show/hide)


Question:  Will this fix the growth bug?  If not, how can I do that?  Thanks
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 20, 2014, 06:27:41 pm
Is there a way of storing a single abstract variable in a fort that persists when the game is reloaded?  (Basically merit points for good behavior)

So far I've been trying to do it by creating an invisible custom metal bar that stores the variable as its DIMENSION value, but I was wondering if there's a simpler, more elegant way.  (The number must be capable of being very large).
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 20, 2014, 06:28:39 pm
You could use general refs

or you could use this (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#persistent-configuration-storage)

Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 20, 2014, 08:42:59 pm
Is there any way to make dead civ members not spawn ghosts in the first place? (I have skeleton civ members, makes no sense that they must be buried/spawn ghosts)
Title: Re: DFHack 0.34.11 r3
Post by: DrKillPatient on January 20, 2014, 08:50:44 pm
Hello! I've got DFHack running mostly properly on OSX Mavericks, but Stonesense has some issues. Upon open it via DFHack in the terminal, DF and SS run together for just a moment — I can see my map load — and then both crash. Strangely, it only occurs when I set a different PRINT_MODE in my init.txt. Unfortunately, as I have a Retina display, I can't use PRINT_MODE:2D (I use STANDARD). What can I do here?
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 21, 2014, 02:51:44 am
You could use general refs

or you could use this (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#persistent-configuration-storage)

How would I use this?  Can you give a simple example?  Just a script that saves and recalls a variable.
Title: Re: DFHack 0.34.11 r3
Post by: danaris on January 21, 2014, 09:52:44 am
Hello! I've got DFHack running mostly properly on OSX Mavericks, but Stonesense has some issues. Upon open it via DFHack in the terminal, DF and SS run together for just a moment — I can see my map load — and then both crash. Strangely, it only occurs when I set a different PRINT_MODE in my init.txt. Unfortunately, as I have a Retina display, I can't use PRINT_MODE:2D (I use STANDARD). What can I do here?

There are still serious issues with Stonesense on OS X that I haven't yet had time to iron out in Mountain Lion, let alone Mavericks.

For the time being, if you can get Stonesense to work at all on OS X, you're in the lucky minority.

I hope to have more time to look into its issues in a few weeks. Unfortunately, right now, I'm swamped.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 21, 2014, 12:40:55 pm
Question about syndromeTrigger. I know we can get the ID of the unit targeted by an interaction (i.e. \UNIT_ID), but is it possible to get the ID of the unit that used the interaction?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 21, 2014, 12:58:18 pm
give the interaction a second target, SELF_ONLY and add the unit id there?
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 21, 2014, 01:31:23 pm
give the interaction a second target, SELF_ONLY and add the unit id there?

Not sure how that would work since I would like to have both ID's.

Also, do you know what will happen if I do that and give the interaction a [USAGE_HINT:ATTACK]? I've always wondered if the AI will use the interaction when there are two targets and one of them is SELF_ONLY.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 21, 2014, 01:56:13 pm
Nope
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 21, 2014, 02:13:33 pm
give the interaction a second target, SELF_ONLY and add the unit id there?

Not sure how that would work since I would like to have both ID's.

Also, do you know what will happen if I do that and give the interaction a [USAGE_HINT:ATTACK]? I've always wondered if the AI will use the interaction when there are two targets and one of them is SELF_ONLY.
Your mage has an interaction. It targets himself (harmless, but gives you the UNIT_ID) and targets the enemy. The enemy gets CE_CAN_DO_INTERACTION with another harmless interaction, with target self-only, which gives you the targets UNIT_ID.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 21, 2014, 02:14:15 pm
That will work, though.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 22, 2014, 11:38:21 am
I want to make a general suggestion, a tiny feature that could be added to all scripts/plugins:

Code: [Select]
local log = io.open('gamelog.txt', 'a')
log:write(text.."\n")
log:close()

with the text being the name of the script. So every time a script runs, a line is added to the gamelog. It would make it a lot easier to identify possible causes for crashes. If the last entry in the gamelog is the scripts name, then you know what to look for.
Title: Re: DFHack 0.34.11 r3
Post by: Armeleon on January 22, 2014, 06:12:49 pm
Can anyone tell me what format the .dfmap files are in? Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 22, 2014, 06:25:53 pm
You could use general refs

or you could use this (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#persistent-configuration-storage)

How would I use this?  Can you give a simple example?  Just a script that saves and recalls a variable.

My new teleport script uses persistent variables. You can check it out in my thread.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 23, 2014, 03:17:54 pm
When looking at the df-structures I see that they are labelled as int16 and int32, I am guessing that tells me the maximum the integer can be? I know the maximum body size is something like 2,000,000,000, so do all int32's have that same cap? And correspondingly do the int16's have the max around 30,000?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 23, 2014, 03:38:58 pm
When looking at the df-structures I see that they are labelled as int16 and int32, I am guessing that tells me the maximum the integer can be? I know the maximum body size is something like 2,000,000,000, so do all int32's have that same cap? And correspondingly do the int16's have the max around 30,000?
Short answer: yes (full ranges for signed types: here (http://nf.nci.org.au/facilities/software/Matlab/techdoc/ref/int8.html) same for almost all languages)
Long answer: in general case no, df might malfunction if passed value too great or too small than it expects. Also some values have special meaning e.g. cursor coordinates are set to -30000 if cursor is not displayed. Also there are uint(s) that have only positive (but twice more) values.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on January 24, 2014, 03:46:25 am
Hmm what's the proper changes for heal commands for R4 given that the transfer between the two broke them?
I can't even dfusion heal copy this time... I ask given meph updated his copy to prototype r4 and most of the commands are broken from the result... meaning I can't revive a dead ghostly necromancer from the dead like I should.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 24, 2014, 04:42:54 am
here (https://gist.github.com/warmist/8594614)
Title: Re: DFHack 0.34.11 r3
Post by: Grombardrim on January 25, 2014, 06:47:36 am
Quick question: I've been using Wanderer's Friend in Adventure Mode, and have created a new form of gauntlets (think plate-armor high gloves), but whenever I create them I can't equip them.  This same issue happens with all forms of created gloves (I've figured out why, too: Wanderer's Friend gloves have no chirality, thus are neither left- nor right-handed, and I can't seem to edit the raws to make it work either).  Someone told me that I could use DFHack to fix that, but I have no idea how.  Could someone talk me through it?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 25, 2014, 01:10:04 pm
It's called fixglovehandedness.rb or something along those lines, it's a ruby script. Don't know exactly where to find it.

Also, yeah, gloves made with reactions cannot have chirality.
Title: Re: DFHack 0.34.11 r3
Post by: peterix on January 25, 2014, 02:47:19 pm
Hello. I think it's time for a status update!

I'm not dead... yet :D

The past year, I've been busy with finishing university, getting a job, MultiMC5 (http://multimc.org/), having a job and MultiMC5 some more (http://multimc.org/). DFHack and any other related activities just went out of the window.

Anyway, today I've started making some changes.

I'll try to answer any PMs sent up to this point now.

Unless you think there's something in the many thread pages I'm skipping right now that I should *really* know about, I'll skip them. There's just too many to read :)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 25, 2014, 02:55:31 pm
That explains all the e-mails I just got about it :P
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 25, 2014, 05:24:01 pm
Hey, anyone know how to spawn a workshop at a given location with a .lua script?  It seems like it should be simple enough (df.building_workshopst:new() seems to make one in the game's memory, then just fill in all the blank variables) but it doesn't appear.
Title: Re: DFHack 0.34.11 r3
Post by: Grombardrim on January 25, 2014, 06:11:16 pm
Putnam, I think I've found it:

Spoiler (click to show/hide)

Does that seem like it'll work?  If yes, how do I run it (like I said, I'm a complete newb at DFHack...)
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 25, 2014, 06:12:40 pm
Put the file (as an .rb) into your scripts folder and run it.
Title: Re: DFHack 0.34.11 r3
Post by: Grombardrim on January 25, 2014, 06:21:43 pm
Um.  It's not a file, it's a wall of text...  What parts do I need to excise in order to make it run smoothly?  And, to run it, I assume I just type the name of the file into DFHack and hit enter, correct?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 25, 2014, 06:35:26 pm
The parts between "code" and "end code":

Code: [Select]
gloves=df.world.items.other[:GLOVES]   # the collection of GLOVES
hand=0 # which hand  0=right, 1=left
count=0
gloves.each do |glove|
# if glove is unhanded (right and left = false, fix it)
unless glove.handedness[0] or glove.handedness[1]
glove.handedness[hand] = true   # enable hand
hand ^= 1   # switch hand for next glove
# XOR assignment: 0 ^ 1 = 1 ; 1 ^ 1 = 0
count += 1
end
end

You put that into a file by the name of "fixhandedness.rb".
Title: Re: DFHack 0.34.11 r3
Post by: Grombardrim on January 25, 2014, 06:37:29 pm
Alright, that's what I thought too, but DFHack's is different enough from C++ that I wanted an outside opinion before messing everything up :P  Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 25, 2014, 06:50:33 pm
That's ruby code, thus the .rb
Title: Re: DFHack 0.34.11 r3
Post by: Grombardrim on January 25, 2014, 06:57:21 pm
Okay, if it's ruby code that'd explain the differences (I was pretty damned sure it wasn't vanilla C++, but I really have no experience with other languages)

Also, this should be my last question for a while: I'm trying to heal a nerve injury caused by my earlier lack of gloves, and have found this code:

Spoiler (click to show/hide)

It seems fine, but when I try to run it, I get:

Spoiler (click to show/hide)

I've tried removing the hash symbol, changing the hash symbol to a colon, changing the bracket to a colon, and placing a colon in front of the bracket, nothing worked.  What exactly do I need to do here?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 25, 2014, 07:04:30 pm
Because that's Lua code, not ruby. You want .lua, not .rb.
Title: Re: DFHack 0.34.11 r3
Post by: Grombardrim on January 25, 2014, 07:07:46 pm
*facepalm*  Thanks.  Would've been nice if he could've put that somewhere.  And to think, it took me a long time to learn ONE programming language, let alone however many DFHack uses XP
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 25, 2014, 07:13:25 pm
Just the 3.

C++ is always compiled and you won't find it in a script form; it looks, of course.

It's usually easy to tell which is which. Ruby has #comments and often has $ everywhere, lua has --comments and for k,v in ipairs(tbl) everywhere and C++ is usually in a .dll but if it isn't it declares types everywhere and has //comments or /*comments*/

Also you probably want to use this (https://gist.github.com/warmist/8594614) healing script.
Title: Re: DFHack 0.34.11 r3
Post by: Grombardrim on January 25, 2014, 07:20:42 pm
Hmm.  What's the difference between the two? 

Also, both of them seem to want me to select a unit, which you can only do in Fortress mode... Nevermind, 'c' lets you select units in Adventure mode too.  A tutorial for Dwarf Fortress would really make it boring, wouldn't it? :P
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on January 25, 2014, 07:21:11 pm
l-->(unit) also allows that.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 26, 2014, 02:45:11 am
Thanks Putnam and Roses for the info on persistant variables.  Those will be very useful.

Allright, three new questions:

1. How to create a new building/workshop on a given map location?
2. How to read the material composition of a given undug tile?
3. When turning a tile clear by changing the tile type, how to run the call that makes caveins and liquid flow work properly?

(My next project is an extendable and retractable drilling rig for making vertical holes and bringing liquids to the surface more easily than a pump stack.)
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on January 26, 2014, 09:08:08 am
Is there a compiled version of cleanconst (https://github.com/quietust/dfhack/blob/master/plugins/cleanconst.cpp) anywhere?
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 26, 2014, 04:01:03 pm
Okay, another question:

Is there a way to get the structure type of a variable?

For example, here I'm trying to get a list of inorganic materials found in an area.
Code: [Select]
local block = dfhack.maps.getTileBlock(pos.x,pos.y,pos.z)
if #block.block_events > 0 then

for e=0,#block.block_events-1,1 do
inorganic = df.inorganic_raw.find(block.block_events[e].inorganic_mat)
print(inorganic)
end
end

Only problem is, if there's water or grass in the area, those particular items don't have an inorganic_mat, and I can't get dfhack to simply skip over them, it always crashes.  So I need to put them in an if statement that only allows it to look if the particular item is block_square_event_mineralst, but not grassst or spatterst.  How do I do that?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on January 26, 2014, 04:23:53 pm
The easy way:
Code: [Select]
for id,ev in ipairs(block.block_events) do
  if ev:getType()==df.block_square_event_type.mineral then
  -- do something here
  end
end
Harder way:
Code: [Select]
for id,ev in ipairs(block.block_events) do
  if df.block_square_event_mineralst:is_instance(ev) then
  -- do something here
  end
end
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 26, 2014, 06:17:35 pm
Ah, that works.

Any idea about the earlier questions?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 26, 2014, 06:26:14 pm
Maybe use a creature instead of a workshop? I would assume that making it a creature that is teleported and uses interactions for mining would be easier than a workshop.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 26, 2014, 06:43:38 pm
I've never tried to construct a building with DFHack, but supposidly this (https://github.com/peterix/dfhack/blob/0.34.11-r4/Lua%20API.rst#buildings-module) can be used to create buildings.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on January 26, 2014, 07:19:40 pm
I've never tried to construct a building with DFHack, but supposidly this (https://github.com/peterix/dfhack/blob/0.34.11-r4/Lua%20API.rst#buildings-module) can be used to create buildings.

Well, it's a start...but it can't actually construct the buildings by itself, only designate them to be constructed.  It also doesn't seem to construct my custom drill section "workshop", even when I put in the correct type.  I can turn an existing building into one, though.
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on January 27, 2014, 02:17:51 am
Has the syntax for truetransform changed? Interactions that used to properly set the creature's race/caste in r3 does not seem to trigger in r4 at all. This seems to happen in Meph's walrock mod too.

First I have reaction triggering autosyndrome. It temp transform the worker into an immobile creature and give it an interaction.

The interaction has several syndromes acting as cases depending of the target. They change into 'summoned souls' as they should but afterward it revert to their original form.

I tried removing autosyndrome tags from the reaction's boiling rock, to be sure that there is not issues but the result is the same (well, with more randomness due to no autosyndrome).

Trying with \COMMAND,

Any clue ?

Here's the interaction :
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Meph on January 27, 2014, 03:30:20 am
TrueTransform is exactly the same and still works without a problem. I just got a report that said that these newly converted civ members are treated like enemies, even if they are a new creature. I havent tested it myself yet.

Here is an example of a working truetransform interaction. But I am sure that your syntax is correct, its literally the same.

Code: [Select]
[INTERACTION:TRANSFORM_OVERLORD] 
[I_TARGET:A:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[IT_AFFECTED_CREATURE:WARLOCK_CIV:WARLOCK_M]
[IT_AFFECTED_CREATURE:WARLOCK_CIV:WARLOCK_V_M]
[IT_MANUAL_INPUT:self]
[IT_CANNOT_HAVE_SYNDROME_CLASS:BLOCK_OVERLORD]
[I_EFFECT:ADD_SYNDROME]
[IE_TARGET:A]
[IE_IMMEDIATE]
[SYNDROME]
[SYN_AFFECTED_CREATURE:WARLOCK_CIV:WARLOCK_M]
[SYN_AFFECTED_CREATURE:WARLOCK_CIV:WARLOCK_V_M]
[CE_BODY_TRANSFORMATION:PROB:100:START:0:END:10]
[CE:CREATURE:WARLOCK_MIST:MALE]
[SYN_CLASS:\PERMANENT][SYN_CLASS:WARLOCK_CIV][SYN_CLASS:WARLOCK_OVERLORD]   
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on January 27, 2014, 04:31:31 am
For converted prisoners being beaten up it seems that using makeown from master fixes that. At least on my tests it worked :
https://github.com/DFHack/dfhack/blob/master/library/lua/makeown.lua
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on January 27, 2014, 09:17:46 am
Is there a compiled version of cleanconst (https://github.com/quietust/dfhack/blob/master/plugins/cleanconst.cpp) anywhere?
Sure, right here (http://www.qmtpro.com/~quietust/df/cleanconst.plug.dll.bz2).
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on January 27, 2014, 01:09:26 pm
For converted prisoners being beaten up it seems that using makeown from master fixes that. At least on my tests it worked :
https://github.com/DFHack/dfhack/blob/master/library/lua/makeown.lua

Herp derp, I needed to add 'syndromeTrigger enable' to dfhack.init. Now trueTransform is working.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on January 27, 2014, 05:56:18 pm
Is it possible to trigger an event every time a particular map square is crossed by a creature (without checking the occupancy of the square every tick)? Something like an eventful plugin?
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on January 27, 2014, 06:25:43 pm
Is there a compiled version of cleanconst (https://github.com/quietust/dfhack/blob/master/plugins/cleanconst.cpp) anywhere?
Sure, right here (http://www.qmtpro.com/~quietust/df/cleanconst.plug.dll.bz2).
It works, though I needed to get the game save into a copy of 34.11 running alongside DFHack r2. Bit of fiddling about for one command, though the result was worth it. I didn't realise a mere ~3200 constructed blocks were eating 10-20fps.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on January 28, 2014, 02:20:05 am
In caste_body_info there is a vector attacks which is padding. I was interested in using this creature body part attack data for a script, so I looked at the memory to determine the structure:

The structure, which could probably be called caste_attack, has a size of 0x148 (328) bytes. There is one structure in the vector for each body part attack option that you can choose from when aiming an attack (i.e. punch left, punch right, kick left, kick right, scratch left, scratch right, bite for most humanoids).

-Offset 0x0, size 0x1c is a string for the word X in "[ATTACK:X:BODYPART:BY_TYPE:Y]"
-Offset 0x1c, size 0x1c is a string for the 3rd person verb i.e. "punches"
-Offset 0x38, size 0x1c is a string for the 2nd person verb i.e. "punch"
-Offset 0x54, size 0x4 is flags. In ascending order (1,2,4,8) known flags are "with", "latch", "main", "edge". Secondary attacks don't get a flag, but just the absence of the "main" flag.
-Unknown stuff follows, which may be related to poison injection attacks (needs more research)
-Offset 0xe8, size 0x4 is the contact% of the body part attack, defaulting to 0x64 (100)
-Offset 0xec, size 0x4 is the penetration% of the body part attack, defaulting to 0x64 (100)
-Offset 0xf0, size 0x10 appears to be a [EDIT] vector of body part id numbers.
-[EDIT2] Offset 0x100, size 0x10 appears to be another vector of unknowns.
-Offset 0x110, size 0x4 is the skill number of the skill used for the attack (typically 0x66, 0x67, or 0x68)
-Offset 0x114, size 0x4 is the speed of the attack, defaulting to 0x3e8 (1000)
-Unknown stuff follows to the end of the structure.

[EDIT3]
It seems highly likely based on further probing and looking at how code uses the data, that the remaining unknown space is used for several size 0x10 vectors. The offsets are: 0x58, 0x68, 0x78, 0x88, 0x98, 0xa8, 0xb8, 0xc8, 0xd8, and also 0x118, 0x128, 0x138.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on January 28, 2014, 01:42:24 pm
A few corrections:

-Offset 0x54, size 0x4 is flags. In ascending order (1,2,4,8) known flags are "with", "latch", "main", "edge". Secondary attacks don't get a flag, but just the absence of the "main" flag.
Actual size is only 0x2.

-Offset 0xf0, size 0x10 appears to be a [EDIT] vector of body part id numbers.
-[EDIT2] Offset 0x100, size 0x10 appears to be another vector of unknowns.
It is important to know that both of these are int16 vectors; the first one is indeed body part IDs, while the second is tissue layer IDs.

-Offset 0x110, size 0x4 is the skill number of the skill used for the attack (typically 0x66, 0x67, or 0x68)
Again, actual size is only 0x2.

I also went through the raw parsing code and figured out what all of the other fields are:
Code: [Select]
    <struct-type type-name='caste_attack'>
        <stl-string name='name'/>
        <stl-string name='verb_3rd'/>
        <stl-string name='verb_2nd'/>
        <bitfield name='flags' base-type='uint16_t'>
            <flag-bit name='with'/>
            <flag-bit name='latch'/>
            <flag-bit name='main'/>
            <flag-bit name='edge'/>
        </bitfield>
        <stl-vector type-name='int32_t' name='specialattack_type' comment='0 = inject extract, 1 = suck blood, 2 = perform interaction'/>
        <stl-vector type-name='int16_t' name='specialattack_mat_type' comment='extract injected'/>
        <stl-vector type-name='int32_t' name='specialattack_mat_index'/>
        <stl-vector type-name='matter_state' name='specialattack_mat_state'/>
        <static-array count='4' name='specialattack_temp_mat' comment='parsed during second pass'><stl-vector pointer-type='stl-string'/></static-array>
        <stl-vector type-name='int32_t' name='specialattack_min' comment='amount of extract injected or blood sucked'/>
        <stl-vector type-name='int32_t' name='specialattack_max'/>
        <int32_t name='contact_perc'/>
        <int32_t name='penetration_perc'/>
        <stl-vector type-name='int16_t' name='body_part_idx'/>
        <stl-vector type-name='int16_t' name='tissue_layer_idx'/>
        <enum base-type="int16_t" type-name="job_skill" name="skill"/>
        <stl-vector pointer-type='stl-string' name='specialattack_interaction_tmp_name' comment='parsed during second pass'/>
        <stl-vector type-name='int32_t' name='specialattack_interaction_id'/>
    </struct-type>

Should be in df-structures shortly.
Title: Re: DFHack 0.34.11 r3
Post by: Starweaver396 on January 28, 2014, 10:49:22 pm
Nevermind. Sorry.
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on February 01, 2014, 05:38:38 am
For using workflow to manage boots and gloves, do you specify how many items, or how many pairs?

Does 'count' vs. 'amount' make a difference here?
Title: Re: DFHack 0.34.11 r3
Post by: DrKillPatient on February 02, 2014, 01:40:10 am
Hello! I've got DFHack running mostly properly on OSX Mavericks, but Stonesense has some issues. Upon open it via DFHack in the terminal, DF and SS run together for just a moment — I can see my map load — and then both crash. Strangely, it only occurs when I set a different PRINT_MODE in my init.txt. Unfortunately, as I have a Retina display, I can't use PRINT_MODE:2D (I use STANDARD). What can I do here?

There are still serious issues with Stonesense on OS X that I haven't yet had time to iron out in Mountain Lion, let alone Mavericks.

For the time being, if you can get Stonesense to work at all on OS X, you're in the lucky minority.

I hope to have more time to look into its issues in a few weeks. Unfortunately, right now, I'm swamped.

I now have access to a Windows computer... I'm going to try Stonesense on it with an unusual PRINT_MODE and see if it still crashes. Perhaps it's not Mac-specific?
Title: Re: DFHack 0.34.11 r3
Post by: Raidau on February 02, 2014, 06:17:32 am

[SYN_CLASS:script][SYN_CLASS:\UNIT_ID][SYN_CLASS:ITEM_WEAPON_DAGGER_LONG][SYN_CLASS:IRON] will make an iron dagger.

Its possible to change it to tools as well, would just need to change a few lines. (actually I think the only thing you would need to change is 'WEAPON' to 'TOOL' and 'item_weaponst' to 'item_toolst'. Although I am not positive about that)

It works (at least initial testing conformed that). I made this crude variation (for tools) for my own use, it also takes one more argumet as quality. Gonna try expand this for armor as well. Thanks Roses.

Code: [Select]
args = {...}

local unit = df.unit.find(tonumber(args[1]))
local mat = args[3]
local quality = args[4]
local mat_type = dfhack.matinfo.find(mat).type
local mat_index = dfhack.matinfo.find(mat).index

local item_index = df.item_type['TOOL']
local item_subtype = 'nil'

for i=0,dfhack.items.getSubtypeCount(item_index)-1 do
  local item_sub = dfhack.items.getSubtypeDef(item_index,i)
  if item_sub.id == args[2] then
  item_subtype = item_sub.subtype
end
end

if item_subtype == 'nil' then
  print("No weapon of that type found")
  return
end

local item=df['item_toolst']:new() --incredible
item.id=df.global.item_next_id
df.global.world.items.all:insert('#',item)
df.global.item_next_id=df.global.item_next_id+1
item:setSubtype(item_subtype)
item:setMaterial(mat_type)
item:setMaterialIndex(mat_index)
item:categorize(true)
item.flags.removed=true
item:setSharpness(1,0)
item:setQuality(quality)
dfhack.items.moveToGround(item,{x=unit.pos.x,y=unit.pos.y,z=unit.pos.z})

By the way, what will happen if item:setSharpness(1,0) is used on a non-sharp non-weapon tool? looks like honeycombs dont become edged this way
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on February 02, 2014, 01:21:04 pm
...
By the way, what will happen if item:setSharpness(1,0) is used on a non-sharp non-weapon tool? looks like honeycombs dont become edged this way

Strangely, it appears items with Sharpness that don't come with ATTACK tokens will be treated as blunt if used in melee, but will treated as edged if thrown. This should apply to knapped rocks as well (needs verification)
Title: Re: DFHack 0.34.11 r3
Post by: Baleur on February 02, 2014, 06:10:24 pm
Is there anyway to keep autolabor on WITHOUT it doing either of two things;

1. Not changing labors of specified dwarves, such as my miners.
2. Not assigning/deassigning the mining labor, but keeping the already assigned dwarves to it.

I absolutely love autolabor, but this one single issue where it keeps messing up the miners is pretty much a dealbreaker, almost making it as bad at managing the fortress as it is in vanilla with micromanagement. Having your Engineer suddenly become a Dabbling Miner while your Master Miner is now crafting wooden arrows pretty much breaks the game.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on February 02, 2014, 06:18:21 pm
IIRc, dwarves assigned to a burrow (not civilian alert) are left alone by autolabor, so you could just define the whole map as one burrow and assign them to that.  In this one, extra mining is still handled... I'm pretty sure that you can modify the autolabor job priorities too, so if you get that command and set mining to zero it should just be the burrowed miners. 
Title: Re: DFHack 0.34.11 r3
Post by: Roses on February 03, 2014, 02:36:15 am
So I have been trying to get the unit id of both the person who used an interaction and the id of the unit targeted by that interaction. The closest I have been able to come up with so far is giving the interaction a CDI:VERB so that it generates an announcement, and as soon as the syndrome is triggered, checking for the last announcement generated. This gives me the position of the generated announcement which I can use to check the units on that map square for their ID. This works, but is obviously very buggy as several announcements triggering in close succession will give false results.

Does anyone have a better idea for attempting this? I figured a creature might have a list of used interactions, or maybe they would appear in the units attack tables, but after hours of testing I can't find anything else that would link the interaction to its source.
Title: Re: DFHack 0.34.11 r3
Post by: Ravendarksky on February 04, 2014, 08:16:44 am
... Nevermind
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 05, 2014, 11:42:29 am
Is there anywhere I can find a list of all the existing eventTypes?  I have a script I'd like to run when a caravan is about to leave, as well as some other circumstances.  Eventful's enableEvent(evType,frequency) says it can do that, but what's the event type?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on February 05, 2014, 03:01:22 pm
Is there anywhere I can find a list of all the existing eventTypes?  I have a script I'd like to run when a caravan is about to leave, as well as some other circumstances.  Eventful's enableEvent(evType,frequency) says it can do that, but what's the event type?

https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#eventful
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 05, 2014, 03:10:45 pm
Is there anywhere I can find a list of all the existing eventTypes?  I have a script I'd like to run when a caravan is about to leave, as well as some other circumstances.  Eventful's enableEvent(evType,frequency) says it can do that, but what's the event type?

https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#eventful

You may notice that that doesn't actually contain the event table, meaning the event table has to be found manually through lua.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 05, 2014, 04:19:57 pm
Is there anywhere I can find a list of all the existing eventTypes?  I have a script I'd like to run when a caravan is about to leave, as well as some other circumstances.  Eventful's enableEvent(evType,frequency) says it can do that, but what's the event type?

https://github.com/DFHack/dfhack/blob/master/Lua%20API.rst#eventful

You may notice that that doesn't actually contain the event table, meaning the event table has to be found manually through lua.

Any idea how to go about doing that?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 05, 2014, 04:28:51 pm
printall(require('eventful').eventType)
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on February 05, 2014, 05:37:56 pm
Oh. It was supposed to. Thanks.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 06, 2014, 12:23:50 am
Oh i thought there was a block for event manager (including docs about it)
Title: Re: DFHack 0.34.11 r3
Post by: sirdave79 on February 07, 2014, 01:02:08 am
OK firstly thanks to Putnam, you corrected a marriage script for me ages ago (sep or so) and Ive got it to work successfully now.

Ive spoilered all that spiel out as I think ive found a script to sort this.

Spoiler (click to show/hide)

Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: sirdave79 on February 07, 2014, 03:42:35 am
nevermind, ive found, I think its Kurik Amudnils (subject to checking and editing) script which fixes most of these problems.

Ive used it on my recruits and they now list civ membership (didnt before) and can be assigned to the military. Seems to hold a noble position too but I didnt check that before (presumably they could not).

Ill report back if they can progress to being married.
cheers
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 07, 2014, 03:46:44 am
be warned, that this method of adding nemesis is crashy. Meph reported that after a season or two game crashes. Moreover it has power to corrupt saves.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on February 07, 2014, 04:27:56 am
I am willing to test again. ^^
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on February 07, 2014, 04:47:48 am
Tweak makeown is old afaik.

Makeown.lua worked well on invaders so I guess merchants should work as well.
Title: Re: DFHack 0.34.11 r3
Post by: sirdave79 on February 07, 2014, 05:40:13 am
Ill keep an eye out for corrupted saves over the next few years.

Of the 4 couples that had stolen spouses, 2 of the couples "stuck" at friends seemed to go to married within minutes of applying the script, almost as if "chats" were saved up.

1 of them was at lover and the remaining one still friends. I have yet to see them get married.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on February 07, 2014, 10:07:42 pm
What is the purpose of the "Nemesis" entries anyways? What do they do that isn't redundant to the unit or historical figure data?
Title: Re: DFHack 0.34.11 r3
Post by: ag on February 08, 2014, 02:19:35 am
What is the purpose of the "Nemesis" entries anyways? What do they do that isn't redundant to the unit or historical figure data?

As far as we understand, they control how unit data is stored in unit-*.dat files in your save directory. They are also where the game stores permanently which units are your current or past adventurer, and who its companions are.
Title: Re: DFHack 0.34.11 r3
Post by: sirdave79 on February 08, 2014, 10:40:50 am
2 years down no sign of any problems so far. I guess the next 2 will be more important.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on February 08, 2014, 10:42:48 am
2 years down no sign of any problems so far. I guess the next 2 will be more important.
what exactly are you doing with the nemesis lines? Spawn creatures? Thats what I tried, make creatures that enter noble/military positions.
Title: Re: DFHack 0.34.11 r3
Post by: sirdave79 on February 08, 2014, 01:37:05 pm
I just used the script I linked for some dwarven caravan guards id used the basic "tweak makeown" dfhack command on because they wouldnt marry. Thats why I stole them in the first place to match up my remaining singletons with a dwarf of the opposite sex and the right age.

A marriage script reported to me that they didnt have historical records. Also their relationship status seemed stuck on "friend" before aplying the script. They naturally married after application and reported civilisation membership in their preferences screen (they didnt before the script).

Then I noticed the stolen dwarfs couldnt be assigned to a military squad.

Someone said a nemesis record (never heard of them before now) was needed for a dwarf stolen from the caravan this way to occupy a noble position. Cant remember if this was also needed for military squad assignment but again the script seems to have fixed all my problems.

I just have to hope my data/save is safe. Im trying to run it fast with a backup save to go back to, to see if it stays stable so im not too invested in a game 5 years down the line thats no longer viable due to the hacks and scripts ive used.

Hopefully that menas I wont have a problem.

EDIT also my ability to know if i have a problem or not will likely be severely lacking.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on February 08, 2014, 02:06:06 pm
Do you think you can add this to warmists spawnunit, so I can do some tests and see if it works, or does cause crashes? :)
Title: Re: DFHack 0.34.11 r3
Post by: sirdave79 on February 08, 2014, 02:52:29 pm
Your not talking to me now are you ?

If so I dont understand sorry.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 08, 2014, 04:08:23 pm
Updated spawn unit with nemesis creation (i.e. can assign to squad members, not captains) with normal working. It was missing a edge case (then 100th unit in same unit chunk is created). Hopefully we'll find how to make them noble'able :)

Edit: updated it yet again: now you can assign nobles/captains too. Unfortunately you can't assign them if it's not your forts race.
Title: Re: DFHack 0.34.11 r3
Post by: Dutchling on February 11, 2014, 11:03:02 am
According the wiki DFHack can fix the growth bug.

How would one do that, exactly?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 11, 2014, 11:20:48 am
fixgrowthbug.rb, which the starter pack and masterwork both come with
Title: Re: DFHack 0.34.11 r3
Post by: Dutchling on February 11, 2014, 11:30:39 am
I got DFHack from the LNP and it doesn't recognize that as a command.
Title: Re: DFHack 0.34.11 r3
Post by: fricy on February 11, 2014, 12:00:00 pm
I got DFHack from the LNP and it doesn't recognize that as a command.

If you're using an LNP that's not too old, (4-5 months?) than the fix is configured to run automatically. Watch the dfhack console for confirmation, there should be a message every month or so saying that "units are fixed to grow normally", or something like that.

If not, get the script, put it into hack/scripts/fix and add this line to dfhack.init:

Code: [Select]
fix/growthbug enable
Title: Re: DFHack 0.34.11 r3
Post by: Severedicks on February 11, 2014, 12:34:54 pm
Is there a list of all binpatches and bugfixing plugins somewhere? PE's pack (which contains the most binpatched executable I know) only has dfhack3 when all the plugins have been updated to some unreleased r4 I never managed to get my hands on.
Title: Re: DFHack 0.34.11 r3
Post by: fricy on February 11, 2014, 01:54:55 pm
Is there a list of all binpatches and bugfixing plugins somewhere? PE's pack (which contains the most binpatched executable I know) only has dfhack3 when all the plugins have been updated to some unreleased r4 I never managed to get my hands on.

I don't quite understand the question there...
PE's pack contains the growthbug fix, a few dfhack binpatches that should be compatible with dfhack-r4, and runs a patched exe that fixes another couple of bugs. All of these should work out of the box with dfhack-r4 as far as I know. The list you can find in /hack/patches.
But as dfhack-r3 working correctly, there's not much reason to update to an unofficial r4 for an unmodded vanilla game. For mods there's a reason to go r4, but you won't get much benefit in vanilla.
If you still feel like updating there's a post somewhere in this thread with r4, or you can get Essential DF mod or Masterwork and replace the raws, and in the case of MW the modded .exe too.
Title: Re: DFHack 0.34.11 r3
Post by: Severedicks on February 11, 2014, 05:16:42 pm
Thanks a lot of your information! I'm trying to mod my own build but I've been having trouble getting the most up-to-date tools and patches, your post helped me a lot.
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on February 14, 2014, 12:10:18 am
Trying to build on Linux... found various posts that helped me over the configuration and missing libraries, but it bombs on this and I can't figure out the problem.

Code: [Select]
In file included from /home/bdbryant/DwarfFortress-mod/df_linux/hack/dfhack/library/LuaApi.cpp:50:0:
/home/bdbryant/DwarfFortress-mod/df_linux/hack/dfhack/library/include/modules/MapCache.h:289:57: error: ‘df::tile_designation::Mask’ has not been declared
/home/bdbryant/DwarfFortress-mod/df_linux/hack/dfhack/library/include/modules/MapCache.h:292:55: error: ‘df::tile_occupancy::Mask’ has not been declared
/home/bdbryant/DwarfFortress-mod/df_linux/hack/dfhack/library/include/modules/MapCache.h:292:10: error: ‘bool MapExtras::Block::getFlagAt(df::coord2d, int)’ cannot be overloaded
/home/bdbryant/DwarfFortress-mod/df_linux/hack/dfhack/library/include/modules/MapCache.h:289:10: error: with ‘bool MapExtras::Block::getFlagAt(df::coord2d, int)’
/home/bdbryant/DwarfFortress-mod/df_linux/hack/dfhack/library/include/modules/MapCache.h:295:57: error: ‘df::tile_designation::Mask’ has not been declared
/home/bdbryant/DwarfFortress-mod/df_linux/hack/dfhack/library/include/modules/MapCache.h:296:55: error: ‘df::tile_occupancy::Mask’ has not been declared
/home/bdbryant/DwarfFortress-mod/df_linux/hack/dfhack/library/include/modules/MapCache.h:296:10: error: ‘bool MapExtras::Block::setFlagAt(df::coord2d, int, bool)’ cannot be overloaded
/home/bdbryant/DwarfFortress-mod/df_linux/hack/dfhack/library/include/modules/MapCache.h:295:10: error: with ‘bool MapExtras::Block::setFlagAt(df::coord2d, int, bool)’
make[2]: *** [library/CMakeFiles/dfhack.dir/LuaApi.cpp.o] Error 1
make[1]: *** [library/CMakeFiles/dfhack.dir/all] Error 2
make: *** [all] Error 2

Am I still missing something?

(Oh, BTW, I'm building warmist's fork that adds rendermax.)
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on February 14, 2014, 12:40:01 am
Sigh...

As an afterthought I fetched peterix's code, on the chance that warmist's fork has a problem.  It gets further, but still blows up:

Code: [Select]
Scanning dependencies of target eventful
[ 64%] Building CXX object plugins/CMakeFiles/eventful.dir/eventful.cpp.o
/home/bdbryant/DwarfFortress-mod/df_linux/hack-peterix/dfhack/plugins/eventful.cpp: In function ‘void enableEvent(int, int)’:
/home/bdbryant/DwarfFortress-mod/df_linux/hack-peterix/dfhack/plugins/eventful.cpp:232:15: error: ‘runtime_error’ is not a member of ‘std’
make[2]: *** [plugins/CMakeFiles/eventful.dir/eventful.cpp.o] Error 1
make[1]: *** [plugins/CMakeFiles/eventful.dir/all] Error 2
make: *** [all] Error 2

Still not obvious what the problem is.

BTW:
Code: [Select]
cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=/home/bdbryant/DwarfFortress-mod/df_linux
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc-4.5
-- Check for working C compiler: /usr/bin/gcc-4.5 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-4.5
-- Check for working CXX compiler: /usr/bin/g++-4.5 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.3.4")
-- Looking for include files CMAKE_HAVE_PTHREAD_H
-- Looking for include files CMAKE_HAVE_PTHREAD_H - found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: /home/bdbryant/DwarfFortress-mod/df_linux/hack-peterix/dfhack/build

Any help will be appreciated.
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on February 14, 2014, 04:37:45 am
For the record, I got the peterix version to work with gcc 4.6 by adding #include <stdexcept> to eventful.cpp

Now to see if I can get rendermax compiled in...
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 14, 2014, 06:40:57 am
Anyone know how to use eventful.onUnitDeath?

I tried to use this very simple code to test it:

Code: [Select]
local eventful = require 'plugins.eventful'

eventful.enableEvent(eventful.eventType.UNIT_DEATH,5)

eventful.onUnitDeath=function(u)
local unit = u
print('unit died.')
end

But nothing happens.  I also tried putting the eventful.onUnitDeath inside a constantly repeating function, but still no effect.  Does anyone know of a script that uses this function?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 14, 2014, 07:12:47 am
Anyone know how to use eventful.onUnitDeath?

I tried to use this very simple code to test it:

Code: [Select]
local eventful = require 'plugins.eventful'

eventful.enableEvent(eventful.eventType.UNIT_DEATH,5)

eventful.onUnitDeath=function(u)
local unit = u
print('unit died.')
end

But nothing happens.  I also tried putting the eventful.onUnitDeath inside a constantly repeating function, but still no effect.  Does anyone know of a script that uses this function?
Try eventful.onUnitDeath.someRandomName=function(u)...
Also it's not a unit, but a unit id (i think).
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 14, 2014, 07:47:37 am
Anyone know how to use eventful.onUnitDeath?

I tried to use this very simple code to test it:

Code: [Select]
local eventful = require 'plugins.eventful'

eventful.enableEvent(eventful.eventType.UNIT_DEATH,5)

eventful.onUnitDeath=function(u)
local unit = u
print('unit died.')
end

But nothing happens.  I also tried putting the eventful.onUnitDeath inside a constantly repeating function, but still no effect.  Does anyone know of a script that uses this function?
Try eventful.onUnitDeath.someRandomName=function(u)...
Also it's not a unit, but a unit id (i think).

That just gives an error "attempt to index field 'onUnitDeath' (a function value)".

EDIT: Some other eventful functions, like onInventoryChange, work in the same circumstances.  I think onUnitDeath might operate differently.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 14, 2014, 07:56:12 am
so strange. It works for me (did this in console):
Code: [Select]
lua
ev=require 'plugins.eventful'
~ev
(echo lots of lines, one relevant) :
onUnitDeath              = <event: 0 listeners>
ev.onUnitDeath.bla=function(u_id) print("unit_died"..u_id) end
ev.enableEvent(eventful.eventType.UNIT_DEATH,5)
and then it printed unit_died0, unit_died2, etc...
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 14, 2014, 08:12:53 am
Uh...
Is that even lua?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 14, 2014, 08:14:34 am
Uh...
Is that even lua?
~ev -> printall(ev)
!ev -> print(ev)
it's an extension to the lua console for fast usage.
A script would look like this:
Code: [Select]
local ev=require 'plugins.eventful'
ev.onUnitDeath.bla=function(u_id) print("unit_died"..u_id) end
ev.enableEvent(eventful.eventType.UNIT_DEATH,5)
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 14, 2014, 08:29:54 am
Well, that worked for some reason.  Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 14, 2014, 10:16:28 am
Anyone know how to use eventful.onUnitDeath?

I tried to use this very simple code to test it:

Code: [Select]
local eventful = require 'plugins.eventful'

eventful.enableEvent(eventful.eventType.UNIT_DEATH,5)

eventful.onUnitDeath=function(u)
local unit = u
print('unit died.')
end

But nothing happens.  I also tried putting the eventful.onUnitDeath inside a constantly repeating function, but still no effect.  Does anyone know of a script that uses this function?
Try eventful.onUnitDeath.someRandomName=function(u)...
Also it's not a unit, but a unit id (i think).

That just gives an error "attempt to index field 'onUnitDeath' (a function value)".

EDIT: Some other eventful functions, like onInventoryChange, work in the same circumstances.  I think onUnitDeath might operate differently.

That's because you literally replaced the entire onUnitDeath event with your function the first time.
Title: Re: DFHack 0.34.11 r3
Post by: Raidau on February 14, 2014, 09:55:32 pm
Is there a way to change zoom level using script? I know there are variables that control window size, somewhere in df.global...
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 15, 2014, 05:26:18 pm
Is there a way to run a function whenever the game is saved?  I need to retain some persistent variables accurately but saving them every frame causes major slowdown.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 15, 2014, 05:29:11 pm
Is there a way to run a function whenever the game is saved?  I need to retain some persistent variables accurately but saving them every frame causes major slowdown.
Have you seen dfhack persistence module?  linky  (https://github.com/warmist/dfhack/blob/master/Lua%20API.rst#id19)
Edit: ah sorry, misread. Afaik there is no event that triggers when a game is saved (or before unload).
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on February 16, 2014, 03:19:18 am
When a caravan is attacked and runs off leaving one of the guards behind, should you use fixmigrant to adopt him, or will that make him a slave?
Title: Re: DFHack 0.34.11 r3
Post by: ag on February 16, 2014, 05:11:23 am
Is there a way to run a function whenever the game is saved?  I need to retain some persistent variables accurately but saving them every frame causes major slowdown.

If you are doing something every frame, it may be better done in C++, and the persistence API there is more low-level and allows you to keep a reference to the actual memory used to store the data, so it can be modified without any overhead. The downside of course is that you can crash some plugins if you delete their persistence entries without telling them, e.g. via the lua api.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 16, 2014, 01:10:42 pm
Is there a way to run a function whenever the game is saved?  I need to retain some persistent variables accurately but saving them every frame causes major slowdown.

If you are doing something every frame, it may be better done in C++, and the persistence API there is more low-level and allows you to keep a reference to the actual memory used to store the data, so it can be modified without any overhead. The downside of course is that you can crash some plugins if you delete their persistence entries without telling them, e.g. via the lua api.

I'd like to be able to mod things in C++, but I honestly don't know where to begin.  What program can I use to edit them?

Also, is there any way of making a workshop that copies the native reactions and behaviors of the smelter/forge, but without needing to use fuel?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 16, 2014, 01:58:50 pm
Is there a way to run a function whenever the game is saved?  I need to retain some persistent variables accurately but saving them every frame causes major slowdown.

If you are doing something every frame, it may be better done in C++, and the persistence API there is more low-level and allows you to keep a reference to the actual memory used to store the data, so it can be modified without any overhead. The downside of course is that you can crash some plugins if you delete their persistence entries without telling them, e.g. via the lua api.

I'd like to be able to mod things in C++, but I honestly don't know where to begin.  What program can I use to edit them?

You can technically use, say, Notepad to write C++, but it'd be better to go with a more robust IDE like Code::Blocks or something.

Here's compilation instruction (https://github.com/DFHack/dfhack/blob/master/Compile.rst)
Title: Re: DFHack 0.34.11 r3
Post by: wooks on February 16, 2014, 06:42:43 pm
Is there a way to reset a moods gathered items? or force it to complete? I seem to have curfuffled one of my important dwarfs moods by accidentally forbidding something he was retrieving and now he won't complete the mood (I even tried using the plainpacked glitch to get an extra of what he needed). Thank You!
Title: Re: DFHack 0.34.11 r3
Post by: Roses on February 17, 2014, 01:24:42 am
I'm trying to get the physical and mental attributes of a unit. This (https://github.com/DFHack/dfhack/blob/0.34.11-r3/Lua%20API.rst#units-module) says that dfhack.units.getPhysicalAttrValue should work, but when I do a printall(dfhack.units) I don't see the physical or the mental one. Any thoughts?

I know I can look at a units attributes with unit.body.physical_attrs, but I was hoping for the aforementioned ones ability to compute effective levels.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 17, 2014, 01:52:23 am
Yeah, those are missing for whatever reason, but here's a simple function that should do the same thing (weighted for syndromes as well):

Code: [Select]
function getAttrValue(unit,attr,mental)
    if unit.curse.attr_change then
        if mental then
            return (unit.status.current_soul.mental_attrs[attr].value+unit.curse.attr_change.ment_att_add[attr])*unit.curse.attr_change.ment_att_perc[attr]/100
        else
            return (unit.body.physical_attrs[attr].value+unit.curse.attr_change.phys_att_add[attr])*unit.curse.attr_change.phys_att_perc[attr]/100
        end
    else
        if mental then
            return unit.status.current_soul[attr].value
        else
            return unit.body.physical_attrs[attr].value
        end
    end
end

So if you want SPATIAL_SENSE:

Code: [Select]
print(getAttrValue(dfhack.gui.getSelectedUnit(),'SPATIAL_SENSE',true))
STRENGTH:

Code: [Select]
print(getAttrValue(dfhack.gui.getSelectedUnit(),'STRENGTH'))
Title: Re: DFHack 0.34.11 r3
Post by: ag on February 17, 2014, 01:55:19 am
Yeah, those are missing for whatever reason, but here's a simple function that should do the same thing (weighted for syndromes as well):

Oops, forgot to actually add those to the export list - will be fixed in the next release whenever that happens.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on February 17, 2014, 06:00:24 am
Perfect, thanks Putnam!
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 17, 2014, 08:16:39 pm
So, another question: is there a function that can return the main material of any item, including corpses and organics, in a way that can be copied onto another item?  Like what you would get if you run a reaction that uses the item's material.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 17, 2014, 08:22:29 pm
To return the main material, just use dfhack.matinfo.decode(item).

To copy using that, use this function as an example:

Code: [Select]
function copyItemMat(item1,item2)
    local matInfo=dfhack.matinfo.decode(item1)
    item2:setMaterial(matInfo.type)
    item2:setMaterialIndex(matinfo.index)
end

When it comes to items, knowing the vmethods that items have available is very useful:

https://github.com/Putnam3145/df-structures/blob/master/df.items.xml
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 18, 2014, 04:35:40 pm
Is there a simple way of causing a body part to fall off through a script?  I've tried using a modified version of Warmist's rip-heart script but that doesn't seem to give the severed part a material, a proper size or properties, etc... I can set the damage to 100% for each layer but is there a way to run the check?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 19, 2014, 12:27:31 am
Is there a simple way of causing a body part to fall off through a script?  I've tried using a modified version of Warmist's rip-heart script but that doesn't seem to give the severed part a material, a proper size or properties, etc... I can set the damage to 100% for each layer but is there a way to run the check?
I think you need to add a wound that marks e.g. connective tissue as destroyed (or other part that connects the two) and then mark a flag to recalculate wounds. Though not sure  if that will work. My rip heart was more of a "create bodypart" experiment and dwarves can live without a heart apparently if not for the bleeding wound.
Title: Re: DFHack 0.34.11 r3
Post by: Raidau on February 19, 2014, 02:48:01 am
What  is the easiest way to find dfhack.matinfo record for a given organic material? dfhack.matinfo.find() function must be able to do that, but i dont understand how it handles several arguments.

I wrote a function that takes a pair of strings returns organic material object, for example funct('DWARF','BONE') will return dwarf bone material. But then i realized that will not speed up the process of finding type/index pair :-\
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on February 19, 2014, 09:23:05 am
What  is the easiest way to find dfhack.matinfo record for a given organic material? dfhack.matinfo.find() function must be able to do that, but i dont understand how it handles several arguments.

I wrote a function that takes a pair of strings returns organic material object, for example funct('DWARF','BONE') will return dwarf bone material. But then i realized that will not speed up the process of finding type/index pair :-\
What exactly did you try with dfhack.matinfo.find()?

I ask because find("DWARF", "BONE"), find("DWARF:BONE"), find("CREATURE", "DWARF", "BONE"), find("CREATURE:DWARF:BONE"), find("CREATURE_MAT", "DWARF", "BONE"), and find("CREATURE_MAT:DWARF:BONE") all properly return material info for dwarf bone.
Title: Re: DFHack 0.34.11 r3
Post by: Raidau on February 19, 2014, 11:03:57 am
What exactly did you try with dfhack.matinfo.find()?

I ask because find("DWARF", "BONE"), find("DWARF:BONE"), find("CREATURE", "DWARF", "BONE"), find("CREATURE:DWARF:BONE"), find("CREATURE_MAT", "DWARF", "BONE"), and find("CREATURE_MAT:DWARF:BONE") all properly return material info for dwarf bone.

I tried several srings as separate arguments, find("DWARF", "BONE") still returns nil,   find("DWARF:BONE") worked just fine! thanks
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 19, 2014, 12:43:45 pm
Is there a simple way of causing a body part to fall off through a script?  I've tried using a modified version of Warmist's rip-heart script but that doesn't seem to give the severed part a material, a proper size or properties, etc... I can set the damage to 100% for each layer but is there a way to run the check?
I think you need to add a wound that marks e.g. connective tissue as destroyed (or other part that connects the two) and then mark a flag to recalculate wounds. Though not sure  if that will work. My rip heart was more of a "create bodypart" experiment and dwarves can live without a heart apparently if not for the bleeding wound.

Until they are hit by an attack, creatures can even live without a head or upper body.  They can also keep body parts that are attached to the missing part, like keeping a hand when their lower arm is missing... obviously this needs fixing.
Where is the flag to recalculate wounds?  (I've tried slamming them into the ground, but that doesn't work... possibly because it's blunt damage and therefore the game ignores it as long as the creature's parts are soft.  Even if that part is supposedly cut in half already.)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 19, 2014, 01:23:30 pm
try unit.flags2.calculated_bodyparts=false
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 19, 2014, 05:44:56 pm
This is always causing me trouble.
What exactly is the nature of the functions on these pages?  https://github.com/DFHack/dfhack/blob/master/library/modules/Items.cpp (https://github.com/DFHack/dfhack/blob/master/library/modules/Items.cpp)
Some of them seem to work, others just don't.  For instance, I'm trying to find the string value for an item type (among other info) given it's type and subtype index.  Isn't that what ItemTypeInfo is supposed to do?
But dfhack.itemtypeinfo throws an error...
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 19, 2014, 06:13:31 pm
That's because it's not exported to lua. The ones in the Lua API are the only ones that are, AFAIK. Those are C++ functions specifically.

Getting type+subtype string is pretty easy with this function:

Code: [Select]
function getRawStringItem(item)
    local type=item:getType()
    local attrs=df.item_type.attrs[type]
    if not attrs.is_rawable then return df.item_type[type]..":NO_SUBTYPE" end
    local subtype=item:getSubtype()
    return df.item_type[type]..":"..df['itemdef_'..df.item_type.attrs[type].caption..'st'].find(subtype).id
end

Okay that last line is way more complex than I expected it to be.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 19, 2014, 07:25:32 pm
Ah, that would explain it.

Thanks for the help!
Title: Re: DFHack 0.34.11 r3
Post by: Roses on February 20, 2014, 02:46:35 am
Questions about changing values;

I know if I use DFHack to change a value in the raws it will be overwritten on the next load of the game, but what about changing values in fields like df.global.world.entities.all[0].resources.ethic? Does anyone know if changing these values has an effect on the game, and if that effect is persistent through saving and loading?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on February 20, 2014, 12:21:05 pm
Questions about changing values;

I know if I use DFHack to change a value in the raws it will be overwritten on the next load of the game, but what about changing values in fields like df.global.world.entities.all[0].resources.ethic? Does anyone know if changing these values has an effect on the game, and if that effect is persistent through saving and loading?
The only reason raws do not persist is because they are not saved in world.[dat|sav] but are instead loaded from external files - if you modify an entity's properties in memory and save/load, the changes will absolutely persist through a save/load cycle (unless the properties you are modifying aren't saved to disk).

Now, whether or not changing those values will affect gameplay is a completely different story - in your example, most ethics are used only during worldgen and have no effect during Fortress mode.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 20, 2014, 07:29:25 pm
Hmmm...
How do I remove a single item from a building or container, and place it on a specific tile as if it was dropped there?  dfhack.items.moveToGround returns false, deleting the general ref doesn't do anything, deleting the entry in buildings.contained_items destroys the item itself and calling the vmethod deconstructItems (which isn't what I want anyway, because it removes all items) followed by moveToGround crashes the game.  I find it hard to believe that this is such a complex task.

EDIT: I figured out a method that works, although it is completely ridiculous.  I set the item's position to the desired location, then turn the item into a projectile with no speed, and finally remove the entry in buildings.contained items.  It...works.  I can't honestly believe that this is the best way of doing it though.
Title: Re: DFHack 0.34.11 r3
Post by: lordkrike on February 21, 2014, 01:31:22 pm
I am having irritating issues with building DFHack, and I can't figure out what I'm doing wrong.  I was hoping I could get some assistance.

When I attempt to build the latest version with cmake or ccmake, I get the following error message:

Code: [Select]
CMake Error at depends/protobuf/CMakeLists.txt:60 (MESSAGE):
   Could not find a working hash map implementation.  Please install GCC >=
   4.4, and all necessary 32-bit C++ development libraries.

Which, if the other posts here are correct, suggest that I don't have the correct 32-bit libraries installed.

I'm running 64-bit Debian Testing.  I have multiarch support enabled.  I have practically every GCC and G++ library I can get from the repository without conflicts to include:

Spoiler (click to show/hide)

I also have protobuf-compiler and protobuf-c-compiler, and mingw.  mingw has both 32-bit and 64-bit libraries available, and I'm not sure about protobuf, but there is a separate :i386 library, I just can't have both installed simultaneously.

So I'm at a loss.  I have no idea what package I could be missing to fix this.  Does anyone have any ideas?

Below is my CMakeError.log:

Spoiler (click to show/hide)

There's something about lpthreads in there, but I don't know jack about cmake and so I'm not sure what's going on.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on February 22, 2014, 12:36:19 pm
Hmmm...
How do I remove a single item from a building or container, and place it on a specific tile as if it was dropped there?  dfhack.items.moveToGround returns false, deleting the general ref doesn't do anything, deleting the entry in buildings.contained_items destroys the item itself and calling the vmethod deconstructItems (which isn't what I want anyway, because it removes all items) followed by moveToGround crashes the game.  I find it hard to believe that this is such a complex task.

EDIT: I figured out a method that works, although it is completely ridiculous.  I set the item's position to the desired location, then turn the item into a projectile with no speed, and finally remove the entry in buildings.contained items.  It...works.  I can't honestly believe that this is the best way of doing it though.

I think just setting the position of the item and setting items.flags.on_ground=true (also removing the entry in the building) should work (at least I remember doing something similar for moving things created in a workshop up several z levels, I will see if I can find my old code).
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on February 22, 2014, 03:06:27 pm
How do I take a look at a dwarf's infection level? I've been looking at the structures here (https://github.com/angavrilov/df-structures/blob/master/df.units.xml) and it would seem that unit.body.infection_level would be the right thing to use. However, if I try that, I get an error:

Cannot read field unit T_body.infection_level: not found

unit.body.blood_count works fine, and blood_count is immediately above infection_level.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on February 22, 2014, 05:07:26 pm
I got a message on Reddit from Ciphertext008 - it's about dfhack r3,but I thought I'd pass it on.

Quote
http://i.imgur.com/5zXj7Rn.png I have been updating my LNP from r44 to r48 this change might need to go upstream. Line 156 dwarfortress34.11/hack/lua/gui/script.lua is missing a ')'
Title: Re: DFHack 0.34.11 r3
Post by: ulspa on February 23, 2014, 11:30:32 am
I am having irritating issues with building DFHack, and I can't figure out what I'm doing wrong.  I was hoping I could get some assistance.

When I attempt to build the latest version with cmake or ccmake, I get the following error message:

Code: [Select]
CMake Error at depends/protobuf/CMakeLists.txt:60 (MESSAGE):
   Could not find a working hash map implementation.  Please install GCC >=
   4.4, and all necessary 32-bit C++ development libraries.

Which, if the other posts here are correct, suggest that I don't have the correct 32-bit libraries installed.

I'm running 64-bit Debian Testing.  I have multiarch support enabled.  I have practically every GCC and G++ library I can get from the repository without conflicts to include:

Spoiler (click to show/hide)

I also have protobuf-compiler and protobuf-c-compiler, and mingw.  mingw has both 32-bit and 64-bit libraries available, and I'm not sure about protobuf, but there is a separate :i386 library, I just can't have both installed simultaneously.

So I'm at a loss.  I have no idea what package I could be missing to fix this.  Does anyone have any ideas?

Below is my CMakeError.log:

Spoiler (click to show/hide)

There's something about lpthreads in there, but I don't know jack about cmake and so I'm not sure what's going on.


Your problem is, that your compiler can't find the file libpthreads. There is no problem with cmake.
You can check whether you have a file called libpthreads.so in /usr/lib/ or in /lib or anywhere else.
But most probably you don't have this file installed.
libpthreads is part of glibc. You can search for glibc or libpthreads in your package manager. Most probably you will find it there, otherwise you can ask somewhere in a debian related forum how to obtain this library. Hope this helps you to solve your problem.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 23, 2014, 07:39:10 pm
I got a message on Reddit from Ciphertext008 - it's about dfhack r3,but I thought I'd pass it on.

Quote
http://i.imgur.com/5zXj7Rn.png I have been updating my LNP from r44 to r48 this change might need to go upstream. Line 156 dwarfortress34.11/hack/lua/gui/script.lua is missing a ')'

Yeah, that was fixed in r4 (https://github.com/DFHack/dfhack/commit/4a32aff6a336944906fb4627f8f06384eb9f46d3#diff-361cb428f3be5581ffaf590c91572af6)
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 24, 2014, 03:39:42 am
How do I read the subtype of a given item if I don't know whether or not it has a subtype?  I've tried passing it to a variable and checking if the variable is nil but it seems that just trying to check for a subtype on an item with no subtype crashes the script.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on February 24, 2014, 04:12:49 am
okay so finally figure out how to bypass the whole every one goes insane and attacks each other when switching to arena mode.
it's mostly due to every one in fort/adventure mode have their Combat_side_id set to 0 which is independent and a giant hostile mess for every one.
with this new script remodel from an old 'companion every civ' script you can swap to and from arena mode with not worrying about dwarves murdering each other though.
script here (https://gist.github.com/Rumrusher/9184245)
 
Title: Re: DFHack 0.34.11 r3
Post by: lordkrike on February 24, 2014, 07:38:30 am
Your problem is, that your compiler can't find the file libpthreads. There is no problem with cmake.
You can check whether you have a file called libpthreads.so in /usr/lib/ or in /lib or anywhere else.
But most probably you don't have this file installed.
libpthreads is part of glibc. You can search for glibc or libpthreads in your package manager. Most probably you will find it there, otherwise you can ask somewhere in a debian related forum how to obtain this library. Hope this helps you to solve your problem.

Alright, so one problem down.  I had to install libc6:i386 to get a 32-bit libpthreads.so.0.  It seems to be okay with finding pthreads now.

However, I still have the message that it can't find a working hash map.  The full output from cmake follows:

Spoiler (click to show/hide)

And actually, looking at the complete output from cmake (which ccmake doesn't print, oddly enough), it might be suggesting that it can't find a 32-bit version of zlib.  Except I have a 32-bit version of zlib installed (/lib/i386-linux-gnu/libz.so.1 from the zlib1g:i386 package).

Thoughts?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 24, 2014, 09:57:54 am
How do I read the subtype of a given item if I don't know whether or not it has a subtype?  I've tried passing it to a variable and checking if the variable is nil but it seems that just trying to check for a subtype on an item with no subtype crashes the script.

item:getSubtype()

If that returns -1, it has no subtype.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 24, 2014, 12:50:07 pm
How do I read the subtype of a given item if I don't know whether or not it has a subtype?  I've tried passing it to a variable and checking if the variable is nil but it seems that just trying to check for a subtype on an item with no subtype crashes the script.

item:getSubtype()

If that returns -1, it has no subtype.

Oh, that simple?  I'm pretty sure I tried that... or maybe I used some variation of it, like dfhack.item:getSubtype() or something.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 24, 2014, 01:43:07 pm
It's a method of the item itself, so I can see why you would have problem with that :p
Title: Re: DFHack 0.34.11 r3
Post by: Roses on February 24, 2014, 02:13:06 pm
Trying to implement continue type functionality in the Lua scripts, after searching a bit online I found that the newer Lua bases (5.2+) have a built in goto command. I was wondering what base the DFHack Lus is built on, and if I can use this goto function.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 24, 2014, 02:17:38 pm
What exactly do you need goto for? I'm sure break (http://www.lua.org/pil/4.4.html) would work just as well...
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on February 24, 2014, 02:19:40 pm
Trying to implement continue type functionality in the Lua scripts, after searching a bit online I found that the newer Lua bases (5.2+) have a built in goto command. I was wondering what base the DFHack Lus is built on, and if I can use this goto function.
5.2. Not sure how you will do that...
There is a lua patch that adds continue, but than you would need to be sure that you will not break ANY script that anyone ever wrote for dfhack.
Also there are a few ways to work around the continue: inverting the if statement, or moving everything to a function and then using return instead of continue:
Code: [Select]
for _,unit in pairs(df.global.world.units.all) do
  if unit.flags1.dead then continue end
  --code
end
--same:
for _,unit in pairs(df.global.world.units.all) do
  if not unit.flags1.dead then
  --code
  end
end
--better:
function do_sth_with_unit(unit)
if unit.flags1.dead then
  return
end
--code
end
for _,unit in pairs(df.global.world.units.all) do
  do_sth_with_unit(unit)
end

Title: Re: DFHack 0.34.11 r3
Post by: Roses on February 24, 2014, 02:23:26 pm
What exactly do you need goto for? I'm sure break (http://www.lua.org/pil/4.4.html) would work just as well...

Well I have a loop that has several checks inside of it, once one of the checks is false I want to stop the checking and go on to the next value in the loop. The break statement would stop all further iterations of the loops and so wouldn't be useful for this.

If it is built on 5.2 then I can simply say goto forend and at the end of the for loop place ::forend::. This will allow me to skip all of the checks in between and continue on with the loop.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on February 24, 2014, 02:26:38 pm
In that case, I think putting the checks into their own functions would be better.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on February 24, 2014, 02:31:24 pm
In that case, I think putting the checks into their own functions would be better.

That was the other possibility, when I originally just had a couple checks it was fine the way it was, but now that I have so many and am adding more I began looking for a way to optimize it and limit the computations. I suppose I should be a good programmer and use separate functions, there may be some errors generated through use of goto statements that I am not aware of.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 25, 2014, 10:46:24 am
How do I change the tile of a building (for animation purposes)?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on February 25, 2014, 11:30:28 am
How do I change the tile of a building (for animation purposes)?
I dont know, but I know that warmist and ag know it. :)
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on February 25, 2014, 11:30:28 am
How do I change the tile of a building (for animation purposes)?
If it's a custom building, you can modify its raws in memory and they should take effect immediately, but it will affect all instances of the building.
If you only want to update a single instance of a building (or if it's a hardcoded one), you'll need to interpose building_[whatever]st::drawBuilding(building_drawbuffer*,int16_t), call the original code, then conditionally modify the contents of the draw buffer.
Title: Re: DFHack 0.34.11 r3
Post by: ulspa on February 25, 2014, 12:24:18 pm
Alright, so one problem down.  I had to install libc6:i386 to get a 32-bit libpthreads.so.0.  It seems to be okay with finding pthreads now.
nice

However, I still have the message that it can't find a working hash map.  The full output from cmake follows:

Spoiler (click to show/hide)

And actually, looking at the complete output from cmake (which ccmake doesn't print, oddly enough), it might be suggesting that it can't find a 32-bit version of zlib.  Except I have a 32-bit version of zlib installed (/lib/i386-linux-gnu/libz.so.1 from the zlib1g:i386 package).

Thoughts?
Actually, your current problem seems to related to another missing library or header. There is a file
Code: [Select]
  dfhack/depends/protobuf/testHashMap.cpp
I guess cmake aborts due to compilation error of this file. Compilation of this file doesn't need any libraries but some standard gnu library therefore you should install all necessary C++ libraries. You can try to compile the file with your 64-bit compiler. This shouldn't cause any problems. Then use
Code: [Select]
$ldd a.out 
to find the missing library. or you may search for libstdc++, glibc, gcc, g++, gcc-libs.
For zlib. You can specify the path with ccmake
Code: [Select]
$ cd dfhack/build
$ ccmake ..
[t] to toggle advanced mode
 ZLIB_INCLUDE_DIR                 /usr/include
 ZLIB_LIBRARY                     /usr//i386-linux-gnu/libz.so
obviously  you have to replace both paths with those that matches for your system.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on February 28, 2014, 05:55:38 am
Is there a way of getting the total value of an item?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on February 28, 2014, 09:23:06 pm
Is there a way of getting the total value of an item?
No - if you want to get the value, you'll need to calculate it manually by taking into consideration the item type, material, and quality. Fortunately, there's a vmethod available for getting the value of all item improvements in the eyes of a particular civilization, so you can add that afterwards.
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on February 28, 2014, 11:47:21 pm
Anyone know how to create a gui.FramedScreen that is not centered in the parent window?

It looks like update_layout might do it, but I haven't been able to construct an argument that won't make it bomb off.

Thanks.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 01, 2014, 04:17:30 am
Anyone know how to create a gui.FramedScreen that is not centered in the parent window?

It looks like update_layout might do it, but I haven't been able to construct an argument that won't make it bomb off.

Thanks.
try e.g:
Code: [Select]
my_screen_class= defclass(my_screen_class, gui.Screen)
my_screen_class.ATTRS={
    frame={t=0,l=0,w=10,h=10}
}
Title: Re: DFHack 0.34.11 r3
Post by: Aaarrgh! on March 01, 2014, 03:39:07 pm
Which changes made with DFHack are persistent? It's a bit tiresome, enabling tweaks and setting up Workflow every time I start up DF.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 01, 2014, 04:12:02 pm
Workflow.

There's also a file called dfhack.init-example. You might want to rename that to dfhack.init.
Title: Re: DFHack 0.34.11 r3
Post by: Aaarrgh! on March 01, 2014, 06:23:53 pm
Workflow.

There's also a file called dfhack.init-example. You might want to rename that to dfhack.init.

Thanks, that really helped! Also, is there a dictionary or flowchart of some sort to help with the constraint spec?
Title: Re: DFHack 0.34.11 r3
Post by: Chaos17 on March 03, 2014, 05:11:43 am
Hi,

How do I use get plants to get all the plants like in the plugins autchop, please?
I tried to trad the documentation and using some commands but I'm just a newbie...
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on March 03, 2014, 05:45:41 am
Hi,

How do I use get plants to get all the plants like in the plugins autchop, please?
I tried to trad the documentation and using some commands but I'm just a newbie...
I haven't tried the autochop, but you can use getplants thus:

getplants -t WILLOW

will mark all the willow trees on the map for choping.

You can also use d->t to make some trees to chop, and then do:

getplants -c CEDAR

to *unmark* any cedar trees that were marked for choping.
Title: Re: DFHack 0.34.11 r3
Post by: Chaos17 on March 03, 2014, 03:13:09 pm
thanks  :)
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 04, 2014, 03:04:13 pm
getplants -t WILLOW

will mark all the willow trees on the map for choping.
Technically, you don't need "-t" if you're specifying by name - the "-t" (trees only) and "-s" (shrubs only) options are meant to be used with "-a" (select all) and "-x" (exclude) options (e.g. so you can say "all trees except CEDAR" as compared to "all trees and shrubs except for CEDAR and MUSHROOM_HELMET_PLUMP).
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on March 04, 2014, 09:45:13 pm
Reasking this (http://www.bay12forums.com/smf/index.php?topic=91166.msg5032491#msg5032491) infection-viewing question, since it wasn't answered and ended up tucked away at the bottom of a page.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on March 05, 2014, 02:24:37 am
Reasking this (http://www.bay12forums.com/smf/index.php?topic=91166.msg5032491#msg5032491) infection-viewing question, since it wasn't answered and ended up tucked away at the bottom of a page.

Are you using the correct unit.body.infection_level (not the one with T_body)?
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on March 05, 2014, 06:55:35 pm
Here's the working script for blood count:

Spoiler (click to show/hide)

Uses unit.body.blood_count. Substituting that for unit.body.infection_level gives me the T_body error.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 05, 2014, 07:14:52 pm
You probably want df.unit.find rather than df.global.world.units.all.

Also, are you on r3? The structure xml is for r4.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on March 05, 2014, 07:55:28 pm
Here's the working script for blood count:

Spoiler (click to show/hide)

Works fine for me on r4

Uses unit.body.blood_count. Substituting that for unit.body.infection_level gives me the T_body error.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on March 05, 2014, 09:22:01 pm
Ah. What's the status of r4 now?
Title: Re: DFHack 0.34.11 r3
Post by: ag on March 06, 2014, 01:06:40 am
r4 has been unofficially released quite a while back now, and there won't be an official release of it because things have changed since then. Instead, there may be an r5 eventually.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on March 06, 2014, 06:21:00 pm
Anyone know how to read data on an attack?  All I see is a bunch of 'userdata'.
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on March 07, 2014, 02:01:29 am
Is it possible to make a script re-execute periodically, or would you have to make a plugin for that?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 07, 2014, 02:19:41 am
The way it's usually done is recursive timeouts in a lua script:

Code: [Select]
function repeatScriptEvery100Ticks()
    dfhack.run_script('script','arg1','arg2',...)
    dfhack.timeout(100,'ticks',repeatScriptEvery100Ticks)
end

Though this should be possible:

Code: [Select]
local script=require('gui.script')

script.start(function()
while true do
    dfhack.run_script('script','arg1','arg2',...)
    script.sleep(100,'ticks')
end

Hmm. I think it'd be better to replace "true" with some global variable that can be toggled, though.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 07, 2014, 09:05:33 am
Anyone know how to read data on an attack?  All I see is a bunch of 'userdata'.
If something is labeled as "userdata", it means the structure layout hasn't been determined - someone will have to analyze the game code and/or memory layout in order to figure out its overall size as well as the size and location (and ideally meaning) of each field within it and add that data to the df-structures XML files, and then you'll be able to view it in the next DFHack release (or rebuild DFHack yourself).

What exactly do you mean by "an attack"? Where is the structure actually stored? Because if you're talking about creature attacks (i.e. from the raws), then it's already been done and will be available in r5.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on March 07, 2014, 09:43:32 am
What exactly do you mean by "an attack"? Where is the structure actually stored? Because if you're talking about creature attacks (i.e. from the raws), then it's already been done and will be available in r5.

Yes, this is what I was talking about.  Okay then.
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on March 07, 2014, 05:52:49 pm
Edit:

D'oh!  I was posting about successfully building Dwarf Therapist.  Wrong thread.

But since I'm here... The current DT has to be run as root on Linux, or else as a child process of DF.  Has anyone tried to find a way to launch it from within the dfhack terminal?

Has there been any discussion of converting it to a dhfack plugin, a la stonesense?
Title: Re: DFHack 0.34.11 r3
Post by: Doktoro Reichard on March 07, 2014, 10:35:08 pm
Has there been any discussion of converting it to a dhfack plugin, a la stonesense?

I'm on Windows, if it matters, but the r3 version has a sort of Dwarf Therapist, aptly named Dwarf Manipulator (https://github.com/DFHack/dfhack/blob/master/Readme.rst#dwarf-manipulator). It does what DT does in a DF kinda way... It is accessed through the 'u'nits menu by pressing 'l'.
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on March 08, 2014, 05:05:40 pm
r4 has been unofficially released quite a while back now, and there won't be an official release of it because things have changed since then. Instead, there may be an r5 eventually.
Got r4 now. Found a data point for something I noted during a previous medical test -- the dwarf was getting infections here and there, but I was never really convinced that the shoulder was getting infected, or remaining infected. I currently have a dwarf wandering around with a health screen claiming an infected left shoulder, but an infection level of 0.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on March 09, 2014, 03:52:08 am
How do you read/change the size of an article of clothing?  Related: how do you calculate the size of clothing a given creature can wear?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 09, 2014, 04:12:18 am
How do you read/change the size of an article of clothing?  Related: how do you calculate the size of clothing a given creature can wear?
Items have not size, but maker race and it compares to your race.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on March 09, 2014, 04:19:08 am
How do you read/change the size of an article of clothing?  Related: how do you calculate the size of clothing a given creature can wear?
Items have not size, but maker race and it compares to your race.

Ah, so if I wanted to make, for example, elephant sized armor, I would set the maker race to elephant's race id?
How much leeway is there for comparing sizes?  They don't have to be the exact same size, do they?
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on March 09, 2014, 12:15:18 pm
How do you read/change the size of an article of clothing?  Related: how do you calculate the size of clothing a given creature can wear?
Items have not size, but maker race and it compares to your race.

Ah, so if I wanted to make, for example, elephant sized armor, I would set the maker race to elephant's race id?
How much leeway is there for comparing sizes?  They don't have to be the exact same size, do they?
pretty much the size bit is tied to the race size, so if you have anyone as large as an elephant would be able to normally wear elephant clothes even if the elephant made them for their own.
that doesn't stop someone from force equipping the clothes on any one they want.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on March 09, 2014, 05:56:01 pm
I'm looking at messing with the temperatures of map tiles and saw that there is a temperature_1 and temperature_2 designation for each map tile. Does anyone know what the difference is? (Is it a max/min, or maybe a current/max, or something else?)
Title: Re: DFHack 0.34.11 r3
Post by: Andux on March 09, 2014, 11:33:55 pm
IIRC, temperature_1 is the current temperature, and temperature_2 is the tile's normal temperature (which it will generally return to over the course of several frames).
Title: Re: DFHack 0.34.11 r3
Post by: Sutremaine on March 09, 2014, 11:35:10 pm
Is there a way of determining how friendly you are with another civ?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on March 10, 2014, 01:01:10 am
How do you read/change the size of an article of clothing?...

The getVolume() item vmethod helps to read the volume of an item.
Title: Re: DFHack 0.34.11 r3
Post by: breadman on March 11, 2014, 11:42:42 am
But since I'm here... The current DT has to be run as root on Linux, or else as a child process of DF.  Has anyone tried to find a way to launch it from within the dfhack terminal?

I had managed to convince a slightly older version of Linux to exec DF after launching DT (http://eswald.wordpress.com/2013/03/26/therapist-hacking/), but an upgrade broke that script.  Thereafter, I started re-opening the ptrace loophole (echo 0 | sudo tee /proc/sys/kernel/yama/ptrace_scope) until I started using autolabor to the point that I simply stopped using DT.

A potentially better solution is to grant DT permission to ptrace at will: sudo apt-get install libcap2-bin && sudo setcap cap_sys_ptrace=eip ./bin/release/DwarfTherapist
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on March 11, 2014, 11:03:18 pm
Thanks for the tip.
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on March 12, 2014, 05:31:47 am
Possible bugs in  calcInventoryWeight -

From Units.cpp:
Code: [Select]
static int calcInventoryWeight(df::unit *unit)
{
    int armor_skill = Units::getEffectiveSkill(unit, job_skill::ARMOR);
    int armor_mul = 15 - std::min(15, armor_skill);

    int inv_weight = 0, inv_weight_fraction = 0;

    for (size_t i = 0; i < unit->inventory.size(); i++)
    {
        auto item = unit->inventory[i]->item;
        if (!item->flags.bits.weight_computed)
            continue;

        int wval = item->weight;
        int wfval = item->weight_fraction;
        auto mode = unit->inventory[i]->mode;

        if ((mode == df::unit_inventory_item::Worn ||
             mode == df::unit_inventory_item::WrappedAround) &&
             item->isArmor() && armor_skill > 1)
        {
            wval = wval * armor_mul / 16;
            wfval = wfval * armor_mul / 16;
        }

        inv_weight += wval;
        inv_weight_fraction += wfval;
    }

    return inv_weight*100 + inv_weight_fraction/10000;
}
I see two possible problems:

1) When I use a script to spit out inventory item weights everything is zero, because the .weight_computed flags are all false.  I have to invoke .calculateWeight for each item in order to get a non-zero weight.  Unless something is forcing all the weights to be calculated before this function is called, it looks like the function will just skip everything.

2) Even when the weights are precalculated, the weight for a container does not include its contents.  So for example a quiver shows up as 1.5 dorf-pounds, but if you look at the unit's inventory in the game its weight is 30dp due to being full of steel bolts.  Similarly for packs and flasks.  I think the code needs to iterate through the contents of any containers that the unit is wearing (and probably also hauled containers).
Title: Re: DFHack 0.34.11 r3
Post by: Bo-Rufus CMVII on March 13, 2014, 05:40:50 pm
Possible bugs in  calcInventoryWeight -
False alarm.  I was seeing the observed effects because I was loading a map and running the script without unpausing the game.  If I let it run for even a second, both "problems" go away.
Title: Re: DFHack 0.34.11 r3
Post by: FallenAngel on March 14, 2014, 01:25:31 pm
I really like this, but I do want to bring up something that was probably covered somewhere in the 300+ pages...
The mac version lacks multiple scripts, like invasion-now.
I want a goblin invasion when I want it.
Title: Re: DFHack 0.34.11 r3
Post by: fricy on March 14, 2014, 01:53:23 pm
I really like this, but I do want to bring up something that was probably covered somewhere in the 300+ pages...
The mac version lacks multiple scripts, like invasion-now.
I want a goblin invasion when I want it.

Uhm, no.
The reason you don't find the invasion-now script in the dfhack-mac-r3 download, is because that script is newer than the r3 package. You won't find it in the windows version either, only in r4 (I think). I try to collect them in Macnewbie, but there's some much one can do, and not all of them are useful in vanilla, as some needs modding to take advantage.

And scripts are multi-platform, they will usually work on windows/mac/linux without any modifications, just drop them into hack/scripts, restart df and call them. Plugins are another story, but we are not talking about those now.

And scripts are a bit of a mass anyway, there's no central script repository, not every modder uses github, and pushes the commits, so you may have a hard time hunting down the ones you need...that obviously needs some improvement, although in the last few months some new forums have been created to help with organization, so the situation is much better than it was before.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 14, 2014, 02:20:36 pm
There is no mac version of r4 because I don't have one and can't compile for mac OS. For now you can grab the scripts you want from the github link. They *should* work for r3.
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on March 14, 2014, 07:59:49 pm
I'm uploading a (hopefully) working OS X r4 build at the moment. Stonesense is missing (due to how often it crashes), but I think everything else is there.

Edit: Here (http://dffd.wimbli.com/file.php?id=8474)
Title: Re: DFHack 0.34.11 r3
Post by: yaymeh on March 15, 2014, 03:23:34 am
My df crashes if I click on the df window while searching for a unit in the unit list.

No idea how to start investigating this problem... any hints?
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on March 15, 2014, 07:08:38 am
What platform? I remember experiencing that before - I think it's a mousequery search plugin issue, but I can't remember if/how I fixed it.
Title: Re: DFHack 0.34.11 r3
Post by: yaymeh on March 15, 2014, 02:37:52 pm
Linux x86/64.

Couldn't find anything weird with the event sent...
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on March 15, 2014, 03:27:20 pm
It occurs even with mousequery disabled, so I think it's a bug in the search plugin (disabling the plugin gets rid of the bug, obviously, since there's no search option).
It occurs for me on OS X, both with r3 and r4. Evidently this isn't isolated to a single platform (although I'm unsure if it occurs on Windows or not). From the code (https://github.com/DFHack/dfhack/blob/master/plugins/search.cpp), I don't see any reason why mouse events should trigger anything, which leads me to believe it's a problem with DFHack's input handling. I haven't noticed it anywhere else, which is strange, but I'll see if there are other places where it occurs.
Edit: Some findings:
* It happens with 2D, PARTIAL, and STANDARD print modes (not sure about others)
* It occurs in multiple places besides the unit list, including announcements and the stocks screen (but _not_ in Falconne's (?) [e]nhanced view)
* It does not occur with "modal" input boxes (e.g. Lua's gui.FramedScreen, tested with Putnam's hackWish script)
* It also doesn't occur with native DF input (e.g. filtering creatures in the arena, saving a macro)
Another edit: It looks like the search plugin uses a custom input field for searching, but I'm not sure if it's causing the problem or if it's caused by the input method it uses.
Title: Re: DFHack 0.34.11 r3
Post by: PLANKS on March 16, 2014, 03:57:54 am
Noob question here. I've just installed DFhack R4 and I can't get my overlays to show. Like these: http://imgur.com/Fvh9Vo5 (http://imgur.com/Fvh9Vo5).

I don't know if I'm doing it wrong or if I've forgotten the command.

I was previously running R1 I think and all I want is infiniteSky plugin.

Hope this was the right place to ask. Thanks.
Title: Re: DFHack 0.34.11 r3
Post by: Doktoro Reichard on March 16, 2014, 10:40:30 am
infiniteSky, although not documented on the readme files, is also available on R3, which might be easier than building and installing the R4 version.
Title: Re: DFHack 0.34.11 r3
Post by: molkemon on March 16, 2014, 11:24:16 am
Is there a possibility to get a "cleanowned" script which clears owner information, but does not dump the item? I like to have big cloth stockpiles next to my trade depot and buyout caravans with tattered cloth. However, since the items get dumped first, it makes the process a bit annoying to micromanage as the dwarves will first put it into the dump (which can take quite a while), then I have to reclaim and then they put it in the stockpile.

Having only ownership removed should result in the dwarves filling up the appropriate stockpiles with the worn cloth instead. Please? :)
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 16, 2014, 02:15:53 pm
infiniteSky, although not documented on the readme files, is also available on R3, which might be easier than building and installing the R4 version.

https://github.com/DFHack/dfhack/blob/master/NEWS#L125

Also try "help infiniteSky". New in r3. I did a release for an earlier version of the plugin, but it's bundled with DFHack now. Either r3 or r4 should be fine. I haven't made any changes since then.
Title: Re: DFHack 0.34.11 r3
Post by: Doktoro Reichard on March 16, 2014, 02:39:09 pm
Assuming you don't have anything to dump, you can reach a certain compromise with the existing tools. You would also need to get the Stocks plugin by Falconne, as it eases the work on undumping items.

As you stated, cleanowned scattered or any variation of it but all marks those items to dump. With the Stocks plugin, you access the stocks, press e and they you can type "dump". This will filter all items marked for dumping. Then you press Shift-A and then Shift-D. This will select all items on the filtered list and unmark them.
Title: Re: DFHack 0.34.11 r3
Post by: PLANKS on March 16, 2014, 04:51:41 pm
Thanks Doktoro Reichard and expwnent.

R3 and R4 didn't have DFusion which for some reason I thought was doing the overlays. But its all good now.
Title: Re: DFHack 0.34.11 r3
Post by: Fluoman on March 17, 2014, 02:27:09 am
Yeah, so I've got some questions, centered around DFHack scripts:
First, my game crashes around a season after setting a stockpile to auto-melt (q-Shift M) with the DFHack script. Is it just me, or is there a bug (and a fix?) ?
Second, I use autobutcher a lot, but sometimes... It just doesn't set the cats to butcher. No, they are not pets. Yes, I started the script. Am I the only one?
Third, the workflow plugin sometimes doesn't unsuspend protected jobs. Am I the only one?
Last, The "Alt" key is seen as permanently pressed by the scripts from DFHack. Am I the only one?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on March 17, 2014, 02:48:11 am
The "Alt" key is seen as permanently pressed by the scripts from DFHack. Am I the only one?

Nope, this is a known issue - when you alt-tab away from DF and come back, it thinks that alt is still held.  I've heard that this is a bug in the (old) version of SDL that Toady uses; he's not likely to update the graphics code for some time.  Tapping alt should (temporarily) fix this. 

A question for anyone else:  Can dfhack detect when DF comes back into focus?  If so, could a script be written that automates this solution? 
Title: Re: DFHack 0.34.11 r3
Post by: falconne on March 17, 2014, 03:56:50 pm
First, my game crashes around a season after setting a stockpile to auto-melt (q-Shift M) with the DFHack script. Is it just me, or is there a bug (and a fix?) ?

Can you upload a save for me where this happens (and tell me which stockpile has the issue).


It occurs even with mousequery disabled, so I think it's a bug in the search plugin (disabling the plugin gets rid of the bug, obviously, since there's no search option).

I can't reproduce this so it's going to be hard to debug. So this happens any time you're in search mode and you click on the list?
Title: Re: DFHack 0.34.11 r3
Post by: breadman on March 17, 2014, 04:26:15 pm
And scripts are a bit of a mass anyway, there's no central script repository, not every modder uses github, and pushes the commits, so you may have a hard time hunting down the ones you need...that obviously needs some improvement, although in the last few months some new forums have been created to help with organization, so the situation is much better than it was before.

Speaking of GitHub, should I open a pull request for my stockflow plugin, or would you all prefer not to take over maintenance?  Granted, I'd be happier with it if I could convince the bookkeeper to update records more often...
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on March 17, 2014, 06:27:06 pm
I can't reproduce this so it's going to be hard to debug. So this happens any time you're in search mode and you click on the list?
Yeah. I managed to reproduce it on Linux (32-bit Ubuntu) just now. I'm not sure how platform-dependent this is, but it's occurring for me on both OS X and Linux. It's possible that it doesn't occur on Windows for some reason, but I haven't checked.
Title: Re: DFHack 0.34.11 r3
Post by: Fluoman on March 18, 2014, 02:39:26 am
First, my game crashes around a season after setting a stockpile to auto-melt (q-Shift M) with the DFHack script. Is it just me, or is there a bug (and a fix?) ?
Can you upload a save for me where this happens (and tell me which stockpile has the issue).
Sure. Just wait for a week or something, I'm a little busy at the moment.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on March 18, 2014, 08:52:34 pm
I am interested in doing some research in the vmethods mentioned in this post (http://www.bay12forums.com/smf/index.php?topic=135597.msg5063992#msg5063992), but am unsure how to go about it. Is there someone with more experience regarding these that could point me in the right direction to help me get started?
Title: Re: DFHack 0.34.11 r3
Post by: PLANKS on March 18, 2014, 10:50:19 pm
I posted this in another thread and didn't get any responses so I thought I'd put it here see if anyone knows whats going on.

Basically I'm building a pump stack thats really high. Higher than the ammount of Z levels that are available. So I'm using infiniteSky plugin to add levels in. Now here is where it gets kind of weird.
(http://i.imgur.com/StUJh5i.jpg)
That open space next to the stairs is where I get a collapse everytime. It always collapses on the same level (165) and it happens on both stacks in the same place everytime. I can't really see a reason for it but because I've been hacking Z levels I figured dorf physics are acting up.

I found http://dwarffortresswiki.org/index.php/DF2012:Sky_support (http://dwarffortresswiki.org/index.php/DF2012:Sky_support) on the wiki and I think it might be related but I can't be sure.

Any ideas?
Title: Re: DFHack 0.34.11 r3
Post by: Fluoman on March 19, 2014, 07:48:32 am
First, my game crashes around a season after setting a stockpile to auto-melt (q-Shift M) with the DFHack script. Is it just me, or is there a bug (and a fix?) ?

Can you upload a save for me where this happens (and tell me which stockpile has the issue).
Here it is! (http://dffd.wimbli.com/file.php?id=8484)
The offending stockpile is between the magma forges and the smelters. Phoebus graphics.
Hotkey 8 should bring you to the correct z-level. More info on the DFFD page.
Have fun :)
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 20, 2014, 11:21:39 am
Weird things happen with sky support sometimes. This may seem obvious, but does saving and loading after building help?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on March 21, 2014, 07:32:13 pm
So despite having no lua at all, I've been fiddling around with scripts a bit - trying to fix the error thrown by log-region and expand exportmaps to cover all legends exports. 

I fixed log-region by adding a test (if df.world_site.find(df.global.ui.site_id) ~= nil then) that catches the nil value when a world is loaded in a non-fort mode.  It works!

On the other hand, exportlegends is not working, and I can't work out why.  Can someone take a look? (https://github.com/PeridexisErrant/dfhack/tree/PeridexisErrant/log-region-and-exportlegends) 
Spoiler: exportlegends.lua (click to show/hide)

Edit:  I should also mention that I've tried "gui.simulateInput(dfhack.gui.getCurViewscreen(), 'x')" and variations - I suspect I'm just getting the input to pass in the wrong format.  Help?  (Now googleing 'keycodes'...)  edit2: 80, '80', etc aren't working either.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 21, 2014, 09:46:09 pm
If you're trying to simulate input, you need to specify keybinding codes in the format df.interface_key.KEYBIND_NAME (e.g. df.interface_key.LEGENDS_EXPORT_MAP).
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on March 21, 2014, 11:54:27 pm
Thanks!  That's got it working way better... I now have a different issue, which I (edit:) fixed. 

https://github.com/DFHack/dfhack/pull/231
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on March 22, 2014, 09:10:09 am
I'm having a problem with simulateInput: OPTIONS, HELP, and MOVIES don't work at all. This section (https://github.com/DFHack/dfhack/blob/master/library/modules/Screen.cpp#L468) turned up when I was looking through the code - does anyone know of a way to get these keys to work?

Also, is there a way to convert key presses (e.g. Shift-X) to the corresponding keycodes (e.g. CUSTOM_SHIFT_X) other than parsing interface.txt? (That could work, but it would be hard unless there's a Lua raw-parsing library that I'm not aware of).
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 22, 2014, 10:19:18 am
I'm having a problem with simulateInput: OPTIONS, HELP, and MOVIES don't work at all. This section (https://github.com/DFHack/dfhack/blob/master/library/modules/Screen.cpp#L468) turned up when I was looking through the code - does anyone know of a way to get these keys to work?
It is not possible, because those keycodes are handled within DF itself and are filtered out before they even get to the active viewscreen (which is why viewscreen has vmethods "movies_okay", "is_option_screen", "is_save_screen", and "help").

Also, is there a way to convert key presses (e.g. Shift-X) to the corresponding keycodes (e.g. CUSTOM_SHIFT_X) other than parsing interface.txt? (That could work, but it would be hard unless there's a Lua raw-parsing library that I'm not aware of).
The input configuration info currently isn't available to DFHack.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on March 22, 2014, 11:07:41 am
I'm having a problem with simulateInput: OPTIONS, HELP, and MOVIES don't work at all. This section (https://github.com/DFHack/dfhack/blob/master/library/modules/Screen.cpp#L468) turned up when I was looking through the code - does anyone know of a way to get these keys to work?

Also, is there a way to convert key presses (e.g. Shift-X) to the corresponding keycodes (e.g. CUSTOM_SHIFT_X) other than parsing interface.txt? (That could work, but it would be hard unless there's a Lua raw-parsing library that I'm not aware of).
I usually create a simple lua-screen that prints(all) the keys in function on_input.
Title: Re: DFHack 0.34.11 r3
Post by: TheCoolSideofthePIllow on March 23, 2014, 12:14:00 am
I don't suppose there is a plugin that will instantly perform the actions I have designated through the 'd' menu, is there?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on March 23, 2014, 04:50:47 am
I seem to recall a script called magic shovel, but I don't know if it works...
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on March 26, 2014, 02:18:02 am
creature_raw.tissue (i.e. world.raws.creatures.all[123].tissue) - which currently has USERDATA listed
https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L1100

Current tissue_template struct (for reference)
https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L1272

We sort of guessed that the creature-specific tissue info was stored in creature_raw. The format of the data currently covered by the USERDATA is very similar to tissue_template, except that it is 0x120 long instead of 0x110. The extra 0x10 in length is inserted as follows:
Code: [Select]
offset size field type field name
0xf0 0x2 int16_t tissue_mat_state (unchanged from tissue_template)
0xf4 0x2 int16_t UNK?
0xf6 0x2 int16_t HEATDAM_POINT
0xf8 0x2 int16_t COLDDAM_POINT
0xfa 0x2 int16_t IGNITE_POINT
0xfc 0x2 int16_t MELTING_POINT
0xfe 0x2 int16_t BOILING_POINT
0x100 0x2 int16_t SPEC_HEAT
0x102 0x2 int16_t UNK?
0xf4 0x1c stl-string tissue_shape_str (offset increased by 0x10 from tissue_template)

Otherwise the data is a straight copy of the format of tissue_template (from 0x0 to 0xf0)
Title: Re: DFHack 0.34.11 r3
Post by: Dapper Dan on March 26, 2014, 04:32:42 am
I used createitem to make bituminous coal once but now i've forgotten how i did it. could you guys help me, please?


EDIT: never mind. figured it out. it was createitem BOULDER INORGANIC:COAL_BITUMINOUS for those of you who also want to know this.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on March 26, 2014, 10:03:53 am
Is it possible to trigger PRESERVE_REAGENT depending on if a script was successful or not?

I'm guessing the answer is no, so a follow up. Can you read a reactions reagents and then re-create them depending on the script?
Title: Re: DFHack 0.34.11 r3
Post by: Boltgun on March 26, 2014, 12:21:19 pm
Is it possible to trigger PRESERVE_REAGENT depending on if a script was successful or not?

I'm guessing the answer is no, so a follow up. Can you read a reactions reagents and then re-create them depending on the script?

Using a reaction lua hook, you can capture the reaction execution and set a reagent flag to true to conserve it. There is an exemple in the 'hire guard' mod on dffd.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on March 26, 2014, 08:32:01 pm
It would be easier to have PRESERVE_REAGENT on by default, then have the script delete the items if successful.
Title: Re: DFHack 0.34.11 r3
Post by: drayath on March 27, 2014, 03:59:36 pm
A quick query, has anyone done any work on creating a unit outfitted with specific equipement (weapons/armor) either in script or as a plugin

SpawnUnit script can create a unit.
Example scripts to set desired skills.
CreateItem script/plugin can create a new item.

Would assume that instead of ending item.MoveToGround(...) would need to write a method to equip the item as there does not seem to be a item.Equip(...) vmethod. E.g. Add to unit inventory, set the correct item worn flags, add an appropiate new unit_inventory_item to the unit etc.   It is the etc that i am concerned about  ;)

A second related question, what it needed to make a newly spawned unit act with different ai modes (e.g. thief, ambusher, seiger attack, seiger camp). Is it just setting the unit_flags1/2 appropiatly? Worst case i suppose could just directly update the unit.path/unit.enemy periodically.)

Aim to update SpawnUnit.lua to set skills and equiped items, and support creating custom squads of invaders.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on March 28, 2014, 11:03:14 am
Would assume that instead of ending item.MoveToGround(...) would need to write a method to equip the item as there does not seem to be a item.Equip(...) vmethod.

you shouldn't be using vmethods for that at all--you want dhack.items.moveToGround and dfhack.items.moveToInventory.
Title: Re: DFHack 0.34.11 r3
Post by: greycat on March 28, 2014, 03:12:28 pm
I've been using DFHack with the LFR mod successfully on my home machine for some time now.  As some of you may remember, I built this using an incredibly baroque procedure involving a 32-bit chrooted old version of Debian and compiled gcc 4.5 from source code.

After doing all that, someone told me "Oh, you can just remove the libstdc++.so.6 file that comes with DF."

Well, today I decided to try that approach on a different machine (at work).  This is another Debian 7 64-bit system.  This time, instead of doing the chrooted build as I did at home, I tried moving the DF-supplied libstdc++.so.6 library out of the way, and then building everything with the gcc 4.7 toolchain provided in Debian 7.

I am using the DFHack source code from https://github.com/DFHack/dfhack with the one-line patch that is required to make it compile (adding #include <stdexception> in plugins/eventful.cpp).

After a few minor false starts, I was able to get this to build, and start up.  I generated a world, and embarked, and was able to play about a month before the game locked up.  Totally CPU-bound.  I had to kill it.  I tried reloading the save, but I had weird and inconsistent results.  Sometimes it would segfault.  Sometimes it would lock up before even displaying the embark.  Once it got far enough to display the embark, and then segfaulted.

I started a second worldgen, thinking that maybe it was some weird glitch with just that one world.  The second worldgen completed, and I embarked... and got the same lock-up.  I played around with various things, including "./dfhack -g" but didn't really get anywhere.

So, then I decided to copy the entire hack/ subdirectory from my home computer (containing the DFHack stuff that I built with gcc 4.5) to the work computer.  I moved the gcc-4.7-compiled hack/ subdirectory aside, and dropped the gcc-4.5-compiled hack/ subdirectory in its place.  Then I moved the DF-supplied libstdc++.so.6 library back into place.  I did not change anything else at all.  Then I reran ./dfhack and loaded the second fortress (autosaved upon embark).  This time I was able to play all the way through the spring, with no lock-ups or segfaults.
Title: Re: DFHack 0.34.11 r3
Post by: drayath on March 28, 2014, 07:28:15 pm
Ta, moveToInventory was what i was looking for. Searching on that finds the companion-orders.lua script that then has all the code i need for wielding the items appropiatly.
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on March 29, 2014, 03:16:44 pm
how do I spawn units with certain castes like a ant man worker or a black dragon from masterwork dwarffortress which I am play right now
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on March 29, 2014, 03:31:06 pm
how do I spawn units with certain castes like a ant man worker or a black dragon from masterwork dwarffortress which I am play right now

You can put in a number argument after you put it in the name of the spawn command and the ID of the creature.

For example, 'spawn DRAGON 0' will spawn a female red dragon, but 'spawn DRAGON 1' will spawn a male red dragon.

Edit: For a black dragon, the command will either be 'spawn DRAGON_CHROMATIC 2' or 'spawn DRAGON_CHROMATIC 3'.
Title: Re: DFHack 0.34.11 r3
Post by: catvanbrian on March 29, 2014, 05:14:24 pm
one more question, how do you give a civ id to a unit without giving it a x y z location and only using the pointer
Title: Re: DFHack 0.34.11 r3
Post by: FallenAngel on March 29, 2014, 08:30:20 pm
Apparently, while I was gone, DFHack updated itself, and now magmasource won't work.
That's really inconvenient.
Especially since I'm in a glacier with absolutely no foliage whatsoever and the nearest volcano is far, far, far away from where I embarked because it's a glacier and whatnot.
Troubleshooting?
Title: Re: DFHack 0.34.11 r3
Post by: Rose on March 30, 2014, 07:04:39 am
Use the liquids command?
Title: Re: DFHack 0.34.11 r3
Post by: Antsan on March 30, 2014, 09:10:10 am
I want to start dfhack from a terminal on Linux and have Dwarf Fortress run with xinit. I really prefer not sttarting my window manager if it is possible to avoid it and I know
Code: [Select]
xinit ./libs/Dwarf_Fortressworks in the df script shipped with the linux version of the game.

I tried doing something like that with dfhack, but inserting xinit before every instance of ./libs/Dwarf_Fortress doesn't work but fails with
Code: [Select]
xinit: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8rendererI have no idea what that means and how to deal with that.

Playing with dfhack in text mode works, generally (and I think it actually looks better then any tileset or graphics pack) but then I cannot access the console easily, the dfhack.init isn't loaded for some reason and keybindings don't work at all (I guess dfhack doesn't deal with ncurses?).

Any pointers or outright solutions?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 30, 2014, 12:32:48 pm
Is it really that much of an inconvenience to use a graphical user interface?
Title: Re: DFHack 0.34.11 r3
Post by: greycat on March 30, 2014, 12:36:25 pm
I want to start dfhack from a terminal on Linux and have Dwarf Fortress run with xinit.

I'm guessing you mean "from the Linux console" rather than a generical terminal (xterm, etc.).

Quote
I tried doing something like that with dfhack, but inserting xinit before every instance of ./libs/Dwarf_Fortress doesn't work but fails with
Code: [Select]
xinit: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8rendererI have no idea what that means and how to deal with that.

So wait, you're running ./dfhack from the console, rather than within the X session?  Most likely, the shared library environment variables that dfhack sets are not being propagated through to the Dwarf_Fortress process running in the X session.

Try some variant of this, from the Linux console:

Code: [Select]
startx /usr/bin/rxvt -e /wherever/you/put/dfhack

If you don't have rxvt installed, run some other terminal emulator.  If you insist on skipping the entire dfhack script, then you'll have to set the shared library environment variables yourself.

I really think you're going to need a window manager though, unless you painstakingly set the geometry for the terminal emulator window so it doesn't overlap the Dwarf_Fortress window, since you won't be able to raise one above the other at will.

If you REALLY want to have the dfhack command line interface running on the Linux console, and Dwarf_Fortress running within an X session, with no X terminal emulator at all, then I have no idea how to achieve that.  I wouldn't even attempt it.
Title: Re: DFHack 0.34.11 r3
Post by: Antsan on March 30, 2014, 02:15:19 pm
Is it really that much of an inconvenience to use a graphical user interface?
Well, it uses resources (DF runs more slowly when the window manager is running), it takes additional (and noticable) time to start up, it changes the behavior of my monitor in undesirable ways when working with the console (it really is annoying when I am working in emacs in the console and suddenly the monitor dims and I need to switch to X just to move the mouse a bit).
Of course I can start up the window manager every time I want to play DF, but I still hoped I didn't have to.

I want to start dfhack from a terminal on Linux and have Dwarf Fortress run with xinit.

I'm guessing you mean "from the Linux console" rather than a generical terminal (xterm, etc.).
Yes, that is exactly what I meant.

Quote
Quote
I tried doing something like that with dfhack, but inserting xinit before every instance of ./libs/Dwarf_Fortress doesn't work but fails with
Code: [Select]
xinit: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8rendererI have no idea what that means and how to deal with that.

So wait, you're running ./dfhack from the console, rather than within the X session?  Most likely, the shared library environment variables that dfhack sets are not being propagated through to the Dwarf_Fortress process running in the X session.

Try some variant of this, from the Linux console:

Code: [Select]
startx /usr/bin/rxvt -e /wherever/you/put/dfhack

If you don't have rxvt installed, run some other terminal emulator.  If you insist on skipping the entire dfhack script, then you'll have to set the shared library environment variables yourself.

I really think you're going to need a window manager though, unless you painstakingly set the geometry for the terminal emulator window so it doesn't overlap the Dwarf_Fortress window, since you won't be able to raise one above the other at will.

If you REALLY want to have the dfhack command line interface running on the Linux console, and Dwarf_Fortress running within an X session, with no X terminal emulator at all, then I have no idea how to achieve that.  I wouldn't even attempt it.
That's unfortunate, it's exactly what I was hoping for.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 30, 2014, 02:49:52 pm
Is it really that much of an inconvenience to use a graphical user interface?
Well, it uses resources (DF runs more slowly when the window manager is running), it takes additional (and noticable) time to start up, it changes the behavior of my monitor in undesirable ways when working with the console (it really is annoying when I am working in emacs in the console and suddenly the monitor dims and I need to switch to X just to move the mouse a bit).
Of course I can start up the window manager every time I want to play DF, but I still hoped I didn't have to.
If running a window manager causes DF to run noticeably slower, then either your computer is underpowered or there's something seriously wrong with your window manager and you should consider using a different one. The fact that your monitor also randomly dims lends further credence to the "dodgy window manager" theory.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on March 30, 2014, 05:03:21 pm
I am playing around with upgrade-able buildings (you run a reaction and it changes the building from one into the other). I have it working just fine (assuming it is the same type and same size) but was just wondering if anyone had done this before and encountered any problems, or if anyone knows of any problems this might cause?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on March 30, 2014, 06:08:59 pm
If you're changing one workshop into another, you should probably be careful to recategorize it (i.e. ->uncategorize() it, change the subtype, then ->categorize(1) it), otherwise the job manager will probably get confused upon attempting to assign jobs to it. There's also the matter of resetting the occupancy, in case the two types have different accessible/inaccessible tiles.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on March 30, 2014, 06:58:32 pm
Ah, I didn't think about the manager or accessible tiles, good point. Will do some more testing and make sure it doesn't muck things up.
Title: Re: DFHack 0.34.11 r3
Post by: you.fail.me on April 01, 2014, 02:49:34 pm
Guys, is there any dfhack or another 3rd part way to revert tile changes and make them intact stone or ground again? For example, if you've dug a room and you don't like it anymore, is there any way to undo those actions and make that area intact and unexplored again?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 01, 2014, 03:05:45 pm
Guys, is there any dfhack or another 3rd part way to revert tile changes and make them intact stone or ground again? For example, if you've dug a room and you don't like it anymore, is there any way to undo those actions and make that area intact and unexplored again?
Yes.

Don't have time to go into details, but look into the liquids plugin, it allows to paint obsidian walls. If you want something more fancy then: yes, but you would need to write a script/plugin.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on April 01, 2014, 04:05:34 pm
I think it's possible with the tiletypes plugin, but I have no idea how that works.

Even without that, if you just clear the right flag on the tile, it should undig it, but you might run into problems if there's stuff there. I don't have the syntax memorized, but if you poke around in lua with "~" or "printall" you should be able to find what you're looking for without too much trouble.
Title: Re: DFHack 0.34.11 r3
Post by: Antsan on April 02, 2014, 07:12:44 am
Is it really that much of an inconvenience to use a graphical user interface?
Well, it uses resources (DF runs more slowly when the window manager is running), it takes additional (and noticable) time to start up, it changes the behavior of my monitor in undesirable ways when working with the console (it really is annoying when I am working in emacs in the console and suddenly the monitor dims and I need to switch to X just to move the mouse a bit).
Of course I can start up the window manager every time I want to play DF, but I still hoped I didn't have to.
If running a window manager causes DF to run noticeably slower, then either your computer is underpowered or there's something seriously wrong with your window manager and you should consider using a different one. The fact that your monitor also randomly dims lends further credence to the "dodgy window manager" theory.
I am sorry, DF running more slowly in the window manager is bullshit.
The monitor dimming doesn't happen on my desktop PC, but it happens in my laptop. I don't think it's the fault of the window manager, as both use lightdm.

Basically I want dfhack to work with the ncurses interface of Dwarf Fortress.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 02, 2014, 12:53:15 pm
DFHack works by replacing DF's SDL library with its own and I don't think the ncurses DF uses SDL, so...
Title: Re: DFHack 0.34.11 r3
Post by: Doktoro Reichard on April 02, 2014, 02:02:51 pm
Guys, is there any dfhack or another 3rd part way to revert tile changes and make them intact stone or ground again? For example, if you've dug a room and you don't like it anymore, is there any way to undo those actions and make that area intact and unexplored again?

As people said, you can make due with:

1- the liquids command. It enables you to paint obsidian walls at any given point.

2- the gui/liquids command. Same deal, but with a graphical user interface, that makes it much easier to designate large areas. Note however that you can't designate stuff at 3D - every level you want to fill with obsidian you need to do it one by one.

3- the tiletypes command. The previous commands left the tiles visible. tiletypes can revert that. Also, tiletypes can fill any given area with any "type" of material. However, tiletypes is also a very, very crude hammer. The sequence of commands to fill a tile with stone and revert it to hidden, for instance, are the following:

paint mat stone  - This sets the material to the biome's layer stone type
paint h 1        - This sets the visibility flag to "hidden"
paint sp normal  - This sets the material special flag, so that it appears as unmined (not smoothed) stone
range x y z      - The range, from the lower upper left corner of the cube, that the tiletypes command works


Pressing Enter with the "k" cursor will activate the commands and turn every tile in range to what was specified. You can refine the sequence, if you only want to affect certain tiles (such as floors or fortifications).
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on April 02, 2014, 02:29:31 pm
DFHack works by replacing DF's SDL library with its own and I don't think the ncurses DF uses SDL, so...
That's only on Windows - On Linux and OS X, it hooks in by running DF as a child process (or with some form of exec). As far as I know, it does rely on SDL for keyboard input, so things like keybindings won't work. There may be other things that don't work either, since SDL_Init wouldn't be available in text mode.
Edit: Keybindings don't seem to work, but the search plugin does work. It's difficult to test many other plugins without a console.
Title: Re: DFHack 0.34.11 r3
Post by: drayath on April 02, 2014, 08:50:42 pm
I am trying to directly add an improvemnt to an item as part of a larger script (E.g. directly adding poison splatter to an weapon being added to a spawned unit). Having an issue where i can't work out how to set the type of the improvement, am i missing something silly or is this somehting dfhack does not expose (yet). If that is there case are there any sensible work arounds?

Code: [Select]
function AddImprovement(item, improvementDef)

if not CheckChance(improvementDef["chance"])
return
end

local improvement = df.itemimprovement:new()

improvement.mat_type = improvementDef["material"][1] -- TODO: check dont need to do a lookup before assigment
improvement.mat_index = improvementDef["material"][2]   -- TODO: check dont need to do a lookup before assigment
improvement.quality = improvementDef["quality"].Generate()
improvement.skill_rating = improvementDef["skillLevel"].Generate()
improvement.maker = item.maker

        -- THIS METHOD DOES NOT EXIST
-- TODO: There is a getType() method, but no setType() and no type property exposed 
improvement:setType(df.improvement_type.COVERED)

utils.insert_or_update(item.improvements, improvement, 'id')
end

item_improvement type for reference
Spoiler (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 02, 2014, 11:27:41 pm
There is no setType because it uses virtual inheritance. Thus can't change the object itself with a function (at least easily...). You need to create not a base object but the more specific one, in your case this: "itemimprovement_coveredst". That class has two more fields: cover_flags (for marking glazed items) and shape (not sure about this one...).

One minor nitpick: every time you write foo["bar"] you can replace that with simpler: foo.bar.
Title: Re: DFHack 0.34.11 r3
Post by: cdombroski on April 03, 2014, 07:15:35 am
Guys, is there any dfhack or another 3rd part way to revert tile changes and make them intact stone or ground again? For example, if you've dug a room and you don't like it anymore, is there any way to undo those actions and make that area intact and unexplored again?

As people said, you can make due with:

1- the liquids command. It enables you to paint obsidian walls at any given point.

2- the gui/liquids command. Same deal, but with a graphical user interface, that makes it much easier to designate large areas. Note however that you can't designate stuff at 3D - every level you want to fill with obsidian you need to do it one by one.

3- the tiletypes command. The previous commands left the tiles visible. tiletypes can revert that. Also, tiletypes can fill any given area with any "type" of material. However, tiletypes is also a very, very crude hammer. The sequence of commands to fill a tile with stone and revert it to hidden, for instance, are the following:

paint mat stone  - This sets the material to the biome's layer stone type
paint h 1        - This sets the visibility flag to "hidden"
paint sp normal  - This sets the material special flag, so that it appears as unmined (not smoothed) stone
range x y z      - The range, from the lower upper left corner of the cube, that the tiletypes command works


Pressing Enter with the "k" cursor will activate the commands and turn every tile in range to what was specified. You can refine the sequence, if you only want to affect certain tiles (such as floors or fortifications).

Pretty certain you also need:

paint sh wall - to actually do the undigging

It goes with the other paint commands.
Title: Re: DFHack 0.34.11 r3
Post by: Fluoman on April 03, 2014, 07:24:03 am
Well, the auto-melt script is still buggy, I don't know what to do :(
Title: Re: DFHack 0.34.11 r3
Post by: Roses on April 03, 2014, 07:39:38 am
So I have been using dfhack.run_script(name[,args...]), but it expects the arguments to be in the form dfhack.run_script(name,args[0], args[1], args[2], ...). Is there anyway to send just an array of arguments through and have it work? Or is there a lua command that does that?
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on April 03, 2014, 08:13:17 am
So I have been using dfhack.run_script(name[,args...]), but it expects the arguments to be in the form dfhack.run_script(name,args[0], args[1], args[2], ...). Is there anyway to send just an array of arguments through and have it work? Or is there a lua command that does that?
dfhack.run_script(name, unpack(args)), I believe.
Edit: It looks like DFHack's Lua interpreter doesn't include unpack(), so here's a Lua implementation (from the Lua docs (http://www.lua.org/pil/5.1.html)):
Code: [Select]
    function unpack (t, i)
      i = i or 1
      if t[i] ~= nil then
        return t[i], unpack(t, i + 1)
      end
    end
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 03, 2014, 11:39:24 am
It includes it, but it's under table.unpack.
Title: Re: DFHack 0.34.11 r3
Post by: Doktoro Reichard on April 03, 2014, 12:47:46 pm
...
...

Pretty certain you also need:

paint sh wall - to actually do the undigging

It goes with the other paint commands.

Yes, that's right. I forgot about it but it is needed. Thanks for correcting.
Title: Re: DFHack 0.34.11 r3
Post by: xxseuzxx on April 03, 2014, 01:16:32 pm
why does the dfusion used in dfhack lacks the friendship command?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 04, 2014, 03:18:29 am
why does the dfusion used in dfhack lacks the friendship command?
Short answer: because i'm a lazy bum.
Long answer: It's included but due some changes (mostly that it's higher level command, and you need to know what you are doing) it's been moved to a module and you need to have some knowledge of lua to activate it. It also might not work on linux and osx and it might be that i forgot include one file needed for it to work. That being said i'm too lazy to develop it further i.e. make a gui and add support for modification of races that are active while game is running. This is mainly due to fact that friendship (and embark) uses different way to modify df and it's a very error prone, and maintenance intensive way. And for that reasons i'm trying to deprecate both plugins. It's shame that there is no good way to mimic the same functionality in other ways.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 04, 2014, 11:24:05 am
You forgot it on Windows, too. I had to compile DFHack manually then copy friendship.o to wherever it's needed.

Also I put it on dropbox. (https://dl.dropboxusercontent.com/u/13790475/friendship.o)

Also, yes, I read friendship's code. From what I understand... it's hacky as hell.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 04, 2014, 05:25:01 pm
Well if anyone is interested the idea is very simple, replace ALL reads to <current race> with a function call. The implementation could be better...
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 04, 2014, 07:52:59 pm
The idea's simple, but how many reads to <current race> are there, anyway?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 05, 2014, 02:25:03 am
Oh okay i lied a bit, here is how it works:
usually ( about 90%?) you would have a "mov REG, [address to current race]" and after some time "cmp REG,[struct offset+0x8c]". This is the load/compare from units race. And i replace only if the second one is close. In my df (windows) it replaces 84 such places. Main drawback is that it does not discriminate and might miss some of more optimized places (e.g. load to reg, move to other register, then compare) or if it passes as a param to function (then the compare is far away from load). The non discriminating part usually accounts for unintended behaviour (like changing icons to @ or having to burry the goblins as dwarfs etc...).
Title: Re: DFHack 0.34.11 r3
Post by: Duefaku on April 05, 2014, 08:08:26 pm
Hey guys, I'm having an issue with Advfort. (Or me just being an idiot. Regardless, I need help.) Whenever I try to make a few certain workshop and furnace buildings, and I alt-move into them while I have supplies nearby, nothing happens.

For example, I mined down to Adamantine and magma level, mined some Adamantine, and now I want to smelt it. I have some rocks to build with, even a log I pulled down here just in case, but no matter how many times I press alt+direction towards the magma smelter marker nothing happens. I've built loads (like 9) workshops, so I think I've got the "technique" down. There's a 3x3 area with magma tiles near it. Do I need more materials? Is it bugged?

This also happens with wood furnaces, siege workshops, (although with that, my character takes a log and uses it, but doesn't do anything else. I believe I had rocks nearby.) and a few more I've forgotten about because that was like yesterday before I went to sleep.

So, in essence, I need halp building stouf.
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on April 05, 2014, 08:12:13 pm
Logs aren't fire-safe, so they won't be used in a smelter or furnace.

What type of stone did you have? If it is an economic stone it may be ignored.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 05, 2014, 09:13:47 pm
you also need to have the items on the ground, or
'hauling' and not in your backpack.
Title: Re: DFHack 0.34.11 r3
Post by: Duefaku on April 05, 2014, 09:44:23 pm
They're on the ground. I have granite and hematite. What rocks would be suitable?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on April 05, 2014, 09:56:10 pm
They're on the ground. I have granite and hematite. What rocks would be suitable?

Non-economic stones. Here are economic stones. (http://dwarffortresswiki.org/index.php/DF2012:Economic_stone)

Metal ores and coal bearing stones are also considered economic. Basically any stone that has a use is economic.

And they must be magma-safe if you want a magma smelter. (http://dwarffortresswiki.org/index.php/DF2012:Magma-safe)
Title: Re: DFHack 0.34.11 r3
Post by: Duefaku on April 05, 2014, 10:23:30 pm
They're on the ground. I have granite and hematite. What rocks would be suitable?

Non-economic stones. Here are economic stones. (http://dwarffortresswiki.org/index.php/DF2012:Economic_stone)

Metal ores and coal bearing stones are also considered economic. Basically any stone that has a use is economic.

And they must be magma-safe if you want a magma smelter. (http://dwarffortresswiki.org/index.php/DF2012:Magma-safe)

Well, I mined a few Gabbro rocks. According to the list they're magma safe, and are not on the economic list. But I still can't build. Is there some sort of skill prerequisite or something?

To be clear I'm setting this up correctly: I'm on a layer consisting of a floor of blue Dense Floor Tiles, and a few Granite Cavern Floors where I cleared an area next to magma to put the smelter.

To the right of the edge of the floor which I'm building on (nothing in between) there are red 7s, which are listed as "Open space" when using the look key.

After CTRL+T Building the start marker thing, it shows a little grey area 3x3, which I assume is the area it occupies, because that's how it worked with the others.

I align the 3x3 with the last 3 right tiles of the floor (by being on the 4th tile away and alt moving right after selecting "magmasmelter" under the furnaces menu) then, with the magma safe and non economic stone gabbro nearby, I alt move into the unfinished smelter as done with all other buildings I've done so far.

Nothing happens.

It seems to acknowledge it's an unfinished building because it doesn't say "Can only do on buildings that haven't been finished" or something along those lines.

Do I lack materials and it just doesn't say?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on April 05, 2014, 10:38:55 pm
It can't be needing more than just the one building material. I'm not quite sure what it could be then.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 06, 2014, 09:59:58 am
when in doubt bust out "c- advfort" and build it anyway,
Title: Re: DFHack 0.34.11 r3
Post by: Geldrin on April 06, 2014, 01:00:03 pm
Greetings modsters!

I'm asking you for help regarding the dfusion plugin.
I used it to heal some dwarves with minor injuries that otherways cannot be threated with the medic script (it seems injured dwarves get out of the hospital as soon as they can stand up, not careing about their own broken fingers and such...)
Accidentally, I applied the powerup instead of the healing, and now I have a perfect dwarf running around the fort, claiming the previous mayor's position, and so on. I found it too hackish for my playstyle, but I'm not familiar with lua.

Could you help me undo this tremendous experience gain?
Title: Re: DFHack 0.34.11 r3
Post by: Rose on April 06, 2014, 01:09:14 pm
Easiest way would just to have an accident happen to him during a time when most of your dwarves are happy.
Title: Re: DFHack 0.34.11 r3
Post by: Loud Whispers on April 06, 2014, 02:29:45 pm
Is there any common reason why dfhack wouldn't be able to load stonesesne .png files? I have an issue where stonesense keeps crashing because it usually can't load the .png for tracks, and this problem persists even with entirely new installations of DFhack and stonesense.
Title: Re: DFHack 0.34.11 r3
Post by: snjwffl on April 06, 2014, 05:26:33 pm
I'm having some trouble with the "drainaquifer" command.  I ran the command, and it cleared the majority of the aquifer flags on my embark, but there are still a number of aquifer tiles left (the "probe" command lists "water_table = Y" on said tiles).  Running the command again didn't work (I even tried having my cursor in different places, in case the issue was due to my multi-biome embark).  In addition, it seems that tiletypes and liquids can do stuff with aquifers, but I can't for the life of me figure out how.
Title: Re: DFHack 0.34.11 r3
Post by: falconne on April 06, 2014, 06:01:13 pm
Well, the auto-melt script is still buggy, I don't know what to do :(

Just been really busy lately. Will fix it soon as I have time.
Title: Re: DFHack 0.34.11 r3
Post by: Fluoman on April 07, 2014, 01:53:09 am
Well, the auto-melt script is still buggy, I don't know what to do :(

Just been really busy lately. Will fix it soon as I have time.
Thanks for the update :)
Title: Re: DFHack 0.34.11 r3
Post by: kingu on April 07, 2014, 03:26:44 pm
is there a way to use dfhack to rename a weapon? For me it will be useful when assigning spcific weapons coated in syndromes
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 07, 2014, 03:41:28 pm
Weapons have to be artifacts to have names, I'm pretty sure
Title: Re: DFHack 0.34.11 r3
Post by: TheThing on April 07, 2014, 04:23:30 pm
Who can help with script, which can heal and(or) ressurect creature? Fullheal from masterwork doesnt work.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 07, 2014, 04:25:32 pm
By what do you mean "doesn't work"?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on April 07, 2014, 04:48:02 pm
As the name implies it heals them. But it doesnt remove syndromes or resurrect anyone.
Title: Re: DFHack 0.34.11 r3
Post by: Doktoro Reichard on April 07, 2014, 06:58:03 pm
Weapons have to be artifacts to have names, I'm pretty sure

Not true. Just think about all those happy military dwarves naming their worthless junk because they killed a goblin or another remarkless creature.

Is there any common reason why dfhack wouldn't be able to load stonesesne .png files? I have an issue where stonesense keeps crashing because it usually can't load the .png for tracks, and this problem persists even with entirely new installations of DFhack and stonesense.

I also had that problem (mainly because I have really a really old graphics board). The solution I found was to comment out the entries regarding the tracks. I also made a post here (http://www.bay12forums.com/smf/index.php?topic=135555.0) regarding the same problem. It's probably related to high-def sprites or whatnot.
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 07, 2014, 06:58:50 pm
The named weapons are still artifacts. They even show up in the artifact menu.
Title: Re: DFHack 0.34.11 r3
Post by: TheThing on April 07, 2014, 11:43:05 pm
By what do you mean "doesn't work"?


Scipt writen for older version dfhack, and write this error in console.
Quote
[DFHack]# fullheal -r
Resurrecting...
Erasing wounds...
Refilling blood...
Resetting grasp/stand status...
Resetting status flags...
Resetting counters...
Resetting body part status...
E:\MASTERWORK\Dwarf Fortress\hack\scripts/fullheal.lua:64: Cannot read field bod
y_component_info.body_layer_328: not found.
stack traceback:
        [C]: in function '__index'
        E:\MASTERWORK\Dwarf Fortress\hack\scripts/fullheal.lua:64: in main chunk

        (...tail calls...)

Title: Re: DFHack 0.34.11 r3
Post by: Loud Whispers on April 09, 2014, 07:30:07 pm
I also had that problem (mainly because I have really a really old graphics board). The solution I found was to comment out the entries regarding the tracks. I also made a post here (http://www.bay12forums.com/smf/index.php?topic=135555.0) regarding the same problem. It's probably related to high-def sprites or whatnot.
That did the trick! Thanks!
Title: Re: DFHack 0.34.11 r3
Post by: lechium on April 11, 2014, 03:40:38 am
-Moved to own thread-
Title: Re: DFHack 0.34.11 r3
Post by: Terr on April 12, 2014, 10:48:56 am
I've been trying for several hours now and I can't figure out how to dig in Adventure mode using DFhack. Could someone please help?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on April 12, 2014, 02:31:22 pm
I've been trying for several hours now and I can't figure out how to dig in Adventure mode using DFhack. Could someone please help?

Using the advfort plug-in?

You need a pickaxe in your main hand. To make sure that you're using your main hand to wield it, drop whatever is in your hands then take out your pick.

Make sure that the current job is set to dig, then hold the alt key and try to move into the wall you want to dig out.
Title: Re: DFHack 0.34.11 r3
Post by: Terr on April 12, 2014, 03:26:08 pm
I've been trying for several hours now and I can't figure out how to dig in Adventure mode using DFhack. Could someone please help?

Using the advfort plug-in?

You need a pickaxe in your main hand. To make sure that you're using your main hand to wield it, drop whatever is in your hands then take out your pick.

Make sure that the current job is set to dig, then hold the alt key and try to move into the wall you want to dig out.

Oh, thanks a lot, I had no clue advfort even existed, I just heard you could do it! Got it working now, thanks a lot!
Title: Re: DFHack 0.34.11 r3
Post by: Wabbaction on April 13, 2014, 01:28:29 am
I cannot get it, how to make a steel bow? I've tried a tonn of different combinations with ITEM_WEAPON_BOW and everything..
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on April 13, 2014, 01:31:23 am
I cannot get it, how to make a steel bow? I've tried a tonn of different combinations with ITEM_WEAPON_BOW and everything..

createitem WEAPON:ITEM_WEAPON_BOW STEEL
Title: Re: DFHack 0.34.11 r3
Post by: Wabbaction on April 13, 2014, 01:34:11 am
Right, didn't put WEAPON: on the beginning, thanks.
But still does "No unit selected", you can't just spawn them on ground?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on April 13, 2014, 01:35:51 am
Right, didn't put WEAPON: on the beginning, thanks.
But still does "No unit selected", you can't just spawn them on ground?

Nope, you have to view a unit when doing it.

If you are in adventure mode, you can just enter the z-status screen and it will work there too.
Title: Re: DFHack 0.34.11 r3
Post by: Wabbaction on April 13, 2014, 01:38:16 am
What if in DF mode I will spawn it on civilian, will he just haul it to weapons stockpile?
Title: Re: DFHack 0.34.11 r3
Post by: BlackFlyme on April 13, 2014, 01:40:59 am
What if in DF mode I will spawn it on civilian, will he just haul it to weapons stockpile?

Yea, probably. But it will be considered a fort-made item, and can be usable by your dwarves.
Title: Re: DFHack 0.34.11 r3
Post by: Snaake on April 14, 2014, 04:37:59 pm
I've come back to DF after a while away, and am setting up a new fort. I can't seem to get yarn spinning working with workflow*, and in general, could use a refresher on everything that can be done with workflow. I remember that about a year ago there were loads of threads where people listed their workflow constraints, but my forum/google search-fu is failing me.

Could someone point me towards such a thread? Or at least the right subforum?


*Falconne's status screen shows the cap as red, dfhack says "Constraint THREAD/YARN count 10 (gap 5)", and on the next line in red "(no jobs)" even though I do have a spin thread job on repeat at a farmer's workshop.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on April 21, 2014, 12:15:20 am
Is there file reading capabilities within the DFHack lua? I am thinking of making configurable targeting text files, and would like to be able to read them in to a lua script.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on April 21, 2014, 01:09:41 am
Is there file reading capabilities within the DFHack lua? I am thinking of making configurable targeting text files, and would like to be able to read them in to a lua script.

IIRC it isn't documented within the DFHack lua api, but the lua standard io library works.

FAKEEDIT: Look at the script in this post: http://www.bay12forums.com/smf/index.php?topic=126558.msg4307550#msg4307550
It only uses open, write, and close, but I am sure you could figure out how to read files using the appropriate part of the io library (if implemented).
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on April 21, 2014, 01:15:46 am
Better example, with full read-and-write. (https://github.com/warmist/dfhack/blob/develop/scripts/gui/mod-manager.lua)
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on April 21, 2014, 02:28:55 am
I remember a while ago Peterix (iirc) said that due to the confusion with unofficial builds r4 would be skipped, but the transition to a github organisation was going to make it easier to hit future targets - and r5 would be out soonish. 

What's the current plan, and should I be waiting for  release?
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on April 21, 2014, 03:51:07 pm
It's already been transferred to an organization (https://github.com/DFHack/dfhack) and development is fairly active (on the 'develop' branch): https://github.com/DFHack/dfhack/commits/develop. I'm not aware of any release plans at the moment, and Peterix doesn't appear to have done much recently, so I think you can safely update your pack without waiting for r5.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 22, 2014, 12:11:09 am
It's already been transferred to an organization (https://github.com/DFHack/dfhack) and development is fairly active (on the 'develop' branch): https://github.com/DFHack/dfhack/commits/develop. I'm not aware of any release plans at the moment, and Peterix doesn't appear to have done much recently, so I think you can safely update your pack without waiting for r5.
Actually we are hoping to release r5 ASAP. We want to have at least one release before the next df version and i think r5 has a lot of changes compared to r4.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on April 22, 2014, 03:46:12 am
We are hoping to release r5 ASAP. We want to have at least one release before the next df version and i think r5 has a lot of changes compared to r4.
Wow, just looked at the news page (https://github.com/DFHack/dfhack/blob/develop/NEWS) - that's awesome!  I've been hoping for something like the command prompt for a while :)

And here's my recent work (https://github.com/DFHack/dfhack/pull/237) on clearing out some old stuff in needs_porting; it needs a more experienced pair of eyes if someone has time. 
Title: Re: DFHack 0.34.11 r3
Post by: Roses on April 22, 2014, 03:01:06 pm
I've been playing around with trying to change features of the maps using lua scripts and was wondering if anyone knows if it is possible to change the material a specific tile is made of? I know I can change entire layers, and material veins, but with my experimentation I was unable to change only one specific tile.

Note that I can change the tiles geo-layer and biome index which will change it, but not to an arbitrary inorganic. I can also change its tile type, so I can change a tile into a glowing barrier, ice, lava, or a couple other choices, but again it doesn't do what I would like.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on April 22, 2014, 04:44:36 pm
As far as I know, it is more trouble than it is worth. You'd have to muck around with world map data in complicated ways.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on April 22, 2014, 11:53:05 pm
As far as I know, it is more trouble than it is worth. You'd have to muck around with world map data in complicated ways.

More trouble indeed. All I really wanted was to change the temperature of specific tiles and I can already do that, was just thinking of other manipulations I could include.

On a related note. Is it possible to make constructions of different materials with DFHack?
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 22, 2014, 11:58:56 pm
As far as I know, it is more trouble than it is worth. You'd have to muck around with world map data in complicated ways.

More trouble indeed. All I really wanted was to change the temperature of specific tiles and I can already do that, was just thinking of other manipulations I could include.

On a related note. Is it possible to make constructions of different materials with DFHack?
Constructions are more difficult (i think). Setting a tile material to inorganic one can be done by creating a new (or expanding an old one) vein. I use that to build unminable/undeconstructable towers. Will share the script when i get home.
Title: Re: DFHack 0.34.11 r3
Post by: ag on April 23, 2014, 06:33:17 am
The API for working with the map is mostly only available in C++, and since r4 it supports setting a tile to an arbitrary stone material using the vein method. It is used by the 3dveins plugin, and also exposed in the tiletypes command.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 23, 2014, 09:45:40 am
Here is the script:  linky  (https://gist.github.com/warmist/11218191)
Title: Re: DFHack 0.34.11 r3
Post by: Roses on April 23, 2014, 10:50:14 am
Here is the script:  linky  (https://gist.github.com/warmist/11218191)

Awesome. And thanks for all the help everyone.

EDIT: That works beautifully. Two comments
1. Multiple calls using the same materials will do nothing unless you clear the block_events_mineralst associated with the material. For example if I ran a reaction that changed the floor into silver, then one that changed it to gold, then again tried to change it to silver it would stay gold.
2. Some walls for some reason have a tiletype not associated with a wall, even though they are called walls in game. This means that they will not take any change effect you run. For example, I had a rough conglomerate wall section I was attempting to change to slade, 4 of the 6 pieces of wall segment changed, but two had the tiletype associated with an upward ramp. No idea how that happens, but manually changing the tiletype to that of the others caused them to behave correctly.

Overall, it works fairly well. Note that if you want to change a grassy square into a mineral you also need to change its tiletype (just like in 2), not sure if doing this will have any unintended consequences.
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on April 24, 2014, 12:19:44 am
Map editing in general is a very complicated procedure, this is because: simple tiles are just tile type + material lookup to current strata (e.g. soil/ granite etc...) , trees/shrubs look up into plants list, grasses i think uses events, mineral veins have events for them and should not overlap, constructions have yet another system and i think i missed a few... So if you want "just place a wall" you need to take into account ALL of this what you are replacing. That could involve removing one tile from block_events_mineralst or world constructions or removing tree etc... So yeah, my script is very minimal and if you want to do it "the right way" there is a lot involved.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on April 24, 2014, 11:00:58 am
Yeah, I am beginning to understand that, but as it stands your script does very well, even for being so simple.

One last question, I have been looking at http://dwarffortresswiki.org/index.php/DF2012:Tile_types_in_DF_memory (http://dwarffortresswiki.org/index.php/DF2012:Tile_types_in_DF_memory) and was wondering if there is a list in actual numbers somewhere. I am interested in playing around a bit with tile types, but I would rather not go through and figure out which each one is.
Title: Re: DFHack 0.34.11 r3
Post by: Andux on April 24, 2014, 05:51:00 pm
Here's a rough list I put together while working on MADMAN:

Spoiler: big ugly list (click to show/hide)

Note that it's missing the numbers for minecart tracks (and possibly other things I've forgotten about).
Title: Re: DFHack 0.34.11 r2
Post by: Eric Blank on April 24, 2014, 09:12:18 pm
There's actually a "showmood" command in DFHack which will tell you exactly what your moody dwarf wants.

"Urist McGoth wants a hug."
Pop into adventure mode, use this dfusion script
Code: [Select]
function spar(unit)
if unit==nil then
unit=getCreatureAtPos(getxyz())
entry=getline()
targ=getCreatureAtPos(getxyz())
end
unit.flags2.sparring=true
targ.flags2.sparring=true
unit.job.hunt_target=targ
targ.job.hunt_target=unit
end
adv_tools.menu:add("spar another",spar)
To set spar flag on urist Mcgoth and current unit you're playing, walk up and wrestle both arms over Mcgoth.

So I've been trying my best to implement this script, and had no success doing so on my own.

Can somebody please let me know where exactly it's supposed to go?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on April 25, 2014, 01:22:29 pm
You could add a "hug" interaction to the dwarf race and have an associated announcement with its usage.
Title: Re: DFHack 0.34.11 r3
Post by: Eric Blank on April 25, 2014, 01:29:40 pm
Oh. no, I wasn't looking to hug anybody, I was interested in using the sparring script to spar with companions and others.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 25, 2014, 03:14:22 pm
Oh. no, I wasn't looking to hug anybody, I was interested in using the sparring script to spar with companions and others.
oh that goes into dfusion looks tricky but the "adv_tools.menu:add("spar another",spar)" was a clear give away.
also 'interaction hugs' doesn't give you the ability to snatch stuff off folks with out being pegged hostile.
just shove the code into the adv...wait you don't need adv_tools.menu if you shove it in the adv_tools file?
it looks like an old ass dfusion file
hell you don't need to do that just plop the code into companion order and copy and edit the menu set up.

that's a two year old script uhh you could activate sparring by diving into gm-editor and slapping the spar flag on both units... but getting them to fight each other is slightly bit more.
Code: [Select]
function getxyz() -- this will return pointers x,y and z coordinates.
local x=df.global.cursor.x
local y=df.global.cursor.y
local z=df.global.cursor.z
return x,y,z -- return the coords
end
function getCreatureAtPos(x,y,z) -- gets the creature index @ x,y,z coord
--local x,y,z=getxyz() --get 'X' coords
local vector=df.global.world.units.all -- load all creatures
for i = 0, #vector-1 do -- look into all creatures offsets
local curpos=vector[i].pos --get its coordinates
local cx=curpos.x
local cy=curpos.y
local cz=curpos.z
if cx==x and cy==y and cz==z then --compare them
return vector[i] --return index
end
end
--print("Creature not found!")
return nil

end

function Attack(unit)
Fig={}
if unit==nil then
unit=getCreatureAtPos(getxyz())
end
local adv=df.global.world.units.active[0]
for k,v in pairs(df.global.world.units.active) do
if v.relations.group_leader_id==adv.id or v.relations.following==adv.id then
v.job.hunt_target=unit
v.job.hunt_target=Fig
unit.job.hunt_target=v
end
table.insert(Fig,unit)
end
end


don't know if this still works but here's the stuff you need for pitting fights.
Title: Re: DFHack 0.34.11 r3
Post by: Eric Blank on April 25, 2014, 03:24:21 pm
adv_tools.lua? In which folder? There's like three of the damn things so far as I've found, and it didn't work when simply copy/pasted into any one of them.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 25, 2014, 03:31:21 pm
adv_tools.lua? In which folder? There's like three of the damn things so far as I've found, and it didn't work when simply copy/pasted into any one of them.
it should be in lua scripting folder where dfusion is. also the script is 2 years old.
Title: Re: DFHack 0.34.11 r3
Post by: Eric Blank on April 25, 2014, 03:44:31 pm
ah, so it just doesn't work with the current version. Sorry about that :-[
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on April 25, 2014, 10:32:50 pm
Any chance the next dfhack version could have access to the https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L1089 creature_raw.tissue vector?

See also post from earlier in this thread: http://www.bay12forums.com/smf/index.php?topic=91166.msg5124382;topicseen#msg5124382

Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on April 26, 2014, 04:44:19 am
ah, so it just doesn't work with the current version. Sorry about that :-[
it's more so that piece of coding doesn't work on it's own with out the functions that it calls for.
Title: Re: DFHack 0.34.11 r3
Post by: Mithril Leaf on April 26, 2014, 04:39:36 pm
I'm looking to find a way to remove the occupied status from a tile after the door fix has failed. Could anyone guide me in the right direction?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on April 26, 2014, 10:04:11 pm
I'm looking to find a way to remove the occupied status from a tile after the door fix has failed. Could anyone guide me in the right direction?
If you build a door at the location and it doesn't close, just type "fix/stuckdoors" and then deconstruct/rebuild the door to confirm that it's fixed. If it doesn't fix it, then you'll need to upload a copy of your saved game somewhere (e.g. DFFD) so somebody can figure out what's wrong with it.
Title: Re: DFHack 0.34.11 r3
Post by: Quarterblue on April 28, 2014, 09:33:27 pm
Is dfhack r5 planned to be released before the next DF update? It seems that the update does seem imminent, a matter of weeks now that Toady has entered the bugfixing phase. If that is the case, are there plans to skip r5 too and go straight to a post-update r6?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on April 28, 2014, 10:25:24 pm
Is dfhack r5 planned to be released before the next DF update? It seems that the update does seem imminent, a matter of weeks now that Toady has entered the bugfixing phase. If that is the case, are there plans to skip r5 too and go straight to a post-update r6?

I keep hearing "soon" - for months now - but nothing's happened yet. 

An official release within the next few weeks would be great!
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on April 29, 2014, 03:34:44 pm
Any chance the next dfhack version could have access to the https://github.com/angavrilov/df-structures/blob/master/df.creature-raws.xml#L1089 creature_raw.tissue vector?

See also post from earlier in this thread: http://www.bay12forums.com/smf/index.php?topic=91166.msg5124382;topicseen#msg5124382

I don't know, but consider asking (very patiently) in the (very sparsely active) irc chatroom. With rare exceptions, if it's not on ag or Q's df-structures fork, it's not included yet. It's possible it got missed.

Is dfhack r5 planned to be released before the next DF update? It seems that the update does seem imminent, a matter of weeks now that Toady has entered the bugfixing phase. If that is the case, are there plans to skip r5 too and go straight to a post-update r6?

We definitely want one before the next DF release.

Any DFHack release after the next DF release would loop back to r1. DFHack is very, very much tied to a specific DF version.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on April 30, 2014, 07:49:24 pm
Taken from this (http://www.bay12forums.com/smf/index.php?topic=135597.msg5231791#msg5231791) thread and moved here, to a more appropriate spot.

Actually, what I was hoping to be able to do is tie into the interaction itself, for example;
Code: [Select]
[INTERACTION:TEST1]
[I_SOURCE:CREATURE_ACTION]
[I_TARGET:A:MATERIAL]
[IT_MATERIAL:MATERIAL:INORGANIC:SOME_INORGANIC:SPATTER_LIQUID]
[I_TARGET:B:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[I_TARGET:C:CREATURE]
[IT_LOCATION:CONTEXT_CREATURE]
[IT_MANUAL_INPUT:target]
[I_EFFECT:MATERIAL_EMISSION]
[IE_TARGET:A]
[IE_TARGET:B]
[IE_TARGET:C]
[IE_IMMEDIATE]
If I was able to access each of the three targets at the moment the interaction is cast, then I would have the caster, the target, and an inorganic. I could then read off the inorganic a script to run. This is all just theoretical now as I haven't actually looked at the innards, but it seems reasonable that I might be able to do something of this sort.

So looking through the df-structures, I don't see anything about material emission interactions. In fact, I really don't see anything about interactions at all except for in df.syndrome.xml and it just seems like that is about syndromes not interactions (despite them being listed as creature_interaction_effect). Any idea if this information exists somewhere and maybe just hasn't been categorized yet?
Title: Re: DFHack 0.34.11 r3
Post by: Quarterblue on May 01, 2014, 03:14:35 pm
We definitely want one before the next DF release.

Any DFHack release after the next DF release would loop back to r1. DFHack is very, very much tied to a specific DF version.

Maybe I'm mistaken but you seem to act as if you had little control over it. Who exactly releases dfhack versions? It's a bit blurry now that it's all centralized in a global github account.
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on May 01, 2014, 07:05:13 pm
  • DFHack and related projects are now under a github organization, with me, angavrilov and Quietust: https://github.com/DFHack - this should allow more people than just me to make releases.
They're the ones that can tag releases on Github (unless there are others with push access that I'm not aware of) - the decision to actually make a release is usually made by a number of developers.
Title: Re: DFHack 0.34.11 r3
Post by: MystRunner on May 01, 2014, 09:01:49 pm
I was wondering if anyone has checked the "fix/cloth-stockpile" script to see if it's working right? I tried it last night but couldn't really tell that running the script made any difference. The dwarfs were still buggering the clothing stockpiles and several others. When the script is ran it does say that it fixed it and patched 752324 bad references in 22574 materials. According to DFHack it seems to fix the problem but I do not notice any fix in game. Am I doing something wrong?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 03, 2014, 03:21:02 pm
In general, "official" releases come from peterix, quietust, or angavrilov. Peterix started the project, but is mostly inactive these days and I got the impression he wants to be less involved for the forseeable future. It's open source so anyone could compile it and do a release of it. I got approval to make a semi-official r4 release, but since peterix didn't update the first post of the thread it led to some confusion.

https://github.com/DFHack/dfhack/graphs/contributors
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on May 04, 2014, 03:15:45 am
So I've been working on cleaning out the needs_porting folder (https://github.com/DFHack/dfhack/pull/234) - it turns out that a lot of the two-year-old plugins have already been replaced.  Having eliminated many of them, there's now seven which I'm not sure about.  Could someone with more knowledge of C++ or dfhack help out? 

Quote from:  Plugins I need checked before I delete
attachtest.py
- checks if dfhack is working with DF (i think)
- definitely replaced on windows, pretty sure also on other platforms

dfbauxtite.cpp
- as far as I can tell, this plugin changes the material of all mechanisms (printed string 'mechanisms', class 'item_trapparts') to Bauxtite; presumably from when this was the only magma-safe stone. 
- I don't know of a newer alternative, but it's not really neccessary anymore

digpattern.cpp
- I think all this one does is allow multi-z designations - no longer required.

drawtile.cpp
- draws changes to tiles
- I think this is replaced by tiletypes, but not sure

fix-3708.cpp
- fixes an issue with ghosts you can't engrave a slab for; some bad side-effects
- replaced by "tweak clear-missing" or "tweak clear-ghostly"? (I'm pretty sure it is, but not certain)

treedump.py
- looks like it outputs a list of trees in a given volume
- overlaps with 'prospect' and 'autochop'; probably does not need porting

veinlook.cpp
- I'm not sure what this does that "digv" and "reveal" don't but there must be something since it was around at the same time
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 04, 2014, 05:13:59 am
In general, "official" releases come from peterix, quietust, or angavrilov. Peterix started the project, but is mostly inactive these days and I got the impression he wants to be less involved for the forseeable future. It's open source so anyone could compile it and do a release of it. I got approval to make a semi-official r4 release, but since peterix didn't update the first post of the thread it led to some confusion.

https://github.com/DFHack/dfhack/graphs/contributors
When other people continue mods or projects, for example Splinterz with DwarfEngineers Therapist, they usually make a new thread. So... its maybe a bit lat for dfhack r4, but maybe r5 should get its own thread in future.
Title: Re: DFHack 0.34.11 r3
Post by: IndigoFenix on May 07, 2014, 01:27:40 pm
How do I get the name of a sphere based on its id number?
Title: Re: DFHack 0.34.11 r3
Post by: Roses on May 08, 2014, 01:58:18 pm
Does using dfhack.items.remove(item[, no_uncat]) make an item completely disappear?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on May 08, 2014, 02:01:46 pm
Does using dfhack.items.remove(item[, no_uncat]) make an item completely disappear?

What do you mean by "completely disappear"?
Title: Re: DFHack 0.34.11 r3
Post by: Roses on May 08, 2014, 02:10:17 pm
Does using dfhack.items.remove(item[, no_uncat]) make an item completely disappear?

What do you mean by "completely disappear"?

I mean remove it from the map, so no one can use it.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 08, 2014, 07:54:23 pm
Using "dfhack.items.remove(item, false)" will remove the item from existence, just as if you had atom-smashed it (though without a "masterwork destruction" event).
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 08, 2014, 08:45:39 pm
How do I get the name of a sphere based on its id number?

Code: (test.lua) [Select]
print(df.sphere_type[40]) --will print FORTRESSES
Title: Re: DFHack 0.34.11 r3
Post by: Roses on May 08, 2014, 10:17:51 pm
Using "dfhack.items.remove(item, false)" will remove the item from existence, just as if you had atom-smashed it (though without a "masterwork destruction" event).

Perfect, exactly what I wanted.
Title: Re: DFHack 0.34.11 r3
Post by: Lumify on May 12, 2014, 03:44:03 pm
The documentation for tiletypes is sparse, leaving me a few questions:

1. Is there a list of materials and shapes I can use for tiletypes?
2. Which raw file contains stone types?
3. Does the "light" flag automatically trigger the "above ground" flag, and does the "dark" flag automatically trigger the "subterranean" flag?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on May 12, 2014, 03:59:16 pm
1. All of the materials, i'm pretty sure.
2. inorganic_x
3. I'd assume no, since you can have "dark, above ground" in practice
Title: Re: DFHack 0.34.11 r3
Post by: Lumify on May 13, 2014, 01:25:04 pm
1. Where can I find a list of all materials and shapes in the game?
3. "Dark, above ground" is impossible without modding then, right? Which attribute enables miasma, "dark" or "subterranean"?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on May 13, 2014, 01:46:19 pm
1. Where can I find a list of all materials and shapes in the game?
3. "Dark, above ground" is impossible without modding then, right? Which attribute enables miasma, "dark" or "subterranean"?

1. The raw files
3. No, modding can't change things like that, just cover up a dug out hole with a bridge or whatever and now you have dark/above ground. Above ground seems to get stuck as a flag whenever it's there. Miasma is a flow.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on May 13, 2014, 03:05:52 pm
Yeah, no amount of floors or constructions can take away the "above ground" flag. Once it is set it is set for like. But light and dark are variable and will change depending on if you have something built above you that block the sun (which comes down directly above all the time).
Title: Re: DFHack 0.34.11 r3
Post by: Andux on May 13, 2014, 03:36:29 pm
Light/underground is the only combination which doesn't happen in the stock game.

Decaying items will only generate miasma if they are on a tile with the inside flag (which is separate from light and underground), though miasma can spread to outdoor tiles. IIRC, creatures with necrosis-type syndromes can generate miasma anywhere.

The "materials" used by tiletypes are not the same as the inorganic materials defined in the raws; internally, DF only gets the general class of material from the tile type itself, and determines the specific material based on biome, veins, etc.

Spoiler: tiletypes infodump (click to show/hide)
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 14, 2014, 08:00:21 am
There are 8 different combinations, and only some of them occur naturally:
* Outside Light Above Ground - Outdoors
* Outside Light Subterranean - Impossible
* Outside Dark Above Ground - Impossible
* Outside Dark Subterranean - Impossible
* Inside Light Above Ground - Constructed buildings on the surface
* Inside Light Subterranean - In version 0.23.130.23a and earlier, excavated tiles between the cave river and the cliff face (though the game didn't actually display tile attributes back then)
* Inside Dark Above Ground - In version 0.31.12 and earlier, obsidian towers built by the Goblins
* Inside Dark Subterranean - Underground tunnels, including most of your fortress

Being in the Dark causes cave adaptation to increase, and being Outside causes it to decrease (along with stunning/nausea if the sun is out).
Title: Re: DFHack 0.34.11 r3
Post by: Lumify on May 14, 2014, 01:57:11 pm
1. The raw files
3. No, modding can't change things like that, just cover up a dug out hole with a bridge or whatever and now you have dark/above ground. Above ground seems to get stuck as a flag whenever it's there. Miasma is a flow.

1. Which raw files?
3. Memory modding can change that; it can change anything really. I've read about the stuck "above ground" flag, and I've also read that the "light" flag is inseparable from the "above ground" flag in recent versions. This means that "light" is also a sticky flag then, right?
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on May 14, 2014, 02:24:01 pm
Putnam was referring to raw modding, not memory editing.

Shapes are in descriptor_shape_standard.txt. This wiki page (http://dwarffortresswiki.org/index.php/DF2012:Material_token) might help with materials. If you mean metals or stones, they're in the inorganic_* raw files (also on the wiki (http://dwarffortresswiki.org/index.php/DF2012:Stone), although you're better off grepping the raw files if you want a single/unformatted list).
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on May 14, 2014, 04:08:43 pm
Does DFHack have any power over the online help viewer? A simple Falconne-type search function would be nice.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 14, 2014, 10:19:21 pm
just cover up a dug out hole with a bridge or whatever and now you have dark/above ground.
No, cover it up with a bridge and you will get Inside Light Above Ground.

I've read about the stuck "above ground" flag, and I've also read that the "light" flag is inseparable from the "above ground" flag in recent versions. This means that "light" is also a sticky flag then, right?
Both "above ground" and "light" are permanent states - it is not possible through normal means to make a tile become "subterranean" or "dark". The only one you can change is "outside" versus "inside", and that's based on whether you've constructed a roof over it.
Title: Re: DFHack 0.34.11 r3
Post by: Helgoland on May 15, 2014, 06:07:33 am
What about casting obsidian outside, then excavating?
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 15, 2014, 07:03:20 pm
What about casting obsidian outside, then excavating?
It will still be Light Above Ground.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 16, 2014, 05:46:39 am
Can I somehow plant colonies or hives at a specific location with a specific hiveable creature? Like: Place "ANT_HONEY" colony at x:y:z?

I would like to make a little workshop that spawns colonies of it around it.

Second question: Any way to make hives work underground? I know it makes sense to only have bee-hives aboveground, but a hive of ants could be underground... any chance for that?
Title: Re: DFHack 0.34.11 r3
Post by: Erkki on May 16, 2014, 03:21:22 pm
FixGrowth and cleanowned basically fix and make 300-Dwarf multi-generation forts playable --> a happy long time user here. Thanks for this great tool!
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 16, 2014, 10:59:16 pm
FYI: http://www.bay12forums.com/smf/index.php?topic=138609.msg5286137#msg5286137

I have a lua script there that somewhat debugs a unit which should be receiving water/food, but isn't.

misc_trait_type 0 should be called GiveWaterCooldown
misc_trait_type 1 should be called GiveFoodCooldown

FAKEEDIT: https://github.com/angavrilov/df-structures/blob/master/df.units.xml#L1182
Wow, I didn't realize some people already knew about this.
I updated the bug report here: http://www.bay12games.com/dwarves/mantisbt/view.php?id=2606
Title: Re: DFHack 0.34.11 r3
Post by: Tabithda on May 19, 2014, 03:02:02 pm
Is there a currently script that marks ghosts as slabbed, or otherwise prevents ghosts from appearing?  If not, is it currently possible for such a script to be made?
Title: Re: DFHack 0.34.11 r3
Post by: Roses on May 22, 2014, 03:35:45 pm
I am having an interesting issue with my current upgradebuilding script. I am adding the items used in the reaction to the contained items of the new building, and everything is almost working correctly. They items are appearing in the building and they are unable to be used in other buildings/reactions, but when the building is de-constructed they do not appear on the map. Here is where it gets interesting though, you can't see the item, and it won't show in any locations, but if you try and build a new building or run a reaction that would use the item, the dwarf will go to where the building was de-constructed and grab it and use it normally.

Any ideas what might be going on there? I am thinking that since I am actually just creating the reagents over (via, df[]:new()) that there may be a flag I am missing. I am wondering now though, would it be easier to simply grab the items in the reaction itself, and if they have preserve_reagent on them, add them to the building? Is it possible to get the actual reagent from a completed reaction (e.g. <item_boulderst>)? This would save a lot of trouble.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on May 25, 2014, 08:17:49 am
is there a way to reduce embark size after embarking?  Like a dfhack tool that would truncate my land for me.
Title: Re: DFHack 0.34.11 r3
Post by: User2 on May 27, 2014, 01:06:03 am
Everyone who is mad of 30-item manager limit, has a good news. By patching the following offsets in memory:
0x6E61E5    75->EB
0x6E6301    02->03
Your job limit will be set to 999. I think it can be done using dfhack lua scripts. I am not good at lua-scripting, sorry.
PS. These offsets are for non-rebased image of the game (Base 0x400000).
Title: Re: DFHack 0.34.11 r3
Post by: Roses on May 27, 2014, 02:01:59 pm
Not sure if it has been talked about, or maybe even already changed, but it would be nice if \WORKER_ID and \UNIT_ID were combined into one, so that you didn't have to distinguish between reactions and interactions when working in the raws.

EDIT: Is it possible to destroy an already constructed building using DFHack? I know I can queue a building for deconstruction, but I was hoping to be able to get rid of the building instantly instead of having to wait for it to be deconstructed in game.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 28, 2014, 10:05:51 am
Everyone who is mad of 30-item manager limit, has a good news. By patching the following offsets in memory:
0x6E61E5    75->EB
0x6E6301    02->03
Your job limit will be set to 999. I think it can be done using dfhack lua scripts. I am not good at lua-scripting, sorry.
PS. These offsets are for non-rebased image of the game (Base 0x400000).
You should probably double-check your patches before you post them to the forum: the first line is bad because the original value is wrong (it's 7C, not 75), and the second line is bad because the address is wrong (it should be 0x6E6302, not 0x6E6301).

Also, this is obviously a Windows-only patch, so it can't be used on Linux or MacOS without further research.

[edit]

Patch for Linux:
0x5239C8 : 0F 4C -> 90 8B
0x523B08 : 02 -> 03

And for OSX:
0x5A5EDC : 0F 4C -> 90 8B
0x5A602A : 02 -> 03
Title: Re: DFHack 0.34.11 r3
Post by: User2 on May 28, 2014, 10:34:48 am
You should probably double-check your patches before you post them to the forum: the first line is bad because the original value is wrong (it's 7C, not 75), and the second line is bad because the address is wrong (it should be 0x6E6302, not 0x6E6301).

Also, this is obviously a Windows-only patch, so it can't be used on Linux or MacOS without further research.
Probably should. Probably. I guess nobody has blown his computer up due to the wrong offsets.
Actual data:
0x6E61E5   7C->EB
0x6E6302   02->03

Of course windows only. Linux & MacOS users can find it themselves as a summer holydays homework.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 30, 2014, 01:27:55 am
By request, a lua script with function to insert pets if they don't already exist
Note this won't add the creature to the wagon, pack, mount, minion, or exotic lists - just as a pet.
The code is rather unoptimized for CPU usage.

Code: [Select]
--comment


local function insertPet(alpha,beta,gamma)
local exists=false
for k,v in pairs(df.global.world.entities.all) do
--ENTITY TYPES
--Civilization 0
--SiteGovernment 1
--VesselCrew 2
--MigratingGroup 3
--NomadicGroup 4
--Religion 5
--MilitaryUnit 6
--Outcast 7
if v.type==0 and v.entity_raw.code==alpha then --exclude bandits
--print(k)
--printall(v.resources.animals)
for kk,vv in pairs(v.resources.animals.pet_races) do
--print(kk,vv,v.resources.animals.pet_castes[kk])
local checkrace = df.creature_raw.find(vv)
local checkcaste = checkrace.caste[v.resources.animals.pet_castes[kk]]
--print(checkrace.creature_id, checkcaste.caste_id)
if checkrace.creature_id == beta and checkcaste.caste_id == gamma then exists=true end
end
if exists==true then
print("ERROR- civilization ",alpha," has creature ", beta, gamma)
else
--the civ doesn't have the creature as a pet
--add the creature as a pet
local racenum=-1
local castenum=-1
for kk,vv in pairs(df.global.world.raws.creatures.all) do
--print(vv.creature_id)
if vv.creature_id==beta then
racenum=kk
--print(kk)
--printall(vv.caste)
for kkk,vvv in pairs(vv.caste) do
--print(vvv.caste_id)
if vvv.caste_id==gamma then castenum=kkk end
end
break
end
end
if racenum > -1 and castenum > -1 then
--print("success!!")
--print(v)
v.resources.animals.pet_races:insert('#',racenum)
v.resources.animals.pet_castes:insert('#',castenum)
print("Inserted ", beta, gamma, " in civ ",k, alpha)
else
print(beta, gamma, " not found in raws")
end
end
end
exists=false
end
end




--for example add CREATURE:DOG to ENTITY:PLAINS and CREATURE:HORSE to ENTITY:FOREST?
--As in: Humans have dogs and elves have horses

insertPet("PLAINS","DOG","MALE")
insertPet("PLAINS","DOG","FEMALE")
insertPet("FOREST","HORSE","MALE")
insertPet("FOREST","HORSE","FEMALE")
insertPet("MOUNTAIN","DRAGON","MALE")
insertPet("MOUNTAIN","DRAGON","FEMALE")
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 30, 2014, 04:54:10 am
By request, a lua script with function to insert pets if they don't already exist
Note this won't add the creature to the wagon, pack, mount, minion, or exotic lists - just as a pet.
The code is rather unoptimized for CPU usage.

Code: [Select]
--comment


local function insertPet(alpha,beta,gamma)
local exists=false
for k,v in pairs(df.global.world.entities.all) do
--ENTITY TYPES
--Civilization 0
--SiteGovernment 1
--VesselCrew 2
--MigratingGroup 3
--NomadicGroup 4
--Religion 5
--MilitaryUnit 6
--Outcast 7
if v.type==0 and v.entity_raw.code==alpha then --exclude bandits
--print(k)
--printall(v.resources.animals)
for kk,vv in pairs(v.resources.animals.pet_races) do
--print(kk,vv,v.resources.animals.pet_castes[kk])
local checkrace = df.creature_raw.find(vv)
local checkcaste = checkrace.caste[v.resources.animals.pet_castes[kk]]
--print(checkrace.creature_id, checkcaste.caste_id)
if checkrace.creature_id == beta and checkcaste.caste_id == gamma then exists=true end
end
if exists==true then
print("ERROR- civilization ",alpha," has creature ", beta, gamma)
else
--the civ doesn't have the creature as a pet
--add the creature as a pet
local racenum=-1
local castenum=-1
for kk,vv in pairs(df.global.world.raws.creatures.all) do
--print(vv.creature_id)
if vv.creature_id==beta then
racenum=kk
--print(kk)
--printall(vv.caste)
for kkk,vvv in pairs(vv.caste) do
--print(vvv.caste_id)
if vvv.caste_id==gamma then castenum=kkk end
end
break
end
end
if racenum > -1 and castenum > -1 then
--print("success!!")
--print(v)
v.resources.animals.pet_races:insert('#',racenum)
v.resources.animals.pet_castes:insert('#',castenum)
print("Inserted ", beta, gamma, " in civ ",k, alpha)
else
print(beta, gamma, " not found in raws")
end
end
end
exists=false
end
end




--for example add CREATURE:DOG to ENTITY:PLAINS and CREATURE:HORSE to ENTITY:FOREST?
--As in: Humans have dogs and elves have horses

insertPet("PLAINS","DOG","MALE")
insertPet("PLAINS","DOG","FEMALE")
insertPet("FOREST","HORSE","MALE")
insertPet("FOREST","HORSE","FEMALE")
insertPet("MOUNTAIN","DRAGON","MALE")
insertPet("MOUNTAIN","DRAGON","FEMALE")
Thank you. I will do some tests today and let you know how it goes. :)

Quote
Note this won't add the creature to the wagon, pack, mount, minion, or exotic lists - just as a pet.
Wagon, Pack and Mount is clear to me. But Minion and Exotic? I assume that Minion = For example trolls in goblin sieges. And Exotic is just exotic pets, which atm does not mean a big difference.

Is it impossible to add pack or mount or wagon animals for traders, or just something that this specific script cant do, but potentially could be written?
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 30, 2014, 08:56:22 am
...
Thank you. I will do some tests today and let you know how it goes. :)

Quote
Note this won't add the creature to the wagon, pack, mount, minion, or exotic lists - just as a pet.
Wagon, Pack and Mount is clear to me. But Minion and Exotic? I assume that Minion = For example trolls in goblin sieges. And Exotic is just exotic pets, which atm does not mean a big difference.

Is it impossible to add pack or mount or wagon animals for traders, or just something that this specific script cant do, but potentially could be written?

I presume there could be something written such as "if this creature has the appropriate wagon/pack/mount tokens, also add it to those lists". See also https://github.com/angavrilov/df-structures/blob/master/df.entities.xml#L324
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on May 30, 2014, 10:44:32 am
I assume that Minion = For example trolls in goblin sieges. And Exotic is just exotic pets, which atm does not mean a big difference.
Minion is indeed for trolls in goblin sieges. Exotic, I'm not 100% certain about.

Is it impossible to add pack or mount or wagon animals for traders, or just something that this specific script cant do, but potentially could be written?
There's no reason why it can't be done - in fact, the old "fixwagons" plugin I wrote for version 0.31.25 used this exact same method to add wagons to Human and Dwarven civilizations.  Additionally, if you add wagons to Elven civilizations, I'm pretty sure they will use them - though their ethics prevent them from being given access to wagons, they do not prevent them from using wagons if they are given access to them by other means.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on May 30, 2014, 11:01:21 am
Quietust: I dont know if you are aware, but my mod includes several races you can play. So my intention is to give one race access to one type of wagon, pack, pull, pet and mount animal (and now minion, since that is pretty neat). And give another race access to other types. And now the important part: Without any of the pets be available to multiple civs.

In the beginning I could use entity tags for this, use cavern, good, evil animals, but with 6 playable races (and more enemy-only ones), this has become impossible.

Maybe I should open a new thread, and ask around if anyone wants to work on the script. Its quite useful for mods with a lot of different invaders, for example Fortress Defense.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 30, 2014, 08:43:52 pm
By request, a lua script with function to insert pets if they don't already exist
Note this won't add the creature to the wagon, pack, mount, minion, or exotic lists - just as a pet.
The code is rather unoptimized for CPU usage.

That's a nice script, and with the examples it's clear how to use it, but you really should name your variables better. Among mathematicians it's traditional to make variables meaningless one character symbols, but among programmers it's necessary to make it very clear what things are supposed to be (in case you didn't know, not a passive-aggressive comment).
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on May 31, 2014, 02:46:00 pm
By request, a lua script with function to insert pets if they don't already exist
Note this won't add the creature to the wagon, pack, mount, minion, or exotic lists - just as a pet.
The code is rather unoptimized for CPU usage.

That's a nice script, and with the examples it's clear how to use it, but you really should name your variables better. Among mathematicians it's traditional to make variables meaningless one character symbols, but among programmers it's necessary to make it very clear what things are supposed to be (in case you didn't know, not a passive-aggressive comment).

If you mean the function arguments, I copied that part from a template lua function, and didn't get around to changing it. "Replace with" in notepad can fix that quickly. I tend to make things work first before making them look better. Engineer, not programmer.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on May 31, 2014, 09:53:53 pm
I only criticized because people would likely copy+paste your script verbatim, which would make their stuff slightly harder to understand for new modders looking at examples, or worse, teach bad habits about variable naming. The (untested) "corrected" code is below:

Code: [Select]
--comment


local function insertPet(entity,creature,caste)
local exists=false
for k,v in pairs(df.global.world.entities.all) do
--ENTITY TYPES
--Civilization 0
--SiteGovernment 1
--VesselCrew 2
--MigratingGroup 3
--NomadicGroup 4
--Religion 5
--MilitaryUnit 6
--Outcast 7
if v.type==df.historical_entity_type.Civilization and v.entity_raw.code==entity then --exclude bandits
--print(k)
--printall(v.resources.animals)
for kk,vv in pairs(v.resources.animals.pet_races) do
--print(kk,vv,v.resources.animals.pet_castes[kk])
local checkrace = df.creature_raw.find(vv)
local checkcaste = checkrace.caste[v.resources.animals.pet_castes[kk]]
--print(checkrace.creature_id, checkcaste.caste_id)
if checkrace.creature_id == creature and checkcaste.caste_id == caste then exists=true end
end
if exists==true then
print("ERROR- civilization ",entity," has creature ", creature, caste)
else
--the civ doesn't have the creature as a pet
--add the creature as a pet
local racenum=-1
local castenum=-1
for kk,vv in pairs(df.global.world.raws.creatures.all) do
--print(vv.creature_id)
if vv.creature_id==creature then
racenum=kk
--print(kk)
--printall(vv.caste)
for kkk,vvv in pairs(vv.caste) do
--print(vvv.caste_id)
if vvv.caste_id==caste then castenum=kkk end
end
break
end
end
if racenum > -1 and castenum > -1 then
--print("success!!")
--print(v)
v.resources.animals.pet_races:insert('#',racenum)
v.resources.animals.pet_castes:insert('#',castenum)
print("Inserted ", creature, caste, " in civ ",k, entity)
else
print(creature, caste, " not found in raws")
end
end
end
exists=false
end
end




--for example add CREATURE:DOG to ENTITY:PLAINS and CREATURE:HORSE to ENTITY:FOREST?
--As in: Humans have dogs and elves have horses

insertPet("PLAINS","DOG","MALE")
insertPet("PLAINS","DOG","FEMALE")
insertPet("FOREST","HORSE","MALE")
insertPet("FOREST","HORSE","FEMALE")
insertPet("MOUNTAIN","DRAGON","MALE")
insertPet("MOUNTAIN","DRAGON","FEMALE")
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 01, 2014, 11:02:06 am
Minor improvement: "if v.type==0" to "if v.type==df.historical_entity_type.Civilization". When possible, always use enum types instead of magic numbers.
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 01, 2014, 11:25:19 am
Fixed.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 01, 2014, 06:02:53 pm
I tested the script, and it works. With OnLoad.init in the raw folder even automatically when the game is loaded. Otherwise people would have to run the script manually.

Next logical step would be adding functionality for minions, pack, pull and mounts. And wagons. Especially the mount and minion is interesting for enemies, and pack/pull/wagons for allies.

One other thing I would like to test is if this allows adding pets to civs on the fly, while a game is running. Lets say you trade with humans. You try to order "Mastiffs" from humans, but obviously they dont have any. But your civ has some, and you can bring 2 to a specific workshop and run "trade a breeding pair of Mastiffs to the humans". This runs the script, and adds the creature mastiff to the human civ. Next time their liaison comes by, you try to order pets, and oh wonder, they do have access to mastiffs now.

You could also periodically upgrade the enemy. First siege of creature X has no mounts. But they have an interaction that runs this script with SyndromeTrigger and add mounts to their sieges. Second siege has these mounts. Now the mounts have an interaction that targets the creature riding it and gives another interaction, that unlocks the next difficulty of mounts. Third siege might have these better mounts then. Or minions. Same thing.

Edit: I assume its not as easy as making a copy of the script and replacing all pet_races and pet_castes with wagon_races and wagon_castes, or minion_races and minion_castes, etc. ?
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 01, 2014, 09:21:06 pm
In light of the planned July 1 release (yay!), can we please do an official dfhack r5 sometime in June? 
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 01, 2014, 10:21:45 pm
One other thing I would like to test is if this allows adding pets to civs on the fly, while a game is running. Lets say you trade with humans. You try to order "Mastiffs" from humans, but obviously they dont have any. But your civ has some, and you can bring 2 to a specific workshop and run "trade a breeding pair of Mastiffs to the humans". This runs the script, and adds the creature mastiff to the human civ. Next time their liaison comes by, you try to order pets, and oh wonder, they do have access to mastiffs now.
I'm fairly certain that it does.

I assume its not as easy as making a copy of the script and replacing all pet_races and pet_castes with wagon_races and wagon_castes, or minion_races and minion_castes, etc. ?
That's exactly what you need to do.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 02, 2014, 05:01:56 am
I assume its not as easy as making a copy of the script and replacing all pet_races and pet_castes with wagon_races and wagon_castes, or minion_races and minion_castes, etc. ?
That's exactly what you need to do.
Neat. Just to make sure, the correct lines are :
mount_races/castes
pack_races/castes
pull_races/castes
minion_races/castes
wagon_races/castes
exotic_races/castes (or maybe pet_exotic_races/castes?)
Title: Re: DFHack 0.34.11 r3
Post by: meeneque on June 02, 2014, 05:50:22 am
Does embark anywhere work anymore? Or do I have to play with memory (offset not found)? I couldn't find any coherent answer.
Thanks.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 02, 2014, 06:46:13 am
Does embark anywhere work anymore? Or do I have to play with memory (offset not found)? I couldn't find any coherent answer.
Thanks.

The standalone utility should work, but it's not ideal.  There's also the "embark" script (iirc it is in r3), which should let you embark on sites etc.  A comprehensive embark plugin has recently been finished and is waiting for a release of dfhack r5. 
Title: Re: DFHack 0.34.11 r3
Post by: meeneque on June 02, 2014, 07:44:17 am
The standalone utility should work, but it's not ideal.  There's also the "embark" script (iirc it is in r3), which should let you embark on sites etc.  A comprehensive embark plugin has recently been finished and is waiting for a release of dfhack r5.

I was talking about script - it doesn't work for me.
As for standalone utlity - which one is it?

Thx
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 02, 2014, 08:07:15 am
Neat. Just to make sure, the correct lines are :
mount_races/castes
pack_races/castes
pull_races/castes
minion_races/castes
wagon_races/castes
exotic_races/castes (or maybe pet_exotic_races/castes?)

They're all in here (https://github.com/angavrilov/df-structures/blob/master/df.entities.xml#L324).
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 02, 2014, 08:13:08 am
Thank You. :)
Title: Re: DFHack 0.34.11 r3
Post by: Quarterblue on June 02, 2014, 03:05:42 pm
In light of the planned July 1 release (yay!), can we please do an official dfhack r5 sometime in June?
I guess there won't be a dfhack r5 now that an actual release that would break everything is so soon.
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on June 02, 2014, 03:27:44 pm
In light of the planned July 1 release (yay!), can we please do an official dfhack r5 sometime in June?
I guess there won't be a dfhack r5 now that an actual release that would break everything is so soon.
Actually, there is an active discussion on IRC about releasing r5 (the current estimate is around two weeks). We want a release before the next DF release so it isn't delayed further by the need to update DFHack's memory structures.
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 02, 2014, 03:47:28 pm
That is very good news. I support a dfhack r5 for 34.11. :)
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 02, 2014, 04:09:47 pm
Current plan is that I'll do it and make a new thread and everything in two weeks unless someone else does it first.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 02, 2014, 06:46:38 pm
I know it's a lot of work, so thanks!
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 03, 2014, 11:53:53 am
Thank you Urist DaVinci, Expwnent and Quietust. I did do some testruns with the pet, minions, puller/packer/wagons that are added by script. It works as advertised and allows many new features. Gnomish steamtanks as wagons, pulled by steamengine creatures... or orc sieges that suddenly bring squads of ogres, cyclops and minotauri along, just like goblins bring trolls. It is all very, very neat. :)
Title: Re: DFHack 0.34.11 r3
Post by: Severedicks on June 03, 2014, 12:09:38 pm
Is there a changelog of what will be new in r5?
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on June 03, 2014, 01:51:34 pm
https://github.com/DFHack/dfhack/blob/develop/NEWS
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 03, 2014, 08:28:16 pm
Thank you Urist DaVinci, Expwnent and Quietust. I did do some testruns with the pet, minions, puller/packer/wagons that are added by script. It works as advertised and allows many new features. Gnomish steamtanks as wagons, pulled by steamengine creatures... or orc sieges that suddenly bring squads of ogres, cyclops and minotauri along, just like goblins bring trolls. It is all very, very neat. :)

It occurred to me that they would be missing animal products - all your meats, leathers, cheeses, wool, etc. is tracked elsewhere in the entity resources structure (so it doesn't have to be recalculated after worldgen).
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 04, 2014, 03:08:49 am
Thank you Urist DaVinci, Expwnent and Quietust. I did do some testruns with the pet, minions, puller/packer/wagons that are added by script. It works as advertised and allows many new features. Gnomish steamtanks as wagons, pulled by steamengine creatures... or orc sieges that suddenly bring squads of ogres, cyclops and minotauri along, just like goblins bring trolls. It is all very, very neat. :)

It occurred to me that they would be missing animal products - all your meats, leathers, cheeses, wool, etc. is tracked elsewhere in the entity resources structure (so it doesn't have to be recalculated after worldgen).
I checked the embark, the leathers, meat, cheese, wool... its all still there. No issues.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 04, 2014, 03:07:31 pm
It occurred to me that they would be missing animal products - all your meats, leathers, cheeses, wool, etc. is tracked elsewhere in the entity resources structure (so it doesn't have to be recalculated after worldgen).
I checked the embark, the leathers, meat, cheese, wool... its all still there. No issues.
If the civilization already had access to the creature by other means, then you'll be fine, but if you were adding a special creature (e.g. no biomes) to pack/pull/mount/pet/minion then its products will NOT be automatically included - I just checked the code, and I can't find evidence of that being done afterwards, so you do need to add those yourself, and doing it correctly is a bit complicated:

Code: [Select]
* If the civilization has USE_ANIMAL_PRODUCTS:
** if the creature/caste lacks CAN_LEARN or the civ's ethic for EAT_SAPIENT_OTHER is set to ACCEPTABLE, REQUIRED, or PERSONAL_MATTER:
*** add to fish_races/fish_castes if it has FISHITEM
*** add to egg_races/egg_castes if it has LAYS_EGGS
*** for each entry in caste_raw.unknown2.materials where the entry in caste_raw.unknown2.unk_2f30 is zero:
**** for every reaction product that the material has:
***** if the reaction product ID matches any reaction that produces SKIN_TANNED (e.g. TAN_A_HIDE), add the product material to resources.organic.leather
**** if the material has the MEAT flag, add it to resources.misc_mat.meat
**** if the material has the LEATHER flag, add it to resources.misc_mat.leather and resources.misc_mat.crafts
**** if the material has the BONE flag, add it to resources.misc_mat.crafts and resources.refuse.bone
**** if the material has the SHELL flag, add it to resources.misc_mat.crafts and resources.refuse.shell
**** if the material has the PEARL flag, add it to resources.misc_mat.crafts and resources.refuse.pearl
**** if the material has the HORN flag, add it to resources.misc_mat.crafts and resources.refuse.horn
**** if the material has the TOOTH flag, add it to resources.misc_mat.crafts and resources.refuse.ivory
*** add caste_raw.unknown2.mat_type/mat_index to resources.misc_mat.meat
** add each material from caste_raw.extracts.extract_mat/matidx to resources.misc_mat.extracts
** if caste.extracts.milkable_mat/matidx is valid, add it to resources.misc_mat.extracts if valid
** if the entity has PERMITTED_JOB:SHEARER and PERMITTED_JOB:SPINNER:
*** for each entry in caste_raw.shearable_tissue_layer, add all shearable YARN tissue materials to resources.organic.wool (part_idx/unk_8 into body_info.body_parts[], then layer_idx/unk_18 into body_part_raw.tissue_id, then that tissue_id into creature_raw.tissue[] to get the mat_type/index)
** if caste.extracts.blood_mat/matidx is valid, add it to resources.misc_mat.extracts if valid
** if caste.extracts.webber_mat/matidx is valid and made of SILK, add it to resources.misc_mat.crafts and resources.organic.silk
** for each entry in caste_raw.body_info.attacks
*** add each value for specialattack_mat_type/index to resources.misc_mat.extracts, though to avoid bug #1044 you should first make sure the corresponding specialattack_type is equal to INJECT_EXTRACT (0) and the matter state is not equal to GAS (2)
** for each entry in caste_raw.secretion, add mat_type/index to resources.misc_mat.extracts if the matter_state is not equal to GAS (2)
** if you added an entry to resources.misc_mat.extracts that has a CHEESE_MAT reaction product, add that product material to resources.misc_mat.cheese
Title: Re: DFHack 0.34.11 r3
Post by: Quarterblue on June 04, 2014, 03:59:08 pm
https://github.com/DFHack/dfhack/blob/develop/NEWS
I see a lot of scripts such as what was made by Urist Da Vinci (or forumdwarves or "text will be text") are not included. Will they be compatible?
Title: Re: DFHack 0.34.11 r3
Post by: scamtank on June 04, 2014, 07:37:26 pm
If they're just little ruby or Lua scripts, most likely. If they're actual plugins in .dll form, no.
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 04, 2014, 10:08:02 pm
https://github.com/DFHack/dfhack/blob/develop/NEWS
I see a lot of scripts such as what was made by Urist Da Vinci (or forumdwarves or "text will be text") are not included. Will they be compatible?

If the lua scripts used game data which was named "unk_*" or "anon*" or similar, it may have been renamed in r5. This would happen if we had discovered recently what the data does, and gave it a proper name. This would break the script temporarily until the new name was used.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on June 04, 2014, 11:58:32 pm
is there a way to resize farms using dfhack.  Kind of like how I can cut away pieces of zones and/or stockpile areas.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on June 05, 2014, 10:08:31 am
is there a tree array in the df structures I can cycle through?

I'm hoping to type up a script that applies a chance of upgrading saplings to trees.

I'd also like a small chance to spawn saplings at a nearby radius (say a 2 step distance from the source tree, I would have to check if the destination tile is currently on map and a conditional check if it's a soil based tile with no existing tree/sapling).  The second question is a little more difficult, however... if the trees had stored x,y coordinates in the array (if not, then I would need a way to extract x,y cordinates after being able to identify trees in some structure, and create my own array, say trees[], that has member variables {sapling/tree status, x,y coordinates}.

I was looking at the structures...

has trees and saplings defined

https://github.com/DFHack/df-structures/blob/master/df.plant-raws.xml

and soil is defined here
https://github.com/DFHack/df-structures/blob/master/df.tile-types.xml

now just need to be able to do a get x,y function.

Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 05, 2014, 12:30:57 pm
is there a tree array in the df structures I can cycle through?

I'm hoping to type up a script that applies a chance of upgrading saplings to trees.

I'd also like a small chance to spawn saplings at a nearby radius (say a 2 step distance from the source tree, I would have to check if the destination tile is currently on map and a conditional check if it's a soil based tile with no existing tree/sapling).  The second question is a little more difficult, however... if the trees had stored x,y coordinates in the array (if not, then I would need a way to extract x,y cordinates after being able to identify trees in some structure, and create my own array, say trees[], that has member variables {sapling/tree status, x,y coordinates}.

I was looking at the structures...

has trees and saplings defined

https://github.com/DFHack/df-structures/blob/master/df.plant-raws.xml

and soil is defined here
https://github.com/DFHack/df-structures/blob/master/df.tile-types.xml

now just need to be able to do a get x,y function.
The actual "tree" structure is in https://github.com/DFHack/df-structures/blob/master/df.plants.xml (https://github.com/DFHack/df-structures/blob/master/df.plants.xml), but it's also used for shrubs so you'll need to take that into account.

The global list of all plants is here (https://github.com/DFHack/df-structures/blob/master/df.world.xml#L572), but creating new trees from scratch requires following certain steps exactly or you will corrupt your savegame. For reference, those steps are correctly followed in this (https://github.com/DFHack/dfhack/blob/develop/plugins/plants.cpp#L221) plugin command.
Title: Re: DFHack 0.34.11 r3
Post by: Nopenope on June 05, 2014, 01:11:26 pm
Is there a manual of some kind to write plugins/scripts or a repository that keeps track of all of them?
Title: Re: DFHack 0.34.11 r3
Post by: Putnam on June 05, 2014, 01:30:12 pm
https://github.com/DFHack/dfhack
Title: Re: DFHack 0.34.11 r3
Post by: Nopenope on June 05, 2014, 01:55:06 pm
It doesn't contain all the scripts, far from it, and it only provides documentation for lua (no ruby/python/c++).
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 05, 2014, 02:10:30 pm
It doesn't contain all the scripts, far from it, and it only provides documentation for lua (no ruby/python/c++).
It's the official repo. See the develop branch for new stuff. Also there is no python bindings (afaik) and c++ part is mostly comment-documented and i learned by examples/hanging out in the irc and bugging the people that know stuff. As for ruby bindings (I forget who wrote it) they are really similar to lua.
Biggest problem is that you need to know df very intimately to do stuff. And there is just so much to know... I mean here (https://github.com/DFHack/df-structures/) is the data structures but still there are strange ways df is doing stuff. AFAIK there is no easy way. Also i should have written many tutorials and maybe someday i will until then i'll repeat myself: check other people scripts (especially the official repo ones, they might be nicer, more correct, etc...), bug people (especially in irc, though remeber timezones, and patience), play with gui/gm-editor - that is the thing i made for myself to check stuff out, and edit df on the fly and soon you'll be writing next great total conversion that allows you to build rockets and crash moons into enemy forts.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 05, 2014, 05:36:16 pm
It doesn't contain all the scripts, far from it,

If there are scripts that you think should be there, open an issue and it should happen eventually. 
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on June 05, 2014, 06:10:30 pm
is there a way to show the raw entry for a workshop job?  Often I'm wondering what skill/labor does a job (in a mod).
Title: Re: DFHack 0.34.11 r3
Post by: DracoGriffin on June 06, 2014, 06:13:08 am
Code: [Select]
Invoking: gui/workflow
Cannot find material: COAL:COKE
Cannot find material: COAL:COKE
...rf Fortress\Dwarf Fortress\hack\scripts/gui/workflow.lua:950: invalid constraint: BAR//COAL:COKE
stack traceback:
[C]: in function 'setConstraint'
...rf Fortress\Dwarf Fortress\hack\scripts/gui/workflow.lua:950: in function <...rf Fortress\Dwarf Fortress\hack\scripts/gui/workflow.lua:949>
[C]: in function 'on_submit'
...rf Fortress\Dwarf Fortress\hack\scripts/gui/workflow.lua:351: in function 'on_activate'
...k Dwarf Fortress\Dwarf Fortress\hack\lua\gui\widgets.lua:322: in function <...k Dwarf Fortress\Dwarf Fortress\hack\lua\gui\widgets.lua:318>
(...tail calls...)
...asterwork Dwarf Fortress\Dwarf Fortress\hack\lua\gui.lua:472: in function <...asterwork Dwarf Fortress\Dwarf Fortress\hack\lua\gui.lua:467>
(...tail calls...)
[C]: in ?
Invoking: gui/workflow

Didn't see a specific thread for Workflow (other than extremely old) so posting here; this was the version packaged with Masterwork v5.02 on Dwarf Fortress 0.34.11
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 06, 2014, 08:15:47 am
By any chance did you attempt to invoke gui/workflow before you actually loaded your fortress?
Title: Re: DFHack 0.34.11 r3
Post by: DracoGriffin on June 06, 2014, 08:25:34 am
No, this was quite into the game. Save file here (http://dffd.wimbli.com/file.php?id=8617).

The link was for a separate issue but the workflow issue also came up.
Title: Re: DFHack 0.34.11 r3
Post by: darthbob88 on June 06, 2014, 12:41:37 pm
I've had the same issue, also well into the game, and only if I use the GUI. If I set limits on coal through the command line, using " workflow count BAR//COAL 20 ", no problems. I think the problem is that the job-scraper is getting the wrong material for the product, as terrifically helpful as that is.
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on June 07, 2014, 04:30:29 pm
What source file contains grow for growing saplings into trees?
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on June 07, 2014, 04:41:24 pm
plugins/plants.cpp (develop branch (r5) (https://github.com/DFHack/dfhack/blob/develop/plugins/plants.cpp) | master branch (r3-4) (https://github.com/DFHack/dfhack/blob/master/plugins/plants.cpp))
Title: Re: DFHack 0.34.11 r3
Post by: MeMyselfAndI on June 07, 2014, 05:03:11 pm
Is there a way to get the actual value of a room?

Related: is there a way to get the directionality of an engraving?
Title: Re: DFHack 0.34.11 r3
Post by: thistleknot on June 07, 2014, 10:58:21 pm
I've had no migrants for a long while.  I'm wondering is their a dfhack way to exploit my status as a new embark?  I have the dwarf # limited to 40 dwarf's, I don't think changing that value either in memory, or in the .ini will have an affect, as I'm still under that number.  I think the problem is actually not doing well with trading with other civilizations (probably my home civ).

Is there a way to hack my home civ's regard to myself, and if so where?

Update:

I used force caravan player to force a diplomat.  I then proceeded to trade with him to his advantage, yet skipped out on meeting the diplomat who left unhappy, and I GOT MIGRANTS!
Title: Re: DFHack 0.34.11 r3
Post by: Roses on June 08, 2014, 11:48:49 am
Is it possible to assign pets to particular dwarfs using DFHack? I am thinking for the spawn script it might be nice to have the spawn become attached to the casting dwarf (like a mages familiar).
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 08, 2014, 01:45:25 pm
Is it possible to assign pets to particular dwarfs using DFHack? I am thinking for the spawn script it might be nice to have the spawn become attached to the casting dwarf (like a mages familiar).
Yes - create a pet_info record, fill in all of the appropriate fields, insert the record into ui.pet_info, then create specific_refs to it from the pet itself (using type PETINFO_PET) and the owner (using type PETINFO_OWNER). Of course, you'll also want to generate a name for the pet, though this is beyond the scope of this post.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on June 08, 2014, 03:09:12 pm
Thank you Urist DaVinci, Expwnent and Quietust. I did do some testruns with the pet, minions, puller/packer/wagons that are added by script. It works as advertised and allows many new features. Gnomish steamtanks as wagons, pulled by steamengine creatures... or orc sieges that suddenly bring squads of ogres, cyclops and minotauri along, just like goblins bring trolls. It is all very, very neat. :)

Three questions about this;
1. Does this mean that you can make civs bring along creatures that normally do not appear in the game? (i.e. don't have any BIOME tags).
2. What happens if you use it on creatures without the [PET] token (or any of the other similar tokens)?
3. What happens if you use it on a creature that is INTELLIGENT and a member of another civ? Can you have human sieges bring along squads of elves?

Is it possible to assign pets to particular dwarfs using DFHack? I am thinking for the spawn script it might be nice to have the spawn become attached to the casting dwarf (like a mages familiar).
Yes - create a pet_info record, fill in all of the appropriate fields, insert the record into ui.pet_info, then create specific_refs to it from the pet itself (using type PETINFO_PET) and the owner (using type PETINFO_OWNER). Of course, you'll also want to generate a name for the pet, though this is beyond the scope of this post.

I've never worked with specific_refs before, is there anything special that needs to be done with them, or is it just like creating new records and inserting them into the pet and owner?
Title: Re: DFHack 0.34.11 r3
Post by: Meph on June 08, 2014, 03:12:29 pm
Quote
Three questions about this;
1. Does this mean that you can make civs bring along creatures that normally do not appear in the game? (i.e. don't have any BIOME tags).
2. What happens if you use it on creatures without the [PET] token (or any of the other similar tokens)?
3. What happens if you use it on a creature that is INTELLIGENT and a member of another civ? Can you have human sieges bring along squads of elves?
1, Yes, 2, It acts as pet, 3, It should act as pet as well.

I have one issue with it, and thats that the pack/pull animals dont work, they do get added, but the caravans arrive completely empty. So pack/pull has to be done the normal way.
Title: Re: DFHack 0.34.11 r3
Post by: Quietust on June 08, 2014, 04:00:41 pm
I have one issue with it, and thats that the pack/pull animals dont work, they do get added, but the caravans arrive completely empty. So pack/pull has to be done the normal way.
In what way is the caravan "empty"? Do they not have pack animals at all, or are they not carrying anything?

If the latter, there are two possibilities that come to mind:
1. You forgot to set a TRADE_CAPACITY, though it should default to 1000 if not specified
2. The civilization doesn't have any actual trade goods at all, which shouldn't really happen unless you haven't given them any of the various tokens (STONE_PREF, GEM_PREF, USE_ANIMAL_PRODUCTS, INDOOR_FARMING, OUTDOOR_FARMING, INDOOR_WOOD, OUTDOOR_WOOD, and USE_MISC_PROCESSED_WOOD_PRODUCTS).
Title: Re: DFHack 0.34.11 r3
Post by: Urist Da Vinci on June 08, 2014, 08:08:10 pm
Quote
Three questions about this;
1. Does this mean that you can make civs bring along creatures that normally do not appear in the game? (i.e. don't have any BIOME tags).
2. What happens if you use it on creatures without the [PET] token (or any of the other similar tokens)?
3. What happens if you use it on a creature that is INTELLIGENT and a member of another civ? Can you have human sieges bring along squads of elves?
1, Yes, 2, It acts as pet, 3, It should act as pet as well.

I have one issue with it, and thats that the pack/pull animals dont work, they do get added, but the caravans arrive completely empty. So pack/pull has to be done the normal way.

1. Yes
2. Civs will bring those creatures to the map in caravans or as migrant pets, and you can embark with them. Their actual behaviour on-map is governed by the tokens, so they won't act like creatures with the [PET] token AFTER they arrive.
3. Yes, I have brought elves and they show up as "tame elf" that appear in the citizens list (not the pets list). They may have AI bugs due to not being the fort race - Toady really ought to allow multicultural forts.

4. I had elves pulling dwarf caravan wagons; I don't recall it requiring anything special to work.
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on June 10, 2014, 04:10:52 am
fun fact for any future Dfhack users DO NOT SUMMON GODS INTO THE MORTAL REALM in attempts to talk to them
it will only end with them being HELLA PISSED OFF and not in any mood to talk at all.
how I did this well I fiddle with one of the blank historical units in adventure mode figuring since they don't really have an important soul I could cram a deity into them
also just as some weird idea figure if I reload the map it would 'fix' any errors I would get by changing the historical unit id.

well this happen when I did this on a farmer
(http://www.truimagz.com/host/fortcrush2/de/really-dont-talk-to-gods.png)
Now I'm currently running away from a freshly awoken deity I should have learn better not to play god.
Title: Re: DFHack 0.34.11 r3
Post by: palu on June 12, 2014, 10:40:46 am
Are there any plans to add support for any othe scripting languages to DFHack?
Title: Re: DFHack 0.34.11 r3
Post by: Nopenope on June 12, 2014, 11:20:51 am
I think Ruby is supported and I'm pretty sure I saw a few Python scripts laying around, though they might have been out-of-date. But I think the hard part isn't Lua (which is a fairly intuitive and straightforward language, on top of being perfectly adapted to plugins) but the API and complex data structures. I've been trying to wrap my head around these recently but the sheer amount of information to know is daunting, and there's no scripting language that can fix that.
Title: Re: DFHack 0.34.11 r3
Post by: Roses on June 12, 2014, 11:40:34 am
Yeah, I had never used lua before I started scripting for DFHack, and it was a lot easier to learn that then it was to start piecing together the complexity of the API and DF itself.
Title: Re: DFHack 0.34.11 r3
Post by: indyofcomo on June 14, 2014, 09:18:38 am
Quote from: dfhack readme
{...}putting fix/cloth-stockpile enable in dfhack.init makes it run automatically.

Is this possible with any dfhack command? Like the tweaks?
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on June 14, 2014, 09:27:40 am
Anything in dfhack.init will be run when DFHack starts, so you can enable tweaks there, for example, to avoid having to enable them manually. Other plugins can be enabled on startup as well - see dfhack.init-example for examples (r3 (https://github.com/DFHack/dfhack/blob/0.34.11-r3/dfhack.init-example), r4+ (https://github.com/DFHack/dfhack/blob/master/dfhack.init-example))
Title: Re: DFHack 0.34.11 r3
Post by: FallenAngel on June 14, 2014, 06:53:18 pm
I read somewhere that it is possible to, using adv-bodyswap, to completely take over someone's body and have it not revert when you press Esc. I can't find any way to actually do that, however.
That's mostly because I want to cause Fun. Any help?
Title: Re: DFHack 0.34.11 r3
Post by: Roses on June 14, 2014, 09:34:54 pm
Is there a flag or anything that gets changed/set when the day, month, year, etc... changes? And I didn't see anything in the eventful documentation, but is it possible to attach an trigger to the changing of those things?
Title: Re: DFHack 0.34.11 r3
Post by: indyofcomo on June 14, 2014, 09:55:31 pm
How does the autolabor decide which dwarves to turn on labors for?
Title: Re: DFHack 0.34.11 r3
Post by: Quarterblue on June 15, 2014, 07:33:48 am
Current plan is that I'll do it and make a new thread and everything in two weeks unless someone else does it first.
HYPE
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 15, 2014, 08:18:56 am
Current plan is that I'll do it and make a new thread and everything in two weeks unless someone else does it first.
HYPE
Hmm, that's only two days away. Hype!
Title: Re: DFHack 0.34.11 r3
Post by: FallenAngel on June 17, 2014, 07:45:20 am
Hey, here's a question for you.
What is the "was worried not to have adequate protection" mean in regards to dfhack, since its vanilla context doesn't exist at the moment?
Also, is dfhack related to my never-tired race complaining of being tired without having the "Tired" notification pop up in their Wounds?
Title: Re: DFHack 0.34.11 r3
Post by: expwnent on June 17, 2014, 09:45:08 am
There's tiredness and sleepiness. It's possible your dwarves have one but not the other.

Adequate protection refers to the fortress guard, I believe.
Title: Re: DFHack 0.34.11 r3
Post by: FallenAngel on June 17, 2014, 09:53:23 am
I guess I'll have to wait until we surpass 50, since currently the fort is in Summer and at 11 citizens.
I'm running my own mod, by the way, which leaves dwarves as an option (I'm playing as the Risens).
In the meantime, they'll have to cope with nobody but a lack of things to oppose us.
Title: Re: DFHack 0.34.11 r3
Post by: danaris on June 17, 2014, 07:02:17 pm
Hey, here's a question for you.
What is the "was worried not to have adequate protection" mean in regards to dfhack, since its vanilla context doesn't exist at the moment?

I believe that has to do with using the "siren" command to zap your dwarves out of sleep or break. It gives a bad thought to sort of balance out the usefulness of the command, I guess, and that one isn't used for much else in vanilla.
Title: Re: DFHack 0.34.11 r3
Post by: WillowLuman on June 17, 2014, 07:06:23 pm
Why not just use the "Woken up by noise recently" one?
Title: Re: DFHack 0.34.11 r3
Post by: lethosor on June 17, 2014, 07:08:42 pm
It triggers that thought as well - the "worried not to have adequate protection" thought is only triggered under a specific set of conditions, namely https://github.com/DFHack/dfhack/blob/develop/scripts/siren.lua#L91
Title: Re: DFHack 0.34.11 r3
Post by: Warmist on June 18, 2014, 12:48:51 am
Here's an idea: a plugin that allows nestboxes to be claimed by civ members (and then manages their eggs).
Title: Re: DFHack 0.34.11 r3
Post by: Rumrusher on June 19, 2014, 08:11:17 pm
Here's an idea: a plugin that allows nestboxes to be claimed by civ members (and then manages their eggs).
a plugin that allows you to shove eggs created by reactions or bought, into a nestbox.
Title: Re: DFHack 0.34.11 r3
Post by: PeridexisErrant on June 19, 2014, 09:40:06 pm
An upgrade to autonestbox that can deal with more than one box per pasture, and doesn't require that the one box be in the correct corner.  Because just slappig down a room full of nests and a single pasture would be a lot easier, and it's a tool to prevent micromanagement. 
Title: Re: DFHack 0.34.11 r3
Post by: peterix on June 20, 2014, 12:43:48 pm
A new thread has been made for dfhack 0.34.11 r5 and newer. (LINK) (http://www.bay12forums.com/smf/index.php?topic=139553.0)