$ ./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]#
Looking good. First time looking at this.You don't need allegro. It's statically linked to the stonesense plugin. You need libjpeg8 AFAIK.
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. Thebuild 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.
Looking good. First time looking at this.You don't need allegro. It's statically linked to the stonesense plugin. You need libjpeg8 AFAIK.
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. Thebuild 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.
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).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.
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.
This is excellent.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 :)
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.
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 :)
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'?
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.
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 :)
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)
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.
rth (use the alias)
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.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.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.
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)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.
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?
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?
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.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.
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.
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 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 :<
My linux box is pretty much an always updated Arch machine.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!
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...
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/
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:Ok. That's something I haven't seen yet. Some options here:
Cannot load image: stonesense/stonesense.png
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.
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.I compiled stonesense seperately a while ago and it still works fine.Spoiler (click to show/hide)
stonesense.png is in the stonesenese folder that was the first thing I checked since if it was missing I could just replace it.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:Ok. That's something I haven't seen yet. Some options here:
Cannot load image: stonesense/stonesense.png
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.
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 withQuote~/stonesense/stonesense &I was able to run stonesense without the font error usingQuotecd 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 can confirm Stonesense works with r5. Thanks Peter.Good to hear that :)
I can confirm Stonesense works with r5. Thanks Peter.Works for me too. Screenshot below.
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 :)
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.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)
Reminds me... I wonder if creaturemanager (is worth porting/will be ported) to the new system. Although I will miss my batchfiles. 8)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.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)
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.
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.
liballegro.so.5.0: cannot open shared object file: No such file or directory
Stonesense plugin won't load, the log saysDwarf Fortress is 32-bit - therefore, so is Stonesense, so having the 64-bit Allegro library won't do you any good.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?
the only way I see any one getting into that is if they happen to use runesmith to kill someone.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.
the cure was to revive one goblin and hope he scatters off on his own.
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.
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.
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 >_>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.
posting to keep track of the threadJust so you know, there's a "Notify" button that lets you do that without having to post to the thread...
Peter, great stuff you've come up! After installing libjpeg8 and trying to load stonesense, i get in the stderr.log:Yes, you need the 32bit version of the library. You'll probably also need a few others: libfreetype.so.6 and libpng12.so.0
libjpeg.so.8: wrong ELF class: ELFCLASS64
Any idea? I'm using Ubuntu 11.04 x64.
Thanks!
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.
Do I need to generate a new world to use this?No. You just need the SDL version of DF 31.25.
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.
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?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.
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.
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:
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:
Any fortress made in version 0.31.18 or earlier will exhibit several significant problems if you upgrade: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.
* 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
Hi, I was wondering how to interpret the results from the 'flows' tool.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 :)
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.)
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.
Really, you'd have better luck from a trained monkey.
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.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?
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.
Also, would auto-designation of spheres be a possible feature? 3d shapes would be of great help for, say, mining.Yes :)
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?
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)
quick question about the qtplug test:Hmm... what? It works only in MSVC 10.
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 :-[
thanks for the answer.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
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.Interesting idea. It should work I guess. You can use Windows Mutex locks for syncing the files.
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...In this case, it's the pipes that are missing. Anything too OS-specific will be swiftly kicked out of the dfhack project though.
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.
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.
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)
And stop by in #dfhack on freenode. There's plenty of friendly people there :)
Anyway, whatever you come up with, keep me posted :)
ok, so after several hours of trial and error in msvc 2008This 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:
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.
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
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.
Do you still take suggestions on what tools to add?I think it was named Dtil
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?
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?Sure. It's quite possible to do that :)
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?
* Highly useful instructions *
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.
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.
Where do I download the other parts, like DFmode?
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.
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 :)
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.
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. ;)
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.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:
Also, on the very very tiny chance that that might provide some pointers: Are the python bindings i saw traces of actually functional still?
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.zmq uses a network port and I won't have to deal with it manually... at least that's the idea.
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.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.
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. :(
A nice thing about the current DFHack is the fact that you can extend it with pluginsI see how that's nice, but in all honesty, my C knowledge extends about as far as that it comes after B. :)
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. :oOh, 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.
ummm...I tried that already, it says nothing to unrevealPoint the 'k' cursor at a floor that should be visible, run 'revflood'. You can use the same to hide stuff after re-walling.
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.
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.
I've written a new plugin for DFHack, called seedwatch, which is for fortress mode.Awesome :)
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:Yes. That can be fixed. I'll look at it today.
- 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).
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.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.
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.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 :)
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.
(except when your dwarves eat the seeds raw - can't help with that!)Not a problem, dwarves don't eat raw seeds. :)
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.
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.
spotclean makes me a very happy person. Thank you.I'm glad to hear that :)
Could I request a tool that automatically marks all tree saplings and uncollected webs as high movement cost?Hmm... yes. I see the how that could be useful :)
Should prevent them from being trampled so much.
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)Could I request a tool that automatically marks all tree saplings and uncollected webs as high movement cost?Hmm... yes. I see the how that could be useful :)
Should prevent them from being trampled so much.
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: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.
~/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.
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
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
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.
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.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.
Could I request a tool that automatically marks all tree saplings and uncollected webs as high movement cost?I can probably get that done tomorrow night.
Should prevent them from being trampled so much.
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.
Could I request a tool that automatically marks all tree saplings and uncollected webs as high movement cost?I can probably get that done tomorrow night.
Should prevent them from being trampled so much.
@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?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.
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.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 :)
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:Yeah... I started using some C++11 features - auto, lambdas (abusing them in vdig, really), nullptr and a few others.
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
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)
so should I pick up r7d? or continue with r7r7d is r7 with bugfixes - they are functionally the same. It shouldn't be any problem to update :)
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 :)
//
#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;
}
I think it might be possible, maybe, by using the liquid passability flags.
Peterix, I have a feasibility question.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.
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?
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 :)
Yes, is there a way to get a log or something?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?
Sort of. Look for stderr.log in your DF folder. Hopefully it's not empty ~_~Yes, is there a way to get a log or something?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?
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.QuoteSort of. Look for stderr.log in your DF folder. Hopefully it's not empty ~_~Nope, can't find it. Nor can Windows search. :(
Wow, that was quick. Thanks!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.
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.
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.
hmm so r8 for those who paid for Minecraft right?
Ok, new release, again!
What kind of CPU do you have?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?
I guess we finally tracked down the problem. I checked what flags does my build system pass to gcc, and among them are these:What kind of CPU do you have?
AMD Athlon XP 3000+. Yes, it's old.
'-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.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.
It ran fine and made a world but it hilariously killed most of the grass (in chunks) as it did so.
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.
I updated the Linux build (revision 8a now). It's now built for i686 CPUs and should work fine.
More weirdness...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.
#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'.
Then run 'g++ --save-temps -fverbose-asm test.cpp'. This will produce a bunch of files. Post 'test.s'.
.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
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.
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",
Here are the results of running the world in minecraft.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.
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.Yes it is a rectangular map (4x3).
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.
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.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.Yes it is a rectangular map (4x3).
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.
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).Also everything (walls, floors, ramps) in this picture is made of gold blocks and does not appear gold.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.
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.
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.
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.
That report is from the same fortress.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.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.
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
<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.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 tried moving the cursor to different points. I always die and have to respawn (at a different random point for each world).
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 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
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.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.
1. I'm pretty sure the number of embark points is a 32-bit (4 byte) value
[SEGMENTSIZE_XY:70]
[SEGMENTSIZE_Z:4]
I wanted to inspect my construction, unfortunately lower levels are hidden - why?Too eager occlusion culling algorithm (culling tiles that aren't occluded ~_~)
(http://www.img.ie/images/9a7b6.png) (http://www.img.ie/)
Problem persists after changing cube sizeCode: [Select][SEGMENTSIZE_XY:70]
[SEGMENTSIZE_Z:4]
- Is t possible to modify hardcoded job priorities to avoid "disable all labors on broker" ceremony etc
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.
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?
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.
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 ;)
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.
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.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.
The other stonesense branch is officially dead, buried, and unsupported.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.
This is the only branch that will be updated to future versions.
I'll try to get in contact with Jonask and tell him to log on and change the OP.Done.
0.31.25 r8:Is there somewhere a compiled version of this?
Windows version (with Stonesense and DFusion) (https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r8-Windows.zip)
0.31.25 r8:Is there somewhere a compiled version of this?
Windows version (with Stonesense and DFusion) (https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r8-Windows.zip)
The strange thing there are no .exe, only .lua .xml .dll.0.31.25 r8:Is there somewhere a compiled version of this?
Windows version (with Stonesense and DFusion) (https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r8-Windows.zip)
That is the compiled version.
The strange thing there are no .exe, only .lua .xml .dll.0.31.25 r8:Is there somewhere a compiled version of this?
Windows version (with Stonesense and DFusion) (https://github.com/downloads/peterix/dfhack/dfhack-0.31.25-r8-Windows.zip)
That is the compiled version.
How do i launch it?
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.
Just run DwarfFortress.exeOh, i'm stupid. Sorry. :D
A DFHack terminal window will also appear.
No one's wearing any of the new clothing, it's a literal nudist colony now. :(Save your fort, wait for the full graphic release in 2055, load. PROFIT!
Any ideas?
No one's wearing any of the new clothing, it's a literal nudist colony now. :(Save your fort, wait for the full graphic release in 2055, load. PROFIT!
Any ideas?
DOUBLEPROFIT!Be careful what you wish for. You might get a fort full of ugly.No one's wearing any of the new clothing, it's a literal nudist colony now. :(Save your fort, wait for the full graphic release in 2055, load. PROFIT!
Any ideas?
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.Alright. I'll look at it. Got some free time :)
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?
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.
Alright. I'll look at it. Got some free time :)
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.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)
The same happens when you have too much saved games. (More than 40-50 for me)
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?
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?
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".
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.
Did you follow the included instructions for installing it?Yes and yes.
Did you read any of the included documentation?
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.
<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.<material val="26" opacity="15" partlit="1">bed</material>
and the bed appeared at the expected location.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)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).
Any ideas on why/how I can fix this?
Suggestion:That's a very nice idea.
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.
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.
@CardinalI assume you meant to direct that statement to peterix.
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
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.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
Any progress on the DFHack Client/Server with ZMQ and Proto?
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.
I seem to be having an issue here, on startup and in stderr.log it prints:Is memory.xml actually in the "hack" subfolder? If not, you didn't install DFHack correctly.
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?
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.
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.
"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.
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.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.
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.
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)
Just read on github: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).Quote from: angavrilovImplement 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
Just tried the tool - very cool it looks.or you could just use Dfusion go to the Tools menu.
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.
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.Just tried the tool - very cool it looks.or you could just use Dfusion go to the Tools menu.
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.
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.
◦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.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 :)
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
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
[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?
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.
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.
So any news on Fixed dwarf fortresses, Fixed elven fields, Fixed goblin towers?I'd say wait for the next DF release.
Tiletypes is confusing me. A lot. Maybe not just me, seeing some messages in this thread.The problem is that the way this works in DF is pretty confusing and the tool doesn't even try to hide that.
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"?
paint sh wall
paint m soil
This will turn tiles into soil walls.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)filter sh ANY
filter sh SAPLING_OK
paint sh TREE_OK
Turning saplings into trees!filter mat VEIN
filter sh FLOOR
paint sh WALL
Replace mined out veins with walls.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 ;)
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
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.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?
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.
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).
Tools like IDA Pro, evan's debugger, gdb and a few others.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?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
git clone git://github.com/peterix/dfhack.git
cd dfhack
git submodule init
git submodule update
Then go into library/xml/ and: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
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.
/me hopes he didn't miss anythingTechnically, you don't need to get all of DFHack - you just need df-structures:
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.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.
Where i can find marerials id ? For example to change a log material from mapple to oak. Searching the dfhack sourcecode gives nothing :(.
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.
std::string description;
item->getItemDescription(&description, 0);
c->con.print("0x%x %s (wear %d)",
item,
description.c_str(),
item->getWear()
);
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?
MaterialInfo info;
info.decode(item);
c->con.print("Item is made of %s\n", info.toString().c_str());
prospector tool now works in the embark screenmisunderstood this. It's sweet!
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
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.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.
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
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.
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_POTOdd, I tried that. I'll try again. Thanks.
TOOL:ITEM_TOOL_LARGE_POTOdd, I tried that. I'll try again. Thanks.
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".'k' should work.
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.Hmm? Oh.
DOUBLE-EDIT: How do I set up a workflow to dye thread?
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.
its probably still too early to know...but does it still work with the current version or will it require 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.
yea...figured i'd just try it anyways...doesn't work, so i guess i'll have to wait for an update...
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.
PTF for new version... :)
is there any starting point on how to develop a dfhack plugin?This, please!
Yes - it's called the "skeleton plugin", and it can be found in a subdirectory of the plugins source directory.
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.
In some sense, dfhack is a memory hack, so your virus scanner is completely correct.
Wishing this would work.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.
I need my prospect. :(
Wishing this would work.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.
I need my prospect. :(
Whining about it won't help.
BUT IT'S SO SHINYTrue, 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 ::)
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).
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
here is a rough guide to explain how to change from adventure mode to fort mode and vice versaSpoiler (click to show/hide)
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 reposthere is a rough guide to explain how to change from adventure mode to fort mode and vice versaSpoiler (click to show/hide)
What do you mean when you say "undesignate the whole map" and how do you remove the resident tag?
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
I dislike this new DFhack. I much preferred the older one that worked straight out of the box.What's that supposed to mean?
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.
I dislike this new DFhack. I much preferred the older one that worked straight out of the box.What's that supposed to mean?
I dislike this new DFhack. I much preferred the older one that worked straight out of the box.What's that supposed to mean?
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).
we'll be releasing a mini version in the next couple days or so.
Um... you don't have to compile it.
You copy it into your DF folder and run it.
run DF.
Then a window will pop up beside it where you enter commands.
run DF.
Then you didn't install it right.
Then it pops up an error.Then you didn't install it right.
Or they're using the most recent version of DF, which r9 doesn't work with.
You apparently are too lazy to read instructions, otherwise you wouldn't be having issues right now.run DF.
Then a window will pop up beside it where you enter commands.
Not for me.
we'll be releasing a mini version in the next couple days or so.
Whatever happens to actually run... it might even be quite complete. Obviously, the bugfix plugins that are no longer needed will be gone :)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?
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 :)
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 :)
Almost there. Things just need a few tweaks and testing :)Looking forward to it! Any chance on an ETA?
Almost there. Things just need a few tweaks and testing :)
2000 microline, blood everywhere, hundreds upon hundreds of useless pieces of goblinite, owned clothes strewn all over my fortress.
DFHack save me!
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.
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.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.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!!
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.hauling it is just impossible.No it isn't - you're just not trying hard enough.
(while I am aware this is dreadfully off topic)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.hauling it is just impossible.No it isn't - you're just not trying hard enough.
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 :(
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 >:DYou just love teasing the impatient, don't you? :P
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
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.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.
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?
Nevermind, found the culprit. It's not DFHack, ARB_SYNC just doesn't work anymore with the latest NVIDIA release.
Good news is that there's a new 'follow' command/plugin that makes the screen always centered on a creature of your choosing :)
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
Thanks for the new release. I can finally play DF2012 without rage quitting ;DSame here.
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.
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".
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".
PRAISE ARMOK! dfhack has returned! thank you to peterix and the team =] if you'll excuse me ladies and gentlemen, my fortress calls
Any ideas?
I've been running for a few hours with no troubles. This is with a laptop and limited RAM.
Very thankful for this. Vdig is what I use most, and having it back is amazing~Noted, will be there in the future :)
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.
Always say which OS you are on. There are differences between Windows and Linux DFHack :)
Wrote you a PM, but might have been overlooked.Yep. Already replied. It's an interesting idea and should be possible to do.
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.
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.
yes, you can have engraved trees, and the game treats them as such.If you cut them down, is the lumber engraved? :)
yes, you can have engraved trees, and the game treats them as such.If you cut them down, is the lumber engraved? :)
I want engraved trees ^^ A bit elvish, but hey.
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.
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
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 thatThen use autodump. It's like teleporting items.
try 'revflood' command
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.
How do I dig out veins with this new command prompt version? The old one I just clicked the exe
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'Try specifying INORGANIC or INORGANIC:NONE for the material - that's how the game itself keeps track of generic "rock" items.
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.
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?
GAHHH!!!A new version should be available within an hour. Be patient.
Doesnt work with 34.03
Now, 3 days without dfhacks :( Imagine how long it would take to update runesmith
Thank you for this amazing utility. I'm not sure I can play now without DFHack! :DYou'll love the mysterious construction then :)
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! :DYou'll love the mysterious construction then :)Spoiler (click to show/hide)
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
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
For some reason building from git fails with this error:You don't have all the code. Use this first: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
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.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.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
keybinding A job-material ORTHOCLASE
then request a list, it puts 'job-material' and 'ORTHOCLASE' on different lines. Adding ':' seems to change it, but not make it work. What do?
How do you utilize keybinding? When I tryLike this:Code: [Select]keybinding A job-material ORTHOCLASE
then request a list, it puts 'job-material' and 'ORTHOCLASE' on different lines. Adding ':' seems to change it, but not make it work. What do?
keybinding set A "job-material ORTHOCLASE"
keybinding clear A
And then bind the command to something else. Like for example 'Shift-A', 'Alt-A' or 'Ctrl-A'.Changevein, huh?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 ;)
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?
Something else I've been meaning to ask.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.
The fixdiplomats funtion, does it give the player trade agreements with the elves, or do they just annoy with logging quotas?
Something else I've been meaning to ask.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.
The fixdiplomats funtion, does it give the player trade agreements with the elves, or do they just annoy with logging quotas?
Something else I've been meaning to ask.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.
The fixdiplomats funtion, does it give the player trade agreements with the elves, or do they just annoy with logging quotas?
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
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.
Game proceeds to load up normally then. Any pointers?
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]#
34.04 data structures on the other hand are identical to 34.03.
You'll need an updated symbol file : https://raw.github.com/angavrilov/df-structures/a20d8fb6720e13393ba4133bb579612e7bdfe500/symbols.xml34.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.
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.
on a side note, tell me your secret to finding the cur_year offset! :DThat 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.
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!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.
I wish this forum had an animated smiley face for :ROFL: :DDude, shut up! You should be milking this!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.
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!
trying job-material SILVER for an iron mail shirt returns"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.
Job Item 0 has different material: coal
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)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).
Any ideas on why/how I can fix this?
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.
Can someone do a better guide of the tyletypes command? I saw peterixs examples way back in september but this thing is really confusing.
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.
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.
I don't know if it matters, but adamantine isn't recognized under a vdig command, or vein dig command.
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.
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...
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 =)
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).
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
You may also want to try: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.
paint special wet [Enter] (I don't know if wet will help fertility)
Arg! I am having a particular stressful issue, and I would like to confirm if Pre-Embark "Prospect all" is accurate or not?
normally I'd say use liquids to magma the creature, but since this is a ghost, I don't know.
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.
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)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 ...
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)
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.
where should i put the save? compressed or not?
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.
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.
so using dfhack, could i create hematite walls somehow?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.
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.
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?
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.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...
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?tiletypes, yes.
I guess tiletypes can do something like that, but I got some hematite going, thanks
paint sh wall
filter sh floor
filter mat mineral
Then paint over the vein.
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.
Any tips on how to use workflow to automatically process pig tails (spin) and sweet pods (syrup)?
workflow amount THREAD//GRASS_TAIL_PIG:THREAD 5
workflow count LIQUID_MISC//POD_SWEET:EXTRACT 5
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?
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.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.
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.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.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.Spoiler (click to show/hide)
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.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 :)
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.
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.
Horn silver is most definitely a mineral, so it ought to be detecting it. What's the exact error message you're getting?
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.
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 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.
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,
New DF is out. Time for update!But it's a(fun exciting features someone reported as) bug fix patch.
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.
....only in DF.Nah, "there is no kill like overkill" predates DF 8)
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.
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.
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
Will DFHack need an updated build for 34.05, or just an updated xml file?
I miss it already :(
Will DFHack need an updated build for 34.05, or just an updated xml file?
I miss it already :(
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!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 :)
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.
did you try die?QuoteOne 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.
SWEET!!! thanks man!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.
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
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...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 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.
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.
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.
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.QuoteOne 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.
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.
can't i just create my own free fuel babyvolcano with dfhacks liquids?
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.
actually, there is an experimental build that does the equivilant of replacing the dll, unless I mis-understand the purpose of the eggy branch.
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.
#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
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.
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 :)
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?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.
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 :)
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:
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!
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 :)
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).QuoteThe 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.
Spoiler is your friend. Also code blocks, you've got a fair amount of cool looking faces there.
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.you are better off using the Code function.
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)
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).QuoteThe 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.
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:
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.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 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.
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!
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.
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. 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.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
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.
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.
Thank you so much! Makes much more sense to me now :)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"
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?
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?
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.
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.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.
Now that I have breached the magma sea i have no message, and no unlocking of magma buildings.
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.
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.
So you are saying that simply adding the "old" regrass to 34.05 would not work? It was working fine up to 34.04.All it was doing was creating "generic" grass that would likely disappear after a single bite and probably not provide any significant nourishment.
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.
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.
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.
How can I toggle off that thing what shows lower z-levels in paler colors?
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.
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.
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)
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?
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.
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...
check the workflow command. I think that's what it doesI 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.
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.
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 had something strange happen when using the liquids plugin which I don´t really understand: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.
- 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?
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.
workflow count BAR//ASH 50 having 30 WOOD
# Coal is more important
workflow count BAR//COAL 50 having 15 WOOD
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.
Code: [Select]workflow count BAR//ASH 50 having 30 WOOD
# Coal is more important
workflow count BAR//COAL 50 having 15 WOOD
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.
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.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 :DSpoiler (click to show/hide)
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.
workflow amount BLOCKS 100 20
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.
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. :Sdflair will be back in the DFHack next release.
What is the syntax for designating a workflow order on bags?
What is the syntax for designating a workflow order on bags?
Example: workflow count BOX/YARN 30
Bags are BOX.
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.
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).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. :Sdflair 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).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. :Sdflair will be back in the DFHack next release.
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.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).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. :Sdflair will be back in the DFHack next release.
Already in. adv-bodyswap
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!
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.
You most definitely can. Here's how: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.
#Pig Tail
# PlantProcess
workflow amount THREAD//GRASS_TAIL_PIG:THREAD 100 10
# job item-material 1 GRASS_TAIL_PIG
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.
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.
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.
We're working on it guys :)
Should be available tomorrow, unless something horrible happens.
I find most of them in the raws. Haven't been able to find milk yet. For mechanisms, you want TRAPPARTS.
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.
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. ::)
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".Reading comprehension.
At least I think it's "job-material" but I may have mispelt it. Use "ls" to list commands, it should be very similar.
What we have here is a failure to communicate.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".Reading comprehension.
At least I think it's "job-material" but I may have mispelt it. Use "ls" to list commands, it should be very similar.
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?
The spinning comeback strikes the tahujdt in the ego, fracturing the supposed superiority and bruising the dignity! tahujdt has been struck down.
The spinning comeback strikes the tahujdt in the ego, fracturing the supposed superiority and bruising the dignity! tahujdt has been struck down.
Good sportsmanship
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.
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?
... I'm glad it's not my job to update it.
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: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.
- git
- cmake
- perl with XML::LibXML and XML::LibXSLT
- MSVC++ 2010 (on Windows) or GCC (on Linux)
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.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".
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.
Is this the one? http://www.bay12forums.com/smf/index.php?topic=104015.0
Glad I could help.Is this the one? http://www.bay12forums.com/smf/index.php?topic=104015.0
That's the one! Thx. :)
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.
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.
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 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...
cd dfhack/build
setarch i386 cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=~/df_linux
setarch i386 make install
http://zalil.ru/32962130Hooray, vdig is up again! Thanks alot!
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
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
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.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.
Whew, I've been needing vdig, I had forgotten how much useless stone I end up with without it lolI 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.
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.
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.
It would still be vastly preferable to allow redirecting output to a file for a single command.
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 veinvdig isn't really realistic. Doubt it'll be in vanilla.
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?
Toady has already said that he wants to include a variety of vdig that will assign new designations as they're uncovered.Hmm.. maybe have it more accurate the higher the miner skill is.
Also, Dwarves are the children of the earth. I think they could figure out how a vein acts without digging it empty.
Toady has already said that he wants to include a variety of vdig that will assign new designations as they're uncovered.Hmm.. maybe have it more accurate the higher the miner skill is.
Also, Dwarves are the children of the earth. I think they could figure out how a vein acts without digging it empty.
I digress, though. This is off-topic (I think).
Waiting for DFhack to be released to the latest version. :O
Toady has already said that he wants to include a variety of vdig that will assign new designations as they're uncovered.Hmm.. maybe have it more accurate the higher the miner skill is.
Also, Dwarves are the children of the earth. I think they could figure out how a vein acts without digging it empty.
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.
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.
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.
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
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.
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.
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.
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.
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.
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?
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?
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.
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.
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.
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.
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.
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.
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.
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?
so, when you have a lot of masonry work to be done it looks for the most likely targets (eg, idlers)?
sounds cool, but I wouldn't want it to select miners for me.
probably under an hour.
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
Alright guys, another day, another release ;)
EDIT 2: Complete off-topic:
Why your avatar changes every 10 minutes?
Is there any work being done on migrating DFHacks new format into the old .xml format so that Runesmith can be updated?
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 thisNo, it won't. It will screw up all your labor settings and not put them back.
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.
Alright guys, another day, another release ;)HammerDave was ecstatic to make a new acquisition! 8)
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
I think that it may be a good idea to remove fixwagons plugin as Toady ported this to DF.
Thanks thats what i kinda figured i spent to much time with dgc to do that ah well maybe in a future releaseI'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 thisNo, it won't. It will screw up all your labor settings and not put them back.
I notice DFHack is now openning TCP port 5000 for access?
@HugoLuman: it was included in the .06 update.Yeah, but it crashes the game when I attempt to use it
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.
may be dfhack related, may be not: while abandoning the fortress, dwarf fortress crashed.
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.
Both are v0.34.07.SDL?
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.
If it wasn't SDL, it wouldn't be loading DFHack.Both are v0.34.07.SDL?
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.
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?
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.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.
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.
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
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? :-\use revforget
I am using Windows 7
Err... What happened to regrass? i used so much it.
I miss it :'(
/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
What's with this error? I'm trying to compile from git.Update your submodules.Code: [Select]error: ‘struct df::item_flags::<anonymous>’ has no member named ‘garbage_collect’
git submodule update
git pull
cd build
make
make install
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.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.
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
Is it possible to run dfhack without having it take over the console window (linux)?If it takes over the terminal in TEXT mode, then that's a bug. Does it?
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?
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.
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
When I try and run DFHack 0.34.04 on ubuntu 11.10 i'll get:Is there anything in stderr.log?
...
When I try and run DFHack 0.34.04 on ubuntu 11.10 i'll get:Is there anything in stderr.log?
...
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:
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
stderr.log contains the following, after booting DF and loading a game:OK.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:
<md5-hash value='f4fc83475f9fdaa645f3217c57458235'/>
Thanks Rum.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.
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,
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
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!
Hi,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 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
DFHack is ready. Have a nice day!
Type in '?' or 'help' for general help, 'ls' to see all commands.
[DFHack]#
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.Check if you have a file named stderr.log in your DF and if yes, post the contents.
And when I launch "dfhack" and in another console I launch "dfhack-ran prospect all" it will write that about localhost...
Hey
Is there a way to hide map again when i saved my game with revealed map?
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.
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.
don't save a revealed map.
This bears repeating.don't save a revealed map.
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...
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...
DWARF
DOG
DOG
... <4 more times>
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:Mine currently looks like this:Code: [Select]DWARF
DOG
DOG
... <4 more times>
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
Yeah i should get around writing a normal readme.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:Mine currently looks like this:Code: [Select]DWARF
DOG
DOG
... <4 more times>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?
DWARFshould work. Use it just before pressing 'e' to embark (in area selection menu).
CAT
CAT
DOG
DOG
DOG
DOG
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.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.
it's looking for the number 1
just press 1 for simple embark.
Multi race embark.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.
By saying 'e' i meant in df itself.
DWARF:1
CAT:2
CAT:2
DOG:1
DOG:1
DOG:2
DOG:2
DF/dfusion/embark/races.txt is as shown above.castes are usually 0 and 1, not 1 and 2Ah, list sequences. Silly me. -1 to all and it ran! My dogs now have names ._.
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 cursorI 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.
hmmmm, seems someone forgot the executable for the current windows version... only has dfhack-run.exe :/ anyone feel like pm'ing me a copy?
@tapeworm: try using changelayer on the aquifer, change it to a material that cannot contain an aquifer and see what happens
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?
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 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.
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.
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?
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?
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.
Awesome
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?
<...>Could be shortened to:
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
dfuse "dofile('fixmigrant.lua')"
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.
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)
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.
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.
#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).
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.
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.
does a possibility to teleport a creature exists with DFHack?well dfusion kinda had a warp ability for adventure before, but it will take some time to rewrite that function for new dfusion.
If not, does a possibility to create a wall from thin air & instantly exists?
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.
Yeah. This is close enough ;) It's a serialization/deserialization thing with the objects described in a custom language.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:Nope. It's basic TCP sockets. We dropped zmq after it became evident that it just isn't the right tool for the job.
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 :)
I'm having some trouble running this.
Whenever I open the command prompt window, it instantly closes.
but the only one which made any sense didn't apply to me, as it involved a registry entry I don't have.
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.QuoteWhenever 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.Quotebut 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 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?
It was suggested that I post this here, from the Fortress Mode forums.dwarfexport is what you want. Then, just write a script to process the XML to a csv and import it into Excel.Quote from: GahaganI'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?
OK guys, new release is out, along with a whole lot of new tools and improvements, many new automation tools included.Fixed.
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 greatresponsibilitymass 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.
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?
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.
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.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)
Looks like vdig didn't end up in this release for some reason.
It was suggested that I post this here, from the Fortress Mode forums.dwarfexport is what you want. Then, just write a script to process the XML to a csv and import it into Excel.Quote from: GahaganI'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?
Where does dwarfexport place the XML file it generates? I'm not able to find it.
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
The new animal management stuff is super great! I might actually breed animals, now. Thanks everyone! :D
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 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!
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?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.
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.
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: 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?
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, 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?
So I tried the new autolabor plugin. I like it.You can exclude specific labors or set the maximum number of dwarfs to assign to any particular labor.
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.
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.
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.
You can exclude specific labors or set the maximum number of dwarfs to assign to any particular labor.
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...
dfusion folder, best to stick this in tools/init.lua file.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?
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 :-*
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).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.
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 :-*
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.
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.
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.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.
Ok, I made it work. But three things.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.
[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.
./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: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
Everything builds fine, with some warnings about tile_designations.h and enums that I hope are not relevant to my interests.
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)
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)
Is there a utility for measuring the populations of creatures on a map?
QuoteThere'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?I'm sorry, I must not have set out my question properly :)
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).
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.
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).
cmake .. -DCMAKE_BUILD_TYPE:string=Relase -DCMAKE_INSTALL_PREFIX=(my DF folder)
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!
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.
libprotoc.so: undefined reference to 'pthread_once'
collect2: ld returned 1 exit status
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
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:Looks like broken multilib support or some packaging issue. Are you sure you have all the multilib gcc packages?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 directory
I 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.
ia32-libs
ia32-libs-gtk
gcc-4.4-multilib
g++-4.4-multilib
libxml-libxml-perl
lib32z-dev
libxml-libxslt-perl
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?
Sorry to pop in the midst of this discussion, but is there any repositories for cool DFusion plugins?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)
Also, is there plugins to restore those old dummied out Mountain Halls and Goblin towers from early versions?
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.
Is there a way to back out of a utility, like liquids, so I can use other functions again?Q or quit
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)
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).
Can you not manually allow it under the Stones menu?
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.
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.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?
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.
Did you copy the contents of the dfhack zip file into the df directory and replace the SDL.dll?Ah, silly me thinking it should go in the utilities of LNP. Thanks.
Because that's where MSVCP100.dll is. In the df directory.
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.
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.
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.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.
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.
How do I make permanent keybinds?
I want this: V "digv"
Is there a way?
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.
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.Caldfir's dwarves look rather complete and were merged to main version according to Github. So they should be in the next DFhack release.
The new version was just released yesterday, and it takes time to find the data structure offsets and update the various structure layouts.I never said GIVE ME THE UPDATE NAW!, I just said I missed the digv plugin >:(
Quit being so impatient.
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.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.)
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.
So.
Is the OP dead? Where the hell is my update..?
So.
Is the OP dead? Where the hell is my update..?
Dear sir, I do believe that is a mandate.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.
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.
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?
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.
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.
You'll need to use angavrilov/df-structures (https://github.com/angavrilov/df-structures/) instead of the default submodule.
git remote add quietdust https://github.com/quietust/df-structures.git
This one is currently slightly more up to date than angavrilov's one. If you want the one quietdust pointed to, do this:git remote add angavrilov https://github.com/angavrilov/df-structures.git
you can right click on the title bar and do edit->paste.git pull quietdust master
or git pull angavrilov master
, depending on which repo you added. (You can add both)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.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?
open git bash
go to dfhack/library/xml
doCode: [Select]git remote add quietdust https://github.com/quietust/df-structures.git
This 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.git
you can right click on the title bar and do edit->paste.
then doCode: [Select]git pull quietdust master
orCode: [Select]git pull angavrilov master
, depending on which repo you added. (You can add both)
then build as normal.
If you want the one quietdust pointed to, do this:My name does not contain a "d", thankyouverymuch.
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.
If you want the one quietdust pointed to, do this:My name does not contain a "d", thankyouverymuch.
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." ;)
You guys still take ideas for utilities to add on this thing?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.
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.
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.
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 =)
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.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.
Quietust's branch for impatient (not complete of course)
https://docs.google.com/open?id=0B2hg23s5yV1aclFScGVqdy11Yms
stonesense and dfusion are not includedQuietust's branch for impatient (not complete of course)
https://docs.google.com/open?id=0B2hg23s5yV1aclFScGVqdy11Yms
What works and what doesn't?
Yeah, I tested it and 5 plugins dont work yet.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.
dfusion, digv, stonesense, autolabor and df2minecraft.
stonesense and dfusion are not includedQuietust's branch for impatient (not complete of course)
https://docs.google.com/open?id=0B2hg23s5yV1aclFScGVqdy11Yms
What works and what doesn't?
judging by the error message at start-up, autolabor won't work
prospect, drybuckets, autodump, digv, and die all work
Stonesense does work, but like dfhack, it needs to be pulled in from angavrilov's repo.
stonesense and dfusion are not includedQuietust's branch for impatient (not complete of course)
https://docs.google.com/open?id=0B2hg23s5yV1aclFScGVqdy11Yms
What works and what doesn't?
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.
What about workflow? That one's pretty important in easing the micromanagement.
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.What about workflow? That one's pretty important in easing the micromanagement.
That's my favourite. No such luck.
When i try to open 'dfhack-run', it VERY quickly opens a console screen and just as quickly closes it. Any help?
Excuse double post: Is DFHack updated to .34.09?No, see first post, for last version.
Excuse double post: Is DFHack updated to .34.09?No, see first post, for last version.
That works. Thank you :DExcuse 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.
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...
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.
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
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.
you have to pull autolabor from the git repo of the guy who writes the plugin.
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.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.you have to pull autolabor from the git repo of the guy who writes the plugin.and where would i find that?
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.
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.
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
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 ;)
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 ;)
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.
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 ;)
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;
New releaseI 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?
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.
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;
}
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.New releaseI 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?
"autolabor 1"
So no Runesmith tools in DFhack? :( Nobody even commented on my request. Oh well gotta live without it then.
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:
for k,v in pairs(df.global.world.units.all) do tools.empregnate(v) end
- 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)"
https://github.com/peterix/dfhack/blob/master/COMPILE.rst
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 :)
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 :)
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).
:(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.
38>Time Elapsed 00:00:08.37
40>LINK : fatal error LNK1104: cannot open file '..\library\Debug\SDL-debug.lib'
40>
40>Build FAILED.
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.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.By finding where in memory those values are stored. IIRC, we don't know where that is anymore.
......where do I start?
If the consensus is this is a good & useful thing, I'll write up the mental attributes and personality traits in similar separate scripts.
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)
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.
utils = require 'utils'
utils.insert_or_update(unit.status.current_soul.skills, { new = true, id = ..., rating = ... }, 'id')
You can't do that - the vector must be sorted by skill id.
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.
...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 ;) 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.By finding where in memory those values are stored. IIRC, we don't know where that is anymore.
......where do I start?
printall(unit.unknown7) shows only following fields:Quietust meant that in current (github/nonreleased) version it's called like that. The next release will have that.
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...
Superb. I'll try to get ahold of that version and play with it...Nope, I'm pretty sure that's older than the current release.
I think I saw the link to this earlier in this thread.
syn=unit2.unknown7.syndromes[0]
unit2.unknown7.syndromes:erase(0)
syn:delete()
if it fails or crashes than maybe this is enough:unit2.unknown7.syndromes:erase(0)
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')
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.
Probably historical figure stuff.
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.
Prelimary tests show that the 'cured' vampire goes back to his blood-sucking ways sooner or later.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".
I'm kind of wondering if I'm missing something
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?
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?
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.
help! the tiletypes> paint shape channel does not work!What does not work about it?
p shape WALL
Atleast it worked some versions ago.
i want a downward slopehelp! the tiletypes> paint shape channel does not work!What does not work about it?
Example:Code: [Select]p shape WALL
Atleast it worked some versions ago.
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
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
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).
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.
Anyone else having their map revealed when running .lua scripts ?nevermind, it was cleanmap I forgot that it revealed the map.
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.
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.luaalso 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")
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.
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)
You can copy and paste from the DFhack window. just right click the title bar, and do edit->mark.
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
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.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?
They are undead - I placed magma on them, and they became alivingexisting 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.
You can copy and paste from the DFhack window. just right click the title bar, and do edit->mark.... or use "dfhack-run prospect"
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.
They are undead - I placed magma on them, and they became alivingexisting 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.
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)
... 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 not exactly sure what your end goal isI want to...make it interactive...
Ok, well, I split up the three scripts intentionally.I'm not exactly sure what your end goal isI 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.
Here are the skills, nicked from DwarfTherapist:
Any thoughts on where these should go on the wiki? I'll put them up.
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.
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
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).
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.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.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.Yep, this script could be run without dfusion, actually function in this script are copy-pasted from Dfusion )
Prelimary tests show that the 'cured' vampire goes back to his blood-sucking ways sooner or later.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".
I'm kind of wondering if I'm missing something
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)?
it was worth sharingThanks.Then I make mine like yours,a bigger one like dfusion.
...
But "put it into the dfhack scripts directory" mean what? I don't know about dfhack scripts directory,where can I find it? ...
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.
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!
!!!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.*
My brain explodes while I try to realize a structure of "DF" class for example. Which members is it has?
is there a way to fully cure dwarfs with DFHack?that depends on what you mean of cure?
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.
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:)
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?
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.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.
...
How could I modify this to make a dwarf legendary in ALL skills in one go?
Game crashed everytime when I accidently tear down a workshop with job protected by "workflow".
Is there anyone same with me?
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.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)
Sorry, but dfhack keeps giving me some error message about tail calls... I put it in folder scripts as *lua file, as always, but...Code: [Select]function tools.tame(unit)
for easy taming of wild creatures.
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.
Is DF hack open source ?
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.
[...]
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.
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
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
Could anyone here help me or give me an answer to how i should set up a workflow for clay bricks?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.
i tried many variations but cant figure out how.
some of the commands i tried areCode: [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
Could anyone here help me or give me an answer to how i should set up a workflow for clay bricks?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.
i tried many variations but cant figure out how.
some of the commands i tried areCode: [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
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.
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.
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.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
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.
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.
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.
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.
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.
FirstCall()
Initized HOOKS!
Identifying DF version.
Loading hack\symbols.xml ... OK
Dummy symbol table entry: timed_events
Loaded 6 DF symbol tables.
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 :QuoteFirstCall()
Initized HOOKS!
Identifying DF version.
Loading hack\symbols.xml ... OK
Dummy symbol table entry: timed_events
Loaded 6 DF symbol tables.
<symbol-table name='v0.34.10 SDL' os-type='windows'>
<binary-timestamp value='0x4fba073a'/>
<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.
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 :)
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 :QuoteFirstCall()
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'/>
toQuote<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.
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'/>
toQuote<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.
Not really a start at all. All that does it lets DFhack know that this is, indeed, some version of DF.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.
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.
Well excuse me for contributing information, starting at the beginning. Jerks.Not really a start at all. All that does it lets DFhack know that this is, indeed, some version of DF.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.
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.
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.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.
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.
Well excuse me for contributing information, starting at the beginning. Jerks.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.
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.
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.
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".
I could re-install a C compiler and "roll my own", as you coyly put it. ed to start this argument.
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
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.
Well excuse me for contributing information, starting at the beginning. Jerks.Not really a start at all. All that does it lets DFhack know that this is, indeed, some version of DF.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.
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.
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).
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.
Hate to be a jackass but the updated symbols.xml isn't working for me. I'm gettingit also says to check the stderr which says:
DFHACK ERROR!
error while reading symbols.xml
attribute is either missing or invalid : OS type
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)
slaytanic - try this: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.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).
slaytanic - try this:THANX Quietust that worked !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).
Does anyone know variable name or offset to change number of starting dwarves on embark?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.
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...
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.
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.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 )
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
yeah, it's easy.[/quote]
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
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
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...
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?
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.
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!
Changelayer only affects unmined stone - any mined-out boulders should not be changed.
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.
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.
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.
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.
What happens if you do this, then attack the civ they are a part of? Awesome loyalty cascade?
You love me yet, forum? You love me yet? :)
-Edit-
If you tweakmigrant a foreign trader, will they join your fort?
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.
Nope, as it says in the starting thread: supported up to version 34.10.
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.
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.
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.
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 )
Still fairly new winblows install so i haven't got all the good stuff installed yet, forgot about notepadplus.try out http://ninite.com for setting up a new machine.
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.
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'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?
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:)
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.
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.
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.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.
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.
<global-address name='start_dwarf_count' value='???'/>
If somebody would be so kind to find it :) Search for this AFAIK:0x24,0x14,0x07,0x00,0x00,0x00,0xeb,0x08,0x8d
then add 2 to the result (to point directly to starting dwarf count)Code: [Select]0x24,0x14,0x07,0x00,0x00,0x00,0xeb,0x08,0x8d
I've dragged all the DFHack files into my Dwarf Fortress folder but when i run it no command line appears.Yes - you did it wrong. Read the instructions and try again.
Does anyone know why this is happening?
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!
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.
Oh my... that is some crazy stuff right there.
Any ideas how to fix? :P I kinda like my save :(
Oh my... that is some crazy stuff right there.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)
Any ideas how to fix? :P I kinda like my save :(
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?
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.
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
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.
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.
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)
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.Berserk
[lua]# quit
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.
./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.
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
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.
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?
Just one more way in which Apple makes the world a worse place to live in. :P
To hessau: Did your fps recover after Saving, quitting and reloading?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.
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.
...
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).
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?
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?
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.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.
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.
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
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.
Excuse me. What must I fetch, and from where, specifically?I would also like to know that =)
Got it. Thanks a lot man.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.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.
http://www.mediafire.com/?4kr1vne44j0444tThanks mate, but still does't work. I see the command window open, but it closes immideately =S Anyone?
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?
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.
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.
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!This script can be called by targeting a dwarf in DF and simply: rejuvenate , if the script is placed into \hack\scripts\Spoiler: rejuvenate.lua (click to show/hide)
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.
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!This script can be called by targeting a dwarf in DF and simply: rejuvenate , if the script is placed into \hack\scripts\Spoiler: rejuvenate.lua (click to show/hide)
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?
Where did this person find out that df.mood was a thing and how to use it?
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.
Good to see that people are writing scripts for DFhack. :9We need a separate
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.
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.
So it looks like stack sizes are accessible here...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.
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.
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.
I think you can do this from the stocks screen without much trouble.
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.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?
What are the kitchen skin options?
I compiled DFhack (34.11) with the kitchen sync options for WindowsWhat does it do actually?
Yay!
http://www.mediafire.com/?aapoqg33p3fabqx
I compiled DFhack (34.11) with the kitchen sync options for WindowsWhat does it do actually?
Yay!
http://www.mediafire.com/?aapoqg33p3fabqx
rejuvenate.luaInteresting. 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, just read the "all" compile option hereI compiled DFhack (34.11) with the kitchen sync options for WindowsWhat does it do actually?
Yay!
http://www.mediafire.com/?aapoqg33p3fabqx
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).
I compiled DFhack (34.11) with the kitchen sync options for WindowsWhat does it do actually?
Yay!
http://www.mediafire.com/?aapoqg33p3fabqx
OMG, just read the "all" compile option here
https://github.com/peterix/dfhack/blob/master/COMPILE.rst#id12
I compiled DFhack (34.11) with the kitchen sync options for WindowsWhat does it do actually?
Yay!
http://www.mediafire.com/?aapoqg33p3fabqx
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.
rejuvenate.luaInteresting. 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?
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.
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.
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.
Hello :)
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.
I compiled DFhack (34.11) with the kitchen sync options for Windows
Yay!
http://www.mediafire.com/?aapoqg33p3fabqx
I compiled DFhack (34.11) with the kitchen sink options for Windows
Yay!
http://www.mediafire.com/?aapoqg33p3fabqx
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.*rejuvenate.luaInteresting. 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?
How do you actually run it? I couldn't work it out :(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! :)
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
Nope, the reading memory thing is the old way of doing things that didn't work well.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
Nowadays people read the readme file that tells you what, exactly, you are supposed to do with the files you just downloaded.
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.
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 :)
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/scriptsfor k = #events-1,0,-1 do ... events:erase(k) ... end
For erasing stuff you can apply the trick Toady uses: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 :)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 :)Code: [Select]for k = #events-1,0,-1 do ... events:erase(k) ... end
DOH! That makes sense! Thanks!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 :)Code: [Select]for k = #events-1,0,-1 do ... events:erase(k) ... end
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--) {
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.
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.
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.
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.
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.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.
Is there any way to affect items in ways such as giving them names/forcing a warrior to become attached to them?
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.
dfhack.maps.getTileBlock(x,y,z).designation[x%16][y%16].hidden = false
dfhack.gui.getSelectedItem():setWear(0)
dfhack.gui.getSelectedItem().wear = 0
dfhack.gui.getSelectedItem().wear_timer = 0
Also - can anybody answer my question about XXitemsXX?
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.
local x,y,z = pos2xyz(df.global.cursor)
dfhack.maps.getTileBlock(x,y,z).designation[x%16][y%16].hidden = false
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.
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?
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?
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?
[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]
is there a way to hotkey, or autohotkey certain dfhack commands, I'd love to have the sort-units name as a hotkey
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.
local pos=string.find(v.name,".text") or string.find(v.name,"libs/Dwarf_Fortress")
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
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.
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)
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!!.
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?
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)
dfusion/common.lua:45: .Text region not found!
Is the dfusion command working? When I type dfusion into the console I getCode: [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")
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")
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.
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:(.
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?
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.
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.
Think it could be possible to change the point of view when playing fortress mode? Ie North to South etc?
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.
And it would possibly break a lot of tracks that are based on directions. Your NE track might now need to be SW.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.
--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
[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 '.'
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]
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.
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. :).
Mac build isn't working for me:
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.
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!>
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]
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
We don't have a list of the possible shapes for tiletypes
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.
print(df.global.world.raws.syndromes.all[50 or whatever].syn_affected_class[0].value)
printall(df.global.world.raws.syndromes.all[50 or whatever].syn_affected_class[0])
Just embark with 7 and remove the extra dwarves...Yeap, i seems that there's no way to avoid it.
TETRAHEDRITE : 30441 Z: 42..103
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
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
workflow count DRINK 120 30
Cannot produce: drink
Hello!create a job to brew drinks and set it on repeat.
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 statingQuoteCannot 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
Hi, I was wondering...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.
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.
Nice! That is a great script, Hesuchia, well done.
I get an error in the Dwarf Fortress message log statingcreate a job to brew drinks and set it on repeat.QuoteCannot 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.
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)
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.
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.
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?
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?
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.
Alright, I've got a quick question:I'm sorry, but that made me rofl
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...
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).
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).
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
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)
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.
Any ideas about forcing these dorfs to become proper members of my fort? Sounds like cardinal is working on something similar...
Oh ok... I have no idea what to do with it, though. I am not good with scripting :P
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
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
(interactive):3: syntax error near '=='
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.
Thanks. They're all on the "citizens" tab of the unit screen now. I guess just keep going as per normal from here?
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?
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?
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.
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.The "population_id" trait is only for wild animals. What you're looking for is within the unit's historical_figure record: entity links.
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?
Links are objects - they have fields and methods.
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
for k, v in pairs(df.global.world.units.active) do
if dfhack.units.isCitizen(v) then
v.military.patrol_timer=0
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.
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.
is the a way to make a constructed wall into a natural wall? for digging? without turning it into obsidian with "liquids"
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?
maybe you have to invoke "ruby" first, then the commands associated with it? Or did you try that?
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.I'm talking about these functions.
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.
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
I saw this and the sun shone through the leaves...Code: [Select]print(df.global.world.raws.syndromes.all[50 or whatever].syn_affected_class[0].value)
Figured it out by doingCode: [Select]printall(df.global.world.raws.syndromes.all[50 or whatever].syn_affected_class[0])
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()
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!
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.
printall(item.unk_cc)
I get --------------------unk_cc
anon_1 = -1
anon_2 = -1
anon_3 = -1
anon_4 = -1
anon_5 = -1
anon_6 = -1
anon_7 = 0
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
Does anyone know what these values mean?
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)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.
[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
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.
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
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.
I am trying to check the status of some eggs.After a bit of testing, only eggs with anon_7 == -1 hatch.
When I try this:Code: [Select]printall(item.unk_cc)
I getCode: [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.
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.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.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.
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
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.The fix is still not included in this version. To fix it manualy:
Okay, typed in 'dfusion' sans apostraphes, and it gives me this:Spoiler (click to show/hide)
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")
Slayrace is not part of DFusion - it's a Ruby script, which means it requires the (not yet released) Ruby plugin.
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()
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)?
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.
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()
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?
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!
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.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.
Anyone else had this kind of problem before?
Hello there :)I can't reproduce this with a fresh embark. Can you upload your fort somewhere?
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?
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 :)
-- 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)Try df.global.ui.mood_cooldown.
Hi,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.
Is there a way to find out what weather your current evil biome has? The 'feature' thing, perhaps?
[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>
[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.
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)
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")
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)You could fork the github repository, add your files and submit a pull request to the project.
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.
:command
would be recognized, whilecommand
wouldn't.
myScriptNameWithoutDotLua doom1 doom2
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);
print ...
doom1 doom2
printall ...
print bob
doom1
printall bob
print jim
doom1
printall jim
I'm having some trouble figuring out how to pass arguments to lua scripts from DFHack. Here's what I've tried:I think it was
<...>
How do I access the arguments other than the first? "quasivariable" doesn't show up in any LUA documentation I can find.
local stuff={...}
local first=stuff[1]
Is there a way to modify the happyness of my dwarfes?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.
I need to do some testing, and this would save massive amounts of time.
Tis exactly looks like what I need. Thanks.
Now I just have to figure out the 'how'
dfhack.timeout(1,'days',functionName);
Thanks, so it is possible. So all I need is to give a keyword and the script will find it ?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).
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?
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
onfunction.SetCallback("ReactionFinish",Reaction)
function Reactionfolder()
spawndog
spawncat
teleport
transmuteitem
end
onfunction.SetCallback("ReactionFinish",Reactionfolder)
... 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). ...
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.
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.
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.
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...
--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);
This is a glorious day for all of B12.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)
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?
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)
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)
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.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!Good news, everyone!Returning to DF after a long hiatus, this is ... like ... the best news EVER! :)
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.
This build works fine for me (MBPro with 10.7.4)
I am trying to check the status of some eggs.After a bit of testing, only eggs with anon_7 == -1 hatch.
When I try this:Code: [Select]printall(item.unk_cc)
I getCode: [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.
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.
Simple:-\
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. :)
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.Simple:-\
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.
dfusion/common.lua:45: .Text region not found!Whenever I type dfusion in the console it spits the error out. Any workarounds to this?
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
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.Quotedfusion/common.lua:45: .Text region not found!Whenever I type dfusion in the console it spits the error out. Any workarounds to this?
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
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.The fix is still not included in this version. To fix it manualy:
Okay, typed in 'dfusion' sans apostraphes, and it gives me this:Spoiler (click to show/hide)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")
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.The fix is still not included in this version. To fix it manualy:
Okay, typed in 'dfusion' sans apostraphes, and it gives me this:Spoiler (click to show/hide)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")
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?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?...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.
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?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.Quote from: DNKIs 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.
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 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.
It should open when DF opens.
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?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.
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?
You want quickfort.You want macros. They're surprisingly powerful, but surprisingly little-known.
You want quickfort.You want macros. They're surprisingly powerful, but surprisingly little-known.
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)
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.
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
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.
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.
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.
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.
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.
[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.
full support for Mac OS X.
full support for Mac OS X.
does this means stonesense too?
full support for Mac OS X.
does this means stonesense too?
I /think/ so, but don't quote me on that.
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.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...
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.
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.
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...
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.
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.
enable_autobutcher = config_autobutcher.ival(0);
toenable_autobutcher = enable_autobutcher || config_autobutcher.ival(0);
I think that's how it should be.
Not possible, history-making stops as soon as fort mode starts.Eh, k.
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.
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.
I do not know of these devlogs
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.
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.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.
don't want every single game end with a tantrum spiral, it gets boring.
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.
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...
Readme's page is broken.Fixed now :)
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.
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.
migrant and friendship are dfusion commands you need to go into dfusion to run those.
you get into dfusion through typing dfusion, then typing the number next to the menu to navigate through the program.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.
Yeah, did you update DFhack?
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.
Thanks for the help. What do you mean by nemesis?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?
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?
Not exactly. Amount is used for things that are made in stacks, whether they're currently in stacks or not. Case in point: Bolts
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.
Added the OSX version :)I downloaded the osx version.
Test it, see if it works on your system.
Where does the dwarfexport command save the exported xml file(s)?
Added the OSX version :)I downloaded the osx version.
Test it, see if it works on your system.
copied everything into the df folder
not quite sure how to get it to work
$ cd /path/to/DF
$ ./dfhack
clearly something is going over my head.Added the OSX version :)I downloaded the osx version.
Test it, see if it works on your system.
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
<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>
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
?
clearly something is going over my head.Added the OSX version :)I downloaded the osx version.
Test it, see if it works on your system.
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
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
Through experimentation I have discovered the following about the unknown values:
lol, I was literally typing /path/to/dfclearly something is going over my head.Added the OSX version :)I downloaded the osx version.
Test it, see if it works on your system.
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
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.
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.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
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)
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.
<...>
Hey a need a script to remove strange mood from the dwarfWhy 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.
Hey a need a script to remove strange mood from the dwarfWhy 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.
There's actually a "showmood" command in DFHack which will tell you exactly what your moody dwarf wants.
Pop into adventure mode, use this dfusion scriptThere's actually a "showmood" command in DFHack which will tell you exactly what your moody dwarf wants.
"Urist McGoth wants a hug."
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.
I've tried serching to no avail, how do i turn on the option for fastdwarf for the dwarves to teleport to their destination?
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.
./dfhack: line 15: 707 Bus error: 10This was the error message on Terminal
dwarfort.exe(707,0xb0289000) malloc: *** error for object 0x156d4b30: pointer being freed was not allocatedand this was logged in stderr.log.
*** 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
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.
<...>
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.
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.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)
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.I'm using a build that came with Dwarf Builder (Like I said above), and can activate tweaks with parameters without errors.
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?
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)?Lion, because my fingers get ahead of me sometimes. :)
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?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.
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.
I... uh... accidentally(?) painted obsidian all over some candy tubes.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.
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.
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?
DYLD_FORCE_FLAT_NAMESPACE=1
#DYLD_FORCE_FLAT_NAMESPACE=1
removing the tool entirely.
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.
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.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.
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?
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
[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.
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
[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
autobutcher target 0 0 0 0 new
autobutcher autowatch
autobutcher start
[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
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.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 likeCode: [Select]workflow count LEAVES//BUSH_QUARRY 1000
are accepted, but the no jobs are found. Producing thread from pig tails (THREAD) works fine.
workflow count POWDER_MISC//MUSHROOM_CUP_DIMPLE:MILL 1000
Thank you for your help!
And thank you for dfhack. Especially workflow and autobutcher are great tools.
job item-material 1 BUSH_QUARRY
workflow count LEAVES//BUSH_QUARRY:LEAF 50 10
Thank you, this worked!
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 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?
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...).
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.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.
<...>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).
Why this fixes are not being inserted in the original game by Toady/programmers instead of using external patches made by fans ?
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
... 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) ...
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
This has been discussed more times than I can remember, and it really doesn't need to be discussed again.
For example, autobutcher and clean map works,
tweak fast-trading, siren, magmasource
gui/mechanisms
fix/population-cap
gui/workshop-job
gui/workflow
gui/assign-rack
fix-armory
It would seem you have an old version installed.
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.
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.
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.
How did I not use dfhack for so long? I became immediately addicted.Next version probably will have a reactions that trigger lua scripts (e.g. you make a sword and it displays a message)
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?
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.
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?
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.
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.Berserk
[lua]# quit
that's how.Quote[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit
And the inverse? How can get a dwarf to normality?
DFhack became a very important software for my DF games,this could help: atom link to peterix's github (https://github.com/peterix/dfhack/commits/master.atom)
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.
DFhack became a very important software for my DF games,this could help: atom link to peterix's github (https://github.com/peterix/dfhack/commits/master.atom)
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.
ok, thanksDFHack is there, I think not all plugins are enabled, but you can do it yourself.
I played with lazy newb pack, until now I discovered this masterwork megapack.
Is dfhack also inside masterwork, right ?
How do I set up the Siege Engine plugin? I noticed it uses the GUI, what GUI?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.
I want to bring some military spice into my fort that isn't just the boring ol' swordmaster squad.
# siege engine controlIt shows that the siege engine front end is now bound to Alt-A, you can change it if you want.
keybinding add Alt-A@dwarfmode/QueryBuilding/Some/SiegeEngine gui/siege-engine
Quote[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.Berserk
[lua]# quit
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.
[DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit
Actually, neither NONE nor Nil will work:Code: [Select][DFHack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.NONE
[lua]# quit
or Nil
In a related note, if I, say, set a dwarf toCertainly not - it won't do anything unless you actually create and assign a Strange Mood job (which includes specifying all of the required items).MacabreFey, will they, in turn claim a workshop and "materials" and make something artifact-y?
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
changeitem m "raws here" info
I get no such material errors. I tried changing it to pig tail just to practice with changeitem m PLANT:GRASS_TAIL_PIG:THREAD
and it says that the subtypes don't match... I'm lost, help!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 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 itkeybinding 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.
tilestypes edit: tiletype can set and alter the types of tiles. just it's under the special brush settings.
digtype: designates every tile of the same type of vein on the map for 'digging' (any dig designation).jawfloor
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.
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
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.oh that's normal I guess you need to find the noble list and manually insert them
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.
There any chance in hell this will run on OSX 10.5.8?
Hi,see dfusion/embark/races.txt thats where you set which races units to embark with.
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?
Hi,see dfusion/embark/races.txt thats where you set which races units to embark with.
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?
unit=dfhack.gui.getSelectedUnit()
if unit==nil then
print ("No unit under cursor! Aborting with extreme prejudice.")
return
end
printall(unit.body.components)
misery enable 900HA, Thats pretty funny.
siren
siren
siren
siren...
Edit: Oh Armok.
http://i.imgur.com/3SWX6.png
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.
I've been trying to build DFHack on linux, and I'm having a few problems.
First problem: when trying to run cmake, I getCode: [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 getCode: [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.
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?The "z" in "-lz" isn't an option flag, but a library name - it tells it to include "libz".
EDIT2: Looks like I just did not have all the dev libraries I needed
had to add:
- lib32z1-dev
- libxml-libxslt-perl
/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)
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.
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
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_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.
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:<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
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.
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, 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.
NVM, did some mode swapping to select the unit, then more to get back to adv mode.yes it can https://gist.github.com/4061959 (not sure which version of dfhack though...)
Can dfhack add syndromes? Turning off the dead flag brings them back with all BP's missing.
Would the id be used be [CURSE_WHATEVER_#] or some hex string?NVM, did some mode swapping to select the unit, then more to get back to adv mode.yes it can https://gist.github.com/4061959 (not sure which version of dfhack though...)
Can dfhack add syndromes? Turning off the dead flag brings them back with all BP's missing.
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.
-- 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.
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.
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?
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.
what happened with dfusion embark modifier? So I can change the # of dwarfs I start off withhttps://github.com/warmist/dfhack/blob/master/Readme.rst#id115
it was called simple_embark
: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.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
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
There should be something like "make sentient", it sets the dingo men "CAN_LEARN" flag so they show the labor menu.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.
[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):
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
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:"Haha... looks like i forgot to update it. Quickfix: goto dfusion/tools/init.lua (with text editor) and delete line 46. Should fix it.
If I enter "DINGO_MAN" it gives me an error message:
<...>
So what's going on here?
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.
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.
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.
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.
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?
the latter would be ideal, but i'd be happy with the firsti'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
More ghost data for DFHack devs:
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.
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]
Could I make a request ?Sort of is in the new (unreleased) version already. You can run scripts on:
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.
Could I make a request ? -snip-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.
- 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...
- snipped -
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:Notepad++ converts the characters in there easy enough. you just have to manually set it to OEM-US, then convert it to UTF-8Spoiler: 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
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).
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).
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.
[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]
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.
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.
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?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?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.
Alright, when I tried earlier with the CasteID thing I foolishly chose the first caste entry and it defaulted to itself :(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 :-\ )
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.
setarch: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
Anyone know why that would be?
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
/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./bin/sh: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
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:
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.
I am unable to run debuggers on it in my 32bit build VM though because they fail with this error.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!!Code: [Select]setarch: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
Anyone know why that would be?
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.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()
Otherwise, you'll need to use pairs to go through df.global.world.entities.all until you find the one you want.
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
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)I am unable to run debuggers on it in my 32bit build VM though because they fail with this error.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!!Code: [Select]setarch: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
Anyone know why that would be?
...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. ;^)
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.echo "set environment LD_PRELOAD=./hack/libdfhack.so" > gdbcmd.tmp
The problem is that this applies the LD_PRELOAD to both bash and DwarfFortress.echo "set exec-wrapper env 'LD_PRELOAD=./hack/libdfhack.so'" > gdbcmd.tmp
*** 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 ***
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"?
In the workflow and job commands, is there any way to specify NON_PRESSED as part of the constraint spec or job material?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.
(for rock nut paste/cake, which are both GLOB//BUSH_QUARRY:SEED as far as I can tell)
I did figure out the steam engine myself by now, wrote a custom design for it that works.
It is in his Masterwork mod. (http://www.bay12forums.com/smf/index.php?topic=98196.msg3903083#msg3903083)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
Magma Forges only show up after you discovered a volcano or magma lake... always. Has nothing to do with dfhack.
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?
[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]
someFunction location {x} {y} {z} worker_id {worker id} {reaction index} \reaction_index
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).
Launch it from terminal? Post what it printsErm... 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. :/
-snip- Fun content
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. :/
DYLD_FORCE_FLAT_NAMESPACE=1
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
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.Meph, if you are going whole hog on the DFhack intergration thing, then how about a slaving function using "tweak makeown"?
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. :)
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?
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.
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.
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.
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.
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.
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)?
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.
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.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])
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 ^^
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.
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 } )
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 } )
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>) } )
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.
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, 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.
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])
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. ^^
[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.
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
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.
[REMOVE_NATIVE_JOBS] -- remove all the buttons from add job menu (all the native at least...)
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.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)
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.
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.
Megabeast attack:Can a forgotten beast attack be triggered the same way?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.
Melt something.
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
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...
There is no non-plugin DFhack anymore.Well.... That explains it pretty well.
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.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)
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.
dfusion
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.You can spawn magma and water on one tile, making obsidian to seal everything.Or just spawn obsidian wall.
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?
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'.
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).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).
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.
How can I do that? I dont find the commands. Sorry, im a newbie with DFHack :-[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.
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!
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)
Seriously, anybody know why it's saying vector <body_part_status>.0 is a complex object?Because it's 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.
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...
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.
There's a bunch of xml files here: https://github.com/angavrilov/df-structuresI use generated header files: "hack\include\df" in r3 or if you are building yourself it's somewhere in project tree.
don't know what else is there.
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.
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
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?
this-> https://gist.github.com/4514230So 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/4514230So 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.
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 :Dthis-> https://gist.github.com/4514230So 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.
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 :Dthis-> https://gist.github.com/4514230So 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.
I put it in the DFHACK lua folder and it still isn't working.
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].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 :Dthis-> https://gist.github.com/4514230So 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.
I put it in the DFHACK lua folder and it still isn't working.
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.
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
Set their unit.race to something else, they will instantly change back with all wounds healed. However, might mess up their stats.
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)
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!
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 :Dthis-> https://gist.github.com/4514230So 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.
I put it in the DFHACK lua folder and it still isn't working.
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.
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?
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.
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.
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.
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?
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?
... I get MAGMA:0 Z -30000try 'prospect all'
I assume this means that I have to reach the magma sea, right?
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.
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).
Is there a way to get siege flag?
Simple true/false is enough for me.
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.
So what is rusty attribute of skill for exactly and how does rust work internally?
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.
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?
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.
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?
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.
helloYes 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.
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
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.
I have problem with autodump.This is how I use 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?
-- 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
print(dfhack.gui.getSelectedUnit().id)
Cool beans. I'm guessing this means you can marry yourself and your companion in adventurer, too.
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.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 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.
Any way to detect a creature's body size?
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).
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
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...
Cannot read field vector(historical_figure*).6965: index out of bounds.
-- 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]))
-- 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]))
divorce unit_id
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.
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.
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.
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).
[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
ANy ideas why im allways getting the error message "could not move xxx", it usually happens to stones and i dont understand why.
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?
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?)
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...
local args = ...
if args[1] == "popup"
local arg = ...
if arg == "popup"
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.
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?
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.
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.Having hist. events for marriage would make sense as it might check for them when creating new unit.
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.
Does all of that and more: http://www.bay12forums.com/smf/index.php?topic=112381.0
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.
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 am running 10.6.8. What changes do I need to make?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!
export DYLD_FORCE_FLAT_NAMESPACE=1(in other words, put a # in front of it).
Comment out the line in which file?
-- 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]))
familyplanning
or familyplanning menopause_min menopause_max children_min children_max
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.
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.
I've got a unix executable file called dfhack-run, looks like. Is the script in hack/scripts?
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]
Or something like that.
local menopause_age = math.random((unitcaste.misc.maxage_min / 2), (unitcaste.misc.maxage_max / 2))
The actual menopause age and child cap are randomly decided per mother, with the RNG seeded based on her unit id.
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...
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.
I have a few rng written in lua (correctness not guaranteed) if anyone needs.
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.https://github.com/warmist/OpusArcania/blob/master/random.luaI 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.
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)
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.
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.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.
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.
Right then, time to find a very simple RNG generator to embed in the script.
-- 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: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
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
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.
[CDI:MATERIAL:INORGANIC:GRANITE:SOLID_GLOB]
Oh, thanks for the explanation!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.
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).
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.
-- 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,
}
)
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:
uhh no it's really a new but that copies the identity of a corpse over an undead unit.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.
So a unit can have more than one soul.There are two wrong (afaik) assumption here: 1st getting the max id of unit. 2nd that soul needs a new unit id.
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,
}
)
unit_id=selectedUnit.id
Also if you need next unit id its:df.global.unit_next_id
but usually you don't need to mess with that.
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.
[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.
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
I have not tested this myself, I have no idea if it will work or not.
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit
local caste = df.creature_raw.find(unit.race).caste[unit.caste]
for key, value in pairs(some_object) do print(key, value) end
Also, I usually just go into the lua interpreter and use the included (very handy) printall(table) function they have.
EDIT: Ah--how could I get the current adventurer unit?
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()
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.better way to find 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()
-- some code to check if advmode here --
return df.global.world.units.active[0]
:)
Haha, much simpler!There is no sure way to tell without in depth analysis of surounding area (due to ramps) but there was:
EDIT: Is there a way to check if a tile is a wall or similarly non-walkable terrain?
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: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.
getTileType() apparently doesn't exist.hmm it will soon exist :)
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)my 'armoks_blessing' script works in adventure mode. Just tested it with DF34.11 & DFHack34.11r2
If not, I'll look into the scripting. Thanks
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...
-- 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
-- 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.Code: [Select]-- Stop parties
The above would work as long as I included the "local utils = require 'utils'" line above it, correct? That's all I would need?
for _,v in ipairs(df.global.ui.parties) do
v.timer = 0
end
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?I've placed obsidian via liquids to get revflood to hide dug-out areas I'm finished with.
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.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.
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?
if (auto spouse = df::unit::find(bld->owner->relations.spouse_id))
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).
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.
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.
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
Is there a way to display a currently selected dwarfs attributes? interested in speed only atm. ty.
How in the world are you supposed to get that to work on one dorf?
-- ---------------------------------------------------------------------------
-- 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
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.
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. ;)
All the "normal" autopause can be disabled in the init.txt and the anouncements.txt. I do indeed mean the menu pause.
Does not load
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?
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.
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.
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.
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?
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.
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?
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.
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.
And it seems GitHub has three different versions of binpatch: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).Spoiler (click to show/hide)
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.
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
-- 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
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.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.
Have you tested this on more than one creature that has no male castes?
Well, after messing around with the lua code for the empregnate tool I found that changing this line: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.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.
Have you tested this on more than one creature that has no male castes?
unit.relations.pregnancy_mystery=1
to this:unit.relations.pregnancy_mystery=0
seems to fix the problem. I am not quite sure why, but it works now.
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.
Oh. Sorry, not exactly my realm of understanding.
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!
which is why you should always save before doing these changes.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.
And also why DFHack includes a quicksave feature :Pfor fort mode, adventure mode doesn't have that luxury.
-- 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()
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?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?
Edit: Steam engine MUST be a workshop, not a furnace. There is no freedom of choice in this point.
Edit: Well, maybe I should just copy the code from githhub and see if it works with r2. ^^
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.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.
Well... I kept moving it to a different file. The mistakes I made there were !!fun!! as I'm sure you can imagine.
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.
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.
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.
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.
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
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.
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?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)
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?
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.
I tried this script and it removed all skills from all adult dwarves. WTF?
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.
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.
-- 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 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.
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.Spoiler: updated remove_all_skills.lua (click to show/hide)
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.
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?
So it is. I was trying to make it Autolabor. Thanky kindly.
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.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...).
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.
-- 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()
#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;
}
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:
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;
}
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
library/xml in the github.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.
I mostly use printall(table), though...
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?Yes - that'll clear the unit occupany bits on all tiles in that map block, not just the one formerly occupied by your player.
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.
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:...
I had something like 20,000 stone in my fort
Haha, I saw that when you pasted it in irc.I had something like 20,000 stone in my fortSpoiler: You're doing it wrong. (click to show/hide)
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.That didn't fix it :(
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.
--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: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)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).
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
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.
Quick little script if anyone is interested: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.
...
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!
Vjek, would your scripts work with r3? If not, when do you think you could get the new ones up? :PHell 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.
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.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.
Anyway, fortress mode got a lot, lot, lot nicer thanks to autosyndrome, and that is what counts for me. Thanks for that release. :)
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. :)
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...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...
and summon units...
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.Quoteand summon units...
Say what again?
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...).
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"
except it cannot be a squad member, take any positions, etc...
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.
If summoning units works in fort mode, how would I go about this?Eh with dfhack you could just run a reaction that will implant one animal. That way you can do away with Gas syndrome contamination.
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.
Rumrusher, you must be mistaken, because I clearly cannot do this. Otherwise I would have long done so. ;)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.
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.
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
@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.
I repeat: does the previously mentioned summon plugin mean we can load off-site units on the current map?
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)
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.
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.
the latter would be ideal, but i'd be happy with the firsti'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
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 :< )
TrueTransformation and InfiniteSky don't seem to work, just tells me there's no such command.
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...
(nobody loves advfort :< )
I forget: can it also do separate dfhack.init files per save?
Hmm not that i know of. Only init.lua in raws.I forget: can it also do separate dfhack.init files per save?
Looks like it should, yeah.
u can already use it) here: ^^v (http://www.bay12forums.com/smf/index.php?topic=123944.0) (nobody loves advfort :< )
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 :< )
And region-pops, wtf is with that? It asks for "populations tokens," something which does not seem to exist.
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 :)
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 :)
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+
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.
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.
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.
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
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).
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).
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.
What is the true transformation plugin? It's not in the https://github.com/peterix/dfhack/blob/0.34.11-r3/Readme.rst
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.
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.
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 :-/
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.
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.
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.
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.
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.
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.
read the first post...QuoteHow 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.
It over-writes SDL.dll
It over-writes SDL.dll
ahhh, what IS the SDL.dll anyway?
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.
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.
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 readme walks you through it pretty carefully, including writing over of the SDL, and how to use the init file.
local function getItemImprovements(item)
for _,improvement in ipairs(item.improvements) do
printall(improvement)
end
end
getItemImprovements(dfhack.gui.getSelectedItem())
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.
Oh my god I just tried advfort for the first time and giggled like a schoolgirl.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.
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
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.
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. :Phmm then what caused the key commands to shift then?
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.
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?
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.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.
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
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.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).
http://www.bay12forums.com/smf/index.php?topic=91166.msg4102163#msg4102163
Yes it will be there forever. And yes you can retire there.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?
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.
Here's an interesting thought for dwarven economy: Being able to become a wagon in adventurer mode.I did this way back with a so called wagon 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?
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. {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},
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?
[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]
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.
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.
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.)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.
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.
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.
[INORGANIC:SHIELD_MAGIC]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?
[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]
<...>My guess trueTransform only does not work in arena mode.
Huh. Looks like trueTransform only works in Fortress mode ???. Does this sound accurate?
<...>My guess trueTransform only does not work in arena mode.
Huh. Looks like trueTransform only works in Fortress mode ???. Does this sound accurate?
Yes it will be there forever. And yes you can retire there.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?
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.Yes it will be there forever. And yes you can retire there.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?
Thanks!
[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.
How can I check which syndromes already exist on creature?
Ahem, this:Code: [Select][INORGANIC:CYBERDOG_TRANSFORMATION]
does not work. It quickly turns dogs into cryopods and back.
[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]
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.
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.
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?
Seriously? That's exactly what DF itself is about ;D
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.
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
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.
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,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.
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.
[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]
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.
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
local function insertMistThought(unit)
unit.status.recent_events:insert('#',
{
new = df.unit_thought,
type = 162
subtype = -1,
severity = 0
}
)
end
Yes.well for starters it's buggy as hell due to many factors, one being spawning said unit might die and crash the game.
AFAIK, it's buggy as hell.
I could try writing a script for it.
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?
Actually no. All you need to do is run the inbuilt site-finder once, and it'll generate the whole world.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.
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 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.
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.
I've been trying to reattach my left leg for a few hours and I can't seem to get it right .dfusion has a heal unit script that will repair your legs, you need to select your adventurer to get it to work.
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 ?
Ok, here's the savegame: http://dffd.wimbli.com/file.php?id=7525
Thanks, looking into it. Proving tricky to track down.Check ag's fork. I think he already fixed it.
Edit: Think I know what's going on...
[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]
Just typing "keybinding" gives you your current context.
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.
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
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},
By bug tracker I meant the dfhack bug tracker (on git hub, from the first page of this thread)
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.
out.print(Gui::getFocusString(Core::getTopViewscreen()));
becomes out.print(Gui::getFocusString(Core::getTopViewscreen()).c_str());
or maybe out.print("%s\n", Gui::getFocusString(Core::getTopViewscreen()).c_str());
to get a const char* out of an std::string, you need to do string.c_str()
SoCode: [Select]out.print(Gui::getFocusString(Core::getTopViewscreen()));
becomesCode: [Select]out.print(Gui::getFocusString(Core::getTopViewscreen()).c_str());
or maybeCode: [Select]out.print("%s\n", Gui::getFocusString(Core::getTopViewscreen()).c_str());
@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
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?
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.
-[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]
[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]
I've been trying to reattach my left leg for a few hours and I can't seem to get it right .dfusion has a heal unit script that will repair your legs, you need to select your adventurer to get it to work.
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 ?
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
Where can I fiind the dfusion embark plugin? The new dfusion doesn't show it in any menus.hack/lua/dfusion.
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).
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.
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.
#include "df/unit.h"
#include "df/unit_soul.h"
Yes, but what command?oh yeah it doesn't exist in new Dfusion...Sorry.
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?
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.
Then you can either open the solution with MSVC or use 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.
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!
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.
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.
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.
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.
I don't know when the last time you tried it is, but...I 'tried" today with dfhack r3 pulled ca. 2 weeks ago.
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
What version of CMake are you using?2.8.7
Regarding Ghosts.uhh you could also revive ghosts to become normal citizens by flipping off their ghostly flag(and healing all their wounds).
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?
(http://images.wikia.com/aceattorney/images/1/10/Eureka.gif)no need to even make a river source. Just make a single chunk of water over the hole.
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...
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?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...no need to even make a river source. Just make a single chunk of water over the hole.
I think I may have the process for dwarven sewage... especially if that spot of water "muddies" the floor beneath it...
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.
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.
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.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.
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 :PThe default keybinding is Alt-A, not Ctrl-A. And you have to be in the (q)uery building mode.
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 :PThe default keybinding is Alt-A, not Ctrl-A. And you have to be in the (q)uery building mode.
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..
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.
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?help please!
Thank you
I would love to help but I'm not sure such a tool exists.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.
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.
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.
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.
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
which seemed to be the only place where it would allow the stair and engine to coexist
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.
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.
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.
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.
look or talkThe 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?
spawning more than 1 unit at a time will crash the game when you unload the area.This sounds like a serious obstacle ^^
Well, spawning units is really, really hard.
Is anyone aware of how the game determines what map edges tiles are eligible for diplomats/traders/migrants and whether it can be changed?I still haven't had any luck finding something in the lua-addressable dfhack interface that relates to where visitors can appear.
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?
Is anyone aware of how the game determines what map edges tiles are eligible for diplomats/traders/migrants and whether it can be changed?I still haven't had any luck finding something in the lua-addressable dfhack interface that relates to where visitors can appear.
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?
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.That would be consistent with it being re-calculated on each embark, then stored with the site data for the duration of that embark.
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].
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 ?
<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.
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.
i think the vector unit->reports.log[1], unit->reports.log[2] might be linked to sparring session and somethingThe "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.
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?
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.
I am still having problems starting the siege engine script, that allows custom ammo and aiming. I have this in my init:is gui/siege-engine in quotes?
# 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?
I am still having problems starting the siege engine script, that allows custom ammo and aiming. I have this in my init:Just tested it on masterwork 2g+ with updated to r3 DFhack. Both ballistae and catapults are working as intended. Init entry is default.
# 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?
Link in OP isn't completing.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.
Google-fu found this link: http://dethware.org/dfhack/download/
# 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.
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.
# 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
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.
# 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()
I have made an adaptation of unsuspend.rb and autounsuspend.rb for the purposes of fixing handedness on gloves created through custom reactions.
fixhandedness.rbSpoiler (click to show/hide)
autofixhandedness.rbSpoiler (click to show/hide)
I set the auto check to100 ticks and I think it can be set longer2400 ticks for once every 2 dwarf days as I don't expect custom reaction gloves to be created frequently.
autofixhandedness start
in 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.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.
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.
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)
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.
you could change it under the enemy section of the unit list. which has the were caste and wererace files needed.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.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.
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,
you could change it under the enemy section of the unit list. which has the were caste and wererace files needed.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.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.
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.
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.Spoiler (click to show/hide)
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)
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.
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()
Quote from: Imperator314Sorry 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.
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.
simple embark as in embark anywhere or the bit that allows you to alter how many units can spawn on the map simple embark?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
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.
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()
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.
New example showing all syndromes in the world so you can see some of the different types: www.brightsoft.net/examplesyndromereport2.htmlThese 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?
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?
if unit.caste == 0 then
unit.caste = 1
else
unit.caste = 0
end
so that female dwarfs will be regenerated too.
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 toCode: [Select]if unit.caste == 0 then
so that female dwarfs will be regenerated too.
unit.caste = 1
else
unit.caste = 0
end
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.
.. snip ..Code: [Select]if unit.caste == 0 then
so that female dwarfs will be regenerated too.
unit.caste = 1
else
unit.caste = 0
end
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?
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.
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
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 :)
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()
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.Spoiler (click to show/hide)
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?
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.
You want the dwarf manipulator to have a abililty to edit the skills of a unit? I think someone here made a morul script.
--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?
MethNot even once.
Meph, if you can get it working, you might want to consider using the caste-choosing embark plugin for themed embarks.MethNot even once.
I will have a look, I really like this utilty. :) Especially in a mod with so many syndromes and effects flying around.
Something on your system is causing incompatibility with stonesense. What OS and specs do you have?
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 ;).
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.
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.
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.
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.
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)
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 )
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)
puts df.decode_mat(422,43)
If I use 422,43 I get PLANT_MAT:POD_SWEET:EXTRACTautoSyndrome enable
syndromeTrigger enable
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).
Question about makeown: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.
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?
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.
Thanks! Making both changes to the original post.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).
So, since I can't find any clear answer anywhere. Is there currently any way to change the number of embarking dwarf with this?
-- 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 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)
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
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.
The first thing I can think of is that zombies don't have souls.
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
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.
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.
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.
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.
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.
Question about makeown: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.
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?
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:or use this: https://github.com/jjyg/dfhack/blob/master/scripts/startdwarf.rb
(paste it into startdwarf.rb in scripts dir)
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)
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
hmm... is plugin for sorting gem list by material value possible?
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)
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?
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
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
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.
It's in the next release of it (i think).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?
Paste the text in to a notepad, save it to \dfhack\scripts\medic.rbTrying this now...
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
Paste the text in to a notepad, save it to \dfhack\scripts\medic.rbTrying this now...
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
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.
Paste the text in to a notepad, save it to \dfhack\scripts\medic.rbTrying this now...
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
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.
Is there a way to remove all wounds from a dwarf and return him to perfect health?Without cheating? No.
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.
You're in the dfhack topic, tahujdt.For some reason, I though this was 'What's going on in your fort?' Sorry.
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.
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
I type something in the console window, like 'automaterial 1', to turn that feature on. Instead of it turning itself on at startup.
I guess my question got lost,
does anyone have a script to totally heal a dwarf or remove all wounds as it were?
-- 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 guess my question got lost,
does anyone have a script to totally heal a dwarf or remove all wounds as it were?
-- 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
-- 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()
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
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 usinghttps://github.com/peterix/dfhack/blob/master/Readme.rst#id9
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?
You need to add <md5-hash value="..."/> to symbols.xml (use md5 dwarfort.exe to determine it).
the stderr.log seems finemeans in particular no 'wrong md5-sum' error, as i changed it accordingly
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).
starting df normally it runs fineas i haven't changed any string's length (if the replacement was shorter i padded zero-bytes)
QuoteAlso, 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).Quotestarting df normally it runs fineas 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?it's the same: works fine without dfhack, crashes with it
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 need to add <md5-hash value="..."/> to symbols.xml (use md5 dwarfort.exe to determine it).Quotethe stderr.log seems finemeans in particular no 'wrong md5-sum' error, as i changed it accordinglyQuoteAlso, 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).Quotestarting df normally it runs fineas i haven't changed any string's length (if the replacement was shorter i padded zero-bytes)
so that's not it :(
Out of curiosity, what hex editor do you use?i normally use GHex, but for this i did write a python script
Code: [Select]0xf7bfa3bd in DFHack::Core::doUpdate(DFHack::color_ostream&, bool) () from ./hack/libdfhack.so
not quite sure what this tells me, though
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
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à.
tl;dr problem: Queen isn't a dwarf - anything I can do?you got yourself a DROW Cacame.
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.
Reading all this about adding caravan guards to your fort, and changing the race of nobles got me thinking: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.
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?
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.)
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 :)
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
[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]
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.
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.
In adventure mode, anyway of getting a pick with dfhack?
[DFHack]# fastdwarf 1 1
Current state: fast = 1, teleport = 1.
[DFHack]# Segmentation fault (core dumped)
-e
@warmist: So dfhack would slap jobs on them, instead of just having them choose themselves, acording to their skills?hunting is just setting them to attack random animals then carting their corpses to the stock pile.
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.
@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).
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.Anyone know the syntax for unassigning from cages with the zone plugin?
Currently I've triedCode: [Select]zone unassign all 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.
zone unassign all own egglayer
zone unassign all own
zone unassign all
zone unassign
zone unassign count 5 own egglayer minage 1
I am confused. Assigning to cages and zones is working fine. But now I've got 400 peafowl I need to get back out.
zone set
zone assign count 5 own race BIRD_PEAFOWL_BLUE caged female egglayer minage 1
Hmmm.... How can i change a number of dwarves in r3 DFhack? I can't find this function anymore:(http://www.bay12forums.com/smf/index.php?topic=91166.msg4244960#msg4244960
Also i thought there was a script or a tool to force caravan and migration events?
(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
Fast will keep it going for a few seconds, but teleport crashes it instantly, with the same error messages.Hmmm.... How can i change a number of dwarves in r3 DFhack? I can't find this function anymore:(http://www.bay12forums.com/smf/index.php?topic=91166.msg4244960#msg4244960
Also i thought there was a script or a tool to force caravan and migration events?(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?
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?
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?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.
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.
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
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 steam-engine plugin detects custom workshops with STEAM_ENGINE in their token, and turns them into real steam engines.
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.
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?
local this = dfhack.gui.getSelectedUnit()
if this.body.blood_max >= 282 then
this.flags2.slaughter = true
end
print(this.body.blood_max)
keybinding add Shift-B slaughter
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.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.
eg. ?? paint sh tree, paint m plant:oak ??
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?
(blood_max) (~body size) (plate trigger size)
8 61 8 buck rabbit
2808 1006 3257 wild boar piglet
Did the dfhack for version 34.07 have support for lua scripts?
it is just slaughtering everything ... Can someone explain what's wrong here?Perhaps rather than testing the attributes, print them.
it is just slaughtering everything ... Can someone explain what's wrong here?Perhaps rather than testing the attributes, print them.
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...)
It's in the next release of it (i think).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?
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 withcopperunsafe materials to provide power during their short lifespan, or that allows them to generate power when a normal steam engine activates the gear.
Did the dfhack for version 34.07 have support for lua scripts?
yep it can do LUA.
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.It's in the next release of it (i think).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?
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
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.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.It's in the next release of it (i think).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?
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.
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.
dfhack.gui.getSelectedUnit().mood = -1
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
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?
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
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?
If the turtles were running around, then you created a vermin, not a raw fish...
Also, I have yet to see dwarfs babies and children grow as they age.
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.
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?
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. :)
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.
ya i just marked 91 turkies for slaughter.... thank you autobutcher
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.
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)
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?
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?
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).
still work perfectly, as far as I can tell.
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"I'm guessing something about unit wounds changed? I just tried another script that is supposed to fix ability to stand lostCode: [Select]repairhim = lambda { |u|
but right away it throws an error on "able_stand"
# 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
able_stand was renamed to limbs_stand_max and able_stand_impair was renamed to limbs_stand_count
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
Does the DFusion empregnate script make eggs fertile?Nope.
...See my post above - the fields appear to be volume, contact area, and length/height.
If you can figure out more about these fields, it can be updated and made even better ;)
...
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?
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 standCode: [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
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]#
https://github.com/peterix/dfhack/blob/master/Lua%20API.rstWell, 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).
df.global.cursor
Thanks. Is there somewhere I can see a list of these values?
Cheers, I can confirm this script fixes lost ability to standCode: [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?
remind me to wake up tomorrow and make this more coherent: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):
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...
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","ELF","GOBLIN"}
same for embarkplug=require"plugins.dfusion.embark"
plug.Embark:install{{"DWARF",0},{"ELF",0},{"GOBLIN",1},{"DWARF",1},{"DWARF",1},{"DWARF",1},{"GOBLIN",1}}
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","ELF","GOBLIN","DWARF"}
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?
-- 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
-- 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
https://github.com/expwnent/dfhack/blob/f92e859f499105abfbb40d008189bc36e88323f5/Readme.rst#mod-interactionWhile 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.
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
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
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
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.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.
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 have a question, or more of an idea: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.
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?
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.
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.
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!?
--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()
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!?
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....
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?
if (cur_year_tick % 10 == 0 && (cur_year_tick - birth_time) % 1200 == 0) { update stuff }
......
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.
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.
ruby: -1 % 10 == 11
ruby: -1 % 10 == 11
Wait, what?
I Googled this, and apparently Ruby should return 9 in this case...
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)
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
what is needed here:
-1 % 10 == -1
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.
--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()
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.
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?)
Is it in raw, NOT raw/objects?
Ah, then it's working. Hehe. I keep forgetting to include notifications...
...
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)
fastdwarf
steam workshop: just copy the given one is what I would do
oh then siren
It's 'makeown'. You can read about this in .../Dwarf Fortress/hack/Readme.htmlare there restrictions on these units?
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.
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.
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.
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.
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.
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.
[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]
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).
Yes, there are restrictions.
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.
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.
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.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.
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.
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:
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.
dfhack.getline()?
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...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.
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.
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)
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)
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.DFHack also have the temperature tweak, which means it takes less time (hence less processing power) for items to reach equilibrium temperature.
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.
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.
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...
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.
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?
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
stuff starting to creep me out. you sure you guys should be playing with that?
If only we could change the error to say "Unknown and unknowable." Then we could leave something very creepy for adventurers to find...
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.
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?
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.
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?
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.
Question about makeown: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.
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?
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)
The guards, when converted, will:
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)
- 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.
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?It absolutely does matter - in this case, it must be a .lua script.
Also..how do I know to make it a .rb or .lua script? Does it matter?
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?It absolutely does matter - in this case, it must be a .lua script.
Also..how do I know to make it a .rb or .lua script? Does it matter?
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?It absolutely does matter - in this case, it must be a .lua script.
Also..how do I know to make it a .rb or .lua script? Does it matter?
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)
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.
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?
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?
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
And then apply that every immigrant wave and birth?
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.
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:
dfhack.screen.dismiss(dfhack.gui.getCurViewscreen())
i think this would do that:Thanks, but that closes DF entirely.Code: [Select]dfhack.screen.dismiss(dfhack.gui.getCurViewscreen())
gui = require 'gui'
gui.simulateInput(dfhack.gui.getCurViewscreen(), 'LEAVESCREEN')
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?
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.
(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.
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()
Use it on creatures that are fighting in the arena and have wounds.
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
Could somebody please bring me up-to-date with the current custom scripts?None of the scripts are mine actually ;)
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?
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.)
I only meant the startdwarf, the link I found mentioned it was yours. Is it jjyg ? I never seen that name before.Yes it's jjyg in github or jj`` in #dfhack afaikTry 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. :)
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.
...
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?
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
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.
...
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
or similar ruby code to repair all nerve damage stored at this location.
v.motor_nerve_severed=false
v.sensory_nerve_severed=false
end
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?
...
You can also use this:Code: [Select]for k,v in pairs(unit.body.components.body_part_status) do
or similar ruby code to repair all nerve damage stored at this location.
v.motor_nerve_severed=false
v.sensory_nerve_severed=false
end
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.
for k,v in pairs(unit.body.components.body_part_status) do
v.organ_loss=false
v.organ_damage=false
end
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.
-- 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.
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?
...
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.
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.
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.
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
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'
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.
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.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
endCode: [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'
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
--note ipairs instead of pairs
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.
...
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).
I meant a plugin that would clean up the reduction in immigration without clearing the "dead units" list.
-- 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)
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)
Whoa, that's great Kurik! Thanks for the fix!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:
- 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
script to add nemesis to units that have already had historical figures added with the previous version of the fixmakeown or fixhistfig script:
- 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.
Spoiler: fixnemesis.lua (click to show/hide)
... unfortunately that code didn't fix them. The missing organs disappeared again.. are there any scripts out there that actually work on restoring organs?
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)?
Whoa, that's great Kurik! Thanks for the fix!
First "twice as strong as a dragon" would have to be defined.How about a command to give a targeted creature 1000000 strength?
... 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.EDIT: please be sure to make a backup before testing (especially when testing the resurrection part)Spoiler: fullheal.lua (click to show/hide)
How do you check whether the unit still exists in units.all?
dfhack.persistent.save({key='SAVE_PATH',value=SAVE_PATH})
-- 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
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.
-- 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
df.global.world.cur_savegame.save_dir
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.
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.
if flags1.deadand unit.race ~= dwarf_racethen
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
...
... 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.EDIT: please be sure to make a backup before testing (especially when testing the resurrection part)Spoiler: fullheal.lua (click to show/hide)
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.
...
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.
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:Quoteif flags1.deadand unit.race ~= dwarf_racethen
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
...Spoiler: code: the full if statement (click to show/hide)
How do you create binary patches? I've seen these have been used to fix the hospital overstocking.
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
It would be amazing if it read the product chance from the product raws.
Not to worry, this is for a bugged adventure game, the target in question being an absent megabeast.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.
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.
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.
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.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.
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
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.
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.
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.
unit.inventory.each do |invitem|
invitem.item.flags.forbid = false
puts invitem.item.id
end
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.
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
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?
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
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?
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)
[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.
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");
item.mat_type == cons.mat_type and
item.mat_index == cons.mat_index then
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)
item->getMaterial() != cons->material ||
item->getMatgloss() != cons->matgloss)
item.getMaterial(item) == cons.mat_type and
item.getMaterialIndex(item) == cons.mat_index then
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.
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.
if (item->getType() != cons->item_type ||
item->getSubtype() != cons->item_subtype ||
item->getMaterial() != cons->mat_type ||
item->getMaterialIndex() != cons->mat_index)
continue;
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
given the originalCode: [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)
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)
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)
[DFHack]# keybinding list Ctrl-Alt-S
@dwarfmode/Default: quicksave
[DFHack]#
[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]#
@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 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
mousequery track disable
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.
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'.
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. :)
Im having a bit of a problem understanding tiletypesgrass 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.
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?
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?
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.
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.Can you give me an example setup of tiletypes where you got that to work?
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.
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.
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.
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
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.
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
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
which one? my version, your version, warmist version? or all three?warmist is uber stable :)
because to explain it to others my version is a modified old version that was tested in genesis,
warmist is kinda unstable.
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.
Thanks! Methods I tried were: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.
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.
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:
:lua df.global.ui.main.fortress_entity.training_knowledge={new=true}
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?
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
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.
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"DWARF","DWARF","HUMAN","ELF","GOBLIN"}
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]
Running this code:check if there is a file hack\lua\plugins\dfusion\friendship.oCode: [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:
[/color]
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...)
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?
Running this code:check if there is a file hack\lua\plugins\dfusion\friendship.oCode: [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:
[/color]
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...)
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.
minecart_watcher
D_ONESTEP
End of group
CUSTOM_SHIFT_W
End of group
End of macro
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.
Large open areas equals more path-finding calculations.
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.
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.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.
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.
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>
"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.
# 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'))
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?
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.
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.
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.
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?No error. Just says it cant find the first unit regardless of which goes first.
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.
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.
dfhack.gui.getSelectedUnit().flags1.marauder = true
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.
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.
Cross-post from plugins suggestions, since I think this would be really quick:we have the ability to hijack the announcement tab and add anything you want...or well warmist does.
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.
printall(data[x][y])
This doesn't work either. 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.printall(region_map[x][y])
which doesn't work. Could anyone point me in the right direction please?
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?
printall(region_map[x][y])
If you're getting an error, post it. Try this code out: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
[lua]# region_map=df.global.world.world_data.region_map
[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
[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
[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>
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.
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?
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)").Further to this, would it be possible to recursively prospect each region to get a worldwide list of stones, to make a holistic Finder?
Alternatively, you can let DFHack do the work for you and use the function "dfhack.maps.getRegionBiome(x,y)".
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.
BOULDER INORGANIC:GOLD
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
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
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
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.
--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
Try 'revflood'
-- 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
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.
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?
....
-- 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
write_gamelog('Loaded Region'..#..', '..dfhack.TranslateName(site.name)..' ('..dfhack.TranslateName(site.name, true)..'), at coordinates ('..site.pos.x..','..site.pos.y..')'..NEWLINE..
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).
<...> 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
write_gamelog('Loaded '..df.global.world.cur_savegame.save_dir..', '..
-- 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
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!")
Does anyone know how exactly deities are linked to specific entities (Urist Stylesuitor is a deity of The Glad Helms....)?
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.Try 'revflood'
"point the cursor at some empty space you want unhidden"
everything is already unhidden so it wont hid it D:
unknown1b? That sure explains why I couldn't find it.usually thing={new=true} works
EDIT: Friggin' vectors. fig.info.sphere is of type vector<int16_t>, which I can't seem to make a new of in lua.
Is there a way to remove vanilla buildings? I did a forum search but could not find anything conclusive.
unknown1b? That sure explains why I couldn't find it.usually thing={new=true} works
EDIT: Friggin' vectors. fig.info.sphere is of type vector<int16_t>, which I can't seem to make a new of in lua.
...
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.
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
<...>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...
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.
...code...
-- 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)
-- 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)
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.
"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.
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 ;)"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.
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.
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
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".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: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.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 :(
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. Ah, I did not think you could access those data structures from lua. This makes things so much easier. Thanks, tons and tons.
Actually everything that is accessible from c++ is also accessible from lua because the same code that generates c++ structures also generates lua structs.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.
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?
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)
[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
# display gm_editor
keybinding add Alt-E gui/gm-editor
keybinding add Ctrl-E "gui/gm-editor dialog"
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
warmist gave me this tidbitor a more generic:
gui/gm-editor df.global.world.raws.creatures.all[466].caste[0].attributes
Gui/gm-editor Dfhack.gui.getCurViewscreen()
if you want to poke at menus like effecting your stats from the beginning.
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?
Alright. Hmmm.. And uh, how would I do that? If thats not asking too much.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.
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?
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
worldname = df.global.world.world_data.name
dfhack.TranslateName(worldname)
dfhack.TranslateName(worldname ,true)
*** 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).
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?
Aseesed?*arena mode *entered
-- 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 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.
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().
Is there an array that holds the fortress jobs. does the order affect the priority
42
31
The reverse of the jobs creation order.
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.
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.
-- 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)
-- 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)
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 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] ?
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
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.
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?
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./stonesense/deplibs":"./hack"
setarch i386 -R env LD_PRELOAD=./hack/libdfhack.so ./libs/Dwarf_Fortress
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:
What distro are you running and how did you install df + dfhack?Debian Wheezy, 64bit.
What happens if you run this from the DF directory:Makes no difference. DF starts, console is stuck on "Resetting textures".Code: [Select]export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"./stonesense/deplibs":"./hack"
setarch i386 -R env LD_PRELOAD=./hack/libdfhack.so ./libs/Dwarf_Fortress
More importantly see if there is an stderr.log file and what's in it.
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.Thanks, it worked! :) Now I get DFHack console alright.
-- 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)
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.
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.
[DFHack]# :lua dfhack.gui.getSelectedItem().flags.in_building = false
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.
The hive-bug is probably neglectable, because falconnes tweak-plugin fixes it.
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()
...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 script requires a workshop job selected in the 'q' mode
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()
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
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)
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
Roses, tell me what you try to do, maybe I can come up with something.
Can you get the display tile to work on civ-members at all? I only got either no effect, or a flickering tile.
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.
# 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
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?
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.
// 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)
local player = df.global.world.units.active[0]
player.counters2.hunger_timer=0
[SYN_CLASS:\COMMAND]
[SYN_CLASS:fovcommand]
[SYN_CLASS:\WORKER_ID]
[SYN_CLASS:make_legendary]
[SYN_CLASS:DWARF]
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. :)
-- 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)
-- 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
-- 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: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
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
...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]#
local utils = require 'utils'
local unit = utils.binsearch(df.global.world.units.all, id, 'id')
if unit then
...
end
local unit = df.unit.find(id)
if unit then
...
end
local unit = df.unit.find(tonumber(...))
unit.counters2.hunger_timer=0
<...> I also find that it often covers the happiness stats and generally gets annoying eventually. <...>
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.
Lol @ vanilla feature interfering with tool feature, kind of makes me want to say "back in my day..." :DHeh, 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.
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++.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++.
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.
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 :(
to get a unit by idCode: (lua) [Select]local utils = require 'utils'
local unit = utils.binsearch(df.global.world.units.all, id, 'id')
if unit then
...
end
orCode: (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.
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.
Unrepeat them.
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 ;)
function example()
print("Hello, world!")
dfhack.timeout(50,"ticks",example)
end
Code: [Select]dfhack.timeout(50,"ticks",example)
I don't think that works in arena mode, though...
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.
function example()
print("Hello, world!")
if foo(spam) == false then
dfhack.timeout(50,"ticks",example)
end if
end
if string.lower(...) == "disable" then
example = nil
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.
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
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
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.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.
(http://i.imgur.com/k8yR1vQ.png)
Edit: woops, forgot image.
Does anyone know why I get redundant reports on tweaks when I start dfhack?
Does anyone know why I get redundant reports on tweaks when I start dfhack?Because it prints one line per hook: <snip>
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.
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?
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))
and while en route to get it the barrel
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.
df.global.world.worldgen.worldgen_parms.embark_points=tonumber(...)
Then I'll have more reason to wait ;V
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.
[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]
df.global.init.media.volume=0
...
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.
...
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.
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?
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!
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. ;)
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
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
Other flags that may be connected to hostility:
active_invader
hidden_in_ambush
invader_origin
coward
hidden_ambusher
invades
underworld
resident
visitor_uninvited
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.
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.
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.
Does anyone know if the dfusion friendship plugin will work, and if yes how?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.
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! :)
Nope, just re-downloaded another DFHack r3, no friendship.o in there...Ah yes, i think i did not include it in build process or something... I'll try to fix that when i get home.
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?
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.echo off
call "%CD%\..\..\__Process Legends Exports.bat"
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.Spoiler: what we have so far (click to show/hide)
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.Spoiler: what we have so far (click to show/hide)
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.
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. ;)
Is it still possible to actually start a multi-race fort, or are the old DFusion functions axed for the time being?
plug=require"plugins.dfusion.friendship"
plug.Friendship:install{"SOMETHING","SOMETHING","OTHER_THING","ANOTHER_THING"}
I haven't heard anything about embark's current syntax.It's very similar:
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.
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"}
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"}
Wait. So this runs on dfhack r3 and allows multi-race forts with working civ-members of different creatures?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.
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.
Ok, I wont touch it then. I had enough of the crashes, with 2 unstable version...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.
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.
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.Ok, I wont touch it then. I had enough of the crashes, with 2 unstable version...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.
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.
{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{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},
Imma just real quick translate for you guysdue 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.
Put that code into the companion order lua and it will allow youto rideCarry stuff on your back in adventure mode (I'm pretty sure).
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.
unit.relations.old_year=math.random(caste.misc.maxage_min,caste.misc.maxage_max)
unit.relations.old_year=math.random(caste.misc.maxage_min,caste.misc.maxage_max)+df.global.cur_year
--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.
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.
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.
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.
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.printall(df.global.world.world_data.region_details[0].features[X][Y][n]
you can display this structures.-> 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.-> 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.df.global.world.world_data.region_details[0].features[9][13][0] = 83
and voila the volcano disappeared on the embark screen.df.global.world.world_data.region_details[0].features[10][14][0] = 66
made an volcano appear on the other tile.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.
Aaaand now it's time to right a script for that, huh?so I decided to see if this also the same for fort mode.
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.
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.
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.
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.
If you think there are any other features missing that wouldn't be too hard to implement, by all means post them here.
Is it possible to alter the climate temperature of my map?
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.
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.
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
Can Lua coroutines be used in user scripts (scripts directory, or game save init.lua)?
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.
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
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.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.
[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.
To assign labors, you must switch your CURRENT_RACE to the species in question using DFusion, then switch back once done.
-- 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)
You'll want to change unit.enemy.normal_caste; doing this will cause a transformation message, but the transformation is permanent and works perfectly.
"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)
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)
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).
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.
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.
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
...\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 ?
local f=function(name,C)
table.insert(unitsToFuse,C[3])
script.mkresume(true)
end
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
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
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
Am I overcomplicating asking for two inputs?
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?
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
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.
is it possible to make it rain blood without going to a evil biome using dfhack
can you show me a example of the interaction effecthttps://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.
[I_TARGET:C:MATERIAL]
[IT_MATERIAL:MATERIAL:INORGANIC:IRON:WEATHER_FALLING_MATERIAL]
[I_EFFECT:MATERIAL_EMISSION]
[IE_TARGET:C]
[IE_INTERMITTENT:WEEKLY]
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.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?
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.
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.
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.
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.
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.
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
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.
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.
probably do some cool stuff
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.Quoteprobably do some cool stuff
This is the biggest understatement I have ever seen.
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
repeat enable 1 months force siege EVIL
repeat disable force
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()"?
Yes, Sir ;)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.Quoteprobably do some cool stuff
This is the biggest understatement I have ever seen.
Any Fun ideas?
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.
006C8BE2: 89 d7
006C8BE3: b5 c5
006C8BE4: f8 6d
006C8BE5: 14 34
006C8BEE: 0D 0B
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??
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.
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)
teleport x 50 y 35 z 20
teleport unit 3503
teleport showUnitID
teleport showPos
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);
}
Code: [Select]out.print("autoSyndrome is %s\n", enabled ? "enabled" : "disabled");
Is it possible to have custom workshops require power using DFhack?I think so. But afaik only with c++ plugin.
dyld: could not load inserted library './hack/libdfhack.dylib' because no suitable image found. Did find:
./hack/libdfhack.dylib: mach-o, but wrong architecture
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.
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?
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
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)
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.Is it possible to have custom workshops require power using DFhack?I think so. But afaik only with c++ plugin.
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 scriptHere is my first draft of DFHack Plugin tutorial: https://www.dropbox.com/s/059sgov0o40d4ad/PLUGIN%20TUTORIAL.rstSome spots that need correction:
Some spots that need correction:
Make a page, in a similar spot to the dfhack page (http://dwarffortresswiki.org/index.php/Utility:DFHack) and add some links.
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.
Make a page, in a similar spot to the dfhack page (http://dwarffortresswiki.org/index.php/Utility:DFHack)
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).
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.
I've created the page myself - you should be able to add whatever you want to it.Send a PM to Briess (http://www.bay12forums.com/smf/index.php?action=profile;u=18951).
Done. Thanks again.
[dfhack]# lua
[lua]# dfhack.gui.getSelectedUnit().mood = df.mood_type.None
[lua]# quit
[dfhack]# fix/loyaltycascade
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.
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.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.)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.
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?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.
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?
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.
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.
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.
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 ?
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?
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?
Testing so far on a goblin siege squad: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.
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.
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++.
unitAlreadyChecked={}
function checkUnit(unit)
...stuff...
unitAlreadyChecked[unit.id]=true
end
Testing so far on a goblin siege squad: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.
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.
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
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.
is it possible to use dfhack to make a dwarf give birth?
dfhack.gui.getSelectedUnit().relations.pregnancy_timer = 0
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?
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.
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.
...
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.
...
--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
https://github.com/angavrilov/df-structures/blob/master/df.ui.xml#L618it's less spawn and more they convert the dead unit into a ghostly type.
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.
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.
how do you spawn a forgotten beast with the dfhack command "spawn"?
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
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).
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?
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.
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.
My pack is still using r3.
...
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.
# 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
*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?
# 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
# 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
# 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
*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.
...
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?
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?
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.
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.
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.
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.
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?
cd build
cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=/usr/local/src/df_linux
cd ..
mkdir build-2
cd build-2
cmake .. -DCMAKE_BUILD_TYPE:string=Release -DCMAKE_INSTALL_PREFIX=/usr/local/src/df_linux
make install
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
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.
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
$ 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
[ 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
[ 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?
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?
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).
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.
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
How long after the next release can I reasonably expect a DFHack to be updated to the new release?
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.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.
No, AFAIK. It's pretty... kludgy as of now. I think this'll be improved as of next version.
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.
Hi guys,oh uhh just crack open the lua and remove the line that makes them that way.
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.
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.
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
No age; the age should be exact moment of adulthood though.
thanks for the replies guys.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.
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...
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)
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...
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.
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.
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.
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.
/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.
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.
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.
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)
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...
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...
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}
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".
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.
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
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).
[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]
--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
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]]()
Is it possible to tell how dehydrated a dwarf is using dfhack?
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?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.
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: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...
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. :)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.
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.
while #unit.body.wounds > 0 do
unit.body.wounds:erase(#unit.body.wounds-1)
end
do?What doesCode: [Select]while #unit.body.wounds > 0 do
do?
unit.body.wounds:erase(#unit.body.wounds-1)
end
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 justgets 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.Spoiler (click to show/hide)
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.
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.
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.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.
Is there a version of dwarf manipulator where the custom labours of ☼MASTERWORK-DF☼ are a used.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 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. :)
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.
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.
[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]
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?I dont think the bodyparts are possible, but the tissue material should be possible.
Similarly, is it possible to change a creatures tissue materials with dfhack? Like turning all of their skin into stone?
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?I dont think the bodyparts are possible, but the tissue material should be possible.
Similarly, is it possible to change a creatures tissue materials with dfhack? Like turning all of their skin into stone?
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.
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. ^^
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.
I'll see if I can experiment with materials involved in tissues.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.
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.
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.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?)
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. :)
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.
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.
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).
When you say (no plugins needed), does that mean no dfhack? Because spatter-add, autosyndrome and itemsyndrome sounds very fitting for what you plan.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?
Otherwise its really only drinks with syndromes, and they are hard to micromanage.
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.
They also lack natural skills. If you make a creature with NATURAL_SKILL:AXE:20, and spawn it, it wont have any axe skills.
I've found the gmeditor is quite useful for getting around the hostile/friendly problem...What is that, which problems?
df.global.unit_next_id=df.global.unit_next_id+1
unit.relations.old_year=df.global.cur_year-5
Isnt it that part?Old_year is actually death fromold age year.it should be in the future.Quotedf.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.
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!
QuoteI've found the gmeditor is quite useful for getting around the hostile/friendly problem...What is that, which problems?
<...>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)
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...)
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?
I believe a batch file that runs dfhack-run followed by commands is what you're looking for.Works great - thanks!
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.1. two ways possible: simple move (boring), making them projectiles, aka throwing them (that should be fun)
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)
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)
Is there anyway I can use DFHack to play adventure mode with one of the dwarfs from my fortress?
--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.
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
...
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.
...
--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
I just ask because forgotten beasts, demons, titans and procedually generated content in general will use any inorganics in the rawsNo 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.I just ask because forgotten beasts, demons, titans and procedually generated content in general will use any inorganics in the rawsNo 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.
[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]
[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]
[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]
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).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?
What does Dfusion's power up command do? It appears to be both opaque to googling, as well as not listed in the readme.
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?
I dont know if you know the script, but there is a "deathcause.rb" included. (not lua, yes, but maybe it helps.)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.Spoiler (click to show/hide)
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...
warning untested code ahead:Code: [Select]function getSlaugthered()
for other one use: "df.misc_trait_type.RevertWildTimer" not sure on details though...
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
[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. :-\
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})
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. ^^
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.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.
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)
You could use general refs
or you could use this (https://github.com/peterix/dfhack/blob/master/Lua%20API.rst#persistent-configuration-storage)
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?
give the interaction a second target, SELF_ONLY and add the unit id there?
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.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.
local log = io.open('gamelog.txt', 'a')
log:write(text.."\n")
log:close()
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.
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)
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
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
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:for id,ev in ipairs(block.block_events) do
if df.block_square_event_mineralst:is_instance(ev) then
-- do something here
end
end
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.
[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]
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).
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
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.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).
-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.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.
-[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)Again, actual size is only 0x2.
<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>
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.
[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)
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
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?
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
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.
What is the purpose of the "Nemesis" entries anyways? What do they do that isn't redundant to the unit or historical figure data?
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.
I got DFHack from the LNP and it doesn't recognize that as a command.
fix/growthbug enable
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.
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
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
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
local eventful = require 'plugins.eventful'
eventful.enableEvent(eventful.eventType.UNIT_DEATH,5)
eventful.onUnitDeath=function(u)
local unit = u
print('unit died.')
end
Anyone know how to use eventful.onUnitDeath?Try eventful.onUnitDeath.someRandomName=function(u)...
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?
Anyone know how to use eventful.onUnitDeath?Try eventful.onUnitDeath.someRandomName=function(u)...
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?
Also it's not a unit, but a unit id (i think).
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...
Uh...~ev -> printall(ev)
Is that even lua?
local ev=require 'plugins.eventful'
ev.onUnitDeath.bla=function(u_id) print("unit_died"..u_id) end
ev.enableEvent(eventful.eventType.UNIT_DEATH,5)
Anyone know how to use eventful.onUnitDeath?Try eventful.onUnitDeath.someRandomName=function(u)...
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?
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.
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)
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.
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.
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?
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
print(getAttrValue(dfhack.gui.getSelectedUnit(),'SPATIAL_SENSE',true))
print(getAttrValue(dfhack.gui.getSelectedUnit(),'STRENGTH'))
Yeah, those are missing for whatever reason, but here's a simple function that should do the same thing (weighted for syndromes as well):
function copyItemMat(item1,item2)
local matInfo=dfhack.matinfo.decode(item1)
item2:setMaterial(matInfo.type)
item2:setMaterialIndex(matinfo.index)
end
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.
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.What exactly did you try with dfhack.matinfo.find()?
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.
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.
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
Questions about changing values;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).
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?
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.
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.
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 ')'
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.
I got a message on Reddit from Ciphertext008 - it's about dfhack r3,but I thought I'd pass it on.Quotehttp://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 ')'
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.
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.
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.
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...
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
What exactly do you need goto for? I'm sure break (http://www.lua.org/pil/4.4.html) would work just as well...
In that case, I think putting the checks into their own functions would be better.
How do I change the tile of a building (for animation purposes)?I dont know, but I know that warmist and ag know it. :)
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.
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:Actually, your current problem seems to related to another missing library or header. There is a fileSpoiler (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?
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$ldd a.out
to find the missing library. or you may search for libstdc++, glibc, gcc, g++, gcc-libs. $ 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.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.
Anyone know how to create a gui.FramedScreen that is not centered in the parent window?try e.g:
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.
my_screen_class= defclass(my_screen_class, gui.Screen)
my_screen_class.ATTRS={
frame={t=0,l=0,w=10,h=10}
}
Workflow.
There's also a file called dfhack.init-example. You might want to rename that to dfhack.init.
Hi,I haven't tried the autochop, but you can use getplants thus:
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...
getplants -t WILLOWTechnically, 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).
will mark all the willow trees on the map for choping.
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.
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.
function repeatScriptEvery100Ticks()
dfhack.run_script('script','arg1','arg2',...)
dfhack.timeout(100,'ticks',repeatScriptEvery100Ticks)
end
local script=require('gui.script')
script.start(function()
while true do
dfhack.run_script('script','arg1','arg2',...)
script.sleep(100,'ticks')
end
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.
Has there been any discussion of converting it to a dhfack plugin, a la stonesense?
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.
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.
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.
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.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?
How do you read/change the size of an article of clothing?...
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?
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: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.
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.
infiniteSky, although not documented on the readme files, is also available on R3, which might be easier than building and installing the R4 version.
The "Alt" key is seen as permanently pressed by the scripts from DFHack. Am I the only one?
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?) ?
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).
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.
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.
Sure. Just wait for a week or something, I'm a little busy at the moment.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)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).
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.
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?I usually create a simple lua-screen that prints(all) the keys in function on_input.
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).
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)
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?
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.
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
xinit ./libs/Dwarf_Fortress
works in the df script shipped with the linux version of the game.xinit: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
I have no idea what that means and how to deal with that.I want to start dfhack from a terminal on Linux and have Dwarf Fortress run with xinit.
I tried doing something like that with dfhack, but inserting xinit before every instance of ./libs/Dwarf_Fortress doesn't work but fails withCode: [Select]xinit: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
I have no idea what that means and how to deal with that.
startx /usr/bin/rxvt -e /wherever/you/put/dfhack
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).
Yes, that is exactly what I meant.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.).
That's unfortunate, it's exactly what I was hoping for.QuoteI tried doing something like that with dfhack, but inserting xinit before every instance of ./libs/Dwarf_Fortress doesn't work but fails withCode: [Select]xinit: symbol lookup error: ./hack/libdfhack.so: undefined symbol: _ZTV8renderer
I 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.
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.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.
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.
I am sorry, DF running more slowly in the window manager is bullshit.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.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.
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?
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.
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
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).
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.
function unpack (t, i)
i = i or 1
if t[i] ~= nil then
return t[i], unpack(t, i + 1)
end
end
......
Pretty certain you also need:
paint sh wall - to actually do the undigging
It goes with the other paint commands.
why does the dfusion used in dfhack lacks the friendship command?Short answer: because i'm a lazy bum.
They're on the ground. I have granite and hematite. What rocks would be suitable?
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, the auto-melt script is still buggy, I don't know what to do :(
Thanks for the update :)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.
Weapons have to be artifacts to have names, I'm pretty sure
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.
By what do you mean "doesn't work"?
[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...)
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!
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?
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.
I cannot get it, how to make a steel bow? I've tried a tonn of different combinations with ITEM_WEAPON_BOW and everything..
Right, didn't put WEAPON: on the beginning, thanks.
But still does "No unit selected", you can't just spawn them on ground?
What if in DF mode I will spawn it on civilian, will he just haul it to weapons stockpile?
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.
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.
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 :)
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.
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.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?
Here is the script: linky (https://gist.github.com/warmist/11218191)
Pop into adventure mode, use this dfusion scriptThere's actually a "showmood" command in DFHack which will tell you exactly what your moody dwarf wants.
"Urist McGoth wants a hug."Code: [Select]function spar(unit)
To set spar flag on urist Mcgoth and current unit you're playing, walk up and wrestle both arms over Mcgoth.
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)
Oh. no, I wasn't looking to hug anybody, I was interested in using the sparring script to spar with companions and others.
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.
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.
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.
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.
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?
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
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?
Actually, what I was hoping to be able to do is tie into the interaction itself, for example;Code: [Select][INTERACTION:TEST1]
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.
[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]
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.
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.
- 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.
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
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.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.
https://github.com/DFHack/dfhack/graphs/contributors
Does using dfhack.items.remove(item[, no_uncat]) make an item completely disappear?
Does using dfhack.items.remove(item[, no_uncat]) make an item completely disappear?
What do you mean by "completely disappear"?
How do I get the name of a sphere based on its id number?
print(df.sphere_type[40]) --will print FORTRESSES
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).
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.
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.
What about casting obsidian outside, then excavating?It will still be Light Above Ground.
Everyone who is mad of 30-item manager limit, has a good news. By patching the following offsets in memory: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).
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).Probably should. Probably. I guess nobody has blown his computer up due to the wrong offsets.
Also, this is obviously a Windows-only patch, so it can't be used on Linux or MacOS without further research.
--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")
By request, a lua script with function to insert pets if they don't already existThank you. I will do some tests today and let you know how it goes. :)
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")
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.
...
Thank you. I will do some tests today and let you know how it goes. :)QuoteNote 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 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.
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.
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).
--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")
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.
Neat. Just to make sure, the correct lines are :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.
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.
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?)
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.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.
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. :)
I checked the embark, the leathers, meat, cheese, wool... its all still there. No issues.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).
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: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 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
https://github.com/DFHack/dfhack/blob/develop/NEWSI 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?
https://github.com/DFHack/dfhack/blob/develop/NEWSI 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?
is there a tree array in the df structures I can cycle through?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.
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.
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.
It doesn't contain all the scripts, far from it,
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
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.
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. :)
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.
Three questions about this;1, Yes, 2, It acts as pet, 3, It should act as pet as well.
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?
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?
QuoteThree questions about this;1, Yes, 2, It acts as pet, 3, It should act as pet as well.
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?
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.
{...}putting fix/cloth-stockpile enable in dfhack.init makes it run automatically.
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!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
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?
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.